Class: Cucumber::Cli::Main
Class Method Summary collapse
Instance Method Summary collapse
- #configuration ⇒ Object
- #execute!(existing_runtime = nil) ⇒ Object
-
#initialize(args, _ = nil, out = STDOUT, err = STDERR, kernel = Kernel) ⇒ Main
constructor
A new instance of Main.
Constructor Details
#initialize(args, _ = nil, out = STDOUT, err = STDERR, kernel = Kernel) ⇒ Main
Returns a new instance of Main.
15 16 17 18 19 20 |
# File 'lib/cucumber/cli/main.rb', line 15 def initialize(args, _=nil, out=STDOUT, err=STDERR, kernel=Kernel) @args = args @out = out @err = err @kernel = kernel end |
Class Method Details
.execute(args) ⇒ Object
10 11 12 |
# File 'lib/cucumber/cli/main.rb', line 10 def execute(args) new(args).execute! end |
Instance Method Details
#configuration ⇒ Object
63 64 65 66 67 68 |
# File 'lib/cucumber/cli/main.rb', line 63 def configuration @configuration ||= Configuration.new(@out, @err).tap do |configuration| configuration.parse!(@args) Cucumber.logger = configuration.log end end |
#execute!(existing_runtime = nil) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/cucumber/cli/main.rb', line 22 def execute!(existing_runtime = nil) trap_interrupt runtime = if existing_runtime existing_runtime.configure(configuration) existing_runtime else Runtime.new(configuration) end runtime.run! if Cucumber.wants_to_quit exit_unable_to_finish else if runtime.failure? exit_tests_failed else exit_ok end end rescue SystemExit => e @kernel.exit(e.status) rescue FileNotFoundException => e @err.puts(e.) @err.puts("Couldn't open #{e.path}") exit_unable_to_finish rescue FeatureFolderNotFoundException => e @err.puts("Could not find goals directory. Try this: mobiusloop --init") exit_unable_to_finish rescue ProfilesNotDefinedError, YmlLoadError, ProfileNotFound => e @err.puts(e.) exit_unable_to_finish rescue Errno::EACCES, Errno::ENOENT => e @err.puts("#{e.} (#{e.class})") exit_unable_to_finish rescue Exception => e @err.puts("#{e.} (#{e.class})") @err.puts(e.backtrace.join("\n")) exit_unable_to_finish end |