class Rebuild::Runner
Public Class Methods
new(repo_path, primary_scripts, scriptdir)
click to toggle source
# File lib/rebuild/runner.rb, line 6 def initialize(repo_path, primary_scripts, scriptdir) @repo_path = repo_path @primary_scripts = primary_scripts @script_directory = scriptdir end
Public Instance Methods
run()
click to toggle source
# File lib/rebuild/runner.rb, line 12 def run return no_script_found if script_paths.empty? ordered_scripts.each do |script| absolute_path = File.join(absolute_script_directory, script) Logger.info("Running #{absolute_path}...") system('sh', absolute_path) end Logger.finish("Finished to rebuild #{absolute_script_directory}") end
Private Instance Methods
absolute_script_directory()
click to toggle source
# File lib/rebuild/runner.rb, line 52 def absolute_script_directory File.join([@repo_path, @script_directory].compact) end
existent_scripts()
click to toggle source
# File lib/rebuild/runner.rb, line 35 def existent_scripts target = File.join(absolute_script_directory, '*.sh') Dir.glob(target).map do |full_path| File.basename(full_path) end end
no_script_found()
click to toggle source
# File lib/rebuild/runner.rb, line 48 def no_script_found puts "No *.sh found in #{absolute_script_directory}" end
ordered_scripts()
click to toggle source
# File lib/rebuild/runner.rb, line 26 def ordered_scripts inexistent_scripts = @primary_scripts - existent_scripts if inexistent_scripts.any? Logger.fatal("#{inexistent_scripts.join(', ')} can't be found in #{absolute_script_directory}") end @primary_scripts + (existent_scripts - @primary_scripts) end
script_paths()
click to toggle source
# File lib/rebuild/runner.rb, line 43 def script_paths target = File.join(absolute_script_directory, '*.sh') Dir.glob(target) end