treye-semaphore_cucumber_booster_config 1.4.2
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 +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +90 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/cucumber_booster_config.gemspec +26 -0
- data/exe/cucumber-booster-config +4 -0
- data/lib/cucumber_booster_config.rb +8 -0
- data/lib/cucumber_booster_config/cli.rb +17 -0
- data/lib/cucumber_booster_config/cucumber_file.rb +88 -0
- data/lib/cucumber_booster_config/injection.rb +52 -0
- data/lib/cucumber_booster_config/version.rb +3 -0
- metadata +116 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 200d92e1ccd177b1527483db55736c4df54b923d
|
4
|
+
data.tar.gz: 77e79d269f66585c805b5f47e9e63634431d7215
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a0c4b4395835c323f1c6dded2188e7cf8b7ff012017d5e154eec13d866fb8501026423f70dc269d92505a6ac264ce0027512791ca30e1e2ac62ea2c461f72d05
|
7
|
+
data.tar.gz: 3c00b31c009d105c45c5cdd0be0981cdbc1663b6f0bb71b46eac8a3768bf0fd1c778a2527c83395ba2932b5492a104964a4053819f7311e41a0d163520756607
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
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
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
# Cucumber Booster Config
|
2
|
+
|
3
|
+
Note: This version is just an updated copy of the original with the new version number.
|
4
|
+
|
5
|
+
[](https://semaphoreci.com/renderedtext/cucumber_booster_config)
|
6
|
+
[](https://badge.fury.io/rb/semaphore_cucumber_booster_config)
|
7
|
+
|
8
|
+
Injects additional configuration for Cucumber so that it outputs JSON report suitable
|
9
|
+
for estimation of the [split configuration](https://github.com/renderedtext/test-boosters#split-configuration) for the next build.
|
10
|
+
|
11
|
+
Cucumber Booster Config is primarily used as [Test Boosters gem](https://github.com/renderedtext/test-boosters) dependency.
|
12
|
+
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).
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Add this line to your application's Gemfile:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem "semaphore_cucumber_booster_config"
|
20
|
+
```
|
21
|
+
|
22
|
+
## Usage from the CLI
|
23
|
+
|
24
|
+
```
|
25
|
+
$ cucumber-booster-config help inject
|
26
|
+
Usage:
|
27
|
+
cucumber-booster-config inject PATH
|
28
|
+
|
29
|
+
Options:
|
30
|
+
[--dry-run], [--no-dry-run]
|
31
|
+
|
32
|
+
inject Semaphore's Cucumber configuration in project PATH
|
33
|
+
```
|
34
|
+
|
35
|
+
If you use the `--dry-run` option, output will look like this:
|
36
|
+
|
37
|
+
```
|
38
|
+
$ cucumber-booster-config inject . --dry-run
|
39
|
+
Running in .
|
40
|
+
Found Cucumber profile file: ./cucumber.yml
|
41
|
+
Content before:
|
42
|
+
---
|
43
|
+
default: --format pretty features
|
44
|
+
---
|
45
|
+
Inserting Semaphore configuration at the top
|
46
|
+
Appending Semaphore profile to default profile
|
47
|
+
Content after:
|
48
|
+
---
|
49
|
+
semaphoreci: --format json --out=features_report.json
|
50
|
+
default: --format pretty features --profile semaphoreci
|
51
|
+
---
|
52
|
+
```
|
53
|
+
|
54
|
+
## Usage from other scripts
|
55
|
+
|
56
|
+
You can invoke the injector script programaticaly too:
|
57
|
+
|
58
|
+
``` ruby
|
59
|
+
current_path = Dir.pwd
|
60
|
+
output_report_path = "/tmp/cucumber_report.json"
|
61
|
+
|
62
|
+
CucumberBoosterConfig::Injection.new(current_path, output_report_path).run
|
63
|
+
```
|
64
|
+
|
65
|
+
This is how Test Boosters gem is using it to configure Cucumber.
|
66
|
+
|
67
|
+
## Development
|
68
|
+
|
69
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
70
|
+
`bundle exec rspec` to run the tests. You can also run `bin/console` for an
|
71
|
+
interactive prompt that will allow you to experiment.
|
72
|
+
|
73
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
74
|
+
|
75
|
+
### How to release a new version
|
76
|
+
|
77
|
+
Bump version number in `lib/cucumber_booster_config/version.rb`, commit and
|
78
|
+
push your changes.
|
79
|
+
|
80
|
+
Semaphore is currently configured to push new versions to Rubygems.
|
81
|
+
If version hasn't changed, Rubygems will simply ignore the update.
|
82
|
+
|
83
|
+
## Contributing
|
84
|
+
|
85
|
+
Bug reports and pull requests are welcome on GitHub at
|
86
|
+
https://github.com/renderedtext/cucumber_booster_config.
|
87
|
+
|
88
|
+
## License
|
89
|
+
|
90
|
+
The gem is available as open source under the terms of the [MIT license](LICENSE).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "cucumber_booster_config"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cucumber_booster_config/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "treye-semaphore_cucumber_booster_config"
|
8
|
+
spec.version = CucumberBoosterConfig::VERSION
|
9
|
+
spec.authors = ["Marko Anastasov"]
|
10
|
+
spec.email = ["marko@renderedtext.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Cucumber configuration injection for autoparallelism.}
|
13
|
+
spec.description = %q{Injects additional configuration for Cucumber so that it outputs JSON suitable for auto-parallelism without affecting stdout.}
|
14
|
+
spec.homepage = "https://github.com/treye/cucumber_booster_config"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "thor", "~> 0.19.1"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "rspec"
|
26
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "thor"
|
2
|
+
|
3
|
+
module CucumberBoosterConfig
|
4
|
+
class CLI < Thor
|
5
|
+
|
6
|
+
desc "inject PATH", "inject Semaphore's Cucumber configuration in project PATH"
|
7
|
+
option :dry_run, :type => :boolean
|
8
|
+
def inject(path)
|
9
|
+
puts "Running in #{path}"
|
10
|
+
|
11
|
+
report_path = "cucumber_report.json"
|
12
|
+
|
13
|
+
Injection.new(path, report_path, :dry_run => options[:dry_run]).run
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
module CucumberBoosterConfig
|
2
|
+
|
3
|
+
class CucumberFile
|
4
|
+
|
5
|
+
DEFAULT_PROFILE = "default: --format pretty --profile semaphoreci features"
|
6
|
+
|
7
|
+
def initialize(path, dry_run)
|
8
|
+
@path = path
|
9
|
+
@dry_run = dry_run
|
10
|
+
end
|
11
|
+
|
12
|
+
def configure_for_autoparallelism(report_path)
|
13
|
+
load_file_content
|
14
|
+
|
15
|
+
if dry_run?
|
16
|
+
puts "Content before:"
|
17
|
+
puts "---"
|
18
|
+
puts @original_lines
|
19
|
+
puts "---"
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
unless semaphore_profile_defined? && semaphore_profile_included?
|
24
|
+
define_semaphore_profile(report_path)
|
25
|
+
include_semaphore_profile
|
26
|
+
end
|
27
|
+
|
28
|
+
if dry_run?
|
29
|
+
puts "Content after:"
|
30
|
+
puts "---"
|
31
|
+
puts @new_lines
|
32
|
+
puts "---"
|
33
|
+
else
|
34
|
+
save_file
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def dry_run?
|
41
|
+
!!@dry_run
|
42
|
+
end
|
43
|
+
|
44
|
+
def load_file_content
|
45
|
+
@original_lines = File.open(@path, "r") { |f| f.readlines }
|
46
|
+
@new_lines = @original_lines
|
47
|
+
end
|
48
|
+
|
49
|
+
def save_file
|
50
|
+
File.open(@path, "w") { |f| @new_lines.each { |line| f.puts line } }
|
51
|
+
end
|
52
|
+
|
53
|
+
def define_semaphore_profile(report_path)
|
54
|
+
puts "Inserting Semaphore configuration for json report"
|
55
|
+
puts "Report path: #{report_path}"
|
56
|
+
|
57
|
+
@new_lines << "semaphoreci: --format json --out=#{report_path}\n"
|
58
|
+
end
|
59
|
+
|
60
|
+
def include_semaphore_profile
|
61
|
+
puts "Appending Semaphore profile to default profile"
|
62
|
+
|
63
|
+
default_profile_found = false
|
64
|
+
|
65
|
+
@new_lines.each_with_index do |line, i|
|
66
|
+
if line =~ /default:/
|
67
|
+
default_profile_found = true
|
68
|
+
line = "#{line.gsub("\n", "")} --profile semaphoreci"
|
69
|
+
end
|
70
|
+
|
71
|
+
@new_lines[i] = line
|
72
|
+
end
|
73
|
+
|
74
|
+
if !default_profile_found
|
75
|
+
puts "No definition for default profile found, inserting new one"
|
76
|
+
@new_lines << DEFAULT_PROFILE
|
77
|
+
end
|
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
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require "cucumber_booster_config/cucumber_file"
|
2
|
+
|
3
|
+
module CucumberBoosterConfig
|
4
|
+
|
5
|
+
class Injection
|
6
|
+
|
7
|
+
CUCUMBER_FILES = [
|
8
|
+
"cucumber.yml",
|
9
|
+
"config/cucumber.yml"
|
10
|
+
]
|
11
|
+
|
12
|
+
def initialize(path, report_path, options = {})
|
13
|
+
@path = path
|
14
|
+
@report_path = report_path
|
15
|
+
@dry_run = options.fetch(:dry_run, false)
|
16
|
+
end
|
17
|
+
|
18
|
+
def find_profile_files
|
19
|
+
profile_files = []
|
20
|
+
|
21
|
+
CUCUMBER_FILES.map { |file_name| cucumber_file_path(file_name) }.each do |file|
|
22
|
+
if File.exist?(file)
|
23
|
+
puts "Found Cucumber profile file: #{file}"
|
24
|
+
profile_files << file
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
profile_files
|
29
|
+
end
|
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
|
+
|
37
|
+
find_profile_files.each do |path|
|
38
|
+
CucumberFile.new(path, @dry_run).configure_for_autoparallelism(@report_path)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def no_profile_files?
|
45
|
+
find_profile_files.empty?
|
46
|
+
end
|
47
|
+
|
48
|
+
def cucumber_file_path(file_name)
|
49
|
+
File.join(@path, file_name)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: treye-semaphore_cucumber_booster_config
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.4.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Marko Anastasov
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-04-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.19.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.19.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.10'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.10'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Injects additional configuration for Cucumber so that it outputs JSON
|
70
|
+
suitable for auto-parallelism without affecting stdout.
|
71
|
+
email:
|
72
|
+
- marko@renderedtext.com
|
73
|
+
executables:
|
74
|
+
- cucumber-booster-config
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- ".gitignore"
|
79
|
+
- ".rspec"
|
80
|
+
- Gemfile
|
81
|
+
- LICENSE
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- bin/console
|
85
|
+
- bin/setup
|
86
|
+
- cucumber_booster_config.gemspec
|
87
|
+
- exe/cucumber-booster-config
|
88
|
+
- lib/cucumber_booster_config.rb
|
89
|
+
- lib/cucumber_booster_config/cli.rb
|
90
|
+
- lib/cucumber_booster_config/cucumber_file.rb
|
91
|
+
- lib/cucumber_booster_config/injection.rb
|
92
|
+
- lib/cucumber_booster_config/version.rb
|
93
|
+
homepage: https://github.com/treye/cucumber_booster_config
|
94
|
+
licenses: []
|
95
|
+
metadata: {}
|
96
|
+
post_install_message:
|
97
|
+
rdoc_options: []
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
requirements: []
|
111
|
+
rubyforge_project:
|
112
|
+
rubygems_version: 2.4.5.1
|
113
|
+
signing_key:
|
114
|
+
specification_version: 4
|
115
|
+
summary: Cucumber configuration injection for autoparallelism.
|
116
|
+
test_files: []
|