librarian-puppet 1.1.1 → 1.1.2

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: 8f62f0bf74322ffdea65f43ca9fdd8492dfb7613
4
- data.tar.gz: 8271b8e56dac0b47cdd14c37125bb005940b773a
3
+ metadata.gz: b51ee7e9d024d0df081d224ba54a12e4a06dde25
4
+ data.tar.gz: ef88d4c028b403d861dbb3a7e5ee2d8f53593095
5
5
  SHA512:
6
- metadata.gz: 9d0005cdf61b630ba4ff967c3b194f12a029a366f32538f34785a66a507567dfa2bd04653e83567ac03ff5913f19e0805166151c1781b2b480d06762d4644069
7
- data.tar.gz: ade0f1790f35dbf53c7ad0adf566a5717be051af8f95bb11525d2d988619700502403397c1175e496426fceb1a09ff4f20be73ee91a6d9fa5d643fb7e057ed5d
6
+ metadata.gz: eeecb236adf9ef6285069e01655e0d559fd63cbebe1a8c8464f610982307a5b1b7a48a94e786f5435cf8eedd719a0837cc1ec25f80a59151883558452abc4794
7
+ data.tar.gz: c4df7ac66216eb589a12302718a5f9ac7e3aaf1ec21ebb8baff472a1d5eea8fea91208b823d8e192ef893b4cb6b6efd8084a652eb26a3051b97a0377a0d35279
@@ -55,7 +55,7 @@ module Librarian
55
55
 
56
56
  if uri =~ %r{^http(s)?://forge\.puppetlabs\.com}
57
57
  uri = "https://forgeapi.puppetlabs.com"
58
- debug { "Replacing Puppet Forge API URL to use v3 #{uri}. You should update your Puppetfile" }
58
+ warn { "Replacing Puppet Forge API URL to use v3 #{uri}. You should update your Puppetfile" }
59
59
  end
60
60
 
61
61
  @uri = URI::parse(uri)
@@ -86,8 +86,16 @@ module Librarian
86
86
 
87
87
  target = vendored?(name, version) ? vendored_path(name, version).to_s : name
88
88
 
89
- # TODO can't pass the default v3 forge url (http://forgeapi.puppetlabs.com) to clients that use the v1 API (https://forge.puppetlabs.com)
89
+ # can't pass the default v3 forge url (http://forgeapi.puppetlabs.com)
90
+ # to clients that use the v1 API (https://forge.puppetlabs.com)
91
+ # nor the other way around
90
92
  module_repository = source.to_s
93
+
94
+ if Forge.client_api_version() > 1 and module_repository =~ %r{^http(s)?://forge\.puppetlabs\.com}
95
+ module_repository = "https://forgeapi.puppetlabs.com"
96
+ warn { "Replacing Puppet Forge API URL to use v3 #{module_repository} as required by your client version #{Librarian::Puppet.puppet_version}" }
97
+ end
98
+
91
99
  m = module_repository.match(%r{^http(s)?://forgeapi\.puppetlabs\.com})
92
100
  if Forge.client_api_version() == 1 and m
93
101
  ssl = m[1]
@@ -25,7 +25,7 @@ module Librarian
25
25
  all_versions = data.map { |r| r['name'].gsub(/^v/, '') }.sort.reverse
26
26
 
27
27
  all_versions.delete_if do |version|
28
- version !~ /\A\d\.\d(\.\d.*)?\z/
28
+ version !~ /\A\d+\.\d+(\.\d+.*)?\z/
29
29
  end
30
30
 
31
31
  @versions = all_versions.compact
@@ -71,7 +71,7 @@ module Librarian
71
71
  clean_up_old_cached_versions(name)
72
72
 
73
73
  url = "https://api.github.com/repos/#{name}/tarball/#{version}"
74
- url << "?access_token=#{ENV['GITHUB_API_TOKEN']}" if ENV['GITHUB_API_TOKEN']
74
+ add_api_token_to_url(url)
75
75
 
76
76
  environment.vendor!
77
77
  File.open(vendored_path(name, version).to_s, 'wb') do |f|
@@ -95,6 +95,23 @@ module Librarian
95
95
  end
96
96
  end
97
97
 
98
+ def token_key_value
99
+ ENV[TOKEN_KEY]
100
+ end
101
+
102
+ def token_key_nil?
103
+ token_key_value.nil? || token_key_value.empty?
104
+ end
105
+
106
+ def add_api_token_to_url url
107
+ if token_key_nil?
108
+ debug { "#{TOKEN_KEY} environment value is empty or missing" }
109
+ else
110
+ url << "?access_token=#{ENV[TOKEN_KEY]}"
111
+ end
112
+ url
113
+ end
114
+
98
115
  private
99
116
 
100
117
  def api_call(path)
@@ -102,7 +119,7 @@ module Librarian
102
119
  url = "https://api.github.com#{path}?page=1&per_page=100"
103
120
  while true do
104
121
  debug { " Module #{name} getting tags at: #{url}" }
105
- url << "&access_token=#{ENV[TOKEN_KEY]}" if ENV[TOKEN_KEY]
122
+ add_api_token_to_url(url)
106
123
  response = http_get(url, :headers => {
107
124
  "User-Agent" => "librarian-puppet v#{Librarian::Puppet::VERSION}"
108
125
  })
@@ -1,16 +1,22 @@
1
1
  #!/usr/bin/env ruby
2
2
  #^syntax detection
3
3
 
4
- forge "http://forge.puppetlabs.com"
4
+ forge "https://forgeapi.puppetlabs.com"
5
5
 
6
6
  # use dependencies defined in Modulefile
7
7
  modulefile
8
8
 
9
+ # A module from the Puppet Forge
9
10
  # mod 'puppetlabs/stdlib'
10
11
 
11
- # mod 'ntp',
12
+ # A module from git
13
+ # mod 'puppetlabs/ntp',
12
14
  # :git => 'git://github.com/puppetlabs/puppetlabs-ntp.git'
13
15
 
14
- # mod 'apt',
16
+ # A module from a git branch/tag
17
+ # mod 'puppetlabs/apt',
15
18
  # :git => 'https://github.com/puppetlabs/puppetlabs-apt.git',
16
- # :ref => 'feature/master/dans_refactor'
19
+ # :ref => '1.4.x'
20
+
21
+ # A module from Github pre-packaged tarball
22
+ # mod 'puppetlabs/apache', '0.6.0', :github_tarball => 'puppetlabs/puppetlabs-apache'
@@ -1,5 +1,5 @@
1
1
  module Librarian
2
2
  module Puppet
3
- VERSION = "1.1.1"
3
+ VERSION = "1.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: librarian-puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Sharpe
8
+ - Carlos Sanchez
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-06-12 00:00:00.000000000 Z
12
+ date: 2014-06-25 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: librarian
@@ -156,6 +157,7 @@ description: |-
156
157
  a single command.
157
158
  email:
158
159
  - tim@sharpe.id.au
160
+ - carlos@apache.org
159
161
  executables:
160
162
  - librarian-puppet
161
163
  extensions: []