Sha256: cbe59c799b565e4e13f8cd10e3899f901d76a76f73da56094b96f28f39756f5d

Contents?: true

Size: 888 Bytes

Versions: 2

Compression:

Stored size: 888 Bytes

Contents

require 'thor'
module Isolate
  module Scenarios
    class Cli < Thor
      include Thor::Actions

      desc "list", "list scenarios"
      def list
        sandbox = Isolate::Sandbox.new

        sandbox.entries_with_scenarios.each do |entry|
          puts "#{entry.name}:"

          entry.scenarios.each do |scenario|
            is_default_scenario = scenario == entry.default_scenario
            puts "* #{scenario} #{'(default)' if is_default_scenario}"
          end
        end
      end

      desc "rake", "rake for each scenarios"
      def rake(*)
        ARGV.delete('rake')

        sandbox = Isolate::Sandbox.new

        sandbox.entries_with_scenarios.each do |entry|
          entry.scenarios.each do |scenario|
            system "rake #{entry.scenario_env_variable}=#{entry.name}-#{scenario} #{ARGV.join(' ')}"
          end
        end
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
isolate-scenarios-0.1.1 lib/isolate/scenarios/cli.rb
isolate-scenarios-0.1.0 lib/isolate/scenarios/cli.rb