octocatalog-diff 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd8f7061eaf89165ab41fe52f67b2a6a16a355e9
4
- data.tar.gz: 82ced3eb61baa30e35c979fbe748f00ed13c015f
3
+ metadata.gz: a5c575bb439d7b065379f5c30bb650d74f3fa09b
4
+ data.tar.gz: ba4dda3fd34774227a3babac32f981bdbb4fb03b
5
5
  SHA512:
6
- metadata.gz: 3d93c41ab87ba8a41dd701d53efa2074eab6f3bfd3b7327db2150db0d0c42eb7179ed336d4300d16956010b73dc1446acea0b9d0bc516b32e2025b6631718e5b
7
- data.tar.gz: c951dc4cdf13de9ff9204e845bcf87f9f07d13a0cb50eb9844c30322846c90685fca4a3a16bc805bab1932bb40f86f33ddd0b31505c1606144e623424b1a7f0d
6
+ metadata.gz: 3c577fe4b8add2eb722b83ac5b5c33efece70619d6ca7da88287d2a1d49ac24a7091615d33fd7fe80f413ecee268ecdc24af016e53df0d7dc3f57bc491174db9
7
+ data.tar.gz: bbb4cdd2d011c87f0ae9f688af9e416bad7009f3391bbb01981a831d16ae83ffe46aadec12cbef579b6076e2c52b77e505c242e5196a381a9258dd679c3a1df2
data/.version CHANGED
@@ -1 +1 @@
1
- 1.0.3
1
+ 1.0.4
data/doc/CHANGELOG.md CHANGED
@@ -8,6 +8,13 @@
8
8
  </tr>
9
9
  </thead><tbody>
10
10
  <tr valign=top>
11
+ <td>1.0.4</td>
12
+ <td>2017-03-17</td>
13
+ <td>
14
+ <li><a href="https://github.com/github/octocatalog-diff/pull/94">#94</a>: Make Puppet version check respect env vars</li>
15
+ </td>
16
+ </tr>
17
+ <tr valign=top>
11
18
  <td>1.0.3</td>
12
19
  <td>2017-03-15</td>
13
20
  <td>
@@ -68,7 +68,7 @@ module OctocatalogDiff
68
68
  # @return [String] Puppet version
69
69
  def puppet_version
70
70
  raise ArgumentError, '"puppet_binary" was not passed to OctocatalogDiff::Catalog::Computed' unless @puppet_binary
71
- @puppet_version ||= OctocatalogDiff::Util::PuppetVersion.puppet_version(@puppet_binary)
71
+ @puppet_version ||= OctocatalogDiff::Util::PuppetVersion.puppet_version(@puppet_binary, @opts)
72
72
  end
73
73
 
74
74
  # Compilation directory
@@ -12,8 +12,9 @@ module OctocatalogDiff
12
12
  class PuppetVersion
13
13
  # Determine the version of Puppet.
14
14
  # @param puppet [String] Path to Puppet binary
15
+ # @param options [Hash] Options hash as defined in OctocatalogDiff::Catalog::Computed
15
16
  # @return [String] Puppet version number
16
- def self.puppet_version(puppet)
17
+ def self.puppet_version(puppet, options = {})
17
18
  raise ArgumentError, 'Puppet binary was not supplied' if puppet.nil?
18
19
  raise Errno::ENOENT, "Puppet binary #{puppet} doesn't exist" unless File.file?(puppet)
19
20
  cmdline = [Shellwords.escape(puppet), '--version'].join(' ')
@@ -24,6 +25,8 @@ module OctocatalogDiff
24
25
  'PATH' => ENV['PATH'],
25
26
  'PWD' => File.dirname(puppet)
26
27
  }
28
+ pass_env_vars = options.fetch(:pass_env_vars, [])
29
+ pass_env_vars.each { |var| env[var] ||= ENV[var] }
27
30
  out, err, _status = Open3.capture3(env, cmdline, unsetenv_others: true, chdir: env['PWD'])
28
31
  return Regexp.last_match(1) if out =~ /^([\d\.]+)\s*$/
29
32
  raise "Unable to determine Puppet version: #{out} #{err}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octocatalog-diff
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub, Inc.
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-03-15 00:00:00.000000000 Z
12
+ date: 2017-03-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: diffy