semaphore_cucumber_booster_config 1.2.0 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5691d3e9fe17f86e85b76a5fa9259bf203b77beb
4
- data.tar.gz: ac9277bddca09570ee842921cb317a167fdf22c3
3
+ metadata.gz: d7b1bd2ba271d3f4d92d7819e796ef440c311cb9
4
+ data.tar.gz: db7e0c303076f2ad732585feb44cfb9b13bb93b2
5
5
  SHA512:
6
- metadata.gz: db92126e314a3ca17879b3162f738a390f7c89418e6bbe628b00f52737db7071c58234e6095d052ead9a5a9fd3f5a137109f9438348b250467199a55bfb591da
7
- data.tar.gz: 2e30ae2831d05464d5446fbd8102f2c287c348e82bb3e8cdba0aa4a365573881f0861bd318919e9d5baa8c32c1f974d45456a635aee59270c67a420ef1b20a2a
6
+ metadata.gz: f82d5ee3131c858147d34ce2ca4e242dfa9ef33f44e018777582c98168ff1593f8c6ecf8c81dd65734d608432b1eb2ee0169d28af773435ff239691fd483c63a
7
+ data.tar.gz: b32f41e453e1c390402c9f5645adb2c78d195e6b4d7b409c16675ccad8002d922315679e0eb10867687a30325f5d67613b93a34f7e07afaa64425c10d446ab03
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Rendered Text
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,20 +1,23 @@
1
- # CucumberBoosterConfig
1
+ # Cucumber Booster Config
2
2
 
3
- [![Build
4
- Status](https://semaphoreci.com/api/v1/projects/b5ad1293-4dd1-425d-8c00-b42ceca09c75/527737/badge.svg)](https://semaphoreci.com/renderedtext/cucumber_booster_config)
3
+ [![Build Status](https://semaphoreci.com/api/v1/projects/b5ad1293-4dd1-425d-8c00-b42ceca09c75/527737/badge.svg)](https://semaphoreci.com/renderedtext/cucumber_booster_config)
4
+ [![Gem Version](https://badge.fury.io/rb/semaphore_cucumber_booster_config.svg)](https://badge.fury.io/rb/semaphore_cucumber_booster_config)
5
5
 
6
- Injects additional configuration for Cucumber so that it outputs JSON suitable
7
- for auto-parallelism without affecting stdout.
6
+ Injects additional configuration for Cucumber so that it outputs JSON report suitable
7
+ for estimation of the [split configuration](https://github.com/renderedtext/test-boosters#split-configuration) for the next build.
8
+
9
+ Cucumber Booster Config is primarily used as [Test Boosters gem](https://github.com/renderedtext/test-boosters) dependency.
10
+ Boosters help you with distribution of your test files across many parallel jobs and optimize your build time. Find out more about [Boosters](https://semaphoreci.com/docs/about-boosters.html).
8
11
 
9
12
  ## Installation
10
13
 
11
14
  Add this line to your application's Gemfile:
12
15
 
13
16
  ```ruby
14
- gem "cucumber_booster_config", :source => "https://gem.fury.io/renderedtext/"
17
+ gem "semaphore_cucumber_booster_config"
15
18
  ```
16
19
 
17
- ## Usage
20
+ ## Usage from the CLI
18
21
 
19
22
  ```
20
23
  $ cucumber-booster-config help inject
@@ -46,20 +49,40 @@ default: --format pretty features --profile semaphoreci
46
49
  ---
47
50
  ```
48
51
 
52
+ ## Usage from other scripts
53
+
54
+ You can invoke the injector script programaticaly too:
55
+
56
+ ``` ruby
57
+ current_path = Dir.pwd
58
+ output_report_path = "/tmp/cucumber_report.json"
59
+
60
+ CucumberBoosterConfig::Injection.new(current_path, output_report_path).run
61
+ ```
62
+
63
+ This is how Test Boosters gem is using it to configure Cucumber.
64
+
49
65
  ## Development
50
66
 
51
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
67
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run
68
+ `bundle exec rspec` to run the tests. You can also run `bin/console` for an
69
+ interactive prompt that will allow you to experiment.
52
70
 
53
71
  To install this gem onto your local machine, run `bundle exec rake install`.
54
72
 
55
73
  ### How to release a new version
56
74
 
57
- Change version number in `lib/cucumber_booster_config/version.rb`, commit and push your changes.
58
- This will propagate the gemspec and subsequently `.gem` file that is generated on Gemfury.
75
+ Bump version number in `lib/cucumber_booster_config/version.rb`, commit and
76
+ push your changes.
59
77
 
60
- Semaphore is currently configured to push new versions to Gemfury.
61
- If version hasn't changed, Gemfury will simply ignore the update.
78
+ Semaphore is currently configured to push new versions to Rubygems.
79
+ If version hasn't changed, Rubygems will simply ignore the update.
62
80
 
63
81
  ## Contributing
64
82
 
65
- Bug reports and pull requests are welcome on GitHub at https://github.com/renderedtext/cucumber_booster_config.
83
+ Bug reports and pull requests are welcome on GitHub at
84
+ https://github.com/renderedtext/cucumber_booster_config.
85
+
86
+ ## License
87
+
88
+ The gem is available as open source under the terms of the [MIT license](LICENSE).
@@ -18,9 +18,9 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "thor", "~> 0.19.1"
21
+ spec.add_dependency "thor", [">= 0.19.1", "< 2.0"]
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.10"
24
- spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rake", "~> 12.3.3"
25
25
  spec.add_development_dependency "rspec"
26
26
  end
@@ -1,3 +1,5 @@
1
+ require "fileutils"
2
+
1
3
  require "cucumber_booster_config/cli"
2
4
  require "cucumber_booster_config/injection"
3
5
  require "cucumber_booster_config/version"
@@ -2,11 +2,16 @@ require "thor"
2
2
 
3
3
  module CucumberBoosterConfig
4
4
  class CLI < Thor
5
+
5
6
  desc "inject PATH", "inject Semaphore's Cucumber configuration in project PATH"
6
7
  option :dry_run, :type => :boolean
7
8
  def inject(path)
8
9
  puts "Running in #{path}"
9
- Injection.new(path, :dry_run => options[:dry_run]).run
10
+
11
+ report_path = "cucumber_report.json"
12
+
13
+ Injection.new(path, report_path, :dry_run => options[:dry_run]).run
10
14
  end
15
+
11
16
  end
12
17
  end
@@ -2,7 +2,6 @@ module CucumberBoosterConfig
2
2
 
3
3
  class CucumberFile
4
4
 
5
- SEMAPHORE_PROFILE = "semaphoreci: --format json --out=~/cucumber_report.json"
6
5
  DEFAULT_PROFILE = "default: --format pretty --profile semaphoreci features"
7
6
 
8
7
  def initialize(path, dry_run)
@@ -10,7 +9,7 @@ module CucumberBoosterConfig
10
9
  @dry_run = dry_run
11
10
  end
12
11
 
13
- def configure_for_autoparallelism
12
+ def configure_for_autoparallelism(report_path)
14
13
  load_file_content
15
14
 
16
15
  if dry_run?
@@ -20,8 +19,11 @@ module CucumberBoosterConfig
20
19
  puts "---"
21
20
  end
22
21
 
23
- define_semaphore_profile
24
- include_semaphore_profile
22
+
23
+ unless semaphore_profile_defined? && semaphore_profile_included?
24
+ define_semaphore_profile(report_path)
25
+ include_semaphore_profile
26
+ end
25
27
 
26
28
  if dry_run?
27
29
  puts "Content after:"
@@ -48,10 +50,11 @@ module CucumberBoosterConfig
48
50
  File.open(@path, "w") { |f| @new_lines.each { |line| f.puts line } }
49
51
  end
50
52
 
51
- def define_semaphore_profile
52
- puts "Inserting Semaphore configuration"
53
+ def define_semaphore_profile(report_path)
54
+ puts "Inserting Semaphore configuration for json report"
55
+ puts "Report path: #{report_path}"
53
56
 
54
- @new_lines << "#{SEMAPHORE_PROFILE}\n"
57
+ @new_lines << "semaphoreci: --format json --out=#{report_path}\n"
55
58
  end
56
59
 
57
60
  def include_semaphore_profile
@@ -73,5 +76,13 @@ module CucumberBoosterConfig
73
76
  @new_lines << DEFAULT_PROFILE
74
77
  end
75
78
  end
79
+
80
+ def semaphore_profile_defined?
81
+ @original_lines.any? { |line| line.include?("semaphoreci:") }
82
+ end
83
+
84
+ def semaphore_profile_included?
85
+ @original_lines.any? { |line| line.include?("--profile semaphoreci") }
86
+ end
76
87
  end
77
88
  end
@@ -9,8 +9,9 @@ module CucumberBoosterConfig
9
9
  "config/cucumber.yml"
10
10
  ]
11
11
 
12
- def initialize(path, options = {})
12
+ def initialize(path, report_path, options = {})
13
13
  @path = path
14
+ @report_path = report_path
14
15
  @dry_run = options.fetch(:dry_run, false)
15
16
  end
16
17
 
@@ -28,13 +29,22 @@ module CucumberBoosterConfig
28
29
  end
29
30
 
30
31
  def run
32
+ if no_profile_files?
33
+ puts "No cucumber profile files found. Creating empty cucumber.yml file"
34
+ FileUtils.touch("cucumber.yml")
35
+ end
36
+
31
37
  find_profile_files.each do |path|
32
- CucumberFile.new(path, @dry_run).configure_for_autoparallelism
38
+ CucumberFile.new(path, @dry_run).configure_for_autoparallelism(@report_path)
33
39
  end
34
40
  end
35
41
 
36
42
  private
37
43
 
44
+ def no_profile_files?
45
+ find_profile_files.empty?
46
+ end
47
+
38
48
  def cucumber_file_path(file_name)
39
49
  File.join(@path, file_name)
40
50
  end
@@ -1,3 +1,3 @@
1
1
  module CucumberBoosterConfig
2
- VERSION = "1.2.0".freeze
2
+ VERSION = "1.4.2".freeze
3
3
  end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semaphore_cucumber_booster_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marko Anastasov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-19 00:00:00.000000000 Z
11
+ date: 2021-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.19.1
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: 0.19.1
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: bundler
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +50,14 @@ dependencies:
44
50
  requirements:
45
51
  - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: '10.0'
53
+ version: 12.3.3
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
58
  - - "~>"
53
59
  - !ruby/object:Gem::Version
54
- version: '10.0'
60
+ version: 12.3.3
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: rspec
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -78,6 +84,7 @@ files:
78
84
  - ".gitignore"
79
85
  - ".rspec"
80
86
  - Gemfile
87
+ - LICENSE
81
88
  - README.md
82
89
  - Rakefile
83
90
  - bin/console
@@ -108,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
115
  version: '0'
109
116
  requirements: []
110
117
  rubyforge_project:
111
- rubygems_version: 2.4.8
118
+ rubygems_version: 2.6.14
112
119
  signing_key:
113
120
  specification_version: 4
114
121
  summary: Cucumber configuration injection for autoparallelism.