librarian-puppet 0.9.10 → 0.9.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +82 -19
  3. data/bin/librarian-puppet +0 -2
  4. data/lib/librarian/puppet.rb +32 -4
  5. data/lib/librarian/puppet/cli.rb +7 -0
  6. data/lib/librarian/puppet/dsl.rb +13 -0
  7. data/lib/librarian/puppet/environment.rb +5 -8
  8. data/lib/librarian/puppet/extension.rb +212 -0
  9. data/lib/librarian/puppet/requirement.rb +6 -2
  10. data/lib/librarian/puppet/source.rb +1 -0
  11. data/lib/librarian/puppet/source/forge.rb +62 -35
  12. data/lib/librarian/puppet/source/git.rb +51 -36
  13. data/lib/librarian/puppet/source/githubtarball.rb +44 -28
  14. data/lib/librarian/puppet/source/local.rb +4 -1
  15. data/lib/librarian/puppet/templates/Puppetfile +3 -0
  16. data/lib/librarian/puppet/util.rb +27 -0
  17. data/lib/librarian/puppet/version.rb +1 -1
  18. metadata +106 -207
  19. data/vendor/librarian/CHANGELOG.md +0 -185
  20. data/vendor/librarian/Gemfile +0 -6
  21. data/vendor/librarian/MIT-LICENSE +0 -20
  22. data/vendor/librarian/README.md +0 -403
  23. data/vendor/librarian/Rakefile +0 -34
  24. data/vendor/librarian/bin/librarian-chef +0 -7
  25. data/vendor/librarian/bin/librarian-mock +0 -7
  26. data/vendor/librarian/config/cucumber.yaml +0 -1
  27. data/vendor/librarian/features/chef/cli/init.feature +0 -11
  28. data/vendor/librarian/features/chef/cli/install.feature +0 -64
  29. data/vendor/librarian/features/chef/cli/show.feature +0 -77
  30. data/vendor/librarian/features/chef/cli/version.feature +0 -11
  31. data/vendor/librarian/features/support/env.rb +0 -9
  32. data/vendor/librarian/lib/librarian.rb +0 -19
  33. data/vendor/librarian/lib/librarian/action.rb +0 -5
  34. data/vendor/librarian/lib/librarian/action/base.rb +0 -24
  35. data/vendor/librarian/lib/librarian/action/clean.rb +0 -44
  36. data/vendor/librarian/lib/librarian/action/ensure.rb +0 -24
  37. data/vendor/librarian/lib/librarian/action/install.rb +0 -99
  38. data/vendor/librarian/lib/librarian/action/resolve.rb +0 -81
  39. data/vendor/librarian/lib/librarian/action/update.rb +0 -78
  40. data/vendor/librarian/lib/librarian/chef.rb +0 -1
  41. data/vendor/librarian/lib/librarian/chef/cli.rb +0 -48
  42. data/vendor/librarian/lib/librarian/chef/dsl.rb +0 -15
  43. data/vendor/librarian/lib/librarian/chef/environment.rb +0 -27
  44. data/vendor/librarian/lib/librarian/chef/extension.rb +0 -9
  45. data/vendor/librarian/lib/librarian/chef/integration/knife.rb +0 -42
  46. data/vendor/librarian/lib/librarian/chef/manifest_reader.rb +0 -59
  47. data/vendor/librarian/lib/librarian/chef/source.rb +0 -3
  48. data/vendor/librarian/lib/librarian/chef/source/git.rb +0 -25
  49. data/vendor/librarian/lib/librarian/chef/source/local.rb +0 -69
  50. data/vendor/librarian/lib/librarian/chef/source/path.rb +0 -12
  51. data/vendor/librarian/lib/librarian/chef/source/site.rb +0 -452
  52. data/vendor/librarian/lib/librarian/chef/templates/Cheffile +0 -15
  53. data/vendor/librarian/lib/librarian/cli.rb +0 -205
  54. data/vendor/librarian/lib/librarian/cli/manifest_presenter.rb +0 -79
  55. data/vendor/librarian/lib/librarian/config.rb +0 -7
  56. data/vendor/librarian/lib/librarian/config/database.rb +0 -205
  57. data/vendor/librarian/lib/librarian/config/file_source.rb +0 -47
  58. data/vendor/librarian/lib/librarian/config/hash_source.rb +0 -33
  59. data/vendor/librarian/lib/librarian/config/source.rb +0 -149
  60. data/vendor/librarian/lib/librarian/dependency.rb +0 -91
  61. data/vendor/librarian/lib/librarian/dsl.rb +0 -108
  62. data/vendor/librarian/lib/librarian/dsl/receiver.rb +0 -48
  63. data/vendor/librarian/lib/librarian/dsl/target.rb +0 -172
  64. data/vendor/librarian/lib/librarian/environment.rb +0 -134
  65. data/vendor/librarian/lib/librarian/error.rb +0 -4
  66. data/vendor/librarian/lib/librarian/helpers.rb +0 -13
  67. data/vendor/librarian/lib/librarian/lockfile.rb +0 -29
  68. data/vendor/librarian/lib/librarian/lockfile/compiler.rb +0 -66
  69. data/vendor/librarian/lib/librarian/lockfile/parser.rb +0 -100
  70. data/vendor/librarian/lib/librarian/logger.rb +0 -46
  71. data/vendor/librarian/lib/librarian/manifest.rb +0 -234
  72. data/vendor/librarian/lib/librarian/manifest_set.rb +0 -153
  73. data/vendor/librarian/lib/librarian/mock.rb +0 -1
  74. data/vendor/librarian/lib/librarian/mock/cli.rb +0 -19
  75. data/vendor/librarian/lib/librarian/mock/dsl.rb +0 -15
  76. data/vendor/librarian/lib/librarian/mock/environment.rb +0 -24
  77. data/vendor/librarian/lib/librarian/mock/extension.rb +0 -9
  78. data/vendor/librarian/lib/librarian/mock/source.rb +0 -1
  79. data/vendor/librarian/lib/librarian/mock/source/mock.rb +0 -103
  80. data/vendor/librarian/lib/librarian/mock/source/mock/registry.rb +0 -83
  81. data/vendor/librarian/lib/librarian/resolution.rb +0 -44
  82. data/vendor/librarian/lib/librarian/resolver.rb +0 -78
  83. data/vendor/librarian/lib/librarian/resolver/implementation.rb +0 -118
  84. data/vendor/librarian/lib/librarian/source.rb +0 -2
  85. data/vendor/librarian/lib/librarian/source/git.rb +0 -156
  86. data/vendor/librarian/lib/librarian/source/git/repository.rb +0 -217
  87. data/vendor/librarian/lib/librarian/source/local.rb +0 -61
  88. data/vendor/librarian/lib/librarian/source/path.rb +0 -80
  89. data/vendor/librarian/lib/librarian/spec.rb +0 -13
  90. data/vendor/librarian/lib/librarian/spec_change_set.rb +0 -173
  91. data/vendor/librarian/lib/librarian/specfile.rb +0 -18
  92. data/vendor/librarian/lib/librarian/support/abstract_method.rb +0 -21
  93. data/vendor/librarian/lib/librarian/ui.rb +0 -64
  94. data/vendor/librarian/lib/librarian/version.rb +0 -3
  95. data/vendor/librarian/librarian.gemspec +0 -34
  96. data/vendor/librarian/spec/functional/chef/source/git_spec.rb +0 -432
  97. data/vendor/librarian/spec/functional/chef/source/site_spec.rb +0 -215
  98. data/vendor/librarian/spec/functional/source/git/repository_spec.rb +0 -149
  99. data/vendor/librarian/spec/unit/action/base_spec.rb +0 -18
  100. data/vendor/librarian/spec/unit/action/clean_spec.rb +0 -102
  101. data/vendor/librarian/spec/unit/action/ensure_spec.rb +0 -37
  102. data/vendor/librarian/spec/unit/action/install_spec.rb +0 -111
  103. data/vendor/librarian/spec/unit/config/database_spec.rb +0 -319
  104. data/vendor/librarian/spec/unit/dependency_spec.rb +0 -36
  105. data/vendor/librarian/spec/unit/dsl_spec.rb +0 -194
  106. data/vendor/librarian/spec/unit/environment_spec.rb +0 -9
  107. data/vendor/librarian/spec/unit/lockfile/parser_spec.rb +0 -162
  108. data/vendor/librarian/spec/unit/lockfile_spec.rb +0 -65
  109. data/vendor/librarian/spec/unit/manifest_set_spec.rb +0 -202
  110. data/vendor/librarian/spec/unit/manifest_spec.rb +0 -36
  111. data/vendor/librarian/spec/unit/manifest_version_spec.rb +0 -94
  112. data/vendor/librarian/spec/unit/mock/source/mock_spec.rb +0 -22
  113. data/vendor/librarian/spec/unit/resolver_spec.rb +0 -192
  114. data/vendor/librarian/spec/unit/source/git_spec.rb +0 -29
  115. data/vendor/librarian/spec/unit/spec_change_set_spec.rb +0 -169
@@ -1,15 +0,0 @@
1
- require 'librarian/dsl'
2
- require 'librarian/mock/source'
3
-
4
- module Librarian
5
- module Mock
6
- class Dsl < Librarian::Dsl
7
-
8
- dependency :dep
9
-
10
- source :src => Source::Mock
11
-
12
- shortcut :a, :src => 'source-a'
13
- end
14
- end
15
- end
@@ -1,24 +0,0 @@
1
- require "librarian/environment"
2
- require "librarian/mock/dsl"
3
-
4
- module Librarian
5
- module Mock
6
- class Environment < Environment
7
-
8
- def adapter_name
9
- "mock"
10
- end
11
-
12
- def install_path
13
- nil
14
- end
15
-
16
- def registry(options = nil, &block)
17
- @registry ||= Source::Mock::Registry.new
18
- @registry.merge!(options, &block)
19
- @registry
20
- end
21
- end
22
-
23
- end
24
- end
@@ -1,9 +0,0 @@
1
- require 'librarian/mock/environment'
2
-
3
- module Librarian
4
- module Mock
5
- extend self
6
- extend Librarian
7
-
8
- end
9
- end
@@ -1 +0,0 @@
1
- require 'librarian/mock/source/mock'
@@ -1,103 +0,0 @@
1
- require 'librarian/manifest'
2
- require 'librarian/mock/source/mock/registry'
3
-
4
- module Librarian
5
- module Mock
6
- module Source
7
- class Mock
8
-
9
- class << self
10
-
11
- LOCK_NAME = 'MOCK'
12
-
13
- def lock_name
14
- LOCK_NAME
15
- end
16
-
17
- def from_lock_options(environment, options)
18
- new(environment, options[:remote], options.reject{|k, v| k == :remote})
19
- end
20
-
21
- def from_spec_args(environment, name, options)
22
- recognized_options = []
23
- unrecognized_options = options.keys - recognized_options
24
- unrecognized_options.empty? or raise Error, "unrecognized options: #{unrecognized_options.join(", ")}"
25
-
26
- new(environment, name, options)
27
- end
28
-
29
- end
30
-
31
- attr_accessor :environment
32
- private :environment=
33
- attr_reader :name
34
-
35
- def initialize(environment, name, options)
36
- self.environment = environment
37
- @name = name
38
- end
39
-
40
- def to_s
41
- name
42
- end
43
-
44
- def ==(other)
45
- other &&
46
- self.class == other.class &&
47
- self.name == other.name
48
- end
49
-
50
- alias :eql? :==
51
-
52
- def hash
53
- self.to_s.hash
54
- end
55
-
56
- def to_spec_args
57
- [name, {}]
58
- end
59
-
60
- def to_lock_options
61
- {:remote => name}
62
- end
63
-
64
- def registry
65
- environment.registry[name]
66
- end
67
-
68
- def manifest(name, version, dependencies)
69
- manifest = Manifest.new(self, name)
70
- manifest.version = version
71
- manifest.dependencies = dependencies
72
- manifest
73
- end
74
-
75
- def manifests(name)
76
- if d = registry[name]
77
- d.map{|v| manifest(name, v[:version], v[:dependencies])}
78
- else
79
- nil
80
- end
81
- end
82
-
83
- def install!(manifest)
84
- end
85
-
86
- def to_s
87
- name
88
- end
89
-
90
- def fetch_version(name, extra)
91
- extra
92
- end
93
-
94
- def fetch_dependencies(name, version, extra)
95
- d = registry[name]
96
- m = d.find{|v| v[:version] == version.to_s}
97
- m[:dependencies]
98
- end
99
-
100
- end
101
- end
102
- end
103
- end
@@ -1,83 +0,0 @@
1
- module Librarian
2
- module Mock
3
- module Source
4
- class Mock
5
- class Registry
6
-
7
- module Dsl
8
-
9
- class Top
10
- def initialize(sources)
11
- @sources = sources
12
- end
13
- def source(name, &block)
14
- @sources[name] ||= {}
15
- Source.new(@sources[name]).instance_eval(&block) if block
16
- end
17
- end
18
-
19
- class Source
20
- def initialize(source)
21
- @source = source
22
- end
23
- def spec(name, version = nil, &block)
24
- @source[name] ||= []
25
- unless version
26
- Spec.new(@source[name]).instance_eval(&block) if block
27
- else
28
- Spec.new(@source[name]).version(version, &block)
29
- end
30
- @source[name] = @source[name].sort_by{|a| Manifest::Version.new(a[:version])}.reverse
31
- end
32
- end
33
-
34
- class Spec
35
- def initialize(spec)
36
- @spec = spec
37
- end
38
- def version(name, &block)
39
- @spec << { :version => name, :dependencies => {} }
40
- Version.new(@spec.last[:dependencies]).instance_eval(&block) if block
41
- end
42
- end
43
-
44
- class Version
45
- def initialize(version)
46
- @version = version
47
- end
48
- def dependency(name, *requirement)
49
- @version[name] = requirement
50
- end
51
- end
52
-
53
- class << self
54
- def run!(sources, &block)
55
- Top.new(sources).instance_eval(&block) if block
56
- end
57
- end
58
-
59
- end
60
-
61
- def initialize
62
- clear!
63
- end
64
- def clear!
65
- self.sources = { }
66
- end
67
- def merge!(options = nil, &block)
68
- clear! if options && options[:clear]
69
- Dsl.run!(sources, &block) if block
70
- end
71
- def [](name)
72
- sources[name] ||= {}
73
- end
74
-
75
- private
76
-
77
- attr_accessor :sources
78
-
79
- end
80
- end
81
- end
82
- end
83
- end
@@ -1,44 +0,0 @@
1
- module Librarian
2
- #
3
- # Represents the output of the resolution process. Captures the declared
4
- # dependencies plus the full set of resolved manifests. The sources are
5
- # already known by the dependencies and by the resolved manifests, so they do
6
- # not need to be captured explicitly.
7
- #
8
- # This representation may be produced by the resolver, may be serialized into
9
- # a lockfile, and may be deserialized from a lockfile. It is expected that the
10
- # lockfile is a direct representation in text of this representation, so that
11
- # the serialization-deserialization process is just the identity function.
12
- #
13
- class Resolution
14
- attr_reader :dependencies, :manifests, :manifests_index
15
-
16
- def initialize(dependencies, manifests)
17
- @dependencies, @manifests = dependencies, manifests
18
- @manifests_index = build_manifests_index(manifests)
19
- end
20
-
21
- def correct?
22
- manifests && manifests_consistent_with_dependencies? && manifests_internally_consistent?
23
- end
24
-
25
- def sources
26
- manifests.map{|m| m.source}.uniq
27
- end
28
-
29
- private
30
-
31
- def build_manifests_index(manifests)
32
- Hash[manifests.map{|m| [m.name, m]}] if manifests
33
- end
34
-
35
- def manifests_consistent_with_dependencies?
36
- ManifestSet.new(manifests).in_compliance_with?(dependencies)
37
- end
38
-
39
- def manifests_internally_consistent?
40
- ManifestSet.new(manifests).consistent?
41
- end
42
-
43
- end
44
- end
@@ -1,78 +0,0 @@
1
- require 'librarian/resolver/implementation'
2
- require 'librarian/manifest_set'
3
- require 'librarian/resolution'
4
-
5
- module Librarian
6
- class Resolver
7
-
8
- attr_accessor :environment
9
- private :environment=
10
-
11
- def initialize(environment)
12
- self.environment = environment
13
- end
14
-
15
- def resolve(spec, partial_manifests = [])
16
- implementation = Implementation.new(self, spec)
17
- partial_manifests_index = Hash[partial_manifests.map{|m| [m.name, m]}]
18
- manifests = implementation.resolve(spec.dependencies, partial_manifests_index)
19
- enforce_consistency!(spec.dependencies, manifests) if manifests
20
- manifests = sort(manifests) if manifests
21
- Resolution.new(spec.dependencies, manifests)
22
- end
23
-
24
- def enforce_consistency!(dependencies, manifests)
25
- return if dependencies.all?{|d|
26
- m = manifests[d.name]
27
- m && d.satisfied_by?(m)
28
- } && ManifestSet.new(manifests).consistent?
29
-
30
- debug { "Resolver Malfunctioned!" }
31
- errors = []
32
- dependencies.sort_by(&:name).each do |d|
33
- m = manifests[d.name]
34
- if !m
35
- errors << ["Depends on #{d}", "Missing!"]
36
- elsif !d.satisfied_by?(m)
37
- errors << ["Depends on #{d}", "Found: #{m}"]
38
- end
39
- end
40
- unless errors.empty?
41
- errors.each do |a, b|
42
- debug { " #{a}" }
43
- debug { " #{b}" }
44
- end
45
- end
46
- manifests.values.sort_by(&:name).each do |manifest|
47
- errors = []
48
- manifest.dependencies.sort_by(&:name).each do |d|
49
- m = manifests[d.name]
50
- if !m
51
- errors << ["Depends on: #{d}", "Missing!"]
52
- elsif !d.satisfied_by?(m)
53
- errors << ["Depends on: #{d}", "Found: #{m}"]
54
- end
55
- end
56
- unless errors.empty?
57
- debug { " #{manifest}" }
58
- errors.each do |a, b|
59
- debug { " #{a}" }
60
- debug { " #{b}" }
61
- end
62
- end
63
- end
64
- raise Error, "Resolver Malfunctioned!"
65
- end
66
-
67
- def sort(manifests)
68
- ManifestSet.sort(manifests)
69
- end
70
-
71
- private
72
-
73
- def debug(*args, &block)
74
- environment.logger.debug(*args, &block)
75
- end
76
-
77
- end
78
- end
@@ -1,118 +0,0 @@
1
- require 'librarian/dependency'
2
-
3
- module Librarian
4
- class Resolver
5
- class Implementation
6
-
7
- attr_reader :resolver, :source, :dependency_source_map
8
-
9
- def initialize(resolver, spec)
10
- @resolver = resolver
11
- @source = spec.source
12
- @dependency_source_map = Hash[spec.dependencies.map{|d| [d.name, d.source]}]
13
- @level = 0
14
- end
15
-
16
- def resolve(dependencies, manifests = {})
17
- dependencies += manifests.values.map { |m|
18
- m.dependencies.map { |d| sourced_dependency_for(d) }
19
- }.flatten(1)
20
- resolution = recursive_resolve([], manifests, dependencies)
21
- resolution ? resolution[1] : nil
22
- end
23
-
24
- def sourced_dependency_for(dependency)
25
- return dependency if dependency.source
26
-
27
- s = dependency_source_map[dependency.name] || source
28
- Dependency.new(dependency.name, dependency.requirement, s)
29
- end
30
-
31
- def recursive_resolve(dependencies, manifests, queue)
32
- if dependencies.empty?
33
- queue.each do |dependency|
34
- debug { "Scheduling #{dependency}" }
35
- end
36
- end
37
- failure = false
38
- until failure || queue.empty?
39
- dependency = queue.shift
40
- dependencies << dependency
41
- debug { "Resolving #{dependency}" }
42
- scope do
43
- if manifests.key?(dependency.name)
44
- unless dependency.satisfied_by?(manifests[dependency.name])
45
- debug { "Conflicts with #{manifests[dependency.name]}" }
46
- failure = true
47
- else
48
- debug { "Accords with all prior constraints" }
49
- # nothing left to do
50
- end
51
- else
52
- debug { "No known prior constraints" }
53
- resolution = nil
54
- related_dependencies = dependencies.select{|d| d.name == dependency.name}
55
- unless dependency.manifests && dependency.manifests.first
56
- debug { "No known manifests" }
57
- else
58
- debug { "Checking manifests" }
59
- scope do
60
- dependency.manifests.each do |manifest|
61
- break if resolution
62
-
63
- debug { "Checking #{manifest}" }
64
- scope do
65
- if related_dependencies.all?{|d| d.satisfied_by?(manifest)}
66
- m = manifests.merge(dependency.name => manifest)
67
- a = manifest.dependencies.map { |d| sourced_dependency_for(d) }
68
- a.each do |d|
69
- debug { "Scheduling #{d}" }
70
- end
71
- q = queue + a
72
- resolution = recursive_resolve(dependencies.dup, m, q)
73
- end
74
- if resolution
75
- debug { "Resolved #{dependency} at #{manifest}" }
76
- else
77
- debug { "Backtracking from #{manifest}" }
78
- end
79
- end
80
- end
81
- end
82
- if resolution
83
- debug { "Resolved #{dependency}" }
84
- else
85
- debug { "Failed to resolve #{dependency}" }
86
- end
87
- end
88
- unless resolution
89
- failure = true
90
- else
91
- dependencies, manifests, queue = *resolution
92
- end
93
- end
94
- end
95
- end
96
- failure ? nil : [dependencies, manifests, queue]
97
- end
98
-
99
- private
100
-
101
- def scope
102
- @level += 1
103
- yield
104
- ensure
105
- @level -= 1
106
- end
107
-
108
- def debug
109
- environment.logger.debug { ' ' * @level + yield }
110
- end
111
-
112
- def environment
113
- resolver.environment
114
- end
115
-
116
- end
117
- end
118
- end