bashcov 1.7.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/LICENSE.txt +1 -1
- data/README.md +29 -0
- data/Rakefile +4 -1
- data/bashcov.gemspec +2 -0
- data/bin/bashcov +14 -2
- data/lib/bashcov.rb +27 -12
- data/lib/bashcov/field_stream.rb +0 -4
- data/lib/bashcov/version.rb +1 -1
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 663e369ac45484a1d8df36ec47520edc2a5bd5b5
|
4
|
+
data.tar.gz: 3016f906c0b63a1c8d9125c32c197cb1a44bf7f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f977398907a51277dbca731ce8351c366324d13b4df904ffbf369bd49ec2f1d08c2417a3d9c5f7667822a7e0bc2ab2cba60c3eb708dddeb291d0144e6a231819
|
7
|
+
data.tar.gz: 9e122bfd8679f6422b2c974d4afb990a567662c8279f3d6d4ec709521ffbb61530890ea8ccc9a65da72b9e2758b742172e126d22ca903117f461311aa8515a8c
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
-
## Unreleased ([changes](https://github.com/infertux/bashcov/compare/v1.
|
1
|
+
## Unreleased ([changes](https://github.com/infertux/bashcov/compare/v1.8.0...master))
|
2
2
|
|
3
3
|
* TBD
|
4
4
|
|
5
|
+
## v1.8.0, 2018-01-13 ([changes](https://github.com/infertux/bashcov/compare/v1.7.0...v1.8.0))
|
6
|
+
|
7
|
+
* [FEATURE] Merge coverage results from multiple runs when
|
8
|
+
`SimpleCov.use_merging` is set to `true`. Auto-generate
|
9
|
+
likely-unique values for `SimpleCov.command_name`, providing the
|
10
|
+
`--command-name` option and `BASHCOV_COMMAND_NAME` environment
|
11
|
+
variable for users to set a command name explicitly (#34)
|
12
|
+
|
5
13
|
## v1.7.0, 2017-12-28 ([changes](https://github.com/infertux/bashcov/compare/v1.6.0...v1.7.0))
|
6
14
|
|
7
15
|
* [MISC] Add support for Ruby 2.5 and drop 2.2
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -60,6 +60,35 @@ your project's root (like [this](https://github.com/infertux/bashcov/blob/master
|
|
60
60
|
See [SimpleCov README](https://github.com/colszowka/simplecov#readme) for more
|
61
61
|
information.
|
62
62
|
|
63
|
+
#### Controlling the command name
|
64
|
+
|
65
|
+
Bashcov respects all of your `.simplecov` settings save one --
|
66
|
+
[`SimpleCov.command_name`](http://www.rubydoc.info/gems/simplecov/SimpleCov/Configuration#command_name-instance_method),
|
67
|
+
which is the tag that SimpleCov attaches to coverage results from a particular
|
68
|
+
test suite. You can set the value of `SimpleCov.command_name` by using
|
69
|
+
Bashcov's `--command-name` option, or by assigning a value to the environment
|
70
|
+
variable `BASHCOV_COMMAND_NAME`. Otherwise, Bashcov will generate a command
|
71
|
+
name for you based on the name of the currently-executing Bash script and any
|
72
|
+
arguments passed to it. For example, assuming your Bash lives at `/bin/bash`
|
73
|
+
and you run the command
|
74
|
+
|
75
|
+
```
|
76
|
+
$ bashcov -- ./test_suite.sh --and some --flags
|
77
|
+
```
|
78
|
+
|
79
|
+
Bashcov will set `SimpleCov.command_name` to `"/bin/bash ./test_suite.sh --and
|
80
|
+
some --flags"`. Basing `SimpleCov.command_name` on the executing command helps
|
81
|
+
to ensure that multiple coverage runs don't [overwrite each other's
|
82
|
+
results](https://github.com/colszowka/simplecov#test-suite-names) due to
|
83
|
+
SimpleCov identifying multiple runs by the same tag. The `--command-name` and
|
84
|
+
`BASHCOV_COMMAND_NAME` knobs are there for you to twiddle in case your test
|
85
|
+
suite runs the exact same `bashcov` command more than once, in which case the
|
86
|
+
generated command name will not distinguish each invocation from the others.
|
87
|
+
|
88
|
+
For more info on `SimpleCov.command_name` and its relation to SimpleCov's
|
89
|
+
result-merging behavior, see the [SimpleCov
|
90
|
+
README](https://github.com/colszowka/simplecov#merging-results).
|
91
|
+
|
63
92
|
### Some gory details
|
64
93
|
|
65
94
|
Figuring out where an executing Bash script lives in the file system can be
|
data/Rakefile
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
require "bundler/gem_tasks"
|
4
4
|
|
5
|
+
require "cucumber/rake/task"
|
6
|
+
Cucumber::Rake::Task.new
|
7
|
+
|
5
8
|
require "rspec/core/rake_task"
|
6
9
|
RSpec::Core::RakeTask.new(:spec) do |t|
|
7
10
|
t.ruby_opts = "-w"
|
@@ -10,4 +13,4 @@ end
|
|
10
13
|
require "rubocop/rake_task"
|
11
14
|
RuboCop::RakeTask.new
|
12
15
|
|
13
|
-
task default: %i[rubocop spec]
|
16
|
+
task default: %i[rubocop spec cucumber]
|
data/bashcov.gemspec
CHANGED
@@ -25,7 +25,9 @@ Gem::Specification.new do |gem|
|
|
25
25
|
|
26
26
|
gem.add_dependency "simplecov", "~> 0.15"
|
27
27
|
|
28
|
+
gem.add_development_dependency "aruba", "~> 0.14.3"
|
28
29
|
gem.add_development_dependency "coveralls"
|
30
|
+
gem.add_development_dependency "cucumber"
|
29
31
|
gem.add_development_dependency "mutant-rspec"
|
30
32
|
gem.add_development_dependency "rake"
|
31
33
|
gem.add_development_dependency "rspec"
|
data/bin/bashcov
CHANGED
@@ -14,8 +14,20 @@ coverage = runner.result
|
|
14
14
|
|
15
15
|
require "simplecov"
|
16
16
|
|
17
|
-
SimpleCov.
|
17
|
+
SimpleCov.start
|
18
|
+
|
19
|
+
SimpleCov.command_name Bashcov.command_name
|
18
20
|
SimpleCov.root Bashcov.root_directory
|
19
|
-
|
21
|
+
|
22
|
+
result = SimpleCov::Result.new(coverage)
|
23
|
+
if SimpleCov.use_merging
|
24
|
+
SimpleCov::ResultMerger.store_result(result)
|
25
|
+
result = SimpleCov::ResultMerger.merged_result
|
26
|
+
end
|
27
|
+
|
28
|
+
SimpleCov.at_exit do
|
29
|
+
puts "Run completed using #{Bashcov.fullname}"
|
30
|
+
result.format!
|
31
|
+
end
|
20
32
|
|
21
33
|
exit status.exitstatus
|
data/lib/bashcov.rb
CHANGED
@@ -14,19 +14,10 @@ module Bashcov
|
|
14
14
|
|
15
15
|
# A +Struct+ to store Bashcov configuration
|
16
16
|
Options = Struct.new(
|
17
|
-
*%i[skip_uncovered mute bash_path root_directory command]
|
17
|
+
*%i[skip_uncovered mute bash_path root_directory command command_name]
|
18
18
|
)
|
19
19
|
|
20
20
|
class << self
|
21
|
-
# Define option accessors
|
22
|
-
Options.new.members.each do |option|
|
23
|
-
[option, "#{option}="].each do |method|
|
24
|
-
define_method method do |*args|
|
25
|
-
options.public_send(*[method, *args])
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
21
|
# @return [Struct] The +Struct+ object representing Bashcov configuration
|
31
22
|
def options
|
32
23
|
set_default_options! unless defined?(@options)
|
@@ -62,12 +53,22 @@ module Bashcov
|
|
62
53
|
[
|
63
54
|
program_name,
|
64
55
|
VERSION,
|
65
|
-
"
|
56
|
+
"with Bash #{BASH_VERSION},",
|
66
57
|
"Ruby #{RUBY_VERSION},",
|
67
|
-
"and SimpleCov #{SimpleCov::VERSION}
|
58
|
+
"and SimpleCov #{SimpleCov::VERSION}.",
|
68
59
|
].join(" ")
|
69
60
|
end
|
70
61
|
|
62
|
+
# @return [String] The value to use as +SimpleCov.command_name+. Uses the
|
63
|
+
# value of +--command-name+, if this flag was provided, or
|
64
|
+
# +BASHCOV_COMMAND_NAME, if set, defaulting to a stringified
|
65
|
+
# representation of {Bashcov#command}.
|
66
|
+
def command_name
|
67
|
+
return @options.command_name if @options.command_name
|
68
|
+
return ENV["BASHCOV_COMMAND_NAME"] unless ENV.fetch("BASHCOV_COMMAND_NAME", "").empty?
|
69
|
+
command.compact.join(" ")
|
70
|
+
end
|
71
|
+
|
71
72
|
# Wipe the current options and reset default values
|
72
73
|
def set_default_options!
|
73
74
|
@options = Options.new
|
@@ -78,6 +79,17 @@ module Bashcov
|
|
78
79
|
@options.root_directory = Dir.getwd
|
79
80
|
end
|
80
81
|
|
82
|
+
# Define option accessors
|
83
|
+
Options.new.members.each do |option|
|
84
|
+
[option, "#{option}="].each do |method|
|
85
|
+
next if instance_methods(false).include?(method)
|
86
|
+
|
87
|
+
define_method method do |*args|
|
88
|
+
options.public_send(*[method, *args])
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
81
93
|
private
|
82
94
|
|
83
95
|
def help
|
@@ -113,6 +125,9 @@ module Bashcov
|
|
113
125
|
raise Errno::ENOENT, d unless File.directory? d
|
114
126
|
options.root_directory = d
|
115
127
|
end
|
128
|
+
opts.on("--command-name NAME", "Value to use as SimpleCov.command_name") do |c|
|
129
|
+
options.command_name = c
|
130
|
+
end
|
116
131
|
|
117
132
|
opts.separator "\nCommon options:"
|
118
133
|
|
data/lib/bashcov/field_stream.rb
CHANGED
@@ -36,9 +36,6 @@ module Bashcov
|
|
36
36
|
def each(delimiter, field_count, start_match)
|
37
37
|
return enum_for(__method__, delimiter, field_count, start_match) unless block_given?
|
38
38
|
|
39
|
-
# Whether the current field is the start-of-fields match
|
40
|
-
matched_start = nil
|
41
|
-
|
42
39
|
# The number of fields processed since passing the last start-of-fields
|
43
40
|
# match
|
44
41
|
seen_fields = 0
|
@@ -58,7 +55,6 @@ module Bashcov
|
|
58
55
|
# Fill out any remaining (unparseable) fields with empty strings
|
59
56
|
yield_remaining.call
|
60
57
|
|
61
|
-
matched_start = nil
|
62
58
|
seen_fields = 0
|
63
59
|
elsif seen_fields < field_count
|
64
60
|
yield field
|
data/lib/bashcov/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bashcov
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cédric Félizard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simplecov
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.15'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: aruba
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.14.3
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.14.3
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: coveralls
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +52,20 @@ dependencies:
|
|
38
52
|
- - ">="
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: cucumber
|
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'
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
70
|
name: mutant-rspec
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|