module OhlohScm::System
Public Class Methods
logger()
click to toggle source
Use a single logger instance.
# File lib/ohloh_scm/system.rb, line 37 def logger @logger ||= Logger.new(STDERR).tap do |log_obj| log_obj.level = ENV['SCM_LOG_LEVEL'].to_i end end
Protected Instance Methods
logger()
click to toggle source
# File lib/ohloh_scm/system.rb, line 27 def logger System.logger end
run(cmd)
click to toggle source
# File lib/ohloh_scm/system.rb, line 10 def run(cmd) out, err, status = Open3.capture3(cmd) raise "#{cmd} failed: #{out}\n#{err}" unless status.success? out end
run_with_err(cmd)
click to toggle source
# File lib/ohloh_scm/system.rb, line 17 def run_with_err(cmd) logger.debug { cmd } out, err, status = Open3.capture3(cmd) [out, err, status] end
string_encoder_path()
click to toggle source
# File lib/ohloh_scm/system.rb, line 23 def string_encoder_path File.expand_path('../../.bin/string_encoder', __dir__) end
temp_folder()
click to toggle source
# File lib/ohloh_scm/system.rb, line 31 def temp_folder ENV['OHLOH_SCM_TEMP_FOLDER_PATH'] || Dir.tmpdir end