kitchen-puppet 0.0.16 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,29 +1,29 @@
1
- # encoding: utf-8
2
-
3
- $:.unshift File.expand_path('../lib', __FILE__)
4
- require 'kitchen-puppet/version'
5
-
6
- Gem::Specification.new do |s|
7
- s.name = "kitchen-puppet"
8
- s.version = Kitchen::Puppet::VERSION
9
- s.authors = ["Neill Turner"]
10
- s.email = ["neillwturner@gmail.com"]
11
- s.homepage = "https://github.com/neillturner/kitchen-puppet"
12
- s.summary = "puppet provisioner for test-kitchen"
13
- candidates = Dir.glob("{lib}/**/*") + ['README.md', 'provisioner_options.md', 'kitchen-puppet.gemspec']
14
- s.files = candidates.sort
15
- s.platform = Gem::Platform::RUBY
16
- s.require_paths = ['lib']
17
- s.rubyforge_project = '[none]'
18
- s.description = <<-EOF
19
- == DESCRIPTION:
20
-
21
- Puppet Provisioner for Test Kitchen
22
-
23
- == FEATURES:
24
-
25
- Supports puppet apply, puppet agent, hiera, hiera-eyaml, custom facts, librarian-puppet
26
-
27
- EOF
28
-
29
- end
1
+ # encoding: utf-8
2
+
3
+ $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
4
+ require 'kitchen-puppet/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = 'kitchen-puppet'
8
+ s.version = Kitchen::Puppet::VERSION
9
+ s.authors = ['Neill Turner']
10
+ s.email = ['neillwturner@gmail.com']
11
+ s.homepage = 'https://github.com/neillturner/kitchen-puppet'
12
+ s.summary = 'puppet provisioner for test-kitchen'
13
+ candidates = Dir.glob('{lib}/**/*') + ['README.md', 'provisioner_options.md', 'kitchen-puppet.gemspec']
14
+ s.files = candidates.sort
15
+ s.platform = Gem::Platform::RUBY
16
+ s.require_paths = ['lib']
17
+ s.rubyforge_project = '[none]'
18
+ s.description = <<-EOF
19
+ == DESCRIPTION:
20
+
21
+ Puppet Provisioner for Test Kitchen
22
+
23
+ == FEATURES:
24
+
25
+ Supports puppet apply, puppet agent, hiera, hiera-eyaml, custom facts, librarian-puppet
26
+
27
+ EOF
28
+
29
+ end
@@ -1,83 +1,78 @@
1
- # -*- encoding: utf-8 -*-
2
- #
3
- # Author:: Fletcher Nichol (<fnichol@nichol.ca>) Neill Turner (<neillwturner@gmail.com>)
4
- #
5
- # Copyright (C) 2013, Fletcher Nichol, Neill Turner
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
-
19
- require 'kitchen/errors'
20
- require 'kitchen/logging'
21
-
22
- module Kitchen
23
-
24
- module Provisioner
25
-
26
- module Puppet
27
-
28
- # Puppet module resolver that uses Librarian-Puppet and a Puppetfile to
29
- # calculate # dependencies.
30
- #
31
- class Librarian
32
-
33
- include Logging
34
-
35
-
36
- def initialize(puppetfile, path, logger = Kitchen.logger)
37
- @puppetfile = puppetfile
38
- @path = path
39
- @logger = logger
40
- end
41
-
42
- def self.load!(logger = Kitchen.logger)
43
- load_librarian!(logger)
44
- end
45
-
46
- def resolve
47
- version = ::Librarian::Puppet::VERSION
48
- info("Resolving module dependencies with Librarian-Puppet #{version}...")
49
- debug("Using Puppetfile from #{puppetfile}")
50
-
51
- env = ::Librarian::Puppet::Environment.new(
52
- :project_path => File.dirname(puppetfile))
53
- env.config_db.local["path"] = path
54
- ::Librarian::Action::Resolve.new(env).run
55
- ::Librarian::Action::Install.new(env).run
56
- end
57
-
58
- attr_reader :puppetfile, :path, :logger
59
-
60
- def self.load_librarian!(logger)
61
- first_load = require 'librarian/puppet'
62
- require 'librarian/puppet/environment'
63
- require 'librarian/action/resolve'
64
- require 'librarian/action/install'
65
-
66
- version = ::Librarian::Puppet::VERSION
67
- if first_load
68
- logger.debug("Librarian-Puppet #{version} library loaded")
69
- else
70
- logger.debug("Librarian-Puppet #{version} previously loaded")
71
- end
72
- rescue LoadError => e
73
- logger.fatal("The `librarian-puppet' gem is missing and must be installed" +
74
- " or cannot be properly activated. Run" +
75
- " `gem install librarian-puppet` or add the following to your" +
76
- " Gemfile if you are using Bundler: `gem 'librarian-puppet'`.")
77
- raise UserError,
78
- "Could not load or activate Librarian-Puppet (#{e.message})"
79
- end
80
- end
81
- end
82
- end
83
- end
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Fletcher Nichol (<fnichol@nichol.ca>) Neill Turner (<neillwturner@gmail.com>)
4
+ #
5
+ # Copyright (C) 2013, Fletcher Nichol, Neill Turner
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ require 'kitchen/errors'
20
+ require 'kitchen/logging'
21
+
22
+ module Kitchen
23
+ module Provisioner
24
+ module Puppet
25
+ # Puppet module resolver that uses Librarian-Puppet and a Puppetfile to
26
+ # calculate # dependencies.
27
+ #
28
+ class Librarian
29
+ include Logging
30
+
31
+ def initialize(puppetfile, path, logger = Kitchen.logger)
32
+ @puppetfile = puppetfile
33
+ @path = path
34
+ @logger = logger
35
+ end
36
+
37
+ def self.load!(logger = Kitchen.logger)
38
+ load_librarian!(logger)
39
+ end
40
+
41
+ def resolve
42
+ version = ::Librarian::Puppet::VERSION
43
+ info("Resolving module dependencies with Librarian-Puppet #{version}...")
44
+ debug("Using Puppetfile from #{puppetfile}")
45
+
46
+ env = ::Librarian::Puppet::Environment.new(
47
+ project_path: File.dirname(puppetfile))
48
+ env.config_db.local['path'] = path
49
+ ::Librarian::Action::Resolve.new(env).run
50
+ ::Librarian::Action::Install.new(env).run
51
+ end
52
+
53
+ attr_reader :puppetfile, :path, :logger
54
+
55
+ def self.load_librarian!(logger)
56
+ first_load = require 'librarian/puppet'
57
+ require 'librarian/puppet/environment'
58
+ require 'librarian/action/resolve'
59
+ require 'librarian/action/install'
60
+
61
+ version = ::Librarian::Puppet::VERSION
62
+ if first_load
63
+ logger.debug("Librarian-Puppet #{version} library loaded")
64
+ else
65
+ logger.debug("Librarian-Puppet #{version} previously loaded")
66
+ end
67
+ rescue LoadError => e
68
+ logger.fatal("The `librarian-puppet' gem is missing and must be installed" \
69
+ ' or cannot be properly activated. Run' \
70
+ ' `gem install librarian-puppet` or add the following to your' \
71
+ " Gemfile if you are using Bundler: `gem 'librarian-puppet'`.")
72
+ raise UserError,
73
+ "Could not load or activate Librarian-Puppet (#{e.message})"
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end