mojolingo-vagrant-librarian-puppet 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5bdb85b89f820e9de62b9c6f6cc91b4018aa7bc7
4
+ data.tar.gz: 4c8cadbec622b753a2703debb7782ea552800e6a
5
+ SHA512:
6
+ metadata.gz: ecd47f70ba43edb172c2d7abbfbed86d77405578b02d26934c4300c78df505780e335d554bed994a16071740f6fc459ac3df11a37e8b2b86efaeebac9fd66666
7
+ data.tar.gz: cdffb7db7105928297444d9ca7ab39e18b54696b630b8b44e8bde2b75c16acd815eab7712f0bf76433707117c3861d18c2b4c1db127209ad46566a298f2e31ba
@@ -0,0 +1,21 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ Puppetfile.lock
19
+ modules
20
+ .vagrant
21
+ .tmp
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem "vagrant", github: "mitchellh/vagrant"
7
+ gem "debugger"
8
+ end
9
+
10
+ group :plugins do
11
+ gem "mojolingo-vagrant-librarian-puppet", path: "."
12
+ end
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Jimmy Cuadra
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,61 @@
1
+ # vagrant-librarian-puppet
2
+
3
+ A [Vagrant](http://www.vagrantup.com/) plugin to install
4
+ [Puppet](http://docs.puppetlabs.com/#puppetpuppet) modules using
5
+ [Librarian-Puppet](https://github.com/rodjek/librarian-puppet).
6
+
7
+ ## Requirements
8
+
9
+ * Vagrant version 1.2.0 or greater.
10
+
11
+ ## Installation
12
+
13
+ ``` bash
14
+ vagrant plugin install vagrant-librarian-puppet
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ Vagrant will automatically run Librarian-Puppet before any provisioning step, so
20
+ simply set up your Puppetfile as you normally would.
21
+
22
+ You may specify the subdirectory within which to run `librarian-puppet`
23
+ using the `librarian_puppet.puppetfile_dir` config key. Please keep in mind
24
+ that you will need to explicitly set the `modules` path in the
25
+ `:puppet` provisioner and this path must exist before running vagrant commands.
26
+
27
+ **NOTE:** Since the puppet provisioner will fail if the path provided to
28
+ "puppet.modules" doesn't exist and librarian-puppet will destroy and recreate
29
+ the modules directory on each run, this plugin supports a placeholder file
30
+ within the modules directory that can be checked into version control and will
31
+ persist between provisions.
32
+
33
+ ```ruby
34
+ Vagrant.configure("2") do |config|
35
+
36
+ config.librarian_puppet.puppetfile_dir = "puppet"
37
+ # placeholder_filename defaults to .PLACEHOLDER
38
+ config.librarian_puppet.placeholder_filename = ".MYPLACEHOLDER"
39
+
40
+ config.vm.provision :puppet do |puppet|
41
+ puppet.modules = "puppet/modules"
42
+
43
+ ...
44
+
45
+ end
46
+ end
47
+ ```
48
+
49
+ ## Development
50
+
51
+ ``` bash
52
+ bundle
53
+ bundle exec vagrant up
54
+ ```
55
+
56
+ ## Acknowledgements
57
+
58
+ Thanks to @jimmycuadra and other contributors for their work on
59
+ [vagrant-librarian-chef](https://github.com/jimmycuadra/vagrant-librarian-chef).
60
+ This plugin made some slight changes to work with puppet, but largely just used
61
+ their code.
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- mode: ruby -*-
3
+ # vi: set ft=ruby :
4
+
5
+ Vagrant.configure('2') do |config|
6
+ config.vm.box = 'precise64'
7
+ config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
8
+
9
+ config.librarian_puppet.puppetfile_dir = 'puppet'
10
+ config.librarian_puppet.resolve_options = { :force => true }
11
+
12
+ config.vm.provision :puppet do |puppet|
13
+ puppet.manifests_path = 'manifests'
14
+ puppet.manifest_file = 'init.pp'
15
+ puppet.module_path = 'puppet/modules'
16
+ end
17
+
18
+ end
@@ -0,0 +1 @@
1
+ require "vagrant-librarian-puppet"
@@ -0,0 +1,2 @@
1
+ require "vagrant-librarian-puppet/version"
2
+ require "vagrant-librarian-puppet/plugin"
@@ -0,0 +1,71 @@
1
+ require 'librarian/puppet'
2
+ require 'librarian/action'
3
+
4
+ module VagrantPlugins
5
+ module LibrarianPuppet
6
+ module Action
7
+ class Install
8
+ def initialize(app, env)
9
+ @app = app
10
+ @env = env
11
+ # Config#finalize! SHOULD be called automatically
12
+ env[:machine].config.librarian_puppet.finalize!
13
+ end
14
+
15
+ def call(env)
16
+ config = env[:machine].config.librarian_puppet
17
+ if
18
+ provisioned? and
19
+ File.exist? File.join(env[:root_path], config.puppetfile_path)
20
+
21
+ env[:ui].info "Installing Puppet modules with Librarian-Puppet..."
22
+
23
+ # NB: Librarian::Puppet::Environment calls `which puppet` so we
24
+ # need to make sure VAGRANT_HOME/gems/bin has been added to the
25
+ # path.
26
+ original_path = ENV['PATH']
27
+ bin_path = env[:gems_path].join('bin')
28
+ ENV['PATH'] = "#{bin_path}#{::File::PATH_SEPARATOR}#{ENV['PATH']}"
29
+
30
+ # Determine if we need to persist placeholder file
31
+ placeholder_file = File.join(
32
+ env[:root_path],
33
+ config.puppetfile_dir,
34
+ 'modules',
35
+ config.placeholder_filename
36
+ )
37
+ if File.exist? placeholder_file
38
+ placeholder_contents = File.read(placeholder_file)
39
+ else
40
+ placeholder_contents = nil
41
+ end
42
+
43
+ environment = Librarian::Puppet::Environment.new({
44
+ :project_path => File.join(env[:root_path], config.puppetfile_dir)
45
+ })
46
+ Librarian::Action::Ensure.new(environment).run
47
+ Librarian::Action::Resolve.new(environment, config.resolve_options).run
48
+ Librarian::Action::Install.new(environment).run
49
+
50
+ # Restore the original path
51
+ ENV['PATH'] = original_path
52
+
53
+ # Persist placeholder if necessary
54
+ if placeholder_contents != nil
55
+ File.open(placeholder_file, 'w') { |file|
56
+ file.write(placeholder_contents)
57
+ }
58
+ end
59
+
60
+ end
61
+ @app.call(env)
62
+ end
63
+
64
+ def provisioned?
65
+ @env[:provision_enabled].nil? ? true : @env[:provision_enabled]
66
+ end
67
+
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,34 @@
1
+ module VagrantPlugins
2
+ module LibrarianPuppet
3
+ class Config < Vagrant.plugin(2, :config)
4
+ attr_accessor :puppetfile_dir
5
+ attr_accessor :placeholder_filename
6
+ attr_accessor :resolve_options
7
+
8
+ def initialize
9
+ @puppetfile_dir = UNSET_VALUE
10
+ @placeholder_filename = UNSET_VALUE
11
+ @resolve_options = UNSET_VALUE
12
+ end
13
+
14
+ def finalize!
15
+ @puppetfile_dir = '.' if @puppetfile_dir == UNSET_VALUE
16
+ @placeholder_filename = '.PLACEHOLDER' if @placeholder_filename == UNSET_VALUE
17
+ @resolve_options = {} if @resolve_options == UNSET_VALUE
18
+ end
19
+
20
+ def validate(machine)
21
+ errors = []
22
+ if not @resolve_options.kind_of?(Hash)
23
+ errors << '`resolve_options` must be a hash'
24
+ end
25
+ return { 'vagrant-librarian-puppet' => errors }
26
+ end
27
+
28
+ def puppetfile_path
29
+ @puppetfile_path ||= @puppetfile_dir ? File.join(@puppetfile_dir, 'Puppetfile') : 'Puppetfile'
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,28 @@
1
+ begin
2
+ require "vagrant"
3
+ rescue LoadError
4
+ abort "vagrant-librarian-puppet must be loaded in a Vagrant environment."
5
+ end
6
+
7
+ require "vagrant-librarian-puppet/action/librarian_puppet"
8
+
9
+
10
+ module VagrantPlugins
11
+ module LibrarianPuppet
12
+ class Plugin < Vagrant.plugin("2")
13
+ name "vagrant-librarian-puppet"
14
+ description <<-DESC
15
+ A Vagrant plugin to install Puppet modules using Librarian-Puppet.
16
+ DESC
17
+ action_hook "librarian_puppet" do |hook|
18
+ # XXX see if we can only hook so long as a command option isn't passed
19
+ hook.before Vagrant::Action::Builtin::Provision, Action::Install
20
+ end
21
+
22
+ config "librarian_puppet" do
23
+ require_relative "config"
24
+ Config
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,5 @@
1
+ module VagrantPlugins
2
+ module LibrarianPuppet
3
+ VERSION = "0.7.1"
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ class dev {
2
+
3
+ include git
4
+ include supervisor
5
+
6
+ }
7
+
8
+ include dev
@@ -0,0 +1,8 @@
1
+ # Manage Puppet module dependencies with librarian-puppet
2
+
3
+ forge 'http://forge.puppetlabs.com'
4
+
5
+ mod 'supervisor',
6
+ :git => 'git://github.com/eventbrite/puppet-supervisor.git'
7
+
8
+ mod 'puppetlabs/git'
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vagrant-librarian-puppet/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "mojolingo-vagrant-librarian-puppet"
8
+ spec.version = VagrantPlugins::LibrarianPuppet::VERSION
9
+ spec.authors = ["Michael Hahn"]
10
+ spec.email = ["mwhahn@gmail.com"]
11
+ spec.description = %q{A Vagrant plugin to install Puppet modules using Librarian-Puppet.}
12
+ spec.summary = %q{A Vagrant plugin to install Puppet modules using Librarian-Puppet.}
13
+ spec.homepage = "https://github.com/mhahn/vagrant-librarian-puppet"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency "librarian-puppet", "~> 1.0"
22
+ spec.add_runtime_dependency "librarian", "~> 0.1.2"
23
+ spec.add_runtime_dependency "puppet", "~> 3.4.3"
24
+ spec.add_development_dependency "bundler", "~> 1.3"
25
+ spec.add_development_dependency "rake"
26
+ spec.add_development_dependency "rspec"
27
+ end
metadata ADDED
@@ -0,0 +1,144 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mojolingo-vagrant-librarian-puppet
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.1
5
+ platform: ruby
6
+ authors:
7
+ - Michael Hahn
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: librarian-puppet
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: librarian
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.1.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.1.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: puppet
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.4.3
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.4.3
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.3'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: A Vagrant plugin to install Puppet modules using Librarian-Puppet.
98
+ email:
99
+ - mwhahn@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - Gemfile
106
+ - LICENSE.txt
107
+ - README.md
108
+ - Rakefile
109
+ - Vagrantfile
110
+ - lib/mojolingo-vagrant-librarian-puppet.rb
111
+ - lib/vagrant-librarian-puppet.rb
112
+ - lib/vagrant-librarian-puppet/action/librarian_puppet.rb
113
+ - lib/vagrant-librarian-puppet/config.rb
114
+ - lib/vagrant-librarian-puppet/plugin.rb
115
+ - lib/vagrant-librarian-puppet/version.rb
116
+ - manifests/init.pp
117
+ - puppet/Puppetfile
118
+ - vagrant-librarian-puppet.gemspec
119
+ homepage: https://github.com/mhahn/vagrant-librarian-puppet
120
+ licenses:
121
+ - MIT
122
+ metadata: {}
123
+ post_install_message:
124
+ rdoc_options: []
125
+ require_paths:
126
+ - lib
127
+ required_ruby_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ required_rubygems_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ requirements: []
138
+ rubyforge_project:
139
+ rubygems_version: 2.2.2
140
+ signing_key:
141
+ specification_version: 4
142
+ summary: A Vagrant plugin to install Puppet modules using Librarian-Puppet.
143
+ test_files: []
144
+ has_rdoc: