knife_cookbook_dependencies 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,7 +11,6 @@ module KnifeCookbookDependencies
11
11
  :description => "Exclude cookbooks that are in these groups"
12
12
 
13
13
  def run
14
- ui.info 'Reading Cookbookfile'
15
14
  ::KCD.ui = ui
16
15
  ::KCD::Cookbookfile.process_install(config[:without])
17
16
  end
@@ -69,9 +69,14 @@ module KnifeCookbookDependencies
69
69
  target = File.join(KCD::COOKBOOKS_DIRECTORY, @name)
70
70
  FileUtils.rm_rf target
71
71
  FileUtils.cp_r full_path, target
72
+ KCD.ui.info "#{@name} (#{identifier})"
72
73
  FileUtils.rm_rf File.join(target, '.git') if from_git?
73
74
  end
74
75
 
76
+ def identifier
77
+ @git_repo || local_path || latest_constrained_version
78
+ end
79
+
75
80
  # TODO: Clean up download repetition functionality here, in #download and the associated test.
76
81
  def unpack(location = unpacked_cookbook_path, options={})
77
82
  return true if from_path?
@@ -0,0 +1,33 @@
1
+ # From ActiveSupport: https://github.com/rails/rails/blob/c2c8ef57d6f00d1c22743dc43746f95704d67a95/activesupport/lib/active_support/core_ext/kernel/reporting.rb#L39
2
+
3
+ require 'rbconfig'
4
+
5
+ module Kernel
6
+ # Silences any stream for the duration of the block.
7
+ #
8
+ # silence_stream(STDOUT) do
9
+ # puts 'This will never be seen'
10
+ # end
11
+ #
12
+ # puts 'But this will'
13
+ def silence_stream(stream)
14
+ old_stream = stream.dup
15
+ stream.reopen(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
16
+ stream.sync = true
17
+ yield
18
+ ensure
19
+ stream.reopen(old_stream)
20
+ end
21
+
22
+ # Silences both STDOUT and STDERR, even for subprocesses.
23
+ #
24
+ # quietly { system 'bundle install' }
25
+ #
26
+ def quietly
27
+ silence_stream(STDOUT) do
28
+ silence_stream(STDERR) do
29
+ yield
30
+ end
31
+ end
32
+ end
33
+ end
@@ -10,7 +10,7 @@ module KnifeCookbookDependencies
10
10
  content = @cookbooks.map do |cookbook|
11
11
  get_cookbook_definition(cookbook)
12
12
  end.join("\n")
13
- File::open(DEFAULT_FILENAME, "wb") { |f| f.write content }
13
+ File.open(DEFAULT_FILENAME, "wb") { |f| f.write content }
14
14
  end
15
15
 
16
16
  def get_cookbook_definition(cookbook)
@@ -22,8 +22,13 @@ module KnifeCookbookDependencies
22
22
 
23
23
  self.class.populate_graph graph, shelf
24
24
 
25
+
25
26
  selector = DepSelector::Selector.new(graph)
26
- solution = selector.find_solution([DepSelector::SolutionConstraint.new(graph.package(META_COOKBOOK_NAME))])
27
+
28
+ solution = quietly do
29
+ selector.find_solution([DepSelector::SolutionConstraint.new(graph.package(META_COOKBOOK_NAME))])
30
+ end
31
+
27
32
  solution.delete META_COOKBOOK_NAME
28
33
  solution
29
34
  end
@@ -38,7 +43,7 @@ module KnifeCookbookDependencies
38
43
 
39
44
  def populate_cookbooks_directory
40
45
  cookbooks_from_path = @cookbooks.select(&:from_path?) | @cookbooks.select(&:from_git?)
41
-
46
+ KCD.ui.info "Fetching cookbooks:"
42
47
  resolve_dependencies.each_pair do |cookbook_name, version|
43
48
  cookbook = cookbooks_from_path.select { |c| c.name == cookbook_name }.first || Cookbook.new(cookbook_name, version.to_s)
44
49
  @cookbooks << cookbook
@@ -1,3 +1,3 @@
1
1
  module KnifeCookbookDependencies
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -50,3 +50,4 @@ require 'kcd/cookbookfile'
50
50
  require 'kcd/lockfile'
51
51
  require 'kcd/git'
52
52
  require 'kcd/error_messages'
53
+ require 'kcd/core_ext/kernel'
@@ -46,7 +46,7 @@ describe KCD::Lockfile do
46
46
  it "should populate the cookbooks directory from the lockfile" do
47
47
  lockfile = File.read('Cookbookfile.lock')
48
48
  lockfile.gsub!(/0.101.0/, '0.101.2')
49
- File::open('Cookbookfile.lock', 'wb') { |f| f.write lockfile }
49
+ File.open('Cookbookfile.lock', 'wb') { |f| f.write lockfile }
50
50
  KCD::Cookbookfile.process_install
51
51
  File.read('cookbooks/nginx/metadata.rb').scan(/version\s*"([^"]+)"/).first.first.should == "0.101.2"
52
52
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife_cookbook_dependencies
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-05-17 00:00:00.000000000 Z
14
+ date: 2012-05-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: dep_selector
18
- requirement: &70254336887000 !ruby/object:Gem::Requirement
18
+ requirement: &70160531306040 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: '0'
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *70254336887000
26
+ version_requirements: *70160531306040
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: chef
29
- requirement: &70254336886500 !ruby/object:Gem::Requirement
29
+ requirement: &70160531302420 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ~>
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: 0.10.0
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *70254336886500
37
+ version_requirements: *70160531302420
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: minitar
40
- requirement: &70254336886080 !ruby/object:Gem::Requirement
40
+ requirement: &70160531089600 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ! '>='
@@ -45,10 +45,10 @@ dependencies:
45
45
  version: '0'
46
46
  type: :runtime
47
47
  prerelease: false
48
- version_requirements: *70254336886080
48
+ version_requirements: *70160531089600
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: cucumber
51
- requirement: &70254336885620 !ruby/object:Gem::Requirement
51
+ requirement: &70160531089140 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ! '>='
@@ -56,10 +56,10 @@ dependencies:
56
56
  version: '0'
57
57
  type: :development
58
58
  prerelease: false
59
- version_requirements: *70254336885620
59
+ version_requirements: *70160531089140
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: vcr
62
- requirement: &70254336885200 !ruby/object:Gem::Requirement
62
+ requirement: &70160531088720 !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
65
65
  - - ! '>='
@@ -67,10 +67,10 @@ dependencies:
67
67
  version: '0'
68
68
  type: :development
69
69
  prerelease: false
70
- version_requirements: *70254336885200
70
+ version_requirements: *70160531088720
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: webmock
73
- requirement: &70254336884780 !ruby/object:Gem::Requirement
73
+ requirement: &70160531088300 !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
76
76
  - - ! '>='
@@ -78,10 +78,10 @@ dependencies:
78
78
  version: '0'
79
79
  type: :development
80
80
  prerelease: false
81
- version_requirements: *70254336884780
81
+ version_requirements: *70160531088300
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: aruba
84
- requirement: &70254336884360 !ruby/object:Gem::Requirement
84
+ requirement: &70160531087880 !ruby/object:Gem::Requirement
85
85
  none: false
86
86
  requirements:
87
87
  - - ! '>='
@@ -89,10 +89,10 @@ dependencies:
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
- version_requirements: *70254336884360
92
+ version_requirements: *70160531087880
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: rake
95
- requirement: &70254336883860 !ruby/object:Gem::Requirement
95
+ requirement: &70160531087380 !ruby/object:Gem::Requirement
96
96
  none: false
97
97
  requirements:
98
98
  - - ~>
@@ -100,10 +100,10 @@ dependencies:
100
100
  version: 0.9.0
101
101
  type: :development
102
102
  prerelease: false
103
- version_requirements: *70254336883860
103
+ version_requirements: *70160531087380
104
104
  - !ruby/object:Gem::Dependency
105
105
  name: rdoc
106
- requirement: &70254336883360 !ruby/object:Gem::Requirement
106
+ requirement: &70160531086880 !ruby/object:Gem::Requirement
107
107
  none: false
108
108
  requirements:
109
109
  - - ~>
@@ -111,10 +111,10 @@ dependencies:
111
111
  version: '3.0'
112
112
  type: :development
113
113
  prerelease: false
114
- version_requirements: *70254336883360
114
+ version_requirements: *70160531086880
115
115
  - !ruby/object:Gem::Dependency
116
116
  name: rspec
117
- requirement: &70254336712200 !ruby/object:Gem::Requirement
117
+ requirement: &70160531086500 !ruby/object:Gem::Requirement
118
118
  none: false
119
119
  requirements:
120
120
  - - ! '>='
@@ -122,10 +122,10 @@ dependencies:
122
122
  version: '0'
123
123
  type: :development
124
124
  prerelease: false
125
- version_requirements: *70254336712200
125
+ version_requirements: *70160531086500
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: simplecov
128
- requirement: &70254336711140 !ruby/object:Gem::Requirement
128
+ requirement: &70160531086040 !ruby/object:Gem::Requirement
129
129
  none: false
130
130
  requirements:
131
131
  - - ! '>='
@@ -133,10 +133,10 @@ dependencies:
133
133
  version: '0'
134
134
  type: :development
135
135
  prerelease: false
136
- version_requirements: *70254336711140
136
+ version_requirements: *70160531086040
137
137
  - !ruby/object:Gem::Dependency
138
138
  name: fuubar
139
- requirement: &70254336709980 !ruby/object:Gem::Requirement
139
+ requirement: &70160531085620 !ruby/object:Gem::Requirement
140
140
  none: false
141
141
  requirements:
142
142
  - - ! '>='
@@ -144,10 +144,10 @@ dependencies:
144
144
  version: '0'
145
145
  type: :development
146
146
  prerelease: false
147
- version_requirements: *70254336709980
147
+ version_requirements: *70160531085620
148
148
  - !ruby/object:Gem::Dependency
149
149
  name: spork
150
- requirement: &70254336709240 !ruby/object:Gem::Requirement
150
+ requirement: &70160531085200 !ruby/object:Gem::Requirement
151
151
  none: false
152
152
  requirements:
153
153
  - - ! '>='
@@ -155,10 +155,10 @@ dependencies:
155
155
  version: '0'
156
156
  type: :development
157
157
  prerelease: false
158
- version_requirements: *70254336709240
158
+ version_requirements: *70160531085200
159
159
  - !ruby/object:Gem::Dependency
160
160
  name: guard
161
- requirement: &70254336708580 !ruby/object:Gem::Requirement
161
+ requirement: &70160531084780 !ruby/object:Gem::Requirement
162
162
  none: false
163
163
  requirements:
164
164
  - - ! '>='
@@ -166,10 +166,10 @@ dependencies:
166
166
  version: '0'
167
167
  type: :development
168
168
  prerelease: false
169
- version_requirements: *70254336708580
169
+ version_requirements: *70160531084780
170
170
  - !ruby/object:Gem::Dependency
171
171
  name: guard-rspec
172
- requirement: &70254336707280 !ruby/object:Gem::Requirement
172
+ requirement: &70160531084360 !ruby/object:Gem::Requirement
173
173
  none: false
174
174
  requirements:
175
175
  - - ! '>='
@@ -177,10 +177,10 @@ dependencies:
177
177
  version: '0'
178
178
  type: :development
179
179
  prerelease: false
180
- version_requirements: *70254336707280
180
+ version_requirements: *70160531084360
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: guard-spork
183
- requirement: &70254336705560 !ruby/object:Gem::Requirement
183
+ requirement: &70160531083940 !ruby/object:Gem::Requirement
184
184
  none: false
185
185
  requirements:
186
186
  - - ! '>='
@@ -188,7 +188,7 @@ dependencies:
188
188
  version: '0'
189
189
  type: :development
190
190
  prerelease: false
191
- version_requirements: *70254336705560
191
+ version_requirements: *70160531083940
192
192
  description: Resolves cookbook dependencies
193
193
  email:
194
194
  - josiah@skirmisher.net
@@ -220,6 +220,7 @@ files:
220
220
  - lib/kcd.rb
221
221
  - lib/kcd/cookbook.rb
222
222
  - lib/kcd/cookbookfile.rb
223
+ - lib/kcd/core_ext/kernel.rb
223
224
  - lib/kcd/dsl.rb
224
225
  - lib/kcd/error_messages.rb
225
226
  - lib/kcd/git.rb