vagrant-boxen 0.0.1
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 +21 -0
- data/.rspec +2 -0
- data/.travis.yml +7 -0
- data/Gemfile +9 -0
- data/Guardfile +5 -0
- data/LICENSE.txt +22 -0
- data/Puppetfile +3 -0
- data/Puppetfile.lock +10 -0
- data/README.md +63 -0
- data/Rakefile +22 -0
- data/Vagrantfile +13 -0
- data/lib/vagrant-boxen/provisioner.rb +54 -0
- data/lib/vagrant-boxen/version.rb +5 -0
- data/lib/vagrant-boxen.rb +13 -0
- data/lib/vagrant_init.rb +1 -0
- data/puppet/modules/README.md +2 -0
- data/puppet/modules/memcached/.fixtures.yml +3 -0
- data/puppet/modules/memcached/.gemfile +5 -0
- data/puppet/modules/memcached/LICENSE +13 -0
- data/puppet/modules/memcached/Modulefile +8 -0
- data/puppet/modules/memcached/README-DEVELOPER +9 -0
- data/puppet/modules/memcached/README.md +40 -0
- data/puppet/modules/memcached/lib/puppet/parser/functions/memcached_max_memory.rb +38 -0
- data/puppet/modules/memcached/manifests/init.pp +42 -0
- data/puppet/modules/memcached/manifests/params.pp +23 -0
- data/puppet/modules/memcached/templates/memcached.conf.erb +47 -0
- data/puppet/modules/memcached/templates/memcached_sysconfig.erb +21 -0
- data/spec/spec_helper.rb +32 -0
- data/spec/unit/provisioner_spec.rb +56 -0
- data/vagrant-boxen.gemspec +27 -0
- metadata +174 -0
data/.gitignore
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
.librarian/
|
7
|
+
Gemfile.lock
|
8
|
+
InstalledFiles
|
9
|
+
_yardoc
|
10
|
+
coverage
|
11
|
+
doc/
|
12
|
+
lib/bundler/man
|
13
|
+
pkg
|
14
|
+
rdoc
|
15
|
+
spec/reports
|
16
|
+
test/tmp
|
17
|
+
test/version_tmp
|
18
|
+
tmp
|
19
|
+
.vagrant
|
20
|
+
.tmp/
|
21
|
+
coverage/
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Fabio Rehm
|
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.
|
data/Puppetfile
ADDED
data/Puppetfile.lock
ADDED
data/README.md
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# Vagrant::Boxen
|
2
|
+
|
3
|
+
[](https://travis-ci.org/fgrehm/vagrant-boxen)
|
4
|
+
[](https://codeclimate.com/github/fgrehm/vagrant-boxen)
|
5
|
+
|
6
|
+
Inspired by [Rails Wizard](http://railswizard.org/) and GitHub's
|
7
|
+
[Boxen](http://boxen.github.com/), this gem attempts to lower the "entry barrier"
|
8
|
+
of getting a manageable Vagrant machine targetted for development up and
|
9
|
+
running without the need to learn [Puppet](https://puppetlabs.com/puppet/what-is-puppet/)
|
10
|
+
or [Chef](http://www.opscode.com/chef/).
|
11
|
+
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
If you use the gem version of Vagrant, use:
|
16
|
+
|
17
|
+
```terminal
|
18
|
+
$ gem install vagrant-boxen
|
19
|
+
```
|
20
|
+
|
21
|
+
otherwise, use:
|
22
|
+
|
23
|
+
```terminal
|
24
|
+
$ vagrant gem install vagrant-boxen
|
25
|
+
```
|
26
|
+
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
For now, the only module available is `memcached` and you can set it up on your
|
31
|
+
`Vagrantfile` with:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
Vagrant::Config.run do |config|
|
35
|
+
# ... other settings ...
|
36
|
+
config.vm.provision Vagrant::Boxen::Provisioner do |boxen|
|
37
|
+
boxen.memcached!
|
38
|
+
end
|
39
|
+
end
|
40
|
+
```
|
41
|
+
|
42
|
+
While the modules provided might work on most linux distributions, I'm testing
|
43
|
+
it all the time on a Ubuntu 12.10 64bits box based on https://github.com/downloads/roderik/VagrantQuantal64Box/quantal64.box
|
44
|
+
|
45
|
+
To find out more about the planned functionality, check out the
|
46
|
+
[project's issues](https://github.com/fgrehm/vagrant-boxen/issues).
|
47
|
+
|
48
|
+
|
49
|
+
## How does it work?
|
50
|
+
|
51
|
+
Under the hood, [`Vagrant::Boxen::Provisioner`](https://github.com/fgrehm/vagrant-boxen/blob/master/lib/vagrant-boxen/provisioner.rb)
|
52
|
+
will take care of generating the puppet manifest that will get passed to an instance of
|
53
|
+
[`Vagrant::Provisioners::Puppet`](https://github.com/mitchellh/vagrant/blob/1-0-stable/lib/vagrant/provisioners/puppet.rb)
|
54
|
+
and will be applied to the guest machine.
|
55
|
+
|
56
|
+
|
57
|
+
## Contributing
|
58
|
+
|
59
|
+
1. Fork it
|
60
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
61
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
62
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
63
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
|
3
|
+
task :update do
|
4
|
+
require 'fileutils'
|
5
|
+
sh 'librarian-puppet install --path="puppet/modules" --strip-dot-git --clean --verbose'
|
6
|
+
Dir['./puppet/modules/*/{.git,.gitignore,tests,spec,Rakefile,.travis.yml}'].each do |path|
|
7
|
+
FileUtils.rm_rf path
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
begin
|
12
|
+
require 'rspec/core/rake_task'
|
13
|
+
RSpec::Core::RakeTask.new(:spec)
|
14
|
+
|
15
|
+
desc 'Run specs with code coverage enabled'
|
16
|
+
task :coverage do
|
17
|
+
ENV['COVERAGE'] = 'true'
|
18
|
+
Rake::Task["spec"].execute
|
19
|
+
end
|
20
|
+
|
21
|
+
task :default => :coverage
|
22
|
+
rescue LoadError; end
|
data/Vagrantfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
require './lib/vagrant-boxen'
|
5
|
+
|
6
|
+
Vagrant::Config.run do |config|
|
7
|
+
config.vm.box = "quantal64"
|
8
|
+
config.vm.box_url = "https://github.com/downloads/roderik/VagrantQuantal64Box/quantal64.box"
|
9
|
+
|
10
|
+
config.vm.provision Vagrant::Boxen::Provisioner do |boxen|
|
11
|
+
boxen.memcached!
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Vagrant
|
2
|
+
module Boxen
|
3
|
+
class Provisioner < Vagrant::Provisioners::Base
|
4
|
+
class Config < Vagrant::Config::Base
|
5
|
+
def memcached!
|
6
|
+
@memcached = true
|
7
|
+
end
|
8
|
+
|
9
|
+
def memcached?
|
10
|
+
@memcached
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.config_class
|
15
|
+
Config
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize(env, config, provisioner = nil)
|
19
|
+
super(env, config)
|
20
|
+
@logger = Log4r::Logger.new("vagrant::provisioners::boxen")
|
21
|
+
@manifests_dir = "/tmp/vagrant-boxen-#{env['vm'].uuid}"
|
22
|
+
@puppet_provisioner = provisioner ? provisioner : setup_puppet_provisioner
|
23
|
+
end
|
24
|
+
|
25
|
+
def prepare
|
26
|
+
Dir.mkdir @manifests_dir unless Dir.exists? @manifests_dir
|
27
|
+
if config.memcached?
|
28
|
+
File.open("#{@manifests_dir}/site.pp", 'w') { |f| f.print "class { 'memcached': }" }
|
29
|
+
else
|
30
|
+
File.open("#{@manifests_dir}/site.pp", 'w') { |f| f.print "" }
|
31
|
+
end
|
32
|
+
@puppet_provisioner.prepare
|
33
|
+
end
|
34
|
+
|
35
|
+
def provision!
|
36
|
+
@puppet_provisioner.provision!
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def setup_puppet_provisioner
|
42
|
+
config = Vagrant::Provisioners::Puppet::Config.new
|
43
|
+
config.manifests_path = @manifests_dir
|
44
|
+
config.manifest_file = "site.pp"
|
45
|
+
config.module_path = File.join(File.expand_path('../../../', __FILE__), 'puppet/modules')
|
46
|
+
# The root path to be used on the guest machine, changed to avoid
|
47
|
+
# collision with the default path for puppet provisioner
|
48
|
+
config.pp_path = '/tmp/vagrant-boxen-puppet'
|
49
|
+
config.options << [ '--verbose', '--debug '] if ENV['DEBUG'] == '1'
|
50
|
+
Vagrant::Provisioners::Puppet.new(env, config)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'vagrant'
|
2
|
+
|
3
|
+
if File.exists?(File.join(File.expand_path('../../', __FILE__), '.git'))
|
4
|
+
$:.unshift(File.expand_path('../../lib', __FILE__))
|
5
|
+
end
|
6
|
+
|
7
|
+
require "vagrant-boxen/version"
|
8
|
+
require "vagrant-boxen/provisioner"
|
9
|
+
|
10
|
+
module Vagrant
|
11
|
+
module Boxen
|
12
|
+
end
|
13
|
+
end
|
data/lib/vagrant_init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'vagrant-boxen'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright 2011 Steffen Zieger
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
@@ -0,0 +1,8 @@
|
|
1
|
+
name 'saz-memcached'
|
2
|
+
version '2.1.0'
|
3
|
+
source 'git://github.com/saz/puppet-memcached.git'
|
4
|
+
author 'saz'
|
5
|
+
license 'Apache License, Version 2.0'
|
6
|
+
summary 'UNKNOWN'
|
7
|
+
description 'Manage memcached via Puppet'
|
8
|
+
project_page 'https://github.com/saz/puppet-memcached'
|
@@ -0,0 +1,9 @@
|
|
1
|
+
In order to run tests:
|
2
|
+
- puppet and facter must be installed and available in Ruby's LOADPATH
|
3
|
+
- the latest revision of rspec-puppet must be installed
|
4
|
+
- rake, and rspec2 must be install
|
5
|
+
|
6
|
+
- the name of the module directory needs to be memcached
|
7
|
+
|
8
|
+
to run all tests:
|
9
|
+
rake spec
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# puppet-memcached
|
2
|
+
|
3
|
+
[](http://travis-ci.org/saz/puppet-memcached)
|
4
|
+
|
5
|
+
Manage memcached via Puppet
|
6
|
+
|
7
|
+
## How to use
|
8
|
+
|
9
|
+
### Use roughly 90% of memory
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
class { 'memcached': }
|
13
|
+
```
|
14
|
+
|
15
|
+
### Set a fixed memory limit in MB
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
class { 'memcached':
|
19
|
+
max_memory => 2048
|
20
|
+
}
|
21
|
+
```
|
22
|
+
|
23
|
+
### Use 12% of available memory
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
class { 'memcached':
|
27
|
+
max_memory => '12%'
|
28
|
+
}
|
29
|
+
```
|
30
|
+
|
31
|
+
### Other class parameters
|
32
|
+
|
33
|
+
* $logfile = '/var/log/memcached.log'
|
34
|
+
* $listen_ip = '0.0.0.0'
|
35
|
+
* $tcp_port = 11211
|
36
|
+
* $udp_port = 11211
|
37
|
+
* $user = '' (OS specific setting, see params.pp)
|
38
|
+
* $max_connections = 8192
|
39
|
+
* $lock_memory = false (WARNING: good if used intelligently, google for -k key)
|
40
|
+
* $install_dev = false (TRUE if 'libmemcached-dev' package should be installed)
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Puppet::Parser::Functions
|
2
|
+
newfunction(:memcached_max_memory, :type => :rvalue, :doc => <<-EOS
|
3
|
+
Calculate max_memory size from fact 'memsize' and passed argument.
|
4
|
+
EOS
|
5
|
+
) do |arguments|
|
6
|
+
|
7
|
+
raise(Puppet::ParseError, "memcached_max_memory(): " +
|
8
|
+
"Wrong number of arguments given " +
|
9
|
+
"(#{arguments.size} for 1)") if arguments.size != 1
|
10
|
+
|
11
|
+
arg = arguments[0]
|
12
|
+
memsize = lookupvar('memorysize')
|
13
|
+
|
14
|
+
if arg and !arg.to_s.end_with?('%')
|
15
|
+
result_in_mb = arg.to_i
|
16
|
+
else
|
17
|
+
max_memory_percent = arg ? arg : '95%'
|
18
|
+
|
19
|
+
# Taken from puppetlabs-stdlib to_bytes() function
|
20
|
+
value,prefix = */([0-9.e+-]*)\s*([^bB]?)/.match(memsize)[1,2]
|
21
|
+
|
22
|
+
value = value.to_f
|
23
|
+
case prefix
|
24
|
+
when '' then value = value
|
25
|
+
when 'k' then value *= (1<<10)
|
26
|
+
when 'M' then value *= (1<<20)
|
27
|
+
when 'G' then value *= (1<<30)
|
28
|
+
when 'T' then value *= (1<<40)
|
29
|
+
when 'E' then value *= (1<<50)
|
30
|
+
else raise Puppet::ParseError, "memcached_max_memory(): Unknown prefix #{prefix}"
|
31
|
+
end
|
32
|
+
value = value.to_i
|
33
|
+
result_in_mb = ( (value / (1 << 20) ) * (max_memory_percent.to_f / 100.0) ).floor
|
34
|
+
end
|
35
|
+
|
36
|
+
return result_in_mb
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
class memcached(
|
2
|
+
$package_ensure = 'present',
|
3
|
+
$logfile = '/var/log/memcached.log',
|
4
|
+
$max_memory = false,
|
5
|
+
$lock_memory = false,
|
6
|
+
$listen_ip = '0.0.0.0',
|
7
|
+
$tcp_port = 11211,
|
8
|
+
$udp_port = 11211,
|
9
|
+
$user = $::memcached::params::user,
|
10
|
+
$max_connections = '8192',
|
11
|
+
$verbosity = undef,
|
12
|
+
$unix_socket = undef,
|
13
|
+
$install_dev = false
|
14
|
+
) inherits memcached::params {
|
15
|
+
|
16
|
+
package { $memcached::params::package_name:
|
17
|
+
ensure => $package_ensure,
|
18
|
+
}
|
19
|
+
|
20
|
+
if $install_dev {
|
21
|
+
package { $memcached::params::dev_package_name:
|
22
|
+
ensure => $package_ensure,
|
23
|
+
require => Package[$memcached::params::package_name]
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
file { $memcached::params::config_file:
|
28
|
+
owner => 'root',
|
29
|
+
group => 'root',
|
30
|
+
mode => '0644',
|
31
|
+
content => template($memcached::params::config_tmpl),
|
32
|
+
require => Package[$memcached::params::package_name],
|
33
|
+
}
|
34
|
+
|
35
|
+
service { $memcached::params::service_name:
|
36
|
+
ensure => running,
|
37
|
+
enable => true,
|
38
|
+
hasrestart => true,
|
39
|
+
hasstatus => false,
|
40
|
+
subscribe => File[$memcached::params::config_file],
|
41
|
+
}
|
42
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class memcached::params {
|
2
|
+
case $::osfamily {
|
3
|
+
'Debian': {
|
4
|
+
$package_name = 'memcached'
|
5
|
+
$service_name = 'memcached'
|
6
|
+
$dev_package_name = 'libmemcached-dev'
|
7
|
+
$config_file = '/etc/memcached.conf'
|
8
|
+
$config_tmpl = "$module_name/memcached.conf.erb"
|
9
|
+
$user = 'nobody'
|
10
|
+
}
|
11
|
+
'RedHat': {
|
12
|
+
$package_name = 'memcached'
|
13
|
+
$service_name = 'memcached'
|
14
|
+
$dev_package_name = 'libmemcached-devel'
|
15
|
+
$config_file = '/etc/sysconfig/memcached'
|
16
|
+
$config_tmpl = "$module_name/memcached_sysconfig.erb"
|
17
|
+
$user = 'memcached'
|
18
|
+
}
|
19
|
+
default: {
|
20
|
+
fail("Unsupported platform: ${::osfamily}")
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# File managed by puppet
|
2
|
+
|
3
|
+
# Run memcached as a daemon.
|
4
|
+
-d
|
5
|
+
|
6
|
+
# pidfile
|
7
|
+
-P /var/run/memcached.pid
|
8
|
+
|
9
|
+
# Log memcached's output
|
10
|
+
logfile <%= logfile -%>
|
11
|
+
|
12
|
+
<% if @verbosity -%>
|
13
|
+
# Verbosity
|
14
|
+
-<%= verbosity %>
|
15
|
+
<% end -%>
|
16
|
+
|
17
|
+
# Use <num> MB memory max to use for object storage.
|
18
|
+
<% Puppet::Parser::Functions.function('memcached_max_memory') -%>
|
19
|
+
-m <%= scope.function_memcached_max_memory([max_memory]) %>
|
20
|
+
|
21
|
+
<% if @lock_memory -%>
|
22
|
+
# Lock down all paged memory. There is a limit on how much memory you may lock.
|
23
|
+
-k
|
24
|
+
<% end -%>
|
25
|
+
|
26
|
+
<% if @unix_socket -%>
|
27
|
+
# UNIX socket path to listen on
|
28
|
+
-s <%= unix_socket %>
|
29
|
+
<% else -%>
|
30
|
+
# IP to listen on
|
31
|
+
-l <%= listen_ip %>
|
32
|
+
|
33
|
+
# TCP port to listen on
|
34
|
+
-p <%= tcp_port %>
|
35
|
+
|
36
|
+
# UDP port to listen on
|
37
|
+
-U <%= udp_port %>
|
38
|
+
<% end -%>
|
39
|
+
|
40
|
+
# Run daemon as user
|
41
|
+
-u <%= user %>
|
42
|
+
|
43
|
+
# Limit the number of simultaneous incoming connections.
|
44
|
+
-c <%= max_connections %>
|
45
|
+
|
46
|
+
# Number of threads to use to process incoming requests.
|
47
|
+
-t <%= processorcount %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
PORT="<%= tcp_port %>"
|
2
|
+
USER="<%= user %>"
|
3
|
+
MAXCONN="<%= max_connections %>"
|
4
|
+
<% Puppet::Parser::Functions.function('memcached_max_memory') -%>
|
5
|
+
CACHESIZE="<%= scope.function_memcached_max_memory([max_memory]) %>"
|
6
|
+
OPTIONS="<%
|
7
|
+
result = []
|
8
|
+
if @verbosity
|
9
|
+
result << '-' + verbosity
|
10
|
+
end
|
11
|
+
if @lock_memory
|
12
|
+
result << '-k'
|
13
|
+
end
|
14
|
+
if @listen_ip
|
15
|
+
result << '-l ' + listen_ip
|
16
|
+
end
|
17
|
+
if @udp_port
|
18
|
+
result << '-U ' + udp_port
|
19
|
+
end
|
20
|
+
result << '-t ' + processorcount
|
21
|
+
-%><%= result.join(' ') -%>"
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
if ENV['COVERAGE']
|
4
|
+
require 'simplecov'
|
5
|
+
SimpleCov.start
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'bundler/setup'
|
9
|
+
|
10
|
+
Bundler.require
|
11
|
+
|
12
|
+
require 'rspec-spies'
|
13
|
+
|
14
|
+
require 'rspec/fire'
|
15
|
+
RSpec::Fire.configure do |config|
|
16
|
+
config.verify_constant_names = true
|
17
|
+
end
|
18
|
+
|
19
|
+
RSpec.configure do |config|
|
20
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
21
|
+
config.run_all_when_everything_filtered = true
|
22
|
+
config.filter_run :focus
|
23
|
+
|
24
|
+
# Run specs in random order to surface order dependencies. If you find an
|
25
|
+
# order dependency and want to debug it, you can fix the order by providing
|
26
|
+
# the seed, which is printed after each run.
|
27
|
+
# --seed 1234
|
28
|
+
config.order = 'random'
|
29
|
+
|
30
|
+
config.include Vagrant::TestHelpers
|
31
|
+
config.include RSpec::Fire
|
32
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Vagrant::Boxen::Provisioner do
|
4
|
+
let(:uuid) { 'box-uuid' }
|
5
|
+
let(:config) { described_class::Config.new }
|
6
|
+
let(:puppet_manifests_path) { "/tmp/vagrant-boxen-#{uuid}" }
|
7
|
+
let(:puppet_module_path) { File.join(File.expand_path('../../../', __FILE__), 'puppet/modules') }
|
8
|
+
|
9
|
+
before do
|
10
|
+
@app, @env = action_env(vagrant_env.vms.values.first.env)
|
11
|
+
@env['vm'].stub(:uuid => uuid)
|
12
|
+
end
|
13
|
+
|
14
|
+
subject { described_class.new(@env, config) }
|
15
|
+
|
16
|
+
describe 'inner puppet provisioner configuration' do
|
17
|
+
# REFACTOR: This is way too much coupling
|
18
|
+
let(:puppet_config) { subject.instance_variable_get(:@puppet_provisioner).config }
|
19
|
+
|
20
|
+
it 'sets module path to vendored puppet modules' do
|
21
|
+
puppet_config.module_path.should == puppet_module_path
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'sets the manifest path to the tmp folder' do
|
25
|
+
puppet_config.manifests_path.should == puppet_manifests_path
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'provisioner flow' do
|
30
|
+
let(:puppet) { fire_double('Vagrant::Provisioners::Puppet', :prepare => true, :provision! => true) }
|
31
|
+
subject { described_class.new(@env, config, puppet) }
|
32
|
+
|
33
|
+
context 'preparation' do
|
34
|
+
before { subject.prepare }
|
35
|
+
|
36
|
+
it 'generates box manifest on tmp folder based on enabled modules' do
|
37
|
+
File.read("#{puppet_manifests_path}/site.pp").should_not =~ /memcached/
|
38
|
+
config.memcached!
|
39
|
+
subject.prepare
|
40
|
+
File.read("#{puppet_manifests_path}/site.pp").should =~ /memcached/
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'delegates to puppet provisioner' do
|
44
|
+
puppet.should have_received(:prepare)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'provisioning' do
|
49
|
+
before { subject.provision! }
|
50
|
+
|
51
|
+
it 'delegates to puppet provisioner' do
|
52
|
+
puppet.should have_received(:provision!)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'vagrant-boxen/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "vagrant-boxen"
|
8
|
+
gem.version = Vagrant::Boxen::VERSION
|
9
|
+
gem.authors = ["Fabio Rehm"]
|
10
|
+
gem.email = ["fgrehm@gmail.com"]
|
11
|
+
gem.description = %q{Easier vagrant development boxes creation}
|
12
|
+
gem.summary = gem.description
|
13
|
+
gem.homepage = "https://github.com/fgrehm/vagrant-boxen"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_dependency 'vagrant'
|
21
|
+
|
22
|
+
gem.add_development_dependency 'rspec'
|
23
|
+
gem.add_development_dependency 'rspec-spies'
|
24
|
+
gem.add_development_dependency 'rspec-fire'
|
25
|
+
gem.add_development_dependency 'simplecov'
|
26
|
+
gem.add_development_dependency 'librarian-puppet'
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,174 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-boxen
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Fabio Rehm
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-02-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
type: :runtime
|
16
|
+
name: vagrant
|
17
|
+
prerelease: false
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
none: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ! '>='
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '0'
|
29
|
+
none: false
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
type: :development
|
32
|
+
name: rspec
|
33
|
+
prerelease: false
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
none: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
none: false
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
type: :development
|
48
|
+
name: rspec-spies
|
49
|
+
prerelease: false
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
none: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ! '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
none: false
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
type: :development
|
64
|
+
name: rspec-fire
|
65
|
+
prerelease: false
|
66
|
+
requirement: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
none: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
none: false
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
type: :development
|
80
|
+
name: simplecov
|
81
|
+
prerelease: false
|
82
|
+
requirement: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
none: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ! '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
none: false
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
type: :development
|
96
|
+
name: librarian-puppet
|
97
|
+
prerelease: false
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
none: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ! '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
none: false
|
110
|
+
description: Easier vagrant development boxes creation
|
111
|
+
email:
|
112
|
+
- fgrehm@gmail.com
|
113
|
+
executables: []
|
114
|
+
extensions: []
|
115
|
+
extra_rdoc_files: []
|
116
|
+
files:
|
117
|
+
- .gitignore
|
118
|
+
- .rspec
|
119
|
+
- .travis.yml
|
120
|
+
- Gemfile
|
121
|
+
- Guardfile
|
122
|
+
- LICENSE.txt
|
123
|
+
- Puppetfile
|
124
|
+
- Puppetfile.lock
|
125
|
+
- README.md
|
126
|
+
- Rakefile
|
127
|
+
- Vagrantfile
|
128
|
+
- lib/vagrant-boxen.rb
|
129
|
+
- lib/vagrant-boxen/provisioner.rb
|
130
|
+
- lib/vagrant-boxen/version.rb
|
131
|
+
- lib/vagrant_init.rb
|
132
|
+
- puppet/modules/README.md
|
133
|
+
- puppet/modules/memcached/.fixtures.yml
|
134
|
+
- puppet/modules/memcached/.gemfile
|
135
|
+
- puppet/modules/memcached/LICENSE
|
136
|
+
- puppet/modules/memcached/Modulefile
|
137
|
+
- puppet/modules/memcached/README-DEVELOPER
|
138
|
+
- puppet/modules/memcached/README.md
|
139
|
+
- puppet/modules/memcached/lib/puppet/parser/functions/memcached_max_memory.rb
|
140
|
+
- puppet/modules/memcached/manifests/init.pp
|
141
|
+
- puppet/modules/memcached/manifests/params.pp
|
142
|
+
- puppet/modules/memcached/templates/memcached.conf.erb
|
143
|
+
- puppet/modules/memcached/templates/memcached_sysconfig.erb
|
144
|
+
- spec/spec_helper.rb
|
145
|
+
- spec/unit/provisioner_spec.rb
|
146
|
+
- vagrant-boxen.gemspec
|
147
|
+
homepage: https://github.com/fgrehm/vagrant-boxen
|
148
|
+
licenses: []
|
149
|
+
post_install_message:
|
150
|
+
rdoc_options: []
|
151
|
+
require_paths:
|
152
|
+
- lib
|
153
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
none: false
|
159
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - ! '>='
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0'
|
164
|
+
none: false
|
165
|
+
requirements: []
|
166
|
+
rubyforge_project:
|
167
|
+
rubygems_version: 1.8.23
|
168
|
+
signing_key:
|
169
|
+
specification_version: 3
|
170
|
+
summary: Easier vagrant development boxes creation
|
171
|
+
test_files:
|
172
|
+
- spec/spec_helper.rb
|
173
|
+
- spec/unit/provisioner_spec.rb
|
174
|
+
has_rdoc:
|