Sha256: 0253e2b03ce04d2002e5e75c5ae6293ae672672a367ba64fce60878ae715c4c3

Contents?: true

Size: 797 Bytes

Versions: 10

Compression:

Stored size: 797 Bytes

Contents

module StartingBlocks
  class Runner

    include Displayable

    def initialize options
      @use_bundler = options[:use_bundler]
      @include_vendor = options[:no_vendor] != true
    end

    def run_files files
      files = files.select { |x| @include_vendor || x.include?('/vendor/') == false }
      display "Files to run: #{files.inspect}"
      StartingBlocks::Publisher.publish_files_to_run files
      results = execute_these_files files
      StartingBlocks::Publisher.publish_results results
      puts results
      results
    end

    private

    def execute_these_files files
      requires = files.map { |x| "require '#{x}'" }.join("\n")
      if @use_bundler
        `bundle exec ruby -e "#{requires}"`
      else
        `ruby -e "#{requires}"`
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
starting_blocks-0.5.0 lib/starting_blocks/runner.rb
starting_blocks-0.4.0 lib/starting_blocks/runner.rb
starting_blocks-0.3.1 lib/starting_blocks/runner.rb
starting_blocks-0.2.1 lib/starting_blocks/runner.rb
starting_blocks-0.1.1 lib/starting_blocks/runner.rb
starting_blocks-0.1.0 lib/starting_blocks/runner.rb
starting_blocks-0.0.32 lib/starting_blocks/runner.rb
starting_blocks-0.0.31 lib/starting_blocks/runner.rb
starting_blocks-0.0.30 lib/starting_blocks/runner.rb
starting_blocks-0.0.29 lib/starting_blocks/runner.rb