Sha256: 4617d35dddab3196584009a504254c3e3fa9ae2441e9e06367506b91abc4323d

Contents?: true

Size: 736 Bytes

Versions: 13

Compression:

Stored size: 736 Bytes

Contents

require 'rebuild'

module Rebuild
  class Runner
    def initialize(repo_path, primary_scripts, scriptdir)
      @repo_path        = repo_path
      @primary_scripts  = primary_scripts
      @script_directory = scriptdir
    end

    def run
      return no_script_found if script_paths.empty?

      script_paths.each do |path|
        puts "Running #{path}..."
        system('sh', path)
      end
    end

    private

    def script_paths
      target = File.join(absolute_script_directory, '*.sh')
      Dir.glob(target)
    end

    def no_script_found
      puts "No *.sh found in #{absolute_script_directory}"
    end

    def absolute_script_directory
      File.join([@repo_path, @script_directory].compact)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rebuild-0.3.0 lib/rebuild/runner.rb
rebuild-0.3.0.pre8 lib/rebuild/runner.rb
rebuild-0.3.0.pre7 lib/rebuild/runner.rb
rebuild-0.3.0.pre6 lib/rebuild/runner.rb
rebuild-0.3.0.pre5 lib/rebuild/runner.rb
rebuild-0.3.0.pre4 lib/rebuild/runner.rb
rebuild-0.3.0.pre3 lib/rebuild/runner.rb
rebuild-0.3.0.pre2 lib/rebuild/runner.rb
rebuild-0.3.0.pre lib/rebuild/runner.rb
rebuild-0.2.6 lib/rebuild/runner.rb
rebuild-0.2.5 lib/rebuild/runner.rb
rebuild-0.2.4 lib/rebuild/runner.rb
rebuild-0.2.3 lib/rebuild/runner.rb