Class: Cucumber::Cli::Main
- Inherits:
-
Object
- Object
- Cucumber::Cli::Main
- Defined in:
- lib/cucumber/cli/main.rb
Class Method Summary collapse
Instance Method Summary collapse
- #configuration ⇒ Object
- #execute!(existing_runtime = nil) ⇒ Object
-
#initialize(args, out = $stdout, err = $stderr, kernel = Kernel) ⇒ Main
constructor
A new instance of Main.
Constructor Details
#initialize(args, out = $stdout, err = $stderr, kernel = Kernel) ⇒ Main
Returns a new instance of Main.
17 18 19 20 21 22 |
# File 'lib/cucumber/cli/main.rb', line 17 def initialize(args, out = $stdout, err = $stderr, kernel = Kernel) @args = args @out = out @err = err @kernel = kernel end |
Class Method Details
.execute(args) ⇒ Object
12 13 14 |
# File 'lib/cucumber/cli/main.rb', line 12 def execute(args) new(args).execute! end |
Instance Method Details
#configuration ⇒ Object
58 59 60 61 62 63 |
# File 'lib/cucumber/cli/main.rb', line 58 def configuration @configuration ||= Configuration.new(@out, @err).tap do |configuration| configuration.parse!(@args) Cucumber.logger = configuration.log end end |
#execute!(existing_runtime = nil) ⇒ Object
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 |
# File 'lib/cucumber/cli/main.rb', line 24 def execute!(existing_runtime = nil) trap_interrupt runtime = runtime(existing_runtime) runtime.run! if Cucumber.wants_to_quit exit_unable_to_finish elsif runtime.failure? exit_tests_failed else exit_ok 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("#{e.}. You can use `cucumber --init` to get started.") 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 |