knapsack_pro 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +9 -2
- data/lib/knapsack_pro.rb +1 -1
- data/lib/knapsack_pro/config/env.rb +9 -7
- data/lib/knapsack_pro/logger_wrapper.rb +7 -3
- data/lib/knapsack_pro/version.rb +1 -1
- data/spec/knapsack_pro/logger_wrapper_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd3738b3ce978cfd66c03f8a3a125bbf243c51ded0ca237d911b39e5e1bd49a1
|
4
|
+
data.tar.gz: b840297f936a9a9d81af47a67795a7287fd69e996449f88291b5c8a7cd6dc5d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6b64eef137993948a9ab9e6fd001c2bf55d1a05adeb25d1de46c6548db0cc47505019ee9b0b8da4bf0620944be61639eb4372aef620f9ee976dc64219668b28
|
7
|
+
data.tar.gz: d51a9c073f15feb17455a0151d6e655307be2dbdb16796795b2ef751a66f046040256d6549dd2e27b1a27dcd7789c6160d55a624080d2d71ab97fc085c73ac85
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
|
3
3
|
* TODO
|
4
4
|
|
5
|
+
### 1.0.1
|
6
|
+
|
7
|
+
* Fix bug with not being able to set log level via logger wrapper.
|
8
|
+
|
9
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/pull/70
|
10
|
+
|
11
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v1.0.0...v1.0.1
|
12
|
+
|
5
13
|
### 1.0.0
|
6
14
|
|
7
15
|
* Release 1.0.0 is backward compatible with all previous releases.
|
data/README.md
CHANGED
@@ -319,7 +319,12 @@ KnapsackPro.logger = Logger.new(STDOUT)
|
|
319
319
|
KnapsackPro.logger.level = Logger::DEBUG
|
320
320
|
```
|
321
321
|
|
322
|
-
Debug is default log level and
|
322
|
+
Debug is default log level and it is recommended. [Read more](#how-can-i-change-log-level).
|
323
|
+
|
324
|
+
Note your own logger is configured in `spec_helper.rb` or `rails_helper.rb` and it will start working when those files will be loaded.
|
325
|
+
It means the very first request to Knapsack Pro API will be log to `STDOUT` using logger built into knapsack_pro instead of your custom logger.
|
326
|
+
|
327
|
+
If you want to change log level globally than just for your custom log level, please [see this](#how-can-i-change-log-level).
|
323
328
|
|
324
329
|
### Setup your CI server (How to set up 2 of 3)
|
325
330
|
|
@@ -404,13 +409,15 @@ things like external requests done in individual tests).
|
|
404
409
|
On the Knapsack Pro API side, there is test file queue generated for your CI build. Each CI node periodically requests the Knapsack Pro API for test files
|
405
410
|
that should be executed next. Thanks to that each CI node will finish tests at the same time.
|
406
411
|
|
412
|
+
See how it works and what problems can be solved with Queue Mode https://youtu.be/hUEB1XDKEFY
|
413
|
+
|
407
414
|
### How to use queue mode?
|
408
415
|
|
409
416
|
Please use a separate API token for queue mode from one used already for regular mode.
|
410
417
|
|
411
418
|
Use this command to run queue mode:
|
412
419
|
|
413
|
-
# RSpec
|
420
|
+
# RSpec >= 3.x
|
414
421
|
bundle exec rake knapsack_pro:queue:rspec
|
415
422
|
|
416
423
|
# Minitest
|
data/lib/knapsack_pro.rb
CHANGED
@@ -10,7 +10,6 @@ require_relative 'knapsack_pro/version'
|
|
10
10
|
require_relative 'knapsack_pro/extensions/time'
|
11
11
|
require_relative 'knapsack_pro/hooks/queue'
|
12
12
|
require_relative 'knapsack_pro/utils'
|
13
|
-
require_relative 'knapsack_pro/logger_wrapper'
|
14
13
|
require_relative 'knapsack_pro/config/ci/base'
|
15
14
|
require_relative 'knapsack_pro/config/ci/app_veyor'
|
16
15
|
require_relative 'knapsack_pro/config/ci/circle'
|
@@ -25,6 +24,7 @@ require_relative 'knapsack_pro/config/ci/codeship'
|
|
25
24
|
require_relative 'knapsack_pro/config/ci/heroku'
|
26
25
|
require_relative 'knapsack_pro/config/env'
|
27
26
|
require_relative 'knapsack_pro/config/env_generator'
|
27
|
+
require_relative 'knapsack_pro/logger_wrapper'
|
28
28
|
require_relative 'knapsack_pro/client/api/action'
|
29
29
|
require_relative 'knapsack_pro/client/api/v1/base'
|
30
30
|
require_relative 'knapsack_pro/client/api/v1/build_distributions'
|
@@ -1,6 +1,14 @@
|
|
1
1
|
module KnapsackPro
|
2
2
|
module Config
|
3
3
|
class Env
|
4
|
+
LOG_LEVELS = {
|
5
|
+
'fatal' => ::Logger::FATAL,
|
6
|
+
'error' => ::Logger::ERROR,
|
7
|
+
'warn' => ::Logger::WARN,
|
8
|
+
'info' => ::Logger::INFO,
|
9
|
+
'debug' => ::Logger::DEBUG,
|
10
|
+
}
|
11
|
+
|
4
12
|
class << self
|
5
13
|
def ci_node_total
|
6
14
|
(ENV['KNAPSACK_PRO_CI_NODE_TOTAL'] ||
|
@@ -172,13 +180,7 @@ module KnapsackPro
|
|
172
180
|
end
|
173
181
|
|
174
182
|
def log_level
|
175
|
-
|
176
|
-
'fatal' => ::Logger::FATAL,
|
177
|
-
'error' => ::Logger::ERROR,
|
178
|
-
'warn' => ::Logger::WARN,
|
179
|
-
'info' => ::Logger::INFO,
|
180
|
-
'debug' => ::Logger::DEBUG,
|
181
|
-
}[ENV['KNAPSACK_PRO_LOG_LEVEL'].to_s.downcase] || ::Logger::DEBUG
|
183
|
+
LOG_LEVELS[ENV['KNAPSACK_PRO_LOG_LEVEL'].to_s.downcase] || ::Logger::DEBUG
|
182
184
|
end
|
183
185
|
|
184
186
|
private
|
@@ -8,9 +8,13 @@ module KnapsackPro
|
|
8
8
|
|
9
9
|
attr_reader :logger
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
LOG_LEVEL_METHODS = KnapsackPro::Config::Env::LOG_LEVELS.keys.map(&:to_sym)
|
12
|
+
|
13
|
+
def method_missing(method, *args, &block)
|
14
|
+
if LOG_LEVEL_METHODS.include?(method)
|
15
|
+
args[0] = "[knapsack_pro] #{args[0]}"
|
16
|
+
end
|
17
|
+
logger.send(method, *args, &block)
|
14
18
|
end
|
15
19
|
end
|
16
20
|
end
|
data/lib/knapsack_pro/version.rb
CHANGED
@@ -12,4 +12,10 @@ describe KnapsackPro::LoggerWrapper do
|
|
12
12
|
it { should include "[knapsack_pro] Test message\n" }
|
13
13
|
end
|
14
14
|
end
|
15
|
+
|
16
|
+
it 'can set logger level via logger wrapper' do
|
17
|
+
logger_wrapper.level = ::Logger::INFO
|
18
|
+
|
19
|
+
expect(logger_wrapper.level).to eq 1
|
20
|
+
end
|
15
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knapsack_pro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ArturT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|