between_meals 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5952ca7e5fa6d2486432f7a3c6680e01829056e0
4
+ data.tar.gz: e1a35decf62bb0cc2fbb7bda9e449754184f50cd
5
+ SHA512:
6
+ metadata.gz: 5b179124ee7a2330a15e52c87784ad975f1110954cfefc61ad351dc125b57740604eb8197b2ec3320ee3c237ff1ae6bb79471b678a03fd5e4693837289ffaca3
7
+ data.tar.gz: fa1efa5aaa80231f1b9b2dab50427e608ea3a4bd6e1c910d36ab61ffa33928076b2f841e5aa1d8a4a93e00aaa19b8bd4a0545dccb0db4e1d0648090bc93e0b15
@@ -38,7 +38,8 @@ module BetweenMeals
38
38
  info("Cookbook is #{m[1]}")
39
39
  return {
40
40
  :cookbook_dir => dir,
41
- :name => m[1] }
41
+ :name => m[1],
42
+ }
42
43
  end
43
44
  nil
44
45
  end
@@ -47,7 +48,7 @@ module BetweenMeals
47
48
  @files = files
48
49
  @name = self.class.explode_path(
49
50
  files.sample[:path],
50
- cookbook_dirs
51
+ cookbook_dirs,
51
52
  )[:name]
52
53
  # if metadata.rb is being deleted
53
54
  # cookbook is marked for deletion
@@ -20,7 +20,7 @@ module BetweenMeals
20
20
  # Changeset aware role
21
21
  class Role < Change
22
22
  def self.name_from_path(path, role_dir)
23
- re = %r{^#{role_dir}/(.+)\.rb}
23
+ re = %r{^#{role_dir}/(.+)\.(?:rb|json)}
24
24
  debug("[role] Matching #{path} against #{re}")
25
25
  m = path.match(re)
26
26
  if m
@@ -27,7 +27,7 @@ module BetweenMeals
27
27
  # Basically, you always want to use BetweenMeals::Changes through this
28
28
  # helper class.
29
29
  class Changeset
30
- class ReferenceError < Exception
30
+ class ReferenceError < RuntimeError
31
31
  end
32
32
 
33
33
  def initialize(logger, repo, start_ref, end_ref, locations)
@@ -34,7 +34,7 @@ module BetweenMeals
34
34
  @logger.info("Running \"#{cmd}\"")
35
35
  c = Mixlib::ShellOut.new(
36
36
  cmd,
37
- :cwd => cwd
37
+ :cwd => cwd,
38
38
  )
39
39
  c.run_command
40
40
  c.error!
@@ -42,6 +42,7 @@ module BetweenMeals
42
42
  @pem = opts[:pem] ||
43
43
  "#{@home}/.chef/#{@user}-taste-tester.pem"
44
44
  @role_dir = opts[:role_dir]
45
+ @role_type = opts[:role_type] || 'rb'
45
46
  @cookbook_dirs = opts[:cookbook_dirs]
46
47
  @databag_dir = opts[:databag_dir]
47
48
  @checksum_dir = opts[:checksum_dir]
@@ -51,14 +52,16 @@ module BetweenMeals
51
52
 
52
53
  def role_upload_all
53
54
  if File.exists?(@role_dir)
54
- roles = File.join(@role_dir, '*.rb')
55
+ roles = File.join(@role_dir, "*.#{@role_type}")
55
56
  exec!("#{@knife} role from file #{roles} -c #{@config}", @logger)
56
57
  end
57
58
  end
58
59
 
59
60
  def role_upload(roles)
60
61
  if roles.any?
61
- roles = roles.map { |x| File.join(@role_dir, "#{x.name}.rb") }.join(' ')
62
+ roles = roles.map do |x|
63
+ File.join(@role_dir, "#{x.name}.#{@role_type}")
64
+ end.join(' ')
62
65
  exec!("#{@knife} role from file #{roles} -c #{@config}", @logger)
63
66
  end
64
67
  end
@@ -144,7 +147,7 @@ module BetweenMeals
144
147
  end.join(' ')
145
148
  exec!(
146
149
  "#{@knife} data bag from file #{dbname} #{dbitems} -c #{@config}",
147
- @logger
150
+ @logger,
148
151
  )
149
152
  end
150
153
  end
@@ -181,7 +184,7 @@ BLOCK
181
184
  end
182
185
  cfg << "]\n"
183
186
  unless File.directory?(File.dirname(@config))
184
- Dir.mkdir(File.dirname(@config), 0755)
187
+ Dir.mkdir(File.dirname(@config), 0o755)
185
188
  end
186
189
  if !File.exists?(@config) ||
187
190
  ::Digest::MD5.hexdigest(cfg) !=
@@ -234,7 +237,7 @@ IAMAEpsWX2s2A6phgMCx7kH6wMmoZn3hb7Thh9+PfR8Jtp2/7k+ibCeF4gEWUCs5
234
237
  s = Mixlib::ShellOut.new("#{@knife} data bag list" +
235
238
  " --format json -c #{@config}").run_command
236
239
  s.error!
237
- db = JSON.load(s.stdout)
240
+ db = JSON.parse(s.stdout)
238
241
  unless db.include?(databag)
239
242
  exec!("#{@knife} data bag create #{databag} -c #{@config}", @logger)
240
243
  end
@@ -244,7 +247,7 @@ IAMAEpsWX2s2A6phgMCx7kH6wMmoZn3hb7Thh9+PfR8Jtp2/7k+ibCeF4gEWUCs5
244
247
  s = Mixlib::ShellOut.new("#{@knife} data bag show #{databag}" +
245
248
  " --format json -c #{@config}").run_command
246
249
  s.error!
247
- db = JSON.load(s.stdout)
250
+ db = JSON.parse(s.stdout)
248
251
  if db.empty?
249
252
  exec!("#{@knife} data bag delete #{databag} --yes -c #{@config}",
250
253
  @logger)
@@ -60,7 +60,7 @@ module BetweenMeals
60
60
  {
61
61
  :message => msg,
62
62
  :update_ref => 'HEAD',
63
- }
63
+ },
64
64
  )
65
65
  end
66
66
 
@@ -89,7 +89,7 @@ module BetweenMeals
89
89
  rescue => e
90
90
  # We've seen some weird non-reproducible failures here
91
91
  @logger.error(
92
- 'Something went wrong. Please please report this output.'
92
+ 'Something went wrong. Please report this output.',
93
93
  )
94
94
  @logger.error(e)
95
95
  stdout.lines.each do |line|
@@ -158,57 +158,57 @@ module BetweenMeals
158
158
  # A path
159
159
  {
160
160
  :status => :modified,
161
- :path => Regexp.last_match(1)
161
+ :path => Regexp.last_match(1),
162
162
  }
163
163
  when /^C(?:\d*)\s+(\S+)\s+(\S+)/
164
164
  # C<numbers> path1 path2
165
165
  {
166
166
  :status => :modified,
167
- :path => Regexp.last_match(2)
167
+ :path => Regexp.last_match(2),
168
168
  }
169
169
  when /^D\s+(\S+)$/
170
170
  # D path
171
171
  {
172
172
  :status => :deleted,
173
- :path => Regexp.last_match(1)
173
+ :path => Regexp.last_match(1),
174
174
  }
175
175
  when /^M(?:\d*)\s+(\S+)$/
176
176
  # M<numbers> path
177
177
  {
178
178
  :status => :modified,
179
- :path => Regexp.last_match(1)
179
+ :path => Regexp.last_match(1),
180
180
  }
181
181
  when /^R(?:\d*)\s+(\S+)\s+(\S+)/
182
182
  # R<numbers> path1 path2
183
183
  [
184
184
  {
185
185
  :status => :deleted,
186
- :path => Regexp.last_match(1)
186
+ :path => Regexp.last_match(1),
187
187
  },
188
188
  {
189
189
  :status => :modified,
190
- :path => Regexp.last_match(2)
191
- }
190
+ :path => Regexp.last_match(2),
191
+ },
192
192
  ]
193
193
  when /^T\s+(\S+)$/
194
194
  # T path
195
195
  [
196
196
  {
197
197
  :status => :deleted,
198
- :path => Regexp.last_match(1)
198
+ :path => Regexp.last_match(1),
199
199
  },
200
200
  {
201
201
  :status => :modified,
202
- :path => Regexp.last_match(1)
203
- }
202
+ :path => Regexp.last_match(1),
203
+ },
204
204
  ]
205
205
  else
206
- fail 'No match'
206
+ fail 'Failed to parse repo diff line.'
207
207
  end
208
208
  end.flatten.map do |x|
209
209
  {
210
210
  :status => x[:status],
211
- :path => x[:path].sub("#{@repo_path}/", '')
211
+ :path => x[:path].sub("#{@repo_path}/", ''),
212
212
  }
213
213
  end
214
214
  # rubocop:enable MultilineBlockChain
@@ -53,7 +53,7 @@ module BetweenMeals
53
53
  rescue => e
54
54
  # We've seen some weird non-reproducible failures here
55
55
  @logger.error(
56
- 'Something went wrong. Please please report this output.'
56
+ 'Something went wrong. Please report this output.',
57
57
  )
58
58
  @logger.error(e)
59
59
  stdout.lines.each do |line|
@@ -171,40 +171,40 @@ module BetweenMeals
171
171
  when /^A (\S+)$/
172
172
  {
173
173
  :status => :added,
174
- :path => Regexp.last_match(1)
174
+ :path => Regexp.last_match(1),
175
175
  }
176
176
  when /^C (\S+)$/
177
177
  {
178
178
  :status => :clean,
179
- :path => Regexp.last_match(1)
179
+ :path => Regexp.last_match(1),
180
180
  }
181
181
  when /^R (\S+)$/
182
182
  {
183
183
  :status => :deleted,
184
- :path => Regexp.last_match(1)
184
+ :path => Regexp.last_match(1),
185
185
  }
186
186
  when /^M (\S+)$/
187
187
  {
188
188
  :status => :modified,
189
- :path => Regexp.last_match(1)
189
+ :path => Regexp.last_match(1),
190
190
  }
191
191
  when /^! (\S+)$/
192
192
  {
193
193
  :status => :missing,
194
- :path => Regexp.last_match(1)
194
+ :path => Regexp.last_match(1),
195
195
  }
196
196
  when /^\? (\S+)$/
197
197
  {
198
198
  :status => :untracked,
199
- :path => Regexp.last_match(1)
199
+ :path => Regexp.last_match(1),
200
200
  }
201
201
  when /^I (\S+)$/
202
202
  {
203
203
  :status => :ignored,
204
- :path => Regexp.last_match(1)
204
+ :path => Regexp.last_match(1),
205
205
  }
206
206
  else
207
- fail 'No match'
207
+ fail 'Failed to parse repo diff line.'
208
208
  end
209
209
  end
210
210
  # rubocop:enable MultilineBlockChain
@@ -66,7 +66,7 @@ module BetweenMeals
66
66
  parse_status(changes).compact
67
67
  rescue => e
68
68
  @logger.error(
69
- 'Something went wrong. Please please report this output.'
69
+ 'Something went wrong. Please report this output.',
70
70
  )
71
71
  @logger.error(e)
72
72
  stdout.lines.each do |line|
@@ -103,13 +103,13 @@ module BetweenMeals
103
103
  # http://svnbook.red-bean.com/en/1.0/re26.html
104
104
  changes.lines.map do |line|
105
105
  case line
106
- when (/^([\w ])\w?\s+(\S+)$/)
106
+ when /^([\w ])\w?\s+(\S+)$/
107
107
  {
108
108
  :status => Regexp.last_match(1) == 'D' ? :deleted : :modified,
109
109
  :path => Regexp.last_match(2).sub("#{@repo_path}/", ''),
110
110
  }
111
111
  else
112
- fail 'No match'
112
+ fail 'Failed to parse repo diff line.'
113
113
  end
114
114
  end
115
115
  end
metadata CHANGED
@@ -1,208 +1,189 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: between_meals
3
- version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 6
10
- version: 0.0.6
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.7
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Phil Dibowitz
14
8
  - Marcin Sawicki
15
9
  autorequire:
16
10
  bindir: bin
17
11
  cert_chain: []
18
-
19
- date: 2015-11-26 00:00:00 Z
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2016-09-26 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: colorize
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '>='
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
33
21
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: json
37
22
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '>='
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: json
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
47
35
  type: :runtime
48
- version_requirements: *id002
49
- - !ruby/object:Gem::Dependency
50
- name: mixlib-shellout
51
36
  prerelease: false
52
- requirement: &id003 !ruby/object:Gem::Requirement
53
- none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- hash: 3
58
- segments:
59
- - 0
60
- version: "0"
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: mixlib-shellout
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
61
49
  type: :runtime
62
- version_requirements: *id003
63
- - !ruby/object:Gem::Dependency
64
- name: rugged
65
50
  prerelease: false
66
- requirement: &id004 !ruby/object:Gem::Requirement
67
- none: false
68
- requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- hash: 3
72
- segments:
73
- - 0
74
- version: "0"
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rugged
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
75
63
  type: :runtime
76
- version_requirements: *id004
77
- - !ruby/object:Gem::Dependency
78
- name: rspec-core
79
64
  prerelease: false
80
- requirement: &id005 !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ">="
84
- - !ruby/object:Gem::Version
85
- hash: 3
86
- segments:
87
- - 0
88
- version: "0"
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rspec-core
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
89
77
  type: :development
90
- version_requirements: *id005
91
- - !ruby/object:Gem::Dependency
92
- name: rspec-expectations
93
78
  prerelease: false
94
- requirement: &id006 !ruby/object:Gem::Requirement
95
- none: false
96
- requirements:
97
- - - ">="
98
- - !ruby/object:Gem::Version
99
- hash: 3
100
- segments:
101
- - 0
102
- version: "0"
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rspec-expectations
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
103
91
  type: :development
104
- version_requirements: *id006
105
- - !ruby/object:Gem::Dependency
106
- name: rspec-mocks
107
92
  prerelease: false
108
- requirement: &id007 !ruby/object:Gem::Requirement
109
- none: false
110
- requirements:
111
- - - ">="
112
- - !ruby/object:Gem::Version
113
- hash: 3
114
- segments:
115
- - 0
116
- version: "0"
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: rspec-mocks
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
117
105
  type: :development
118
- version_requirements: *id007
119
- - !ruby/object:Gem::Dependency
120
- name: rubocop
121
106
  prerelease: false
122
- requirement: &id008 !ruby/object:Gem::Requirement
123
- none: false
124
- requirements:
125
- - - ">="
126
- - !ruby/object:Gem::Version
127
- hash: 3
128
- segments:
129
- - 0
130
- version: "0"
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: rubocop
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
131
119
  type: :development
132
- version_requirements: *id008
133
- - !ruby/object:Gem::Dependency
134
- name: simplecov
135
120
  prerelease: false
136
- requirement: &id009 !ruby/object:Gem::Requirement
137
- none: false
138
- requirements:
139
- - - ">="
140
- - !ruby/object:Gem::Version
141
- hash: 3
142
- segments:
143
- - 0
144
- version: "0"
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: simplecov
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - '>='
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
145
133
  type: :development
146
- version_requirements: *id009
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
147
140
  description: Library for calculation Chef differences between revisions
148
141
  email:
149
142
  executables: []
150
-
151
143
  extensions: []
152
-
153
- extra_rdoc_files:
144
+ extra_rdoc_files:
154
145
  - README.md
155
146
  - LICENSE
156
- files:
147
+ files:
157
148
  - README.md
158
149
  - LICENSE
159
- - lib/between_meals/knife.rb
160
- - lib/between_meals/cmd.rb
161
150
  - lib/between_meals/util.rb
162
- - lib/between_meals/repo.rb
163
151
  - lib/between_meals/changeset.rb
152
+ - lib/between_meals/knife.rb
153
+ - lib/between_meals/repo.rb
154
+ - lib/between_meals/cmd.rb
155
+ - lib/between_meals/changes/databag.rb
156
+ - lib/between_meals/changes/cookbook.rb
164
157
  - lib/between_meals/changes/change.rb
165
158
  - lib/between_meals/changes/role.rb
166
- - lib/between_meals/changes/cookbook.rb
167
- - lib/between_meals/changes/databag.rb
159
+ - lib/between_meals/repo/git.rb
160
+ - lib/between_meals/repo/svn.rb
161
+ - lib/between_meals/repo/git/cmd.rb
168
162
  - lib/between_meals/repo/svn/cmd.rb
169
163
  - lib/between_meals/repo/hg/cmd.rb
170
- - lib/between_meals/repo/git/cmd.rb
171
- - lib/between_meals/repo/svn.rb
172
- - lib/between_meals/repo/git.rb
173
164
  - lib/between_meals/repo/hg.rb
174
165
  homepage: https://github.com/facebook/between-meals
175
- licenses:
166
+ licenses:
176
167
  - Apache
168
+ metadata: {}
177
169
  post_install_message:
178
170
  rdoc_options: []
179
-
180
- require_paths:
171
+ require_paths:
181
172
  - lib
182
- required_ruby_version: !ruby/object:Gem::Requirement
183
- none: false
184
- requirements:
185
- - - ">="
186
- - !ruby/object:Gem::Version
187
- hash: 3
188
- segments:
189
- - 0
190
- version: "0"
191
- required_rubygems_version: !ruby/object:Gem::Requirement
192
- none: false
193
- requirements:
194
- - - ">="
195
- - !ruby/object:Gem::Version
196
- hash: 3
197
- segments:
198
- - 0
199
- version: "0"
173
+ required_ruby_version: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - '>='
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
178
+ required_rubygems_version: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - '>='
181
+ - !ruby/object:Gem::Version
182
+ version: '0'
200
183
  requirements: []
201
-
202
184
  rubyforge_project:
203
- rubygems_version: 1.8.5
185
+ rubygems_version: 2.0.14
204
186
  signing_key:
205
- specification_version: 3
187
+ specification_version: 4
206
188
  summary: Between Meals
207
189
  test_files: []
208
-