between_meals 0.0.11 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e58d518baa0534eecc6de15ac0fb0f7f09a6069f6fb870a60c55adf2cf2f8404
4
- data.tar.gz: 44aaa21c488bea122a228466f0c30f5d0c9eab3ff778b3f60242cccaf2020ee6
3
+ metadata.gz: 21f7e5e4186f163af47afb9a74c9f877d12949c3a637232747eb1fbfd1e9b845
4
+ data.tar.gz: 3e5e53f85e47ae60291c05c83e244e4d3414e4984443b9471ef4711aad36e937
5
5
  SHA512:
6
- metadata.gz: 7a44420814d8e34888bea5be482a7d8b43d30979c0c8369cb11e0b13ff4cddc36e0a3da29a955d70917ba9b878fa75213640b718658c0f4b6fabbd199e002f8a
7
- data.tar.gz: 12dece7d9a249c883bef1eb0c6460977998fbc7b7e6ba90ecaf5bb7912d374df72b919bd78b1aece7548e1063664e04b6d80007ad5c68baaf2a587060cc6a0aa
6
+ metadata.gz: 0ae9b2b8ad9a02e11dbbbce04bd8fb9e240f2c9af5ae4aa6bd709cc8a18e5453705d3bb41729ac4dd699c016aebbd658b62f0021779af47202c54882554d3d25
7
+ data.tar.gz: 138c9464b07cd6f797ac41fcb91bd360db357db3ca26a2ccca12b21f0d8afbabd99919e41129ae40a2f2b75e4ac1749822eeb291d126eb44172c42d39b109663
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # Between Meals
2
2
 
3
- [![TravisCI](https://travis-ci.org/facebook/between-meals.svg)](http://travis-ci.org/facebook/between-meals)
4
- [![CircleCI](https://circleci.com/gh/facebook/between-meals.svg?style=svg)](https://circleci.com/gh/facebook/between-meals)
3
+ ![Continuous Integration](https://github.com/facebook/between-meals/workflows/Continuous%20Integration/badge.svg?event=push)
5
4
 
6
5
  ## Intro
7
6
  Ohai!
@@ -19,7 +18,6 @@ functions.
19
18
  ## Dependencies
20
19
 
21
20
  * Colorize
22
- * JSON
23
21
  * Mixlib::ShellOut
24
22
  * Rugged
25
23
 
@@ -26,7 +26,7 @@ module BetweenMeals
26
26
  @logger = params[:logger] || Logger.new(STDOUT)
27
27
  end
28
28
 
29
- def cmd(params, cwd = nil)
29
+ def cmd(params, cwd = nil, nofail = false)
30
30
  cwd ||= File.expand_path(@cwd)
31
31
  cmd = "#{@bin} #{params}"
32
32
  @logger.info("Running \"#{cmd}\"")
@@ -40,7 +40,8 @@ module BetweenMeals
40
40
  },
41
41
  )
42
42
  c.run_command
43
- if c.error?
43
+ # If the user asked us not to fail, let them handle error reporting
44
+ if c.error? && !nofail
44
45
  # Let's make sure the error goes to the logs
45
46
  @logger.error("#{@bin} failed: #{c.format_for_exception}")
46
47
  # if our logger is STDOUT, we'll double log when we throw
@@ -61,7 +61,7 @@ module BetweenMeals
61
61
  end
62
62
 
63
63
  def role_upload_all
64
- if File.exists?(@role_dir)
64
+ if File.exist?(@role_dir)
65
65
  roles = File.join(@role_dir, "*.#{@role_type}")
66
66
  exec!("#{@knife} role from file #{roles} #{@knife_verb_option} " +
67
67
  "-c #{@config}", @logger)
@@ -123,7 +123,7 @@ module BetweenMeals
123
123
  if cookbooks.any?
124
124
  @cookbook_dirs.each do |path|
125
125
  cookbooks.each do |cb|
126
- next unless File.exists?("#{path}/#{cb}")
126
+ next unless File.exist?("#{path}/#{cb}")
127
127
 
128
128
  @logger.warn("Running berkshelf on cookbook: #{cb}")
129
129
  exec!("cd #{path}/#{cb} && #{@berks} install #{berks_config} && " +
@@ -205,7 +205,7 @@ BLOCK
205
205
  # not an error if it's already there.
206
206
  nil
207
207
  end
208
- if !File.exists?(@config) ||
208
+ if !File.exist?(@config) ||
209
209
  ::Digest::MD5.hexdigest(cfg) !=
210
210
  ::Digest::MD5.hexdigest(File.read(@config))
211
211
  @logger.info("Generating #{@config}")
@@ -251,7 +251,7 @@ IAMAEpsWX2s2A6phgMCx7kH6wMmoZn3hb7Thh9+PfR8Jtp2/7k+ibCeF4gEWUCs5
251
251
  nil
252
252
  end
253
253
 
254
- unless File.exists?(@pem)
254
+ unless File.exist?(@pem)
255
255
  @logger.info("Generating #{@pem}")
256
256
  File.write(@pem, pem)
257
257
  end
@@ -87,6 +87,12 @@ module BetweenMeals
87
87
  fail "#{__method__} not implemented"
88
88
  end
89
89
 
90
+ # Only interesting in the case of git where we have an underlying
91
+ # repo object courtesy of Rugged.
92
+ def repo_object
93
+ fail "#{__method__} not implemented"
94
+ end
95
+
90
96
  # This method *must* succeed in the case of no repo directory so that
91
97
  # users can call `checkout`. Users may call `exists?` to find out if
92
98
  # we have an underlying repo yet.
@@ -26,7 +26,7 @@ module BetweenMeals
26
26
  class Repo
27
27
  class Git < BetweenMeals::Repo
28
28
  def setup
29
- if File.exists?(File.expand_path(@repo_path))
29
+ if File.exist?(File.expand_path(@repo_path))
30
30
  begin
31
31
  @repo = Rugged::Repository.new(File.expand_path(@repo_path))
32
32
  rescue StandardError
@@ -43,6 +43,12 @@ module BetweenMeals
43
43
  )
44
44
  end
45
45
 
46
+ # Allow people to get access to the underlying Rugged
47
+ # object for their hooks
48
+ def repo_object
49
+ @repo
50
+ end
51
+
46
52
  def exists?
47
53
  !@repo.nil?
48
54
  end
@@ -108,7 +114,7 @@ module BetweenMeals
108
114
  @repo.index.map { |x| { :path => x[:path], :status => :created } }
109
115
  end
110
116
 
111
- def upstream?(rev, master = 'remotes/trunk')
117
+ def upstream?(rev, master = 'upstream/master')
112
118
  if @cmd.merge_base(rev, master).stdout.strip == rev
113
119
  return true
114
120
  end
@@ -21,7 +21,11 @@ module BetweenMeals
21
21
  class Git < BetweenMeals::Repo
22
22
  class Cmd < BetweenMeals::Cmd
23
23
  def config(key)
24
- cmd("config #{key}")
24
+ s = cmd("config #{key}", nil, true)
25
+ unless [0, 1].include?(s.exitstatus)
26
+ s.error!
27
+ end
28
+ s
25
29
  end
26
30
 
27
31
  def clone(url, repo_path)
@@ -32,7 +32,7 @@ module BetweenMeals
32
32
  end
33
33
 
34
34
  def exists?
35
- Dir.exists?(Pathname.new(@repo_path).join('.hg'))
35
+ Dir.exist?(Pathname.new(@repo_path).join('.hg'))
36
36
  end
37
37
 
38
38
  def head_rev
@@ -33,7 +33,7 @@ module BetweenMeals
33
33
  end
34
34
 
35
35
  def exists?
36
- Dir.exists?(Pathname.new(@repo_path).join('.svn'))
36
+ Dir.exist?(Pathname.new(@repo_path).join('.svn'))
37
37
  end
38
38
 
39
39
  def head_rev
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: between_meals
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phil Dibowitz
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-05-28 00:00:00.000000000 Z
12
+ date: 2020-09-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colorize
@@ -53,77 +53,7 @@ dependencies:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
- - !ruby/object:Gem::Dependency
57
- name: rspec-core
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: '0'
63
- type: :development
64
- prerelease: false
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-expectations
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :development
78
- prerelease: false
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-mocks
86
- requirement: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- version: '0'
91
- type: :development
92
- prerelease: false
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: simplecov
100
- requirement: !ruby/object:Gem::Requirement
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- version: '0'
105
- type: :development
106
- prerelease: false
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.49.1
119
- type: :development
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- requirements:
123
- - - '='
124
- - !ruby/object:Gem::Version
125
- version: 0.49.1
126
- description: Library for calculation Chef differences between revisions
56
+ description: Library for calculating Chef differences between revisions
127
57
  email:
128
58
  executables: []
129
59
  extensions: []
@@ -167,8 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
97
  - !ruby/object:Gem::Version
168
98
  version: '0'
169
99
  requirements: []
170
- rubyforge_project:
171
- rubygems_version: 2.7.6.2
100
+ rubygems_version: 3.1.2
172
101
  signing_key:
173
102
  specification_version: 4
174
103
  summary: Between Meals