librarian-puppet-lmco 0.9.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.md +187 -0
- data/bin/librarian-puppet +9 -0
- data/lib/librarian/puppet.rb +22 -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 +47 -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 +348 -0
- data/lib/librarian/puppet/source/git.rb +121 -0
- data/lib/librarian/puppet/source/githubtarball.rb +249 -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 +224 -0
- data/vendor/librarian/Gemfile +6 -0
- data/vendor/librarian/MIT-LICENSE +20 -0
- data/vendor/librarian/README.md +401 -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 +11 -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 +95 -0
- data/vendor/librarian/lib/librarian/action/persist_resolution_mixin.rb +51 -0
- data/vendor/librarian/lib/librarian/action/resolve.rb +46 -0
- data/vendor/librarian/lib/librarian/action/update.rb +44 -0
- data/vendor/librarian/lib/librarian/chef.rb +1 -0
- data/vendor/librarian/lib/librarian/chef/cli.rb +47 -0
- data/vendor/librarian/lib/librarian/chef/dsl.rb +16 -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 +46 -0
- data/vendor/librarian/lib/librarian/chef/manifest_reader.rb +59 -0
- data/vendor/librarian/lib/librarian/chef/source.rb +4 -0
- data/vendor/librarian/lib/librarian/chef/source/git.rb +25 -0
- data/vendor/librarian/lib/librarian/chef/source/github.rb +27 -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 +442 -0
- data/vendor/librarian/lib/librarian/chef/templates/Cheffile +15 -0
- data/vendor/librarian/lib/librarian/cli.rb +223 -0
- data/vendor/librarian/lib/librarian/cli/manifest_presenter.rb +93 -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 +147 -0
- data/vendor/librarian/lib/librarian/dsl.rb +108 -0
- data/vendor/librarian/lib/librarian/dsl/receiver.rb +46 -0
- data/vendor/librarian/lib/librarian/dsl/target.rb +171 -0
- data/vendor/librarian/lib/librarian/environment.rb +182 -0
- data/vendor/librarian/lib/librarian/error.rb +4 -0
- data/vendor/librarian/lib/librarian/helpers.rb +13 -0
- data/vendor/librarian/lib/librarian/linter/source_linter.rb +55 -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 +123 -0
- data/vendor/librarian/lib/librarian/logger.rb +46 -0
- data/vendor/librarian/lib/librarian/manifest.rb +140 -0
- data/vendor/librarian/lib/librarian/manifest_set.rb +151 -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 +80 -0
- data/vendor/librarian/lib/librarian/mock/source/mock/registry.rb +83 -0
- data/vendor/librarian/lib/librarian/resolution.rb +46 -0
- data/vendor/librarian/lib/librarian/resolver.rb +81 -0
- data/vendor/librarian/lib/librarian/resolver/implementation.rb +223 -0
- data/vendor/librarian/lib/librarian/source.rb +2 -0
- data/vendor/librarian/lib/librarian/source/basic_api.rb +45 -0
- data/vendor/librarian/lib/librarian/source/git.rb +134 -0
- data/vendor/librarian/lib/librarian/source/git/repository.rb +217 -0
- data/vendor/librarian/lib/librarian/source/local.rb +54 -0
- data/vendor/librarian/lib/librarian/source/path.rb +56 -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 +17 -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 +35 -0
- data/vendor/librarian/spec/functional/chef/cli_spec.rb +194 -0
- data/vendor/librarian/spec/functional/chef/source/git_spec.rb +432 -0
- data/vendor/librarian/spec/functional/chef/source/site_spec.rb +266 -0
- data/vendor/librarian/spec/functional/source/git/repository_spec.rb +150 -0
- data/vendor/librarian/spec/integration/chef/source/git_spec.rb +441 -0
- data/vendor/librarian/spec/integration/chef/source/site_spec.rb +217 -0
- data/vendor/librarian/spec/support/cli_macro.rb +114 -0
- data/vendor/librarian/spec/support/method_patch_macro.rb +30 -0
- data/vendor/librarian/spec/support/with_env_macro.rb +20 -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 +327 -0
- data/vendor/librarian/spec/unit/dependency_spec.rb +212 -0
- data/vendor/librarian/spec/unit/dsl_spec.rb +173 -0
- data/vendor/librarian/spec/unit/environment_spec.rb +173 -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 +233 -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 +220 -0
@@ -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,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,95 @@
|
|
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?
|
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 specfile_name
|
58
|
+
environment.specfile_name
|
59
|
+
end
|
60
|
+
|
61
|
+
def specfile_path
|
62
|
+
environment.specfile_path
|
63
|
+
end
|
64
|
+
|
65
|
+
def lockfile_name
|
66
|
+
environment.lockfile_name
|
67
|
+
end
|
68
|
+
|
69
|
+
def lockfile_path
|
70
|
+
environment.lockfile_path
|
71
|
+
end
|
72
|
+
|
73
|
+
def spec
|
74
|
+
environment.spec
|
75
|
+
end
|
76
|
+
|
77
|
+
def lock
|
78
|
+
environment.lock
|
79
|
+
end
|
80
|
+
|
81
|
+
def spec_change_set(spec, lock)
|
82
|
+
SpecChangeSet.new(environment, spec, lock)
|
83
|
+
end
|
84
|
+
|
85
|
+
def spec_consistent_with_lock?
|
86
|
+
spec_change_set(spec, lock).same?
|
87
|
+
end
|
88
|
+
|
89
|
+
def install_path
|
90
|
+
environment.install_path
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require "librarian/error"
|
2
|
+
require "librarian/spec_change_set"
|
3
|
+
|
4
|
+
module Librarian
|
5
|
+
module Action
|
6
|
+
module PersistResolutionMixin
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def persist_resolution(resolution)
|
11
|
+
resolution.correct? or raise Error,
|
12
|
+
"Could not resolve the dependencies."
|
13
|
+
|
14
|
+
lockfile_text = lockfile.save(resolution)
|
15
|
+
debug { "Bouncing #{lockfile_name}" }
|
16
|
+
bounced_lockfile_text = lockfile.save(lockfile.load(lockfile_text))
|
17
|
+
unless bounced_lockfile_text == lockfile_text
|
18
|
+
debug { "lockfile_text: \n#{lockfile_text}" }
|
19
|
+
debug { "bounced_lockfile_text: \n#{bounced_lockfile_text}" }
|
20
|
+
raise Error, "Cannot bounce #{lockfile_name}!"
|
21
|
+
end
|
22
|
+
lockfile_path.open('wb') { |f| f.write(lockfile_text) }
|
23
|
+
end
|
24
|
+
|
25
|
+
def specfile_name
|
26
|
+
environment.specfile_name
|
27
|
+
end
|
28
|
+
|
29
|
+
def lockfile_name
|
30
|
+
environment.lockfile_name
|
31
|
+
end
|
32
|
+
|
33
|
+
def specfile_path
|
34
|
+
environment.specfile_path
|
35
|
+
end
|
36
|
+
|
37
|
+
def lockfile_path
|
38
|
+
environment.lockfile_path
|
39
|
+
end
|
40
|
+
|
41
|
+
def specfile
|
42
|
+
environment.specfile
|
43
|
+
end
|
44
|
+
|
45
|
+
def lockfile
|
46
|
+
environment.lockfile
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|