puppet-forge-server 1.7.1 → 1.7.3

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: c02d81c3a75aec7225f4d2055b0103ba1bce3b08
4
- data.tar.gz: c6e88d67050e2521ba3122a5dd42e86fcc075a55
3
+ metadata.gz: 5f1449614786bc09ef0b3ea9d05b0b95bc73c61b
4
+ data.tar.gz: cc504debfd84730de1ac4bfb9dc7c97f4d425979
5
5
  SHA512:
6
- metadata.gz: 8d9068b15c85b51e9b7fae6bacf08c410d7faed77879b6179935489cf00e4b6d59ae0bd0afef2fcc01b89660a14b7e7331a00569c2bdf8275e1b64729666df13
7
- data.tar.gz: 45c71d0b4f4501698e640fff45a8c9b8586c13c737005fd86d5ad6bc45c4beee728b090e6a7b7b8fa2da85999bd0f8284e4e2536e11455cb48256d7a076b24b1
6
+ metadata.gz: 990ad7b68a7d9c98879657691f8b641708430a454c3dc423ccb6ca897d98f7d54fffc05c389e0e624e1d5f79567e1e4b3a6645846bcd5ce8e11d3e202e90f1eb
7
+ data.tar.gz: dc67162f5bbca82fd01549bd8ec4233a68ea38edd17b328c80138b80a734e6ec6371c9aea17151619732a8878b0ffc3926f588ab8e032014c3c6f3d52defe5cb
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  #
3
- # Copyright 2014 North Development AB
3
+ # Copyright 2015 North Development AB
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@ module PuppetForgeServer::Backends
27
27
 
28
28
  def initialize(url)
29
29
  @module_dir = url
30
+ @log = PuppetForgeServer::Logger.get
30
31
  end
31
32
 
32
33
  def query_metadata(query, options = {})
@@ -61,6 +62,11 @@ module PuppetForgeServer::Backends
61
62
  return nil
62
63
  end
63
64
 
65
+ def normalize_metadata(metadata)
66
+ metadata['name'] = metadata['name'].gsub('/', '-')
67
+ metadata
68
+ end
69
+
64
70
  def parse_dependencies(metadata)
65
71
  metadata.dependencies = metadata.dependencies.dup.map do |dependency|
66
72
  PuppetForgeServer::Models::Dependency.new({:name => dependency['name'], :version_requirement => dependency['version_requirement']})
@@ -70,13 +76,20 @@ module PuppetForgeServer::Backends
70
76
 
71
77
  def get_file_metadata(file_name, options)
72
78
  options = ({:with_checksum => true}).merge(options)
73
- Dir["#{@module_dir}/**/#{file_name}"].map do |path|
74
- {
75
- :metadata => parse_dependencies(PuppetForgeServer::Models::Metadata.new(read_metadata(path))),
79
+ file_metadata = []
80
+ Dir["#{@module_dir}/**/#{file_name}"].each do |path|
81
+ metadata_raw = read_metadata(path)
82
+ if metadata_raw
83
+ file_metadata << {
84
+ :metadata => parse_dependencies(PuppetForgeServer::Models::Metadata.new(normalize_metadata(metadata_raw))),
76
85
  :checksum => options[:with_checksum] == true ? Digest::MD5.file(path).hexdigest : nil,
77
86
  :path => "/#{Pathname.new(path).relative_path_from(Pathname.new(@module_dir))}"
78
- }
87
+ }
88
+ else
89
+ @log.error "Failed reading metadata from #{path}"
90
+ end
79
91
  end
92
+ file_metadata
80
93
  end
81
94
  end
82
95
  end
@@ -15,5 +15,5 @@
15
15
  # limitations under the License.
16
16
 
17
17
  module PuppetForgeServer
18
- VERSION = '1.7.1'
18
+ VERSION = '1.7.3'
19
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-forge-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilja Bobkevic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-06 00:00:00.000000000 Z
11
+ date: 2015-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra