r10k 1.0.0rc2 → 1.0.0rc3

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,7 +22,7 @@ module R10K::CLI
22
22
  end
23
23
 
24
24
  required :v, :verbose, 'Set verbosity level' do |value, cmd|
25
- R10K::Logging.level = Integer(value)
25
+ R10K::Logging.level = value
26
26
  end
27
27
 
28
28
  flag :t, :trace, 'Display stack traces on application crash'
@@ -25,7 +25,6 @@ class Config
25
25
 
26
26
  # Scan all possible keys to see if the config has a matching value
27
27
  keys.inject(nil) do |rv, k|
28
- require 'pry'; binding.pry
29
28
  v = @config[k]
30
29
  break v unless v.nil?
31
30
  end
@@ -7,6 +7,8 @@ module R10K::Logging
7
7
 
8
8
  include Log4r
9
9
 
10
+ LOG_LEVELS = %w{DEBUG2 DEBUG1 DEBUG INFO NOTICE WARN ERROR FATAL}
11
+
10
12
  def logger_name
11
13
  self.class.to_s
12
14
  end
@@ -22,9 +24,24 @@ module R10K::Logging
22
24
  class << self
23
25
  include Log4r
24
26
 
27
+ def levels
28
+ @levels ||= LOG_LEVELS.each.inject({}) do |levels, k|
29
+ levels[k] = Log4r.const_get(k)
30
+ levels
31
+ end
32
+ end
33
+
34
+ def parse_level(val)
35
+ begin
36
+ Integer(val)
37
+ rescue
38
+ levels[val.upcase]
39
+ end
40
+ end
41
+
25
42
  def included(klass)
26
43
  unless @log4r_loaded
27
- Configurator.custom_levels(*%w{DEBUG2 DEBUG1 DEBUG INFO NOTICE WARN ERROR FATAL})
44
+ Configurator.custom_levels(*LOG_LEVELS)
28
45
  Logger.global.level = Log4r::ALL
29
46
  @log4r_loaded = true
30
47
  end
@@ -35,8 +52,10 @@ module R10K::Logging
35
52
  end
36
53
 
37
54
  def level=(val)
38
- outputter.level = val
39
- @level = val
55
+ level = parse_level val
56
+ raise "Invalid log level: #{val}" unless level
57
+ outputter.level = level
58
+ @level = level
40
59
  end
41
60
 
42
61
  def formatter
@@ -19,7 +19,7 @@ class Forge
19
19
 
20
20
  include R10K::Logging
21
21
 
22
- attr_accessor :version, :owner, :full_name
22
+ attr_accessor :owner, :full_name
23
23
 
24
24
  def initialize(name, basedir, args)
25
25
  @full_name = name
@@ -1,3 +1,3 @@
1
1
  module R10K
2
- VERSION = '1.0.0rc2'
2
+ VERSION = '1.0.0rc3'
3
3
  end
@@ -45,21 +45,19 @@ describe R10K::Module::Forge do
45
45
 
46
46
  it { should be_insync }
47
47
  its(:version) { should eq '8.0.0' }
48
- its(:current_version) { should eq '8.0.0' }
49
48
  end
50
49
 
51
50
  describe "and the desired version is newer than the installed version" do
52
51
  subject { described_class.new('branan/eight_hundred', fixture_modulepath, '80.0.0') }
53
52
 
54
53
  it { should_not be_insync }
55
- its(:version) { should eq '80.0.0' }
56
- its(:current_version) { should eq '8.0.0' }
54
+ its(:version) { should eq 'v8.0.0' }
57
55
 
58
56
  it "should try to upgrade the module" do
59
57
  # "v80.0.0" ? Seriously? Where did the "v" come from?
60
58
  expected = %w{upgrade --version=v80.0.0 --ignore-dependencies branan/eight_hundred}
61
59
  subject.expects(:pmt).with(expected)
62
- subject.sync!
60
+ subject.sync
63
61
  end
64
62
  end
65
63
 
@@ -67,14 +65,13 @@ describe R10K::Module::Forge do
67
65
  subject { described_class.new('branan/eight_hundred', fixture_modulepath, '7.0.0') }
68
66
 
69
67
  it { should_not be_insync }
70
- its(:version) { should eq '7.0.0' }
71
- its(:current_version) { should eq '8.0.0' }
68
+ its(:version) { should eq 'v8.0.0' }
72
69
 
73
70
  it "should try to downgrade the module" do
74
71
  # Again with the magical "v" prefix to the version.
75
72
  expected = %w{upgrade --version=v7.0.0 --ignore-dependencies branan/eight_hundred}
76
73
  subject.expects(:pmt).with(expected)
77
- subject.sync!
74
+ subject.sync
78
75
  end
79
76
  end
80
77
 
@@ -82,13 +79,12 @@ describe R10K::Module::Forge do
82
79
  subject { described_class.new('branan/eight_hundred', empty_modulepath, '8.0.0') }
83
80
 
84
81
  it { should_not be_insync }
85
- its(:version) { should eq '8.0.0' }
86
- its(:current_version) { should eq SemVer::MIN }
82
+ its(:version) { should eq SemVer::MIN }
87
83
 
88
84
  it "should try to install the module" do
89
85
  expected = %w{install --version=v8.0.0 --ignore-dependencies branan/eight_hundred}
90
86
  subject.expects(:pmt).with(expected)
91
- subject.sync!
87
+ subject.sync
92
88
  end
93
89
  end
94
90
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: r10k
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0rc2
4
+ version: 1.0.0rc3
5
5
  prerelease: 5
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-17 00:00:00.000000000 Z
12
+ date: 2013-05-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colored
@@ -209,3 +209,4 @@ test_files:
209
209
  - spec/unit/git/cache_spec.rb
210
210
  - spec/unit/deployment/environment_spec.rb
211
211
  - spec/unit/module/forge_spec.rb
212
+ has_rdoc: