knapsack 1.12.2 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d93cadf5bd18740988cc4826d0ed219129e2f80d
4
- data.tar.gz: 05aaf96a027a95e2f50d76c106356471a99de891
3
+ metadata.gz: bc507dcb2e7669f4a09a839eb62763c1b843f6a8
4
+ data.tar.gz: 77b634384eed15ed5cceb2edb2257f083c18f58d
5
5
  SHA512:
6
- metadata.gz: 11fcb7f4ce6dca8e1de5967427e6dedc0f6a5e8cbab736e748d834adccd0b66f6e07ee5d0c15158a4839492b14a63a39692c85059db3a5e9326f528347eddfbe
7
- data.tar.gz: 7848784f3951d192a173dcb4c50ae8ad24be60ffa8aebe62d5dcd697cd27a226d318dcc4e95f1685aa0c37ec65c2d236e705bcfa642350282ca20ae26ed9cf4d
6
+ metadata.gz: 4a12fdfdf2e8021c38fcc6929f099edb62614c46faa54c21b181f90416fa8cba65078a4cbb9f5d5b4319979e2a49ba707f6567bda22d63f5b642c402d62300c3
7
+ data.tar.gz: 15ac64348c0cf24847482d74ae368ad9f56117dbb881866f63811dbbfe1f7dceb8ae147bf7df96f4b63256a99eaa90823cd61a3de22e0341a744b9b73ba06cab
@@ -2,6 +2,14 @@
2
2
 
3
3
  * TODO
4
4
 
5
+ ### 1.13.0
6
+
7
+ * Add KNAPSACK_LOG_LEVEL option
8
+
9
+ https://github.com/ArturT/knapsack/pull/49
10
+
11
+ https://github.com/ArturT/knapsack/compare/v1.12.2...v1.13.0
12
+
5
13
  ### 1.12.2
6
14
 
7
15
  * Fix support for turnip >= 2.x
data/README.md CHANGED
@@ -92,6 +92,7 @@ The knapsack gem supports:
92
92
  - [How can I run tests from multiple directories?](#how-can-i-run-tests-from-multiple-directories)
93
93
  - [How to update existing knapsack report for a few test files?](#how-to-update-existing-knapsack-report-for-a-few-test-files)
94
94
  - [How to run tests for particular CI node in your development environment](#how-to-run-tests-for-particular-ci-node-in-your-development-environment)
95
+ - [How can I change log level?](#how-can-i-change-log-level)
95
96
  - [Gem tests](#gem-tests)
96
97
  - [Spec](#spec)
97
98
  - [Spec examples](#spec-examples)
@@ -633,6 +634,16 @@ The test file pattern config option supports any glob pattern handled by [`Dir.g
633
634
 
634
635
  $ KNAPSACK_TEST_DIR=spec KNAPSACK_TEST_FILE_PATTERN="{spec,engines/**/spec}/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
635
636
 
637
+ `KNAPSACK_TEST_DIR` will be your default path for rspec so you should put there your `spec_helper.rb`. Please ensure you will require it in your test files this way:
638
+
639
+ ```ruby
640
+ # good
641
+ require_relative 'spec_helper'
642
+
643
+ # bad - won't work
644
+ require 'spec_helper'
645
+ ```
646
+
636
647
  ### How to update existing knapsack report for a few test files?
637
648
 
638
649
  You may want to look at monkey patch in [this issue](https://github.com/ArturT/knapsack/issues/34). Take into account that there are some cons of this approach.
@@ -648,6 +659,14 @@ For instance to run subset of tests for the first CI node with specified seed yo
648
659
 
649
660
  Above example is for RSpec. You can use respectively rake task name and token environment variable when you want to run tests for minitest, cucumber or spinach.
650
661
 
662
+ ### How can I change log level?
663
+
664
+ You can change log level by specifying the `KNAPSACK_LOG_LEVEL` environment variable.
665
+
666
+ KNAPSACK_LOG_LEVEL=warn bundle exec rake knapsack:rspec
667
+
668
+ Available values are `debug`, `info`, and `warn`. The default log level is `info`.
669
+
651
670
  ## Gem tests
652
671
 
653
672
  ### Spec
@@ -48,7 +48,7 @@ module Knapsack
48
48
  def logger
49
49
  return @@logger if @@logger
50
50
  log = Knapsack::Logger.new
51
- log.level = Knapsack::Logger::INFO
51
+ log.level = Knapsack::Config::Env.log_level
52
52
  @@logger = log
53
53
  end
54
54
 
@@ -22,6 +22,14 @@ module Knapsack
22
22
  ENV['KNAPSACK_TEST_DIR']
23
23
  end
24
24
 
25
+ def log_level
26
+ {
27
+ "debug" => Knapsack::Logger::DEBUG,
28
+ "info" => Knapsack::Logger::INFO,
29
+ "warn" => Knapsack::Logger::WARN,
30
+ }[ENV['KNAPSACK_LOG_LEVEL']] || Knapsack::Logger::INFO
31
+ end
32
+
25
33
  private
26
34
 
27
35
  def index_starting_from_one(index)
@@ -1,3 +1,3 @@
1
1
  module Knapsack
2
- VERSION = '1.12.2'
2
+ VERSION = '1.13.0'
3
3
  end
@@ -110,4 +110,18 @@ describe Knapsack::Config::Env do
110
110
  it { should be_nil }
111
111
  end
112
112
  end
113
+
114
+ describe '.log_level' do
115
+ subject { described_class.log_level }
116
+
117
+ context 'when ENV exists' do
118
+ let(:log_level) { 'debug' }
119
+ before { stub_const("ENV", { 'KNAPSACK_LOG_LEVEL' => log_level }) }
120
+ it { should eql Knapsack::Logger::DEBUG }
121
+ end
122
+
123
+ context "when ENV doesn't exist" do
124
+ it { should eql Knapsack::Logger::INFO }
125
+ end
126
+ end
113
127
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knapsack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.2
4
+ version: 1.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-07 00:00:00.000000000 Z
11
+ date: 2016-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake