semaphore_cucumber_booster_config 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4412775537961ef6bdae9284e94d95c36a9e008b
4
+ data.tar.gz: 24aaa465cbbe014ddaf392f3d100c28248388f86
5
+ SHA512:
6
+ metadata.gz: 543e2690f0d54111f1db05cbee20aceb3f3261790d1037394b3d4fe0e92eb5f2b2e3be79349974080bcea36c46ea629f75ded5d0ed86c49c280a1793e2723b40
7
+ data.tar.gz: 17a065c61c6223f270c76c0d107f86fb660ec56497ca770bd0ffbd808e27fc8ffc7cf5033cd1e2c1de86ad0e77fff18488f78c6c261531772e48aab7b15004fe
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.swp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cucumber_booster_config.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # CucumberBoosterConfig
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)
5
+
6
+ Injects additional configuration for Cucumber so that it outputs JSON suitable
7
+ for auto-parallelism without affecting stdout.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem "cucumber_booster_config", :source => "https://gem.fury.io/renderedtext/"
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```
20
+ $ cucumber-booster-config help inject
21
+ Usage:
22
+ cucumber-booster-config inject PATH
23
+
24
+ Options:
25
+ [--dry-run], [--no-dry-run]
26
+
27
+ inject Semaphore's Cucumber configuration in project PATH
28
+ ```
29
+
30
+ If you use the `--dry-run` option, output will look like this:
31
+
32
+ ```
33
+ $ cucumber-booster-config inject . --dry-run
34
+ Running in .
35
+ Found Cucumber profile file: ./cucumber.yml
36
+ Content before:
37
+ ---
38
+ default: --format pretty features
39
+ ---
40
+ Inserting Semaphore configuration at the top
41
+ Appending Semaphore profile to default profile
42
+ Content after:
43
+ ---
44
+ semaphoreci: --format json --out=features_report.json
45
+ default: --format pretty features --profile semaphoreci
46
+ ---
47
+ ```
48
+
49
+ ## Development
50
+
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.
52
+
53
+ To install this gem onto your local machine, run `bundle exec rake install`.
54
+
55
+ ### How to release a new version
56
+
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.
59
+
60
+ Semaphore is currently configured to push new versions to Gemfury.
61
+ If version hasn't changed, Gemfury will simply ignore the update.
62
+
63
+ ## Contributing
64
+
65
+ Bug reports and pull requests are welcome on GitHub at https://github.com/renderedtext/cucumber_booster_config.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
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,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,34 @@
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 = "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/renderedtext/cucumber_booster_config"
15
+
16
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
17
+ # delete this section to allow pushing this gem to any host.
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
20
+ else
21
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
22
+ end
23
+
24
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.add_dependency "thor", "~> 0.19.1"
30
+
31
+ spec.add_development_dependency "bundler", "~> 1.10"
32
+ spec.add_development_dependency "rake", "~> 10.0"
33
+ spec.add_development_dependency "rspec"
34
+ end
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'cucumber_booster_config'
4
+ CucumberBoosterConfig::CLI.start(ARGV)
@@ -0,0 +1,12 @@
1
+ require "thor"
2
+
3
+ module CucumberBoosterConfig
4
+ class CLI < Thor
5
+ desc "inject PATH", "inject Semaphore's Cucumber configuration in project PATH"
6
+ option :dry_run, :type => :boolean
7
+ def inject(path)
8
+ puts "Running in #{path}"
9
+ Injection.new(path, :dry_run => options[:dry_run]).run
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,77 @@
1
+ module CucumberBoosterConfig
2
+
3
+ class CucumberFile
4
+
5
+ SEMAPHORE_PROFILE = "semaphoreci: --format json --out=cucumber_report.json"
6
+ DEFAULT_PROFILE = "default: --format pretty --profile semaphoreci features"
7
+
8
+ def initialize(path, dry_run)
9
+ @path = path
10
+ @dry_run = dry_run
11
+ end
12
+
13
+ def configure_for_autoparallelism
14
+ load_file_content
15
+
16
+ if dry_run?
17
+ puts "Content before:"
18
+ puts "---"
19
+ puts @original_lines
20
+ puts "---"
21
+ end
22
+
23
+ define_semaphore_profile
24
+ include_semaphore_profile
25
+
26
+ if dry_run?
27
+ puts "Content after:"
28
+ puts "---"
29
+ puts @new_lines
30
+ puts "---"
31
+ else
32
+ save_file
33
+ end
34
+ end
35
+
36
+ private
37
+
38
+ def dry_run?
39
+ !!@dry_run
40
+ end
41
+
42
+ def load_file_content
43
+ @original_lines = File.open(@path, "r") { |f| f.readlines }
44
+ @new_lines = @original_lines
45
+ end
46
+
47
+ def save_file
48
+ File.open(@path, "w") { |f| @new_lines.each { |line| f.puts line } }
49
+ end
50
+
51
+ def define_semaphore_profile
52
+ puts "Inserting Semaphore configuration"
53
+
54
+ @new_lines << "#{SEMAPHORE_PROFILE}\n"
55
+ end
56
+
57
+ def include_semaphore_profile
58
+ puts "Appending Semaphore profile to default profile"
59
+
60
+ default_profile_found = false
61
+
62
+ @new_lines.each_with_index do |line, i|
63
+ if line =~ /default:/
64
+ default_profile_found = true
65
+ line = "#{line.gsub("\n", "")} --profile semaphoreci"
66
+ end
67
+
68
+ @new_lines[i] = line
69
+ end
70
+
71
+ if !default_profile_found
72
+ puts "No definition for default profile found, inserting new one"
73
+ @new_lines << DEFAULT_PROFILE
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,42 @@
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, options = {})
13
+ @path = path
14
+ @dry_run = options.fetch(:dry_run, false)
15
+ end
16
+
17
+ def find_profile_files
18
+ profile_files = []
19
+
20
+ CUCUMBER_FILES.map { |file_name| cucumber_file_path(file_name) }.each do |file|
21
+ if File.exist?(file)
22
+ puts "Found Cucumber profile file: #{file}"
23
+ profile_files << file
24
+ end
25
+ end
26
+
27
+ profile_files
28
+ end
29
+
30
+ def run
31
+ find_profile_files.each do |path|
32
+ CucumberFile.new(path, @dry_run).configure_for_autoparallelism
33
+ end
34
+ end
35
+
36
+ private
37
+
38
+ def cucumber_file_path(file_name)
39
+ File.join(@path, file_name)
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,3 @@
1
+ module CucumberBoosterConfig
2
+ VERSION = "1.1.1"
3
+ end
@@ -0,0 +1,6 @@
1
+ require "cucumber_booster_config/cli"
2
+ require "cucumber_booster_config/injection"
3
+ require "cucumber_booster_config/version"
4
+
5
+ module CucumberBoosterConfig
6
+ end
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: semaphore_cucumber_booster_config
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Marko Anastasov
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-02-28 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
+ - README.md
82
+ - Rakefile
83
+ - bin/console
84
+ - bin/setup
85
+ - cucumber_booster_config.gemspec
86
+ - exe/cucumber-booster-config
87
+ - lib/cucumber_booster_config.rb
88
+ - lib/cucumber_booster_config/cli.rb
89
+ - lib/cucumber_booster_config/cucumber_file.rb
90
+ - lib/cucumber_booster_config/injection.rb
91
+ - lib/cucumber_booster_config/version.rb
92
+ homepage: https://github.com/renderedtext/cucumber_booster_config
93
+ licenses: []
94
+ metadata:
95
+ allowed_push_host: https://rubygems.org
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: []