vagrant-sprinkle 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 032b957764a9bfaa67f9e2765fd4576415bc0b89
4
+ data.tar.gz: 83ec0769d2f1e034b592e8c85bbcfb9b12a4e6d1
5
+ SHA512:
6
+ metadata.gz: 9f7e8abd96ef57ac2820d462292c4d1ce6f930002d507c3d2a64bd2b91ddb13716713f4be6ba3206efa52ca5e78b6e8e042c4c603bb2a71b9e6a4006af0fe383
7
+ data.tar.gz: afd052c70e20ae46a3886be7ca9e34340144d771f076a4ebfaa594dc903cfa94a4ece558473ef77e1a3f7ecc3594fab6e676ab9607bfb15828d6926b9560efa7
data/.gitignore ADDED
@@ -0,0 +1,18 @@
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
+ .vagrant/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'vagrant', github: 'mitchellh/vagrant'
6
+ gem 'sprinkle'
data/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # vagrant-sprinkle
2
+
3
+ A [Vagrant](http://www.vagrantup.com/) plugin to provision virtual machines with [Sprinkle](https://github.com/sprinkle-tool/sprinkle).
4
+
5
+ ## Installation
6
+
7
+ ```
8
+ $ vagrant plugin install vagrant-sprinkle
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### In the Vagrantfile
14
+
15
+ Use `:sprinkle` as the provisioner in your Vagrantfile:
16
+
17
+ ``` ruby
18
+ Vagrant.configure('2') do |config|
19
+ config.vm.provision(:sprinkle) do |sprinkle|
20
+ sprinkle.script = 'sprinkle.rb'
21
+ sprinkle.cloud = true
22
+ end
23
+ end
24
+ ```
25
+
26
+ The only required option is `script`, which should be a relative path to your Sprinkle install script. An example `Vagrantfile` is provided in the root of the repository.
27
+
28
+ ### In the Sprinkle script
29
+
30
+ Set the SSH options for deploy in accordance with the details provided by `vagrant ssh-config`:
31
+
32
+ ``` ruby
33
+ deployment do
34
+ delivery :capistrano do
35
+ role :main, "127.0.0.1"
36
+ set :user, "vagrant"
37
+ ssh_options[:keys] = ["#{ENV['HOME']}/.vagrant.d/insecure_private_key"]
38
+ ssh_options[:port] = 2222
39
+ end
40
+ end
41
+ ```
42
+
43
+ An example `sprinkle.rb` is provided in the root of the repository.
44
+
45
+ ## Options
46
+
47
+ The following options can be set on the `sprinkle` config object (the block parameter).
48
+
49
+ * **script** (String, required): Relative path to a Sprinkle script to run.
50
+ * **only** (String): Only run sprinkle policies for the specified role.
51
+ * **test** (Boolean): Process, but don't perform any actions.
52
+ * **verbose** (Boolean): Provide verbose output.
53
+ * **cloud** (Boolean): Show powder cloud, i.e. package hierarchy and installation order.
54
+ * **force** (Boolean): Force installation of all packages, even if already installed.
55
+
56
+ ## License
57
+
58
+ [MIT](http://opensource.org/licenses/MIT)
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
data/Vagrantfile ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- mode: ruby -*-
3
+ # vi: set ft=ruby :
4
+
5
+ Vagrant.require_plugin('vagrant-sprinkle')
6
+
7
+ Vagrant.configure('2') do |config|
8
+ config.vm.box = 'precise64'
9
+ config.vm.box_url = "http://files.vagrantup.com/precise64.box"
10
+ config.vm.provision(:sprinkle) do |sprinkle|
11
+ sprinkle.script = "sprinkle.rb"
12
+ sprinkle.cloud = true
13
+ end
14
+ end
@@ -0,0 +1,10 @@
1
+ module VagrantPlugins
2
+ module Sprinkle
3
+ def self.source_root
4
+ @source_root ||= Pathname.new(File.expand_path('../..', __FILE__))
5
+ end
6
+ end
7
+ end
8
+
9
+ require 'vagrant-sprinkle/version'
10
+ require 'vagrant-sprinkle/plugin'
@@ -0,0 +1,47 @@
1
+ module VagrantPlugins
2
+ module Sprinkle
3
+ class Config < Vagrant.plugin('2', :config)
4
+ attr_accessor :script
5
+ attr_accessor :only
6
+ attr_accessor :test
7
+ attr_accessor :verbose
8
+ attr_accessor :cloud
9
+ attr_accessor :force
10
+
11
+ def initialize
12
+ self.script = UNSET_VALUE
13
+ self.only = UNSET_VALUE
14
+ self.test = UNSET_VALUE
15
+ self.verbose = UNSET_VALUE
16
+ self.cloud = UNSET_VALUE
17
+ self.force = UNSET_VALUE
18
+ end
19
+
20
+ def finalize!
21
+ self.script = nil if script == UNSET_VALUE
22
+ self.only = nil if only == UNSET_VALUE
23
+ self.test = nil if test == UNSET_VALUE
24
+ self.verbose = nil if verbose == UNSET_VALUE
25
+ self.cloud = nil if cloud == UNSET_VALUE
26
+ self.force = nil if force == UNSET_VALUE
27
+ end
28
+
29
+ def validate(machine)
30
+ errors = []
31
+
32
+ if script
33
+ unless Pathname.new(script).expand_path(machine.env.root_path).file?
34
+ errors << I18n.t(
35
+ 'vagrant.provisioners.sprinkle.script_path_invalid',
36
+ :path => expanded_path
37
+ )
38
+ end
39
+ else
40
+ errors << I18n.t('vagrant.provisioners.sprinkle.no_script')
41
+ end
42
+
43
+ { 'Sprinkle provisioner' => errors }
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,31 @@
1
+ begin
2
+ require 'vagrant'
3
+ rescue LoadError
4
+ raise 'vagrant-sprinkle must be loaded within Vagrant.'
5
+ end
6
+
7
+
8
+ module VagrantPlugins
9
+ module Sprinkle
10
+ class Plugin < Vagrant.plugin('2')
11
+ name 'sprinkle'
12
+ description 'Adds a Sprinkle provisioner to Vagrant.'
13
+
14
+ config(:sprinkle, :provisioner) do
15
+ require_relative 'config'
16
+ Config
17
+ end
18
+
19
+ provisioner(:sprinkle) do
20
+ I18n.load_path << File.expand_path(
21
+ 'locales/en.yml',
22
+ Sprinkle.source_root
23
+ )
24
+ I18n.reload!
25
+
26
+ require_relative 'provisioner'
27
+ Provisioner
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,29 @@
1
+ module VagrantPlugins
2
+ module Sprinkle
3
+ class Provisioner < Vagrant.plugin('2', :provisioner)
4
+ def provision
5
+ command = ['sprinkle'].concat(compile_options)
6
+
7
+ Vagrant::Util::Subprocess.execute(*command) do |type, data|
8
+ if type == :stdout || type == :stderr
9
+ machine.env.ui.info(data.chomp, :prefix => false)
10
+ end
11
+ end
12
+ end
13
+
14
+ private
15
+
16
+ def compile_options
17
+ options = []
18
+ options << "--script=#{config.script}"
19
+ options << "--only #{config.only}" if config.only
20
+ options << '--test' if config.test
21
+ options << '--verbose' if config.verbose
22
+ options << '--cloud' if config.cloud
23
+ options << '--force' if config.force
24
+ options << { :notify => [:stdout, :stderr] }
25
+ options
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,5 @@
1
+ module VagrantPlugins
2
+ module Sprinkle
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
data/locales/en.yml ADDED
@@ -0,0 +1,8 @@
1
+ en:
2
+ vagrant:
3
+ provisioners:
4
+ sprinkle:
5
+ no_script: |-
6
+ You must set the path to the Sprinkle install script.
7
+ script_path_invalid: |-
8
+ No Sprinkle script was found at the provided path.
data/sprinkle.rb ADDED
@@ -0,0 +1,21 @@
1
+ package :git do
2
+ apt 'git-core'
3
+ end
4
+
5
+ package :vim do
6
+ apt 'vim'
7
+ end
8
+
9
+ policy :development, roles: :main do
10
+ requires :git
11
+ requires :vim
12
+ end
13
+
14
+ deployment do
15
+ delivery :capistrano do
16
+ role :main, "127.0.0.1"
17
+ set :user, "vagrant"
18
+ ssh_options[:keys] = ["#{ENV['HOME']}/.vagrant.d/insecure_private_key"]
19
+ ssh_options[:port] = 2222
20
+ end
21
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vagrant-sprinkle/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'vagrant-sprinkle'
8
+ spec.version = VagrantPlugins::Sprinkle::VERSION
9
+ spec.authors = ['Jimmy Cuadra']
10
+ spec.email = ['jimmy@jimmycuadra.com']
11
+ spec.description = %q{A Sprinkle provisioner for Vagrant.}
12
+ spec.summary = <<-SUMMARY
13
+ A Vagrant plugin which adds the ability to provision virtual machines with
14
+ the Sprinkle gem.
15
+ SUMMARY
16
+ spec.homepage = 'https://github.com/jimmycuadra/vagrant-sprinkle'
17
+ spec.license = 'MIT'
18
+
19
+ spec.files = `git ls-files`.split($/)
20
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
+ spec.test_files = spec.files.grep(%r{^spec/})
22
+ spec.require_paths = ['lib']
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.3'
25
+ spec.add_development_dependency 'rake'
26
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-sprinkle
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jimmy Cuadra
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-05-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: A Sprinkle provisioner for Vagrant.
42
+ email:
43
+ - jimmy@jimmycuadra.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - Gemfile
50
+ - README.md
51
+ - Rakefile
52
+ - Vagrantfile
53
+ - lib/vagrant-sprinkle.rb
54
+ - lib/vagrant-sprinkle/config.rb
55
+ - lib/vagrant-sprinkle/plugin.rb
56
+ - lib/vagrant-sprinkle/provisioner.rb
57
+ - lib/vagrant-sprinkle/version.rb
58
+ - locales/en.yml
59
+ - sprinkle.rb
60
+ - vagrant-sprinkle.gemspec
61
+ homepage: https://github.com/jimmycuadra/vagrant-sprinkle
62
+ licenses:
63
+ - MIT
64
+ metadata: {}
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubyforge_project:
81
+ rubygems_version: 2.0.3
82
+ signing_key:
83
+ specification_version: 4
84
+ summary: A Vagrant plugin which adds the ability to provision virtual machines with
85
+ the Sprinkle gem.
86
+ test_files: []