c21e 1.1.5

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 075300005367b7ac110378b4e4a91f8212c44c7a1fe633f246e565ddb343cf34
4
+ data.tar.gz: 2f9056a6b7e82285902b0e46afd129a1e83485ba42f1a5c207aed75c4b7c5fa2
5
+ SHA512:
6
+ metadata.gz: d4221803219ba04c908e7e593a1eaa5c38d460cc1cc72b2a98fe05b20f2fd79f23fe391e7c2d67dd34405a3e2cb9e228d1219bb5befbfcf33b377d8ccb2fffc3
7
+ data.tar.gz: e1ab6d48acaaffe37298cd5b78d5cb804bd629e5b7b7c24e70613f064f36306580f9426e30980acef2d02005dbc144ec6fb76f0281ec7c037713cd465dd3d69e
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) Cucumber Ltd
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,3 @@
1
+ # C21e for Ruby
2
+
3
+ [![Build Status](https://travis-ci.org/cucumber/c21e-ruby.svg?branch=master)](https://travis-ci.org/cucumber/c21e-ruby)
@@ -0,0 +1,48 @@
1
+ require 'rbconfig'
2
+ require 'yaml'
3
+
4
+ module C21e
5
+ class ExeFile
6
+ attr_accessor :target_file
7
+
8
+ def initialize(executable_pattern, props = load_props)
9
+ @props = props
10
+ @target_file = executable_pattern
11
+ .gsub('{{.OS}}', os)
12
+ .gsub('{{.Arch}}', arch)
13
+ .gsub('{{.Ext}}', ext)
14
+ end
15
+
16
+ def load_props
17
+ {
18
+ os: RbConfig::CONFIG['target_os'],
19
+ arch: RbConfig::CONFIG['target_cpu']
20
+ }
21
+ end
22
+
23
+ def ext
24
+ os == 'windows' ? '.exe' : ''
25
+ end
26
+
27
+ def os
28
+ case @props[:os]
29
+ when /darwin/ then 'darwin'
30
+ when /freebsd/ then 'freebsd'
31
+ when /linux/ then 'linux'
32
+ when /netbsd/ then 'netbsd'
33
+ when /openbsd/ then 'openbsd'
34
+ when /cygwin|mingw32|mswin32/ then 'windows'
35
+ else @props[:os]
36
+ end
37
+ end
38
+
39
+ def arch
40
+ # https://github.com/kolosek/residds/blob/master/vendor/bundle/ruby/2.0.0/gems/launchy-2.4.3/spec/tattle-host-os.yaml
41
+ case @props[:arch]
42
+ when /i\d86/ then '386'
43
+ when /x86_64/ then 'amd64'
44
+ else @props[:arch]
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,32 @@
1
+ require 'rspec'
2
+ require 'c21e/exe_file'
3
+
4
+ module C21e
5
+ describe ExeFile do
6
+ it 'detects macos' do
7
+ exe_file = ExeFile.new(
8
+ '',
9
+ os: 'darwin8.10.3', arch: 'amd64'
10
+ )
11
+ expect(exe_file.os).to eq 'darwin'
12
+ expect(exe_file.arch).to eq 'amd64'
13
+ expect(exe_file.ext).to be_empty
14
+ end
15
+
16
+ it 'generates a file name for macos' do
17
+ exe_file = ExeFile.new(
18
+ 'test-{{.OS}}-{{.Arch}}{{.Ext}}',
19
+ os: 'darwin8.10.3', arch: 'amd64'
20
+ )
21
+ expect(exe_file.target_file).to eq 'test-darwin-amd64'
22
+ end
23
+
24
+ it 'generates a file name for windows' do
25
+ exe_file = ExeFile.new(
26
+ 'test-{{.OS}}-{{.Arch}}{{.Ext}}',
27
+ os: 'mingw32', arch: 'i686'
28
+ )
29
+ expect(exe_file.target_file).to eq 'test-windows-386.exe'
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+ # With thanks to @myronmarston
3
+ # https://github.com/vcr/vcr/blob/master/spec/capture_warnings.rb
4
+
5
+ module CaptureWarnings
6
+ def report_warnings(&block)
7
+ current_dir = Dir.pwd
8
+ warnings, errors = capture_error(&block).partition { |line| line.include?('warning') }
9
+ project_warnings, other_warnings = warnings.uniq.partition { |line| line.include?(current_dir) }
10
+
11
+ if errors.any?
12
+ puts errors.join("\n")
13
+ end
14
+
15
+ if other_warnings.any?
16
+ puts "#{ other_warnings.count } warnings detected, set VIEW_OTHER_WARNINGS=true to see them."
17
+ print_warnings('other', other_warnings) if ENV['VIEW_OTHER_WARNINGS']
18
+ end
19
+
20
+ # Until they fix https://bugs.ruby-lang.org/issues/10661
21
+ if RUBY_VERSION == "2.2.0"
22
+ project_warnings = project_warnings.reject { |w| w =~ /warning: possible reference to past scope/ }
23
+ end
24
+
25
+ if project_warnings.any?
26
+ puts "#{ project_warnings.count } warnings detected"
27
+ print_warnings('cucumber-expressions', project_warnings)
28
+ fail "Please remove all cucumber-expressions warnings."
29
+ end
30
+
31
+ ensure_system_exit_if_required
32
+ end
33
+
34
+ def capture_error(&block)
35
+ old_stderr = STDERR.clone
36
+ pipe_r, pipe_w = IO.pipe
37
+ pipe_r.sync = true
38
+ error = String.new
39
+ reader = Thread.new do
40
+ begin
41
+ loop do
42
+ error << pipe_r.readpartial(1024)
43
+ end
44
+ rescue EOFError
45
+ end
46
+ end
47
+ STDERR.reopen(pipe_w)
48
+ block.call
49
+ ensure
50
+ capture_system_exit
51
+ STDERR.reopen(old_stderr)
52
+ pipe_w.close
53
+ reader.join
54
+ return error.split("\n")
55
+ end
56
+
57
+ def print_warnings(type, warnings)
58
+ puts
59
+ puts "-" * 30 + " #{type} warnings: " + "-" * 30
60
+ puts
61
+ puts warnings.join("\n")
62
+ puts
63
+ puts "-" * 75
64
+ puts
65
+ end
66
+
67
+ def ensure_system_exit_if_required
68
+ raise @system_exit if @system_exit
69
+ end
70
+
71
+ def capture_system_exit
72
+ @system_exit = $!
73
+ end
74
+ end
data/spec/coverage.rb ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+ require 'simplecov'
3
+ formatters = [ SimpleCov::Formatter::HTMLFormatter ]
4
+
5
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(*formatters)
6
+ SimpleCov.add_filter 'spec/'
7
+ SimpleCov.start
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: c21e
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.5
5
+ platform: ruby
6
+ authors:
7
+ - Aslak Hellesøy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-09-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '12.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '12.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: coveralls
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: Run cross-platform executables
70
+ email: cukes@googlegroups.com
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files: []
74
+ files:
75
+ - LICENSE
76
+ - README.md
77
+ - lib/c21e/exe_file.rb
78
+ - spec/c21e/exe_file_spec.rb
79
+ - spec/capture_warnings.rb
80
+ - spec/coverage.rb
81
+ homepage: https://github.com/cucumber/cucumber-expressions-ruby#readme
82
+ licenses:
83
+ - MIT
84
+ metadata: {}
85
+ post_install_message:
86
+ rdoc_options:
87
+ - "--charset=UTF-8"
88
+ require_paths:
89
+ - lib
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: 1.9.3
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ requirements: []
101
+ rubyforge_project:
102
+ rubygems_version: 2.7.7
103
+ signing_key:
104
+ specification_version: 4
105
+ summary: c21e-1.1.5
106
+ test_files:
107
+ - spec/c21e/exe_file_spec.rb
108
+ - spec/capture_warnings.rb
109
+ - spec/coverage.rb