launcuke 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzU4MzU2ZTEwNjVlMWMxMDVlOWIxNTk5MzQ4OWM3Njk0YzAxMDk0Ng==
4
+ ZTZhMGU5OGU4MzBkNDlhMDIwYTdiZTI4ZWRiYzlkYjRkNTljYTczNQ==
5
5
  data.tar.gz: !binary |-
6
- ZWI2ZjQ1ZDZjNzg2YzQ5Mjg1YmE1NWVhNjU1NGY1NGZmMmFjOGFiOA==
6
+ ZjAzZTM0N2UzNWI1NGNjZGQ2OGVkMmUyOGVjOGZhMTQ4ZDIwZDUzMA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NjBlMWFjNzk1YTIwMDk2ZTYxZTA2MDFhY2EzZWU3ODFkZjFjNzZmMjI4NWQ0
10
- N2ZlNDk2MjE0NDM3ODY2MmUyMTZjZjljNmQzOWNhODZlYWM5MjA4ZTMwNzIx
11
- YmI3MzhlYmYxYzNhMDkzYzc0YjljMWMzNDk1NmE5N2QwZjI2MWU=
9
+ Y2FkM2JlN2M2ZWQzMjgzNDZmN2NkMjMxYmI2YzljYTZiNWU3NGYyNDlkMGFk
10
+ MzgxMmE5NmQ4Zjc3YzExYTYwOTVlMWYxZDU2Y2UwN2JmMTdkNGI5OWQxYTNl
11
+ MmUzN2RjODNmZGQwNWNiZmIzMDkzZmU4ZGRmNjQyMWM1MTkyNmY=
12
12
  data.tar.gz: !binary |-
13
- N2Y0OGI4OWI2OTU2NzI5YzUwMGRjNTE5YTU2YzdjZWY4YTZjZDhkZTg0M2Ji
14
- YjZmMmJjM2MwNjQ4Y2I1NmI0MzFhZmQ5MTQzMjA2MTE2ZmEzY2QzZDQ3ZGIx
15
- NzY5OGQyMWVlYWZjNDM3OGQzMzczMWIzMTQ4ZWJlNzgyNzdhMzQ=
13
+ YjIwMjBlMjgyNzAzYmZlZjJjM2Q0NjM5ZDIyMGIwYjkwMjQzYzYxMThiODFj
14
+ MmYzYjYxNzA3OGI4ODlmMmE2MTU3MGE3MWNkNGE2NmI3NWU0MjQ2NWJmNDU1
15
+ MDE5ZmU0YTExMmJiN2QxNDEwMzExZWNhMmU3MzdkMTA3NGFiNTc=
@@ -89,9 +89,13 @@ module Launcuke
89
89
  # Delegate to a wrapper of system call in order mock/test
90
90
  attr_accessor :system_command
91
91
 
92
+ # Define the launch mode, parallel or sequential
93
+ attr_accessor :mode
94
+
92
95
  def initialize(features_root)
93
96
  @features_root_path = features_root
94
97
  @extra_options ||= []
98
+ @mode = @extra_options[2]? "#{@extra_options[2]}" : 'sequential'
95
99
  yield self if block_given?
96
100
 
97
101
  @dry_run = false if dry_run.nil?
@@ -108,7 +112,7 @@ module Launcuke
108
112
 
109
113
  def start
110
114
  FileUtils.mkdir_p reports_path
111
- exit_status = launch_process_per_dir
115
+ exit_status = launch_process
112
116
  collect_results
113
117
  reports = ReportsIndex.new(reports_path, features_dirs).generate
114
118
  puts "See reports index at #{reports.index_path}" if reports
@@ -117,21 +121,36 @@ module Launcuke
117
121
 
118
122
  private
119
123
 
120
- def launch_process_per_dir
124
+ def launch_process
121
125
  if dry_run
122
126
  0
123
127
  else
124
- results = features_dirs.forkoff!(:processes => forks_pool_size) { |features_dir|
125
- report_file_path = File.join(reports_path, "#{features_dir.dir_name}.html")
126
- feature_full_path = File.join(features_root_path, "#{features_dir.dir_name}")
127
- main_command = %W[bundle exec cucumber #{feature_full_path}]
128
- options = %W[--format html --out #{report_file_path}]
129
- options.concat %W[--require #{features_root_path}] if require_features_root_option
130
- full_command = main_command + options + extra_options
131
- result = system_command.run full_command
132
- puts "Features '#{features_dir.dir_name.upcase}' finished. #{result ? 'SUCCESS' : 'FAILURE'} (pid: #{Process.pid})"
133
- result
134
- }
128
+ case @mode
129
+ when 'sequential'
130
+ results = features_dirs.each { |features_dir|
131
+ report_file_path = File.join(reports_path, "#{features_dir.dir_name}.html")
132
+ feature_full_path = File.join(features_root_path, "#{features_dir.dir_name}")
133
+ main_command = %W[bundle exec cucumber #{feature_full_path}]
134
+ options = %W[--format html --out #{report_file_path}]
135
+ options.concat %W[--require #{features_root_path}] if require_features_root_option
136
+ full_command = main_command + options + extra_options
137
+ result = system_command.run full_command
138
+ puts "Features '#{features_dir.dir_name.upcase}' finished. #{result ? 'SUCCESS' : 'FAILURE'} (pid: #{Process.pid})"
139
+ result
140
+ }
141
+ when 'parallel'
142
+ results = features_dirs.forkoff!(:processes => forks_pool_size) { |features_dir|
143
+ report_file_path = File.join(reports_path, "#{features_dir.dir_name}.html")
144
+ feature_full_path = File.join(features_root_path, "#{features_dir.dir_name}")
145
+ main_command = %W[bundle exec cucumber #{feature_full_path}]
146
+ options = %W[--format html --out #{report_file_path}]
147
+ options.concat %W[--require #{features_root_path}] if require_features_root_option
148
+ full_command = main_command + options + extra_options
149
+ result = system_command.run full_command
150
+ puts "Features '#{features_dir.dir_name.upcase}' finished. #{result ? 'SUCCESS' : 'FAILURE'} (pid: #{Process.pid})"
151
+ result
152
+ }
153
+ end
135
154
 
136
155
  global_exit_status = results.inject(0) { |acc, result|
137
156
  result ? acc : acc + 1
@@ -1,3 +1,3 @@
1
1
  module Launcuke
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: launcuke
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yi MIN