librarian-puppet-maestrodev 0.9.11.5 → 0.9.11.6

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDM5ZTU0ZTljMjZmY2M3MjljOTZjOTY5YzUzNDVhOWQ4ZGJhMDFkYw==
4
+ MzczNTBlYThiYjhiOGFhNDYwM2ZiNWVlYjJlN2U2ZTJhNDY5MGNiNg==
5
5
  data.tar.gz: !binary |-
6
- Zjk3ZWQxNjhlMzg4MWFiYTlmYjMxOGQ1ZjYxMjg1YmU3ZmQ3ZDE5NA==
7
- SHA512:
6
+ OGU1NWI4OThmNmJjMjFjNDgwOGU2YzcxYWZkMmViOTFlNmViZjAyMQ==
7
+ !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YmI4NDRmM2U2NWJhOTM5NzM4OTYzYmM4N2UxY2YwYTg4MWVhMmJlMWRlMzJi
10
- NzhhODdkZWZiYTIxMjY5OGYwMDM1ZTI3ZjA5Nzc4NThmN2EwOGY1MzFlZjQ3
11
- N2U1YmM1NzAxNDJkZjkzNzkwNzgyMjYyZWU1YzkwNDMyMWJmYTE=
9
+ Y2YyZDc4ZjBjYWFmZmY2MjBjMTE1ZmQ1NjBiYzZmN2FhNjMxMjY3ZWIyYzEx
10
+ ODNkOGE1M2EwODE2M2U1MmVmZTZjMmU3YzNlODU1N2UyOGVmNzUyN2JkMTgz
11
+ YWZhOGRkZTlhMjMyMzdjYjVkNWZlYTlhYTFiNDNkYTBhZDUyMzg=
12
12
  data.tar.gz: !binary |-
13
- YTU1NmQ1NTMyYWE5M2U4YTJkODkxMmMzZDNmZWQ5ZjZlYmFkNjg3MGFmZWNl
14
- NGNmYzlmY2JiNGQ5Y2VkOGNjZmFlMzYzZjdkYjY4YjEyZTY4MGUzMDNkOGQ0
15
- Y2NkOTJjZTIxMDY2YTQ5ZWEzYTFkNzZkZDg0YTMyNjJjYTZiMDc=
13
+ MGE1NjVlYjI3MDcxNTQyM2JhODczZDc3ODAzMzg0ZjA5ZjkxYWZlNjNmMTE0
14
+ ZTA4MWNjZDRiODhhN2ZhOWI1OTk0NTBhNWNhNTQ1ODI1ODg3YTI1MzE1Yzgy
15
+ YzNhYTllNzk0MTM3NWIwMDM4OTFjZWFkM2UxNDcyYzZiODgwOTQ=
data/README.md CHANGED
@@ -4,8 +4,9 @@
4
4
 
5
5
  ## Note
6
6
 
7
- This is a fork of [rodjek librarian-puppet](https://github.com/rodjek/librarian-puppet) to publish to rubygems
8
- [librarian-puppet-maestrodev](https://rubygems.org/gems/librarian-puppet-maestrodev)
7
+ **Since 0.9.11.6 this fork is no longer used, as I am committing directly to [rodjek's librarian-puppet](https://github.com/rodjek/librarian-puppet) and pushing to [librarian-puppet](https://rubygems.org/gems/librarian-puppet)**
8
+
9
+ **librarian-puppet-maestrodev 0.9.11.6 is effectively the same as librarian-puppet 0.9.11**
9
10
 
10
11
  ## Introduction
11
12
 
@@ -7,6 +7,11 @@ module Librarian
7
7
  module Puppet
8
8
  class Cli < Librarian::Cli
9
9
 
10
+ def initialize(*)
11
+ super
12
+ say "librarian-puppet-maestrodev gem is now deprecated in favor of librarian-puppet 0.9.11 and is no longer updated"
13
+ end
14
+
10
15
  module Particularity
11
16
  def root_module
12
17
  Puppet
@@ -67,6 +72,7 @@ module Librarian
67
72
  environment.config_db.local['mode'] = options['local'] ? 'local' : nil
68
73
 
69
74
  resolve!
75
+ debug { "Install: dependencies resolved"}
70
76
  install!
71
77
  end
72
78
 
@@ -1,3 +1,4 @@
1
+ require 'librarian/puppet/util'
1
2
  require 'librarian/puppet/requirement'
2
3
  require 'librarian/puppet/source/path'
3
4
  require 'librarian/puppet/source/git'
@@ -5,7 +5,10 @@ module Librarian
5
5
  module Puppet
6
6
  module Source
7
7
  class Forge
8
+ include Librarian::Puppet::Util
9
+
8
10
  class Repo
11
+ include Librarian::Puppet::Util
9
12
 
10
13
  attr_accessor :source, :name
11
14
  private :source=, :name=
@@ -13,12 +16,17 @@ module Librarian
13
16
  def initialize(source, name)
14
17
  self.source = source
15
18
  self.name = name
19
+ # API returned data for this module including all versions and dependencies, indexed by module name
20
+ # from http://forge.puppetlabs.com/api/v1/releases.json?module=#{name}
16
21
  @api_data = nil
22
+ # API returned data for this module and a specific version, indexed by version
23
+ # from http://forge.puppetlabs.com/api/v1/releases.json?module=#{name}&version=#{version}
24
+ @api_version_data = {}
17
25
  end
18
26
 
19
27
  def versions
20
28
  return @versions if @versions
21
- @versions = api_data[name].map { |r| r['version'] }.reverse
29
+ @versions = api_data(name).map { |r| r['version'] }.reverse
22
30
  if @versions.empty?
23
31
  info { "No versions found for module #{name}" }
24
32
  else
@@ -28,7 +36,7 @@ module Librarian
28
36
  end
29
37
 
30
38
  def dependencies(version)
31
- api_data[name].detect{|x| x['version'] == version.to_s}['dependencies']
39
+ api_version_data(name, version)['dependencies']
32
40
  end
33
41
 
34
42
  def manifests
@@ -57,7 +65,7 @@ module Librarian
57
65
  unless unpacked_path.exist?
58
66
  raise Error, "#{unpacked_path} does not exist, something went wrong. Try removing it manually"
59
67
  else
60
- FileUtils.cp_r(unpacked_path, install_path)
68
+ cp_r(unpacked_path, install_path)
61
69
  end
62
70
 
63
71
  end
@@ -127,41 +135,48 @@ module Librarian
127
135
  end
128
136
 
129
137
  def vendor_cache(name, version)
130
- info = api_data[name].detect {|h| h['version'] == version.to_s }
131
- File.open(vendored_path(name, version).to_s, 'w') do |f|
132
- open("#{source}#{info['file']}") do |input|
133
- while (buffer = input.read)
134
- f.write(buffer)
135
- end
138
+ info = api_version_data(name, version)
139
+ url = "#{source}#{info[name].first['file']}"
140
+ path = vendored_path(name, version).to_s
141
+ debug { "Downloading #{url} into #{path}"}
142
+ File.open(path, 'wb') do |f|
143
+ open(url, "rb") do |input|
144
+ f.write(input.read)
136
145
  end
137
146
  end
138
147
  end
139
148
 
140
- def debug(*args, &block)
141
- environment.logger.debug(*args, &block)
142
- end
143
- def info(*args, &block)
144
- environment.logger.info(*args, &block)
145
- end
146
-
147
149
  private
148
- def api_data
149
- return @api_data if @api_data
150
+
151
+ # get and cache the API data for a specific module with all its versions and dependencies
152
+ def api_data(module_name)
153
+ return @api_data[module_name] if @api_data
150
154
  # call API and cache data
151
- @api_data = api_call(name)
155
+ @api_data = api_call(module_name)
152
156
  if @api_data.nil?
153
157
  raise Error, "Unable to find module '#{name}' on #{source}"
154
158
  end
155
- @api_data
159
+ @api_data[module_name]
160
+ end
161
+
162
+ # get and cache the API data for a specific module and version
163
+ def api_version_data(module_name, version)
164
+ # if we already got all the versions, find in cached data
165
+ return @api_data[module_name].detect{|x| x['version'] == version.to_s} if @api_data
166
+ # otherwise call the api for this version if not cached already
167
+ @api_version_data[version] = api_call(name, version) if @api_version_data[version].nil?
168
+ @api_version_data[version]
156
169
  end
157
170
 
158
- def api_call(module_name)
159
- debug { "Querying Forge API for module #{name}" }
171
+ def api_call(module_name, version=nil)
160
172
  base_url = source.uri
161
- path = "api/v1/releases.json?module=#{module_name}"
173
+ path = "api/v1/releases.json?module=#{module_name}"
174
+ path = "#{path}&version=#{version}" unless version.nil?
175
+ url = "#{base_url}/#{path}"
176
+ debug { "Querying Forge API for module #{name}#{" and version #{version}" unless version.nil?}: #{url}" }
162
177
 
163
178
  begin
164
- data = open("#{base_url}/#{path}") {|f| f.read}
179
+ data = open(url) {|f| f.read}
165
180
  JSON.parse(data)
166
181
  rescue OpenURI::HTTPError => e
167
182
  case e.io.status[0].to_i
@@ -23,6 +23,7 @@ module Librarian
23
23
  module Source
24
24
  class Git < Librarian::Source::Git
25
25
  include Local
26
+ include Librarian::Puppet::Util
26
27
 
27
28
  def cache!
28
29
  return vendor_checkout! if vendor_cached?
@@ -9,7 +9,11 @@ module Librarian
9
9
  module Puppet
10
10
  module Source
11
11
  class GitHubTarball
12
+ include Librarian::Puppet::Util
13
+
12
14
  class Repo
15
+ include Librarian::Puppet::Util
16
+
13
17
  TOKEN_KEY = 'GITHUB_API_TOKEN'
14
18
 
15
19
  attr_accessor :source, :name
@@ -55,7 +59,7 @@ module Librarian
55
59
  end
56
60
 
57
61
  unpacked_path = version_unpacked_cache_path(version).children.first
58
- FileUtils.cp_r(unpacked_path, install_path)
62
+ cp_r(unpacked_path, install_path)
59
63
  end
60
64
 
61
65
  def environment
@@ -121,10 +125,6 @@ module Librarian
121
125
  end
122
126
  end
123
127
 
124
- def debug(*args, &block)
125
- environment.logger.debug(*args, &block)
126
- end
127
-
128
128
  private
129
129
 
130
130
  def api_call(path)
@@ -2,6 +2,7 @@ module Librarian
2
2
  module Puppet
3
3
  module Source
4
4
  module Local
5
+ include Librarian::Puppet::Util
5
6
 
6
7
  def install!(manifest)
7
8
  manifest.source == self or raise ArgumentError
@@ -41,7 +42,7 @@ module Librarian
41
42
 
42
43
  def install_perform_step_copy!(found_path, install_path)
43
44
  debug { "Copying #{relative_path_to(found_path)} to #{relative_path_to(install_path)}" }
44
- FileUtils.cp_r(found_path, install_path, :preserve => true)
45
+ cp_r(found_path, install_path)
45
46
  end
46
47
 
47
48
  def manifest?(name, path)
@@ -0,0 +1,27 @@
1
+ module Librarian
2
+ module Puppet
3
+
4
+ module Util
5
+
6
+ def debug(*args, &block)
7
+ environment.logger.debug(*args, &block)
8
+ end
9
+ def info(*args, &block)
10
+ environment.logger.info(*args, &block)
11
+ end
12
+
13
+ # workaround Issue #173 FileUtils.cp_r will fail if there is a symlink that points to a missing file
14
+ # or when the symlink is copied before the target file when preserve is true
15
+ # see also https://tickets.opscode.com/browse/CHEF-833
16
+ def cp_r(src, dest)
17
+ begin
18
+ FileUtils.cp_r(src, dest, :preserve => true)
19
+ rescue Errno::ENOENT
20
+ debug { "Failed to copy from #{src} to #{dest} preserving file types, trying again without preserving them" }
21
+ FileUtils.rm_rf(dest)
22
+ FileUtils.cp_r(src, dest)
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -1,5 +1,5 @@
1
1
  module Librarian
2
2
  module Puppet
3
- VERSION = "0.9.11.5"
3
+ VERSION = "0.9.11.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: librarian-puppet-maestrodev
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.11.5
4
+ version: 0.9.11.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Sharpe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-27 00:00:00.000000000 Z
11
+ date: 2014-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: librarian
@@ -122,10 +122,10 @@ dependencies:
122
122
  - - ! '>='
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
- description: ! "Simplify deployment of your Puppet infrastructure by\n automatically
126
- pulling in modules from the forge and git repositories with\n a single command."
125
+ description: librarian-puppet-maestrodev gem is now deprecated in favor of librarian-puppet
126
+ 0.9.11 and is no longer updated
127
127
  email:
128
- - tim@sharpe.id.au
128
+ - support@maestrodev.com
129
129
  executables:
130
130
  - librarian-puppet
131
131
  extensions: []
@@ -136,21 +136,22 @@ files:
136
136
  - README.md
137
137
  - bin/librarian-puppet
138
138
  - lib/librarian/puppet.rb
139
- - lib/librarian/puppet/cli.rb
140
139
  - lib/librarian/puppet/dsl.rb
141
- - lib/librarian/puppet/environment.rb
142
- - lib/librarian/puppet/extension.rb
140
+ - lib/librarian/puppet/source.rb
143
141
  - lib/librarian/puppet/lockfile/parser.rb
142
+ - lib/librarian/puppet/cli.rb
143
+ - lib/librarian/puppet/environment.rb
144
144
  - lib/librarian/puppet/requirement.rb
145
- - lib/librarian/puppet/source.rb
145
+ - lib/librarian/puppet/version.rb
146
+ - lib/librarian/puppet/templates/Puppetfile
147
+ - lib/librarian/puppet/extension.rb
148
+ - lib/librarian/puppet/util.rb
146
149
  - lib/librarian/puppet/source/forge.rb
147
- - lib/librarian/puppet/source/git.rb
148
150
  - lib/librarian/puppet/source/githubtarball.rb
149
- - lib/librarian/puppet/source/local.rb
151
+ - lib/librarian/puppet/source/git.rb
150
152
  - lib/librarian/puppet/source/path.rb
151
- - lib/librarian/puppet/templates/Puppetfile
152
- - lib/librarian/puppet/version.rb
153
- homepage: https://github.com/rodjek/librarian-puppet
153
+ - lib/librarian/puppet/source/local.rb
154
+ homepage: https://github.com/maestrodev/librarian-puppet
154
155
  licenses:
155
156
  - MIT
156
157
  metadata: {}
@@ -170,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
171
  version: '0'
171
172
  requirements: []
172
173
  rubyforge_project:
173
- rubygems_version: 2.2.1
174
+ rubygems_version: 2.0.0
174
175
  signing_key:
175
176
  specification_version: 4
176
177
  summary: Bundler for your Puppet modules