librarian-puppet-maestrodev 0.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +3 -0
- data/LICENSE +20 -0
- data/README.md +187 -0
- data/bin/librarian-puppet +9 -0
- data/lib/librarian/puppet.rb +13 -0
- data/lib/librarian/puppet/cli.rb +85 -0
- data/lib/librarian/puppet/dsl.rb +16 -0
- data/lib/librarian/puppet/environment.rb +54 -0
- data/lib/librarian/puppet/extension.rb +41 -0
- data/lib/librarian/puppet/lockfile/parser.rb +53 -0
- data/lib/librarian/puppet/source.rb +4 -0
- data/lib/librarian/puppet/source/forge.rb +279 -0
- data/lib/librarian/puppet/source/git.rb +114 -0
- data/lib/librarian/puppet/source/githubtarball.rb +234 -0
- data/lib/librarian/puppet/source/local.rb +57 -0
- data/lib/librarian/puppet/source/path.rb +12 -0
- data/lib/librarian/puppet/templates/Puppetfile +10 -0
- data/lib/librarian/puppet/version.rb +5 -0
- data/vendor/librarian/CHANGELOG.md +185 -0
- data/vendor/librarian/Gemfile +6 -0
- data/vendor/librarian/MIT-LICENSE +20 -0
- data/vendor/librarian/README.md +403 -0
- data/vendor/librarian/Rakefile +34 -0
- data/vendor/librarian/bin/librarian-chef +7 -0
- data/vendor/librarian/bin/librarian-mock +7 -0
- data/vendor/librarian/config/cucumber.yaml +1 -0
- data/vendor/librarian/features/chef/cli/init.feature +11 -0
- data/vendor/librarian/features/chef/cli/install.feature +64 -0
- data/vendor/librarian/features/chef/cli/show.feature +77 -0
- data/vendor/librarian/features/chef/cli/version.feature +11 -0
- data/vendor/librarian/features/support/env.rb +9 -0
- data/vendor/librarian/lib/librarian.rb +19 -0
- data/vendor/librarian/lib/librarian/action.rb +5 -0
- data/vendor/librarian/lib/librarian/action/base.rb +24 -0
- data/vendor/librarian/lib/librarian/action/clean.rb +44 -0
- data/vendor/librarian/lib/librarian/action/ensure.rb +24 -0
- data/vendor/librarian/lib/librarian/action/install.rb +99 -0
- data/vendor/librarian/lib/librarian/action/resolve.rb +81 -0
- data/vendor/librarian/lib/librarian/action/update.rb +78 -0
- data/vendor/librarian/lib/librarian/chef.rb +1 -0
- data/vendor/librarian/lib/librarian/chef/cli.rb +48 -0
- data/vendor/librarian/lib/librarian/chef/dsl.rb +15 -0
- data/vendor/librarian/lib/librarian/chef/environment.rb +27 -0
- data/vendor/librarian/lib/librarian/chef/extension.rb +9 -0
- data/vendor/librarian/lib/librarian/chef/integration/knife.rb +42 -0
- data/vendor/librarian/lib/librarian/chef/manifest_reader.rb +59 -0
- data/vendor/librarian/lib/librarian/chef/source.rb +3 -0
- data/vendor/librarian/lib/librarian/chef/source/git.rb +25 -0
- data/vendor/librarian/lib/librarian/chef/source/local.rb +69 -0
- data/vendor/librarian/lib/librarian/chef/source/path.rb +12 -0
- data/vendor/librarian/lib/librarian/chef/source/site.rb +446 -0
- data/vendor/librarian/lib/librarian/chef/templates/Cheffile +15 -0
- data/vendor/librarian/lib/librarian/cli.rb +205 -0
- data/vendor/librarian/lib/librarian/cli/manifest_presenter.rb +79 -0
- data/vendor/librarian/lib/librarian/config.rb +7 -0
- data/vendor/librarian/lib/librarian/config/database.rb +205 -0
- data/vendor/librarian/lib/librarian/config/file_source.rb +47 -0
- data/vendor/librarian/lib/librarian/config/hash_source.rb +33 -0
- data/vendor/librarian/lib/librarian/config/source.rb +149 -0
- data/vendor/librarian/lib/librarian/dependency.rb +91 -0
- data/vendor/librarian/lib/librarian/dsl.rb +108 -0
- data/vendor/librarian/lib/librarian/dsl/receiver.rb +48 -0
- data/vendor/librarian/lib/librarian/dsl/target.rb +172 -0
- data/vendor/librarian/lib/librarian/environment.rb +134 -0
- data/vendor/librarian/lib/librarian/error.rb +4 -0
- data/vendor/librarian/lib/librarian/helpers.rb +13 -0
- data/vendor/librarian/lib/librarian/lockfile.rb +29 -0
- data/vendor/librarian/lib/librarian/lockfile/compiler.rb +66 -0
- data/vendor/librarian/lib/librarian/lockfile/parser.rb +100 -0
- data/vendor/librarian/lib/librarian/logger.rb +46 -0
- data/vendor/librarian/lib/librarian/manifest.rb +132 -0
- data/vendor/librarian/lib/librarian/manifest_set.rb +153 -0
- data/vendor/librarian/lib/librarian/mock.rb +1 -0
- data/vendor/librarian/lib/librarian/mock/cli.rb +19 -0
- data/vendor/librarian/lib/librarian/mock/dsl.rb +15 -0
- data/vendor/librarian/lib/librarian/mock/environment.rb +24 -0
- data/vendor/librarian/lib/librarian/mock/extension.rb +9 -0
- data/vendor/librarian/lib/librarian/mock/source.rb +1 -0
- data/vendor/librarian/lib/librarian/mock/source/mock.rb +97 -0
- data/vendor/librarian/lib/librarian/mock/source/mock/registry.rb +83 -0
- data/vendor/librarian/lib/librarian/resolution.rb +44 -0
- data/vendor/librarian/lib/librarian/resolver.rb +78 -0
- data/vendor/librarian/lib/librarian/resolver/implementation.rb +118 -0
- data/vendor/librarian/lib/librarian/source.rb +2 -0
- data/vendor/librarian/lib/librarian/source/git.rb +150 -0
- data/vendor/librarian/lib/librarian/source/git/repository.rb +217 -0
- data/vendor/librarian/lib/librarian/source/local.rb +61 -0
- data/vendor/librarian/lib/librarian/source/path.rb +74 -0
- data/vendor/librarian/lib/librarian/spec.rb +13 -0
- data/vendor/librarian/lib/librarian/spec_change_set.rb +173 -0
- data/vendor/librarian/lib/librarian/specfile.rb +18 -0
- data/vendor/librarian/lib/librarian/support/abstract_method.rb +21 -0
- data/vendor/librarian/lib/librarian/ui.rb +64 -0
- data/vendor/librarian/lib/librarian/version.rb +3 -0
- data/vendor/librarian/librarian.gemspec +34 -0
- data/vendor/librarian/spec/functional/chef/source/git_spec.rb +432 -0
- data/vendor/librarian/spec/functional/chef/source/site_spec.rb +215 -0
- data/vendor/librarian/spec/functional/source/git/repository_spec.rb +149 -0
- data/vendor/librarian/spec/unit/action/base_spec.rb +18 -0
- data/vendor/librarian/spec/unit/action/clean_spec.rb +102 -0
- data/vendor/librarian/spec/unit/action/ensure_spec.rb +37 -0
- data/vendor/librarian/spec/unit/action/install_spec.rb +111 -0
- data/vendor/librarian/spec/unit/config/database_spec.rb +319 -0
- data/vendor/librarian/spec/unit/dependency_spec.rb +36 -0
- data/vendor/librarian/spec/unit/dsl_spec.rb +194 -0
- data/vendor/librarian/spec/unit/environment_spec.rb +9 -0
- data/vendor/librarian/spec/unit/lockfile/parser_spec.rb +162 -0
- data/vendor/librarian/spec/unit/lockfile_spec.rb +65 -0
- data/vendor/librarian/spec/unit/manifest_set_spec.rb +202 -0
- data/vendor/librarian/spec/unit/manifest_spec.rb +36 -0
- data/vendor/librarian/spec/unit/mock/source/mock_spec.rb +22 -0
- data/vendor/librarian/spec/unit/resolver_spec.rb +192 -0
- data/vendor/librarian/spec/unit/source/git_spec.rb +29 -0
- data/vendor/librarian/spec/unit/spec_change_set_spec.rb +169 -0
- metadata +227 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'bundler'
|
|
2
|
+
|
|
3
|
+
module Bundler
|
|
4
|
+
class GemHelper
|
|
5
|
+
|
|
6
|
+
def build_gem_with_built_spec
|
|
7
|
+
spec = Gem::Specification.load(spec_path)
|
|
8
|
+
spec_ruby = spec.to_ruby
|
|
9
|
+
original_spec_path = spec_path + ".original"
|
|
10
|
+
FileUtils.mv(spec_path, original_spec_path)
|
|
11
|
+
File.open(spec_path, "wb"){|f| f.write(spec_ruby)}
|
|
12
|
+
build_gem_without_built_spec
|
|
13
|
+
ensure
|
|
14
|
+
FileUtils.mv(original_spec_path, spec_path)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
alias build_gem_without_built_spec build_gem
|
|
18
|
+
alias build_gem build_gem_with_built_spec
|
|
19
|
+
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
Bundler::GemHelper.install_tasks
|
|
24
|
+
|
|
25
|
+
begin
|
|
26
|
+
require 'rspec/core/rake_task'
|
|
27
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
28
|
+
|
|
29
|
+
require 'cucumber/rake/task'
|
|
30
|
+
Cucumber::Rake::Task.new(:features)
|
|
31
|
+
|
|
32
|
+
task :default => [:spec, :features]
|
|
33
|
+
rescue LoadError
|
|
34
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
default: --tags ~@wip --format progress
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Feature: cli/install
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
Scenario: A simple Cheffile with one cookbook
|
|
6
|
+
Given a file named "cookbook-sources/apt/metadata.yaml" with:
|
|
7
|
+
"""
|
|
8
|
+
name: apt
|
|
9
|
+
version: 1.0.0
|
|
10
|
+
dependencies: { }
|
|
11
|
+
"""
|
|
12
|
+
Given a file named "Cheffile" with:
|
|
13
|
+
"""
|
|
14
|
+
cookbook 'apt',
|
|
15
|
+
:path => 'cookbook-sources'
|
|
16
|
+
"""
|
|
17
|
+
When I run `librarian-chef install --verbose`
|
|
18
|
+
Then the exit status should be 0
|
|
19
|
+
And the file "cookbooks/apt/metadata.yaml" should contain exactly:
|
|
20
|
+
"""
|
|
21
|
+
name: apt
|
|
22
|
+
version: 1.0.0
|
|
23
|
+
dependencies: { }
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
Scenario: A simple Cheffile with one cookbook with one dependency
|
|
29
|
+
Given a file named "cookbook-sources/main/metadata.yaml" with:
|
|
30
|
+
"""
|
|
31
|
+
name: main
|
|
32
|
+
version: 1.0.0
|
|
33
|
+
dependencies:
|
|
34
|
+
sub: 1.0.0
|
|
35
|
+
"""
|
|
36
|
+
Given a file named "cookbook-sources/sub/metadata.yaml" with:
|
|
37
|
+
"""
|
|
38
|
+
name: sub
|
|
39
|
+
version: 1.0.0
|
|
40
|
+
dependencies: {}
|
|
41
|
+
"""
|
|
42
|
+
Given a file named "Cheffile" with:
|
|
43
|
+
"""
|
|
44
|
+
path 'cookbook-sources'
|
|
45
|
+
cookbook 'main'
|
|
46
|
+
"""
|
|
47
|
+
When I run `librarian-chef install --verbose`
|
|
48
|
+
Then the exit status should be 0
|
|
49
|
+
And the file "cookbooks/main/metadata.yaml" should contain exactly:
|
|
50
|
+
"""
|
|
51
|
+
name: main
|
|
52
|
+
version: 1.0.0
|
|
53
|
+
dependencies:
|
|
54
|
+
sub: 1.0.0
|
|
55
|
+
"""
|
|
56
|
+
And the file "cookbooks/sub/metadata.yaml" should contain exactly:
|
|
57
|
+
"""
|
|
58
|
+
name: sub
|
|
59
|
+
version: 1.0.0
|
|
60
|
+
dependencies: {}
|
|
61
|
+
"""
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
Feature: cli/show
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
Background: A simple Cheffile with one cookbook with one dependency
|
|
6
|
+
Given a file named "cookbook-sources/main/metadata.yaml" with:
|
|
7
|
+
"""
|
|
8
|
+
name: main
|
|
9
|
+
version: 1.0.0
|
|
10
|
+
dependencies:
|
|
11
|
+
sub: 1.0.0
|
|
12
|
+
"""
|
|
13
|
+
Given a file named "cookbook-sources/sub/metadata.yaml" with:
|
|
14
|
+
"""
|
|
15
|
+
name: sub
|
|
16
|
+
version: 1.0.0
|
|
17
|
+
dependencies: {}
|
|
18
|
+
"""
|
|
19
|
+
Given a file named "Cheffile" with:
|
|
20
|
+
"""
|
|
21
|
+
path 'cookbook-sources'
|
|
22
|
+
cookbook 'main'
|
|
23
|
+
"""
|
|
24
|
+
Given I run `librarian-chef install --quiet`
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
Scenario: Showing al without a lockfile
|
|
29
|
+
Given I remove the file "Cheffile.lock"
|
|
30
|
+
When I run `librarian-chef show`
|
|
31
|
+
Then the exit status should be 1
|
|
32
|
+
Then the output should contain exactly:
|
|
33
|
+
"""
|
|
34
|
+
Be sure to install first!
|
|
35
|
+
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
Scenario: Showing all
|
|
41
|
+
When I run `librarian-chef show`
|
|
42
|
+
Then the exit status should be 0
|
|
43
|
+
Then the output should contain exactly:
|
|
44
|
+
"""
|
|
45
|
+
main (1.0.0)
|
|
46
|
+
sub (1.0.0)
|
|
47
|
+
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
Scenario: Showing one without dependencies
|
|
53
|
+
When I run `librarian-chef show sub`
|
|
54
|
+
Then the exit status should be 0
|
|
55
|
+
Then the output should contain exactly:
|
|
56
|
+
"""
|
|
57
|
+
sub (1.0.0)
|
|
58
|
+
source: cookbook-sources
|
|
59
|
+
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
Scenario: Showing one with dependencies
|
|
65
|
+
When I run `librarian-chef show main`
|
|
66
|
+
Then the exit status should be 0
|
|
67
|
+
Then the output should contain exactly:
|
|
68
|
+
"""
|
|
69
|
+
main (1.0.0)
|
|
70
|
+
source: cookbook-sources
|
|
71
|
+
dependencies:
|
|
72
|
+
sub (= 1.0.0)
|
|
73
|
+
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'librarian/version'
|
|
2
|
+
require 'librarian/environment'
|
|
3
|
+
|
|
4
|
+
module Librarian
|
|
5
|
+
extend self
|
|
6
|
+
|
|
7
|
+
def environment_class
|
|
8
|
+
self::Environment
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def environment
|
|
12
|
+
@environment ||= environment_class.new
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def version
|
|
16
|
+
VERSION
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module Librarian
|
|
2
|
+
module Action
|
|
3
|
+
class Base
|
|
4
|
+
|
|
5
|
+
attr_accessor :environment
|
|
6
|
+
private :environment=
|
|
7
|
+
|
|
8
|
+
attr_accessor :options
|
|
9
|
+
private :options=
|
|
10
|
+
|
|
11
|
+
def initialize(environment, options = { })
|
|
12
|
+
self.environment = environment
|
|
13
|
+
self.options = options
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
|
|
18
|
+
def debug(*args, &block)
|
|
19
|
+
environment.logger.debug(*args, &block)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
require "librarian/action/base"
|
|
2
|
+
|
|
3
|
+
module Librarian
|
|
4
|
+
module Action
|
|
5
|
+
class Clean < Base
|
|
6
|
+
|
|
7
|
+
def run
|
|
8
|
+
clean_cache_path
|
|
9
|
+
clean_install_path
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def clean_cache_path
|
|
15
|
+
if cache_path.exist?
|
|
16
|
+
debug { "Deleting #{project_relative_path_to(cache_path)}" }
|
|
17
|
+
cache_path.rmtree
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def clean_install_path
|
|
22
|
+
if install_path.exist?
|
|
23
|
+
install_path.children.each do |c|
|
|
24
|
+
debug { "Deleting #{project_relative_path_to(c)}" }
|
|
25
|
+
c.rmtree unless c.file?
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def cache_path
|
|
31
|
+
environment.cache_path
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def install_path
|
|
35
|
+
environment.install_path
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def project_relative_path_to(path)
|
|
39
|
+
environment.project_relative_path_to(path)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require "librarian/error"
|
|
2
|
+
require "librarian/action/base"
|
|
3
|
+
|
|
4
|
+
module Librarian
|
|
5
|
+
module Action
|
|
6
|
+
class Ensure < Base
|
|
7
|
+
|
|
8
|
+
def run
|
|
9
|
+
raise Error, "Cannot find #{specfile_name}!" unless project_path
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def specfile_name
|
|
15
|
+
environment.specfile_name
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def project_path
|
|
19
|
+
environment.project_path
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
require "librarian/manifest_set"
|
|
2
|
+
require "librarian/spec_change_set"
|
|
3
|
+
require "librarian/action/base"
|
|
4
|
+
|
|
5
|
+
module Librarian
|
|
6
|
+
module Action
|
|
7
|
+
class Install < Base
|
|
8
|
+
|
|
9
|
+
def run
|
|
10
|
+
check_preconditions
|
|
11
|
+
|
|
12
|
+
perform_installation
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def check_preconditions
|
|
18
|
+
check_specfile
|
|
19
|
+
check_lockfile
|
|
20
|
+
check_consistent
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def check_specfile
|
|
24
|
+
raise Error, "#{specfile_name} missing!" unless specfile_path.exist?
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def check_lockfile
|
|
28
|
+
raise Error, "#{lockfile_name} missing!" unless lockfile_path.exist?
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def check_consistent
|
|
32
|
+
raise Error, "#{specfile_name} and #{lockfile_name} are out of sync!" unless spec_consistent_with_lock?
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def perform_installation
|
|
36
|
+
manifests = sorted_manifests
|
|
37
|
+
|
|
38
|
+
create_install_path
|
|
39
|
+
install_manifests(manifests)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def create_install_path
|
|
43
|
+
install_path.rmtree if install_path.exist? && destructive?
|
|
44
|
+
install_path.mkpath
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def install_manifests(manifests)
|
|
48
|
+
manifests.each do |manifest|
|
|
49
|
+
manifest.install!
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def sorted_manifests
|
|
54
|
+
ManifestSet.sort(lock.manifests)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def destructive?
|
|
58
|
+
environment.config_db.local['destructive'] == 'true'
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def specfile_name
|
|
62
|
+
environment.specfile_name
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def specfile_path
|
|
66
|
+
environment.specfile_path
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def lockfile_name
|
|
70
|
+
environment.lockfile_name
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def lockfile_path
|
|
74
|
+
environment.lockfile_path
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def spec
|
|
78
|
+
environment.spec
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def lock
|
|
82
|
+
environment.lock
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def spec_change_set(spec, lock)
|
|
86
|
+
SpecChangeSet.new(environment, spec, lock)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def spec_consistent_with_lock?
|
|
90
|
+
spec_change_set(spec, lock).same?
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def install_path
|
|
94
|
+
environment.install_path
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|