librarian-puppet-maestrodev 0.9.7.5 → 0.9.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. data/README.md +3 -3
  2. data/bin/librarian-puppet +0 -2
  3. data/lib/librarian/puppet.rb +10 -1
  4. data/lib/librarian/puppet/extension.rb +68 -11
  5. data/lib/librarian/puppet/requirement.rb +39 -0
  6. data/lib/librarian/puppet/source.rb +1 -0
  7. data/lib/librarian/puppet/source/forge.rb +8 -1
  8. data/lib/librarian/puppet/source/git.rb +2 -0
  9. data/lib/librarian/puppet/source/githubtarball.rb +16 -1
  10. data/lib/librarian/puppet/version.rb +1 -1
  11. metadata +33 -112
  12. data/vendor/librarian/CHANGELOG.md +0 -185
  13. data/vendor/librarian/Gemfile +0 -6
  14. data/vendor/librarian/MIT-LICENSE +0 -20
  15. data/vendor/librarian/README.md +0 -403
  16. data/vendor/librarian/Rakefile +0 -34
  17. data/vendor/librarian/bin/librarian-chef +0 -7
  18. data/vendor/librarian/bin/librarian-mock +0 -7
  19. data/vendor/librarian/config/cucumber.yaml +0 -1
  20. data/vendor/librarian/features/chef/cli/init.feature +0 -11
  21. data/vendor/librarian/features/chef/cli/install.feature +0 -64
  22. data/vendor/librarian/features/chef/cli/show.feature +0 -77
  23. data/vendor/librarian/features/chef/cli/version.feature +0 -11
  24. data/vendor/librarian/features/support/env.rb +0 -9
  25. data/vendor/librarian/lib/librarian.rb +0 -19
  26. data/vendor/librarian/lib/librarian/action.rb +0 -5
  27. data/vendor/librarian/lib/librarian/action/base.rb +0 -24
  28. data/vendor/librarian/lib/librarian/action/clean.rb +0 -44
  29. data/vendor/librarian/lib/librarian/action/ensure.rb +0 -24
  30. data/vendor/librarian/lib/librarian/action/install.rb +0 -99
  31. data/vendor/librarian/lib/librarian/action/resolve.rb +0 -81
  32. data/vendor/librarian/lib/librarian/action/update.rb +0 -78
  33. data/vendor/librarian/lib/librarian/chef.rb +0 -1
  34. data/vendor/librarian/lib/librarian/chef/cli.rb +0 -48
  35. data/vendor/librarian/lib/librarian/chef/dsl.rb +0 -15
  36. data/vendor/librarian/lib/librarian/chef/environment.rb +0 -27
  37. data/vendor/librarian/lib/librarian/chef/extension.rb +0 -9
  38. data/vendor/librarian/lib/librarian/chef/integration/knife.rb +0 -42
  39. data/vendor/librarian/lib/librarian/chef/manifest_reader.rb +0 -59
  40. data/vendor/librarian/lib/librarian/chef/source.rb +0 -3
  41. data/vendor/librarian/lib/librarian/chef/source/git.rb +0 -25
  42. data/vendor/librarian/lib/librarian/chef/source/local.rb +0 -69
  43. data/vendor/librarian/lib/librarian/chef/source/path.rb +0 -12
  44. data/vendor/librarian/lib/librarian/chef/source/site.rb +0 -446
  45. data/vendor/librarian/lib/librarian/chef/templates/Cheffile +0 -15
  46. data/vendor/librarian/lib/librarian/cli.rb +0 -205
  47. data/vendor/librarian/lib/librarian/cli/manifest_presenter.rb +0 -79
  48. data/vendor/librarian/lib/librarian/config.rb +0 -7
  49. data/vendor/librarian/lib/librarian/config/database.rb +0 -205
  50. data/vendor/librarian/lib/librarian/config/file_source.rb +0 -47
  51. data/vendor/librarian/lib/librarian/config/hash_source.rb +0 -33
  52. data/vendor/librarian/lib/librarian/config/source.rb +0 -149
  53. data/vendor/librarian/lib/librarian/dependency.rb +0 -91
  54. data/vendor/librarian/lib/librarian/dsl.rb +0 -108
  55. data/vendor/librarian/lib/librarian/dsl/receiver.rb +0 -48
  56. data/vendor/librarian/lib/librarian/dsl/target.rb +0 -172
  57. data/vendor/librarian/lib/librarian/environment.rb +0 -134
  58. data/vendor/librarian/lib/librarian/error.rb +0 -4
  59. data/vendor/librarian/lib/librarian/helpers.rb +0 -13
  60. data/vendor/librarian/lib/librarian/lockfile.rb +0 -29
  61. data/vendor/librarian/lib/librarian/lockfile/compiler.rb +0 -66
  62. data/vendor/librarian/lib/librarian/lockfile/parser.rb +0 -100
  63. data/vendor/librarian/lib/librarian/logger.rb +0 -46
  64. data/vendor/librarian/lib/librarian/manifest.rb +0 -132
  65. data/vendor/librarian/lib/librarian/manifest_set.rb +0 -154
  66. data/vendor/librarian/lib/librarian/mock.rb +0 -1
  67. data/vendor/librarian/lib/librarian/mock/cli.rb +0 -19
  68. data/vendor/librarian/lib/librarian/mock/dsl.rb +0 -15
  69. data/vendor/librarian/lib/librarian/mock/environment.rb +0 -24
  70. data/vendor/librarian/lib/librarian/mock/extension.rb +0 -9
  71. data/vendor/librarian/lib/librarian/mock/source.rb +0 -1
  72. data/vendor/librarian/lib/librarian/mock/source/mock.rb +0 -97
  73. data/vendor/librarian/lib/librarian/mock/source/mock/registry.rb +0 -83
  74. data/vendor/librarian/lib/librarian/resolution.rb +0 -44
  75. data/vendor/librarian/lib/librarian/resolver.rb +0 -78
  76. data/vendor/librarian/lib/librarian/resolver/implementation.rb +0 -118
  77. data/vendor/librarian/lib/librarian/source.rb +0 -2
  78. data/vendor/librarian/lib/librarian/source/git.rb +0 -150
  79. data/vendor/librarian/lib/librarian/source/git/repository.rb +0 -217
  80. data/vendor/librarian/lib/librarian/source/local.rb +0 -61
  81. data/vendor/librarian/lib/librarian/source/path.rb +0 -74
  82. data/vendor/librarian/lib/librarian/spec.rb +0 -13
  83. data/vendor/librarian/lib/librarian/spec_change_set.rb +0 -173
  84. data/vendor/librarian/lib/librarian/specfile.rb +0 -18
  85. data/vendor/librarian/lib/librarian/support/abstract_method.rb +0 -21
  86. data/vendor/librarian/lib/librarian/ui.rb +0 -64
  87. data/vendor/librarian/lib/librarian/version.rb +0 -3
  88. data/vendor/librarian/librarian.gemspec +0 -34
  89. data/vendor/librarian/spec/functional/chef/source/git_spec.rb +0 -432
  90. data/vendor/librarian/spec/functional/chef/source/site_spec.rb +0 -215
  91. data/vendor/librarian/spec/functional/source/git/repository_spec.rb +0 -149
  92. data/vendor/librarian/spec/unit/action/base_spec.rb +0 -18
  93. data/vendor/librarian/spec/unit/action/clean_spec.rb +0 -102
  94. data/vendor/librarian/spec/unit/action/ensure_spec.rb +0 -37
  95. data/vendor/librarian/spec/unit/action/install_spec.rb +0 -111
  96. data/vendor/librarian/spec/unit/config/database_spec.rb +0 -319
  97. data/vendor/librarian/spec/unit/dependency_spec.rb +0 -36
  98. data/vendor/librarian/spec/unit/dsl_spec.rb +0 -194
  99. data/vendor/librarian/spec/unit/environment_spec.rb +0 -9
  100. data/vendor/librarian/spec/unit/lockfile/parser_spec.rb +0 -162
  101. data/vendor/librarian/spec/unit/lockfile_spec.rb +0 -65
  102. data/vendor/librarian/spec/unit/manifest_set_spec.rb +0 -202
  103. data/vendor/librarian/spec/unit/manifest_spec.rb +0 -36
  104. data/vendor/librarian/spec/unit/mock/source/mock_spec.rb +0 -22
  105. data/vendor/librarian/spec/unit/resolver_spec.rb +0 -192
  106. data/vendor/librarian/spec/unit/source/git_spec.rb +0 -29
  107. data/vendor/librarian/spec/unit/spec_change_set_spec.rb +0 -169
@@ -1,217 +0,0 @@
1
- require 'open3'
2
-
3
- module Librarian
4
- module Source
5
- class Git
6
- class Repository
7
-
8
- class << self
9
- def clone!(environment, path, repository_url)
10
- path = Pathname.new(path)
11
- path.mkpath
12
- git = new(environment, path)
13
- git.clone!(repository_url)
14
- git
15
- end
16
-
17
- def bin
18
- @bin ||= which("git") or raise Error, "cannot find git"
19
- end
20
-
21
- private
22
-
23
- # Cross-platform way of finding an executable in the $PATH.
24
- #
25
- # which('ruby') #=> /usr/bin/ruby
26
- #
27
- # From:
28
- # https://github.com/defunkt/hub/commit/353031307e704d860826fc756ff0070be5e1b430#L2R173
29
- def which(cmd)
30
- exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
31
- ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
32
- path = File.expand_path(path)
33
- exts.each do |ext|
34
- exe = File.join(path, cmd + ext)
35
- return exe if File.file?(exe) && File.executable?(exe)
36
- end
37
- end
38
- nil
39
- end
40
- end
41
-
42
- attr_accessor :environment, :path
43
- private :environment=, :path=
44
-
45
- def initialize(environment, path)
46
- self.environment = environment
47
- self.path = Pathname.new(path)
48
- end
49
-
50
- def git?
51
- path.join('.git').exist?
52
- end
53
-
54
- def default_remote
55
- "origin"
56
- end
57
-
58
- def version(options = { })
59
- version!(options).strip
60
- end
61
-
62
- def version!(options = { })
63
- silent = options.delete(:silent)
64
-
65
- command = %w(--version)
66
- run!(command, :silent => silent)
67
- end
68
-
69
- def clone!(repository_url)
70
- command = %W(clone #{repository_url} . --quiet)
71
- run!(command, :chdir => true)
72
- end
73
-
74
- def checkout!(reference, options ={ })
75
- command = %W(checkout #{reference} --quiet)
76
- command << "--force" if options[:force]
77
- run!(command, :chdir => true)
78
- end
79
-
80
- def fetch!(remote, options = { })
81
- command = %W(fetch #{remote} --quiet)
82
- command << "--tags" if options[:tags]
83
- run!(command, :chdir => true)
84
- end
85
-
86
- def reset_hard!
87
- command = %W(reset --hard --quiet)
88
- run!(command, :chdir => true)
89
- end
90
-
91
- def clean!
92
- command = %w(clean -x -d --force --force)
93
- run!(command, :chdir => true)
94
- end
95
-
96
- def checked_out?(sha)
97
- current_commit_hash == sha
98
- end
99
-
100
- def remote_names
101
- command = %W(remote)
102
- run!(command, :chdir => true).strip.lines.map(&:strip)
103
- end
104
-
105
- def remote_branch_names
106
- remotes = remote_names.sort_by(&:length).reverse
107
-
108
- command = %W(branch -r)
109
- names = run!(command, :chdir => true).strip.lines.map(&:strip).to_a
110
- names.each{|n| n.gsub!(/\s*->.*$/, "")}
111
- names.reject!{|n| n =~ /\/HEAD$/}
112
- Hash[remotes.map do |r|
113
- matching_names = names.select{|n| n.start_with?("#{r}/")}
114
- matching_names.each{|n| names.delete(n)}
115
- matching_names.each{|n| n.slice!(0, r.size + 1)}
116
- [r, matching_names]
117
- end]
118
- end
119
-
120
- def hash_from(remote, reference)
121
- branch_names = remote_branch_names[remote]
122
- if branch_names.include?(reference)
123
- reference = "#{remote}/#{reference}"
124
- end
125
-
126
- command = %W(rev-list #{reference} -1)
127
- run!(command, :chdir => true).strip
128
- end
129
-
130
- def current_commit_hash
131
- command = %W(rev-parse HEAD --quiet)
132
- run!(command, :chdir => true).strip!
133
- end
134
-
135
- private
136
-
137
- def bin
138
- self.class.bin
139
- end
140
-
141
- def run!(args, options = { })
142
- chdir = options.delete(:chdir)
143
- chdir = path.to_s if chdir == true
144
-
145
- silent = options.delete(:silent)
146
-
147
- command = [bin]
148
- command.concat(args)
149
-
150
- maybe_within(chdir) do
151
- logging_command(command, :silent => silent) do
152
- run_command_internal(command)
153
- end
154
- end
155
- end
156
-
157
- def maybe_within(path)
158
- if path
159
- Dir.chdir(path) { with_env_var("GIT_DIR", nil) { yield } }
160
- else
161
- yield
162
- end
163
- end
164
-
165
- def with_env_var(name, value)
166
- original_value = ENV[name]
167
- begin
168
- ENV[name] = value
169
- yield
170
- ensure
171
- ENV[name] = original_value
172
- end
173
- end
174
-
175
- def logging_command(command, options)
176
- silent = options.delete(:silent)
177
-
178
- pwd = Dir.pwd
179
-
180
- unless silent
181
- debug { "Running `#{command.join(' ')}` in #{relative_path_to(pwd)}" }
182
- end
183
-
184
- out = yield
185
-
186
- unless silent
187
- if out.size > 0
188
- out.lines.each do |line|
189
- debug { " --> #{line}" }
190
- end
191
- else
192
- debug { " --- No output" }
193
- end
194
- end
195
-
196
- out
197
- end
198
-
199
- def run_command_internal(command)
200
- Open3.popen3(*command) do |i, o, e, t|
201
- raise StandardError, e.read unless (t ? t.value : $?).success?
202
- o.read
203
- end
204
- end
205
-
206
- def debug(*args, &block)
207
- environment.logger.debug(*args, &block)
208
- end
209
-
210
- def relative_path_to(path)
211
- environment.logger.relative_path_to(path)
212
- end
213
-
214
- end
215
- end
216
- end
217
- end
@@ -1,61 +0,0 @@
1
- require 'librarian/support/abstract_method'
2
-
3
- module Librarian
4
- module Source
5
- # Requires that the including source class have methods:
6
- # #path
7
- # #environment
8
- module Local
9
-
10
- include Support::AbstractMethod
11
-
12
- abstract_method :path, :fetch_version, :fetch_dependencies
13
-
14
- def manifests(name)
15
- manifest = Manifest.new(self, name)
16
- [manifest].compact
17
- end
18
-
19
- def manifest(name, version, dependencies)
20
- manifest = Manifest.new(self, name)
21
- manifest.version = version
22
- manifest.dependencies = dependencies
23
- manifest
24
- end
25
-
26
- def manifest_search_paths(name)
27
- @manifest_search_paths ||= { }
28
- @manifest_search_paths[name] ||= begin
29
- cache!
30
- paths = [filesystem_path, filesystem_path.join(name)]
31
- paths.select{|s| s.exist?}
32
- end
33
- end
34
-
35
- def found_path(name)
36
- @_found_paths ||= { }
37
- @_found_paths[name] ||= begin
38
- paths = manifest_search_paths(name)
39
- paths.find{|p| manifest?(name, p)}
40
- end
41
- end
42
-
43
- private
44
-
45
- abstract_method :manifest? # (name, path) -> boolean
46
-
47
- def info(*args, &block)
48
- environment.logger.info(*args, &block)
49
- end
50
-
51
- def debug(*args, &block)
52
- environment.logger.debug(*args, &block)
53
- end
54
-
55
- def relative_path_to(path)
56
- environment.logger.relative_path_to(path)
57
- end
58
-
59
- end
60
- end
61
- end
@@ -1,74 +0,0 @@
1
- require 'librarian/source/local'
2
-
3
- module Librarian
4
- module Source
5
- class Path
6
-
7
- include Local
8
-
9
- class << self
10
-
11
- LOCK_NAME = 'PATH'
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, path, 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, path, options)
27
- end
28
-
29
- end
30
-
31
- attr_accessor :environment
32
- private :environment=
33
- attr_reader :path
34
-
35
- def initialize(environment, path, options)
36
- self.environment = environment
37
- @path = path
38
- end
39
-
40
- def to_s
41
- path.to_s
42
- end
43
-
44
- def ==(other)
45
- other &&
46
- self.class == other.class &&
47
- self.path == other.path
48
- end
49
-
50
- def to_spec_args
51
- [path.to_s, {}]
52
- end
53
-
54
- def to_lock_options
55
- {:remote => path}
56
- end
57
-
58
- def pinned?
59
- false
60
- end
61
-
62
- def unpin!
63
- end
64
-
65
- def cache!
66
- end
67
-
68
- def filesystem_path
69
- @filesystem_path ||= Pathname.new(path).expand_path(environment.project_path)
70
- end
71
-
72
- end
73
- end
74
- end
@@ -1,13 +0,0 @@
1
- module Librarian
2
- class Spec
3
-
4
- attr_accessor :source, :dependencies
5
- private :source=, :dependencies=
6
-
7
- def initialize(source, dependencies)
8
- self.source = source
9
- self.dependencies = dependencies
10
- end
11
-
12
- end
13
- end
@@ -1,173 +0,0 @@
1
- require 'librarian/helpers'
2
-
3
- require 'librarian/manifest_set'
4
- require 'librarian/resolution'
5
- require 'librarian/spec'
6
-
7
- module Librarian
8
- class SpecChangeSet
9
-
10
- attr_accessor :environment
11
- private :environment=
12
- attr_reader :spec, :lock
13
-
14
- def initialize(environment, spec, lock)
15
- self.environment = environment
16
- raise TypeError, "can't convert #{spec.class} into #{Spec}" unless Spec === spec
17
- raise TypeError, "can't convert #{lock.class} into #{Resolution}" unless Resolution === lock
18
- @spec, @lock = spec, lock
19
- end
20
-
21
- def same?
22
- @same ||= spec.dependencies.sort_by{|d| d.name} == lock.dependencies.sort_by{|d| d.name}
23
- end
24
-
25
- def changed?
26
- !same?
27
- end
28
-
29
- def spec_dependencies
30
- @spec_dependencies ||= spec.dependencies
31
- end
32
- def spec_dependency_names
33
- @spec_dependency_names ||= Set.new(spec_dependencies.map{|d| d.name})
34
- end
35
- def spec_dependency_index
36
- @spec_dependency_index ||= Hash[spec_dependencies.map{|d| [d.name, d]}]
37
- end
38
-
39
- def lock_dependencies
40
- @lock_dependencies ||= lock.dependencies
41
- end
42
- def lock_dependency_names
43
- @lock_dependency_names ||= Set.new(lock_dependencies.map{|d| d.name})
44
- end
45
- def lock_dependency_index
46
- @lock_dependency_index ||= Hash[lock_dependencies.map{|d| [d.name, d]}]
47
- end
48
-
49
- def lock_manifests
50
- @lock_manifests ||= lock.manifests
51
- end
52
- def lock_manifests_index
53
- @lock_manifests_index ||= ManifestSet.new(lock_manifests).to_hash
54
- end
55
-
56
- def removed_dependency_names
57
- @removed_dependency_names ||= lock_dependency_names - spec_dependency_names
58
- end
59
-
60
- # A dependency which is deleted from the specfile will, in the general case,
61
- # be removed conservatively. This means it might not actually be removed.
62
- # But if the dependency originally declared a source which is now non-
63
- # default, it must be removed, even if another dependency has a transitive
64
- # dependency on the one that was removed (which is the scenario in which
65
- # a conservative removal would not remove it). In this case, we must also
66
- # remove it explicitly so that it can be re-resolved from the default
67
- # source.
68
- def explicit_removed_dependency_names
69
- @explicit_removed_dependency_names ||= removed_dependency_names.reject do |name|
70
- lock_manifest = lock_manifests_index[name]
71
- lock_manifest.source == spec.source
72
- end.to_set
73
- end
74
-
75
- def added_dependency_names
76
- @added_dependency_names ||= spec_dependency_names - lock_dependency_names
77
- end
78
-
79
- def nonmatching_added_dependency_names
80
- @nonmatching_added_dependency_names ||= added_dependency_names.reject do |name|
81
- spec_dependency = spec_dependency_index[name]
82
- lock_manifest = lock_manifests_index[name]
83
- if lock_manifest
84
- matching = true
85
- matching &&= spec_dependency.satisfied_by?(lock_manifest)
86
- matching &&= spec_dependency.source == lock_manifest.source
87
- matching
88
- else
89
- false
90
- end
91
- end.to_set
92
- end
93
-
94
- def common_dependency_names
95
- @common_dependency_names ||= lock_dependency_names & spec_dependency_names
96
- end
97
-
98
- def changed_dependency_names
99
- @changed_dependency_names ||= common_dependency_names.reject do |name|
100
- spec_dependency = spec_dependency_index[name]
101
- lock_dependency = lock_dependency_index[name]
102
- lock_manifest = lock_manifests_index[name]
103
- same = true
104
- same &&= spec_dependency.satisfied_by?(lock_manifest)
105
- same &&= spec_dependency.source == lock_dependency.source
106
- same
107
- end.to_set
108
- end
109
-
110
- def deep_keep_manifest_names
111
- @deep_keep_manifest_names ||= begin
112
- lock_dependency_names - (
113
- removed_dependency_names +
114
- changed_dependency_names +
115
- nonmatching_added_dependency_names
116
- )
117
- end
118
- end
119
-
120
- def shallow_strip_manifest_names
121
- @shallow_strip_manifest_names ||= begin
122
- explicit_removed_dependency_names + changed_dependency_names
123
- end
124
- end
125
-
126
- def inspect
127
- Helpers.strip_heredoc(<<-INSPECT)
128
- <##{self.class.name}:
129
- Removed: #{removed_dependency_names.to_a.join(", ")}
130
- ExplicitRemoved: #{explicit_removed_dependency_names.to_a.join(", ")}
131
- Added: #{added_dependency_names.to_a.join(", ")}
132
- NonMatchingAdded: #{nonmatching_added_dependency_names.to_a.join(", ")}
133
- Changed: #{changed_dependency_names.to_a.join(", ")}
134
- DeepKeep: #{deep_keep_manifest_names.to_a.join(", ")}
135
- ShallowStrip: #{shallow_strip_manifest_names.to_a.join(", ")}
136
- >
137
- INSPECT
138
- end
139
-
140
- # Returns an array of those manifests from the previous spec which should be kept,
141
- # based on inspecting the new spec against the locked resolution from the previous spec.
142
- def analyze
143
- @analyze ||= begin
144
- debug { "Analyzing spec and lock:" }
145
-
146
- if same?
147
- debug { " Same!" }
148
- return lock.manifests
149
- end
150
-
151
- debug { " Removed:" } ; removed_dependency_names.each { |name| debug { " #{name}" } }
152
- debug { " ExplicitRemoved:" } ; explicit_removed_dependency_names.each { |name| debug { " #{name}" } }
153
- debug { " Added:" } ; added_dependency_names.each { |name| debug { " #{name}" } }
154
- debug { " NonMatchingAdded:" } ; nonmatching_added_dependency_names.each { |name| debug { " #{name}" } }
155
- debug { " Changed:" } ; changed_dependency_names.each { |name| debug { " #{name}" } }
156
- debug { " DeepKeep:" } ; deep_keep_manifest_names.each { |name| debug { " #{name}" } }
157
- debug { " ShallowStrip:" } ; shallow_strip_manifest_names.each { |name| debug { " #{name}" } }
158
-
159
- manifests = ManifestSet.new(lock_manifests)
160
- manifests.deep_keep!(deep_keep_manifest_names)
161
- manifests.shallow_strip!(shallow_strip_manifest_names)
162
- manifests.to_a
163
- end
164
- end
165
-
166
- private
167
-
168
- def debug(*args, &block)
169
- environment.logger.debug(*args, &block)
170
- end
171
-
172
- end
173
- end