puppet-forge-server 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/puppet_forge_server/app/version3.rb +3 -1
- data/lib/puppet_forge_server/backends/proxy_v1.rb +10 -2
- data/lib/puppet_forge_server/backends/proxy_v3.rb +12 -4
- data/lib/puppet_forge_server/models/builder.rb +1 -1
- data/lib/puppet_forge_server/models/metadata.rb +1 -0
- data/lib/puppet_forge_server/patches.rb +1 -1
- data/lib/puppet_forge_server/utils/option_parser.rb +4 -7
- data/lib/puppet_forge_server/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7534f17808255a66c9f45677758540784f88dd49
|
4
|
+
data.tar.gz: 45e2900ea2f35918116c89b813dfa7465a713f41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4edc8df5081d8244aac83af9a3064a8787ce1d57b023a8b5f90125e440407e3650f2010fa560caabcb46dacce974abb56dde156ae348b792d959cb1b6a7dce1e
|
7
|
+
data.tar.gz: 995943485154d7772395495fcb91b162629491e4ba0e7f98a429847f9fe2ae5eaeef8d68170e6318dc23074eaee805f0d1c94be6faca8457a4f5032671e49087
|
data/README.md
CHANGED
@@ -36,7 +36,9 @@ module PuppetForgeServer::App
|
|
36
36
|
end.flatten.uniq
|
37
37
|
|
38
38
|
halt 404, {'pagination' => {'next' => false}, 'results' => []}.to_json if metadata.empty?
|
39
|
-
|
39
|
+
|
40
|
+
releases = get_releases(metadata)
|
41
|
+
{'pagination' => {'next' => false, 'total' => releases.count}, 'results' => releases}.to_json
|
40
42
|
end
|
41
43
|
|
42
44
|
get '/v3/files/*' do
|
@@ -31,12 +31,20 @@ module PuppetForgeServer::Backends
|
|
31
31
|
def get_metadata(author, name, options = {})
|
32
32
|
options = ({:with_checksum => true}).merge(options)
|
33
33
|
query ="#{author}/#{name}"
|
34
|
-
|
34
|
+
begin
|
35
|
+
get_module_metadata(JSON.parse(get("/modules.json?q=#{query}")).select { |e| e['full_name'].match("#{query}") }, options)
|
36
|
+
rescue OpenURI::HTTPError
|
37
|
+
#ignore
|
38
|
+
end
|
35
39
|
end
|
36
40
|
|
37
41
|
def query_metadata(query, options = {})
|
38
42
|
options = ({:with_checksum => true}).merge(options)
|
39
|
-
|
43
|
+
begin
|
44
|
+
get_module_metadata(JSON.parse(get("/modules.json?q=#{query}")).select { |e| e['full_name'].match("*#{query}*") }, options)
|
45
|
+
rescue OpenURI::HTTPError
|
46
|
+
#ignore
|
47
|
+
end
|
40
48
|
end
|
41
49
|
|
42
50
|
private
|
@@ -29,13 +29,21 @@ module PuppetForgeServer::Backends
|
|
29
29
|
def get_metadata(author, name, options = {})
|
30
30
|
options = ({:with_checksum => true}).merge(options)
|
31
31
|
query ="#{author}-#{name}"
|
32
|
-
|
33
|
-
|
32
|
+
begin
|
33
|
+
releases = options[:version] ? [JSON.parse(get("/v3/releases/#{query}-#{options[:version]}"))] : get_all_release_pages("/v3/releases?module=#{query}")
|
34
|
+
get_release_metadata(releases)
|
35
|
+
rescue OpenURI::HTTPError
|
36
|
+
#ignore
|
37
|
+
end
|
34
38
|
end
|
35
39
|
|
36
40
|
def query_metadata(query, options = {})
|
37
41
|
author, name = query.split('-')
|
38
|
-
|
42
|
+
begin
|
43
|
+
get_metadata(author, name, options) if author && name
|
44
|
+
rescue OpenURI::HTTPError
|
45
|
+
#ignore
|
46
|
+
end
|
39
47
|
end
|
40
48
|
|
41
49
|
private
|
@@ -55,7 +63,7 @@ module PuppetForgeServer::Backends
|
|
55
63
|
:metadata => PuppetForgeServer::Models::Metadata.new(element['metadata']),
|
56
64
|
:checksum => element['file_md5'],
|
57
65
|
:path => element['file_uri'],
|
58
|
-
:tags => element['tags']
|
66
|
+
:tags => (element['tags'] + (element['metadata']['tags'] ? element['metadata']['tags'] : [])).flatten.uniq
|
59
67
|
}
|
60
68
|
end.compact
|
61
69
|
end
|
@@ -23,7 +23,7 @@ module PuppetForgeServer::Models
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def method_missing (method_name, *args, &block)
|
26
|
-
STDERR.puts "Method #{method_name} with args #{args} not found in #{self.class.to_s}" unless method_name == :to_ary
|
26
|
+
STDERR.puts "ERROR: Method #{method_name} with args #{args} not found in #{self.class.to_s}" unless method_name == :to_ary
|
27
27
|
end
|
28
28
|
|
29
29
|
def to_hash
|
@@ -20,6 +20,7 @@ module PuppetForgeServer::Models
|
|
20
20
|
|
21
21
|
attr_accessor :author, :name, :version, :dependencies, :summary, :description, :project_page, :types
|
22
22
|
attr_accessor :checksums, :source, :license, :issues_url, :operatingsystem_support, :requirements
|
23
|
+
attr_accessor :puppet_version, :tags
|
23
24
|
|
24
25
|
def initialize(attributes)
|
25
26
|
super(attributes)
|
@@ -33,15 +33,15 @@ module PuppetForgeServer::Utils
|
|
33
33
|
opts.banner = "Usage: #{File.basename $0} [options]"
|
34
34
|
opts.version = PuppetForgeServer::VERSION
|
35
35
|
|
36
|
-
opts.on('-p',
|
36
|
+
opts.on('-p', "--port PORT', 'Port to listen on (default: #{@@DEFAULT_PORT})") do |port|
|
37
37
|
options[:port] = port
|
38
38
|
end
|
39
39
|
|
40
|
-
opts.on('-b', '--bind-host HOSTNAME', 'Host name to bind to (
|
40
|
+
opts.on('-b', '--bind-host HOSTNAME', 'Host name to bind to (default: whatever Rack wants to use)') do |hostname|
|
41
41
|
options[:hostname] = hostname
|
42
42
|
end
|
43
43
|
|
44
|
-
opts.on('--daemonize',
|
44
|
+
opts.on('-D', '--daemonize', "Run the server in the background (default: #{@@DEFAULT_DAEMONIZE})") do
|
45
45
|
options[:daemonize] = true
|
46
46
|
options[:pidfile] = @@DEFAULT_PID_FILE unless options[:pidfile]
|
47
47
|
end
|
@@ -57,11 +57,8 @@ module PuppetForgeServer::Utils
|
|
57
57
|
opts.on('-x', '--proxy URL', 'Remote forge to proxy (can be specified multiple times)') do |url|
|
58
58
|
options[:backend]['Proxy'] << normalize_url(url)
|
59
59
|
end
|
60
|
-
opts.on('--source-dir DIR', "Directory containing a module's source (can be specified multiple times)") do |module_dir|
|
61
|
-
options[:backend]['Source'] << module_dir
|
62
|
-
end
|
63
60
|
|
64
|
-
opts.on('--cache-basedir DIR', "Cache all proxies' downloaded modules under this directory") do |cache_basedir|
|
61
|
+
opts.on('--cache-basedir DIR', "Cache all proxies' downloaded modules under this directory (default: #{@@DEFAULT_CACHE_DIR})") do |cache_basedir|
|
65
62
|
options[:cache_basedir] = cache_basedir
|
66
63
|
end
|
67
64
|
end
|