librarian-puppet 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,31 @@
1
+ module Librarian
2
+ module Puppet
3
+ class Requirement
4
+ attr_reader :requirement
5
+
6
+ def initialize(requirement)
7
+ @requirement = requirement
8
+ end
9
+
10
+ def gem_requirement
11
+ if range_requirement?
12
+ [@range_match[1], @range_match[2]]
13
+ elsif pessimistic_requirement?
14
+ "~> #{@pessimistic_match[1]}"
15
+ else
16
+ requirement
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def range_requirement?
23
+ @range_match ||= requirement.match(/(>=? ?\d+(?:\.\d+){0,2}) (<=? ?\d+(?:\.\d+){0,2})/)
24
+ end
25
+
26
+ def pessimistic_requirement?
27
+ @pessimistic_match ||= requirement.match(/(\d+(?:\.\d+)?)\.x/)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,3 +1,4 @@
1
+ require 'librarian/puppet/requirement'
1
2
  require 'librarian/puppet/source/path'
2
3
  require 'librarian/puppet/source/git'
3
4
  require 'librarian/puppet/source/forge'
@@ -265,6 +265,7 @@ module Librarian
265
265
 
266
266
  def fetch_dependencies(name, version, version_uri)
267
267
  repo(name).dependencies(version).map do |k, v|
268
+ v = Requirement.new(v).gem_requirement
268
269
  Dependency.new(k, v, nil)
269
270
  end
270
271
  end
@@ -100,6 +100,7 @@ module Librarian
100
100
 
101
101
  def fetch_dependencies(name, version, extra)
102
102
  repository.dependencies.map do |k, v|
103
+ v = Requirement.new(v).gem_requirement
103
104
  Dependency.new(k, v, forge_source)
104
105
  end
105
106
  end
@@ -2,6 +2,8 @@ require 'uri'
2
2
  require 'net/https'
3
3
  require 'json'
4
4
 
5
+ require 'librarian/puppet/version'
6
+
5
7
  module Librarian
6
8
  module Puppet
7
9
  module Source
@@ -118,6 +120,10 @@ module Librarian
118
120
  http.use_ssl = true
119
121
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
120
122
  request = Net::HTTP::Get.new(uri.request_uri)
123
+
124
+ request.add_field "User-Agent",
125
+ "librarian-puppet v#{Librarian::Puppet::VERSION}"
126
+
121
127
  resp = http.request(request)
122
128
  if resp.code.to_i != 200
123
129
  nil
@@ -1,5 +1,5 @@
1
1
  module Librarian
2
2
  module Puppet
3
- VERSION = "0.9.8"
3
+ VERSION = "0.9.9"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: librarian-puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.8
4
+ version: 0.9.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-13 00:00:00.000000000 Z
12
+ date: 2013-04-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -109,6 +109,7 @@ files:
109
109
  - lib/librarian/puppet/environment.rb
110
110
  - lib/librarian/puppet/extension.rb
111
111
  - lib/librarian/puppet/lockfile/parser.rb
112
+ - lib/librarian/puppet/requirement.rb
112
113
  - lib/librarian/puppet/source/forge.rb
113
114
  - lib/librarian/puppet/source/git.rb
114
115
  - lib/librarian/puppet/source/githubtarball.rb