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.
Files changed (115) hide show
  1. data/.gitignore +3 -0
  2. data/LICENSE +20 -0
  3. data/README.md +187 -0
  4. data/bin/librarian-puppet +9 -0
  5. data/lib/librarian/puppet.rb +13 -0
  6. data/lib/librarian/puppet/cli.rb +85 -0
  7. data/lib/librarian/puppet/dsl.rb +16 -0
  8. data/lib/librarian/puppet/environment.rb +54 -0
  9. data/lib/librarian/puppet/extension.rb +41 -0
  10. data/lib/librarian/puppet/lockfile/parser.rb +53 -0
  11. data/lib/librarian/puppet/source.rb +4 -0
  12. data/lib/librarian/puppet/source/forge.rb +279 -0
  13. data/lib/librarian/puppet/source/git.rb +114 -0
  14. data/lib/librarian/puppet/source/githubtarball.rb +234 -0
  15. data/lib/librarian/puppet/source/local.rb +57 -0
  16. data/lib/librarian/puppet/source/path.rb +12 -0
  17. data/lib/librarian/puppet/templates/Puppetfile +10 -0
  18. data/lib/librarian/puppet/version.rb +5 -0
  19. data/vendor/librarian/CHANGELOG.md +185 -0
  20. data/vendor/librarian/Gemfile +6 -0
  21. data/vendor/librarian/MIT-LICENSE +20 -0
  22. data/vendor/librarian/README.md +403 -0
  23. data/vendor/librarian/Rakefile +34 -0
  24. data/vendor/librarian/bin/librarian-chef +7 -0
  25. data/vendor/librarian/bin/librarian-mock +7 -0
  26. data/vendor/librarian/config/cucumber.yaml +1 -0
  27. data/vendor/librarian/features/chef/cli/init.feature +11 -0
  28. data/vendor/librarian/features/chef/cli/install.feature +64 -0
  29. data/vendor/librarian/features/chef/cli/show.feature +77 -0
  30. data/vendor/librarian/features/chef/cli/version.feature +11 -0
  31. data/vendor/librarian/features/support/env.rb +9 -0
  32. data/vendor/librarian/lib/librarian.rb +19 -0
  33. data/vendor/librarian/lib/librarian/action.rb +5 -0
  34. data/vendor/librarian/lib/librarian/action/base.rb +24 -0
  35. data/vendor/librarian/lib/librarian/action/clean.rb +44 -0
  36. data/vendor/librarian/lib/librarian/action/ensure.rb +24 -0
  37. data/vendor/librarian/lib/librarian/action/install.rb +99 -0
  38. data/vendor/librarian/lib/librarian/action/resolve.rb +81 -0
  39. data/vendor/librarian/lib/librarian/action/update.rb +78 -0
  40. data/vendor/librarian/lib/librarian/chef.rb +1 -0
  41. data/vendor/librarian/lib/librarian/chef/cli.rb +48 -0
  42. data/vendor/librarian/lib/librarian/chef/dsl.rb +15 -0
  43. data/vendor/librarian/lib/librarian/chef/environment.rb +27 -0
  44. data/vendor/librarian/lib/librarian/chef/extension.rb +9 -0
  45. data/vendor/librarian/lib/librarian/chef/integration/knife.rb +42 -0
  46. data/vendor/librarian/lib/librarian/chef/manifest_reader.rb +59 -0
  47. data/vendor/librarian/lib/librarian/chef/source.rb +3 -0
  48. data/vendor/librarian/lib/librarian/chef/source/git.rb +25 -0
  49. data/vendor/librarian/lib/librarian/chef/source/local.rb +69 -0
  50. data/vendor/librarian/lib/librarian/chef/source/path.rb +12 -0
  51. data/vendor/librarian/lib/librarian/chef/source/site.rb +446 -0
  52. data/vendor/librarian/lib/librarian/chef/templates/Cheffile +15 -0
  53. data/vendor/librarian/lib/librarian/cli.rb +205 -0
  54. data/vendor/librarian/lib/librarian/cli/manifest_presenter.rb +79 -0
  55. data/vendor/librarian/lib/librarian/config.rb +7 -0
  56. data/vendor/librarian/lib/librarian/config/database.rb +205 -0
  57. data/vendor/librarian/lib/librarian/config/file_source.rb +47 -0
  58. data/vendor/librarian/lib/librarian/config/hash_source.rb +33 -0
  59. data/vendor/librarian/lib/librarian/config/source.rb +149 -0
  60. data/vendor/librarian/lib/librarian/dependency.rb +91 -0
  61. data/vendor/librarian/lib/librarian/dsl.rb +108 -0
  62. data/vendor/librarian/lib/librarian/dsl/receiver.rb +48 -0
  63. data/vendor/librarian/lib/librarian/dsl/target.rb +172 -0
  64. data/vendor/librarian/lib/librarian/environment.rb +134 -0
  65. data/vendor/librarian/lib/librarian/error.rb +4 -0
  66. data/vendor/librarian/lib/librarian/helpers.rb +13 -0
  67. data/vendor/librarian/lib/librarian/lockfile.rb +29 -0
  68. data/vendor/librarian/lib/librarian/lockfile/compiler.rb +66 -0
  69. data/vendor/librarian/lib/librarian/lockfile/parser.rb +100 -0
  70. data/vendor/librarian/lib/librarian/logger.rb +46 -0
  71. data/vendor/librarian/lib/librarian/manifest.rb +132 -0
  72. data/vendor/librarian/lib/librarian/manifest_set.rb +153 -0
  73. data/vendor/librarian/lib/librarian/mock.rb +1 -0
  74. data/vendor/librarian/lib/librarian/mock/cli.rb +19 -0
  75. data/vendor/librarian/lib/librarian/mock/dsl.rb +15 -0
  76. data/vendor/librarian/lib/librarian/mock/environment.rb +24 -0
  77. data/vendor/librarian/lib/librarian/mock/extension.rb +9 -0
  78. data/vendor/librarian/lib/librarian/mock/source.rb +1 -0
  79. data/vendor/librarian/lib/librarian/mock/source/mock.rb +97 -0
  80. data/vendor/librarian/lib/librarian/mock/source/mock/registry.rb +83 -0
  81. data/vendor/librarian/lib/librarian/resolution.rb +44 -0
  82. data/vendor/librarian/lib/librarian/resolver.rb +78 -0
  83. data/vendor/librarian/lib/librarian/resolver/implementation.rb +118 -0
  84. data/vendor/librarian/lib/librarian/source.rb +2 -0
  85. data/vendor/librarian/lib/librarian/source/git.rb +150 -0
  86. data/vendor/librarian/lib/librarian/source/git/repository.rb +217 -0
  87. data/vendor/librarian/lib/librarian/source/local.rb +61 -0
  88. data/vendor/librarian/lib/librarian/source/path.rb +74 -0
  89. data/vendor/librarian/lib/librarian/spec.rb +13 -0
  90. data/vendor/librarian/lib/librarian/spec_change_set.rb +173 -0
  91. data/vendor/librarian/lib/librarian/specfile.rb +18 -0
  92. data/vendor/librarian/lib/librarian/support/abstract_method.rb +21 -0
  93. data/vendor/librarian/lib/librarian/ui.rb +64 -0
  94. data/vendor/librarian/lib/librarian/version.rb +3 -0
  95. data/vendor/librarian/librarian.gemspec +34 -0
  96. data/vendor/librarian/spec/functional/chef/source/git_spec.rb +432 -0
  97. data/vendor/librarian/spec/functional/chef/source/site_spec.rb +215 -0
  98. data/vendor/librarian/spec/functional/source/git/repository_spec.rb +149 -0
  99. data/vendor/librarian/spec/unit/action/base_spec.rb +18 -0
  100. data/vendor/librarian/spec/unit/action/clean_spec.rb +102 -0
  101. data/vendor/librarian/spec/unit/action/ensure_spec.rb +37 -0
  102. data/vendor/librarian/spec/unit/action/install_spec.rb +111 -0
  103. data/vendor/librarian/spec/unit/config/database_spec.rb +319 -0
  104. data/vendor/librarian/spec/unit/dependency_spec.rb +36 -0
  105. data/vendor/librarian/spec/unit/dsl_spec.rb +194 -0
  106. data/vendor/librarian/spec/unit/environment_spec.rb +9 -0
  107. data/vendor/librarian/spec/unit/lockfile/parser_spec.rb +162 -0
  108. data/vendor/librarian/spec/unit/lockfile_spec.rb +65 -0
  109. data/vendor/librarian/spec/unit/manifest_set_spec.rb +202 -0
  110. data/vendor/librarian/spec/unit/manifest_spec.rb +36 -0
  111. data/vendor/librarian/spec/unit/mock/source/mock_spec.rb +22 -0
  112. data/vendor/librarian/spec/unit/resolver_spec.rb +192 -0
  113. data/vendor/librarian/spec/unit/source/git_spec.rb +29 -0
  114. data/vendor/librarian/spec/unit/spec_change_set_spec.rb +169 -0
  115. 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,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ lib = File.expand_path('../../lib', __FILE__)
4
+ $:.unshift(lib) unless $:.include?(lib)
5
+
6
+ require 'librarian/chef/cli'
7
+ Librarian::Chef::Cli.bin!
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ lib = File.expand_path('../../lib', __FILE__)
4
+ $:.unshift(lib) unless $:.include?(lib)
5
+
6
+ require 'librarian/mock/cli'
7
+ Librarian::Mock::Cli.bin!
@@ -0,0 +1 @@
1
+ default: --tags ~@wip --format progress
@@ -0,0 +1,11 @@
1
+ Feature: cli/init
2
+
3
+
4
+
5
+ Scenario: Initing a directory
6
+ When I run `librarian-chef init`
7
+ Then the exit status should be 0
8
+ Then a file named "Cheffile" should exist
9
+
10
+
11
+
@@ -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,11 @@
1
+ Feature: cli/version
2
+
3
+
4
+
5
+ Scenario: Getting the version
6
+ When I run `librarian-chef version`
7
+ Then the exit status should be 0
8
+ And the output should contain "librarian-"
9
+
10
+
11
+
@@ -0,0 +1,9 @@
1
+ require 'aruba/cucumber'
2
+
3
+ Before do
4
+ slow_boot = false
5
+ slow_boot ||= RUBY_PLATFORM == "java"
6
+ slow_boot ||= defined?(::Rubinius)
7
+
8
+ @aruba_timeout_seconds = slow_boot ? 5 : 2
9
+ end
@@ -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,5 @@
1
+ require "librarian/action/clean"
2
+ require "librarian/action/ensure"
3
+ require "librarian/action/install"
4
+ require "librarian/action/resolve"
5
+ require "librarian/action/update"
@@ -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