bashcov 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d8360ca3ab8a2d06296fbd911a15045bf10257d1
4
- data.tar.gz: 9de0f7c886d9ab871d6b17870788bce1925e2b30
3
+ metadata.gz: 51672b26914fff5fc95fbf6c42bddbfb201e8132
4
+ data.tar.gz: ff4eb7d2df73d8817f4780f19fa77872f5670679
5
5
  SHA512:
6
- metadata.gz: cae406036062359b26ddf208eb95dab86d9263aef1a1b04eb37c628300678281b83834183d6c037713a67a648ad9a90e2570ca045f5b75b39380995aeb6852b3
7
- data.tar.gz: 18f0ba69db66d6c36b414c8dd0bd6710f5a3d82ec566b3acc9a5d4cdcff6a5bd806ae6f3a79317970869b15dea7ce1f1db2139762478cf002181d9683ddca41e
6
+ metadata.gz: 5eea7d38ab1ef4ef37df415ff13957fdea5f1a1eb35b13d4de416cca6107177b9dd6f3ca2ac2c24cddab776fec3c1f5905dac59a989b8fe634308f81498d8e20
7
+ data.tar.gz: 7c0eb4b5974220ee6bd1ef18b538f79c3af2dbf3993c675425fd1e9734b3dacbe3bfe76bd0aad8f7dd16df6136ea841c291433f96395efb552dcd18adae8cb4f
data/.travis.yml CHANGED
@@ -11,3 +11,7 @@ matrix:
11
11
  allow_failures:
12
12
  - rvm: ruby-head
13
13
  - rvm: rbx-19mode
14
+ notifications:
15
+ email:
16
+ on_success: always
17
+ on_failure: always
data/CHANGELOG.md CHANGED
@@ -1,7 +1,12 @@
1
- ## Unreleased ([changes](https://github.com/infertux/bashcov/compare/v1.0.0...master))
1
+ ## Unreleased ([changes](https://github.com/infertux/bashcov/compare/v1.0.1...master))
2
2
 
3
3
  * TBD
4
4
 
5
+ ## v1.0.1, 2013-03-21 ([changes](https://github.com/infertux/bashcov/compare/v1.0.0...v1.0.1))
6
+
7
+ * [BUGFIX] Allow to add SimpleCov filters.
8
+ * [BUGFIX] Lines containing only `elif` should be ignored.
9
+
5
10
  ## v1.0.0, 2013-03-16 ([changes](https://github.com/infertux/bashcov/compare/v0.0.9...v1.0.0))
6
11
 
7
12
  * First stable release. Enjoy!
data/README.md CHANGED
@@ -21,7 +21,10 @@
21
21
  [Bashcov]: https://github.com/infertux/bashcov
22
22
  [SimpleCov]: https://github.com/colszowka/simplecov "Bashcov is backed by SimpleCov to generate awesome coverage report"
23
23
 
24
- You should check out the **[demo](http://infertux.github.com/bashcov/test_app/)** -- it's worth a thousand words.
24
+ You should check out these coverage examples - it's worth a thousand words:
25
+
26
+ - [Test app demo](http://infertux.github.com/bashcov/test_app/ "Coverage for the bundled test application")
27
+ - [RVM demo](http://infertux.github.com/bashcov/rvm/ "Coverage for RVM")
25
28
 
26
29
  ## Installation
27
30
 
@@ -29,13 +32,13 @@ You should check out the **[demo](http://infertux.github.com/bashcov/test_app/)*
29
32
 
30
33
  ## Usage
31
34
 
32
- `bashcov --help` prints all available options.
35
+ `$ bashcov --help` prints all available options.
33
36
  Here are some examples:
34
37
 
35
- bashcov ./script.sh
36
- bashcov --skip-uncovered ./script.sh
37
- bashcov -- ./script.sh --some --flags
38
- bashcov --skip-uncovered -- ./script.sh --some --flags
38
+ $ bashcov ./script.sh
39
+ $ bashcov --skip-uncovered ./script.sh
40
+ $ bashcov -- ./script.sh --some --flags
41
+ $ bashcov --skip-uncovered -- ./script.sh --some --flags
39
42
 
40
43
  `script.sh` can be a mere Bash script or typically your CI script.
41
44
  Bashcov will keep track of all executed scripts.
data/bin/bashcov CHANGED
@@ -14,6 +14,6 @@ coverage = runner.result
14
14
  require 'simplecov'
15
15
 
16
16
  SimpleCov.command_name Bashcov.name
17
- SimpleCov.filters = [] # remove default filters
17
+ SimpleCov.root Bashcov.root_directory
18
18
  SimpleCov::Result.new(coverage).format!
19
19
 
data/lib/bashcov/lexer.rb CHANGED
@@ -9,7 +9,7 @@ module Bashcov
9
9
  IGNORE_END_WITH = %w|(|
10
10
 
11
11
  # Lines containing only one of these keywords are irrelevant for coverage
12
- IGNORE_IS = %w|esac if then fi while do done else { } ;;|
12
+ IGNORE_IS = %w|esac if then else elif fi while do done { } ;;|
13
13
 
14
14
  # @param [String] filename File to analyze
15
15
  # @param [Hash] coverage Coverage with executed lines marked
@@ -1,4 +1,4 @@
1
1
  module Bashcov
2
2
  # [String] Bashcov version
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.1'
4
4
  end
data/lib/bashcov.rb CHANGED
@@ -14,9 +14,9 @@ module Bashcov
14
14
  # @return [OpenStruct] Bashcov settings
15
15
  attr_reader :options
16
16
 
17
- # @return [String] The project's root directory inferred from the command
17
+ # @return [String] The project's root directory
18
18
  def root_directory
19
- @root_directory ||= File.dirname(File.absolute_path(@options.command))
19
+ @root_directory ||= Dir.pwd
20
20
  end
21
21
 
22
22
  # Sets default options overriding any existing ones.
@@ -4,10 +4,8 @@ require 'benchmark'
4
4
  describe Bashcov::Runner do
5
5
  let(:runner) { Bashcov::Runner.new test_suite }
6
6
 
7
- before do
8
- # 'Bashcov.options.command' is normally set through 'Bashcov.parse_options!'
9
- # so we need to stub it
10
- Bashcov.options.stub(:command).and_return(test_suite)
7
+ before :all do
8
+ Dir.chdir File.dirname(test_suite)
11
9
  end
12
10
 
13
11
  describe "#run" do
@@ -23,7 +23,7 @@ def expected_coverage
23
23
  "#{test_app}/scripts/source.sh" => [nil, nil, 1, nil, 2],
24
24
  "#{test_app}/scripts/sourced.txt" => [nil, nil, 1],
25
25
  "#{test_app}/scripts/unicode.sh" => [nil, nil, nil, 1],
26
- "#{test_app}/scripts/multiline.sh" => [nil, nil, 1, 2, 1, 1, 0, nil, nil, 0, 1, 2], # XXX the 3 last lines should be [1, 1, 1] - Bash bug
26
+ "#{test_app}/scripts/multiline.sh" => [nil, nil, nil, 1, nil, 0, nil, 1, nil, 1, nil, 0, nil, nil, 1, 2, 1, 1, 0, nil, nil, 0, 1, 2],
27
27
  "#{test_app}/scripts/executable" => [nil, nil, 1],
28
28
  "#{test_app}/test_suite.sh" => [nil, nil, 2, nil, 1]
29
29
  }
@@ -1,5 +1,17 @@
1
1
  #!/bin/bash
2
2
 
3
+ if
4
+ [[ false = true ]]
5
+ then
6
+ echo 1
7
+ elif
8
+ [[ 2 ]]
9
+ then
10
+ echo 2
11
+ else
12
+ echo 3
13
+ fi
14
+
3
15
  [ false = true ] || \
4
16
  [[ 42 -eq 1337 ]] || [[ 1 -eq 1 ]] \
5
17
  && true && \
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.0.0
4
+ version: 1.0.1
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: 2013-03-16 00:00:00.000000000 Z
11
+ date: 2013-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simplecov