vagrant-jenv 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +25 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +56 -0
- data/LICENSE.txt +22 -0
- data/README.md +22 -0
- data/Rakefile +5 -0
- data/example-box/Vagrantfile +126 -0
- data/example-box/provision/puppet/manifests/site.pp +7 -0
- data/lib/vagrant-jenv.rb +30 -0
- data/lib/vagrant-jenv/command.rb +24 -0
- data/lib/vagrant-jenv/config.rb +16 -0
- data/lib/vagrant-jenv/provisioner.rb +18 -0
- data/lib/vagrant-jenv/version.rb +5 -0
- data/vagrant-jenv.gemspec +24 -0
- metadata +92 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fb5db7805425c4dd0a4f62678e7ed3bf6d9ac5a7
|
4
|
+
data.tar.gz: ae6050cb3f2b8b0ee27c0f3e4e637a335a656c2f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f478203328cec281558e2f83442d34b1b6b89b6fdb1a0aaabe2d085d4a225f62431a5a87c6fdbf9ea27eb7a69bc002c2a3dc78b47969fe0a35746dd43960df85
|
7
|
+
data.tar.gz: 6d7eebc2589a8be5daa6e105846f34f22a24001d835f3ecb9d016e6010f1bd53401e2a194c30f5bbb6349847c84ff24373f739bda1312f88b7f4dadbc28d2904
|
data/.gitignore
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
coverage
|
6
|
+
InstalledFiles
|
7
|
+
lib/bundler/man
|
8
|
+
pkg
|
9
|
+
rdoc
|
10
|
+
spec/reports
|
11
|
+
test/tmp
|
12
|
+
test/version_tmp
|
13
|
+
tmp
|
14
|
+
|
15
|
+
# YARD artifacts
|
16
|
+
.yardoc
|
17
|
+
_yardoc
|
18
|
+
doc/
|
19
|
+
|
20
|
+
# IntelliJ IDEA
|
21
|
+
.idea
|
22
|
+
.iml
|
23
|
+
|
24
|
+
# Vagrant
|
25
|
+
.vagrant
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/mitchellh/vagrant.git
|
3
|
+
revision: 00530303fbf1f00acc7e702945191b831e41190a
|
4
|
+
specs:
|
5
|
+
vagrant (1.5.0.dev)
|
6
|
+
bundler (~> 1.5.2)
|
7
|
+
childprocess (~> 0.4.0)
|
8
|
+
erubis (~> 2.7.0)
|
9
|
+
i18n (~> 0.6.0)
|
10
|
+
listen (~> 2.4.0)
|
11
|
+
log4r (~> 1.1.9, < 1.1.11)
|
12
|
+
net-scp (~> 1.1.0)
|
13
|
+
net-ssh (>= 2.6.6, < 2.8.0)
|
14
|
+
rb-kqueue (~> 0.2.0)
|
15
|
+
wdm (~> 0.1.0)
|
16
|
+
|
17
|
+
PATH
|
18
|
+
remote: .
|
19
|
+
specs:
|
20
|
+
vagrant-jenv (0.0.1)
|
21
|
+
|
22
|
+
GEM
|
23
|
+
remote: https://rubygems.org/
|
24
|
+
specs:
|
25
|
+
celluloid (0.15.2)
|
26
|
+
timers (~> 1.1.0)
|
27
|
+
childprocess (0.4.0)
|
28
|
+
ffi (~> 1.0, >= 1.0.11)
|
29
|
+
erubis (2.7.0)
|
30
|
+
ffi (1.9.3)
|
31
|
+
i18n (0.6.9)
|
32
|
+
listen (2.4.0)
|
33
|
+
celluloid (>= 0.15.2)
|
34
|
+
rb-fsevent (>= 0.9.3)
|
35
|
+
rb-inotify (>= 0.9)
|
36
|
+
log4r (1.1.10)
|
37
|
+
net-scp (1.1.2)
|
38
|
+
net-ssh (>= 2.6.5)
|
39
|
+
net-ssh (2.7.0)
|
40
|
+
rake (10.1.1)
|
41
|
+
rb-fsevent (0.9.4)
|
42
|
+
rb-inotify (0.9.3)
|
43
|
+
ffi (>= 0.5.0)
|
44
|
+
rb-kqueue (0.2.0)
|
45
|
+
ffi (>= 0.5.0)
|
46
|
+
timers (1.1.0)
|
47
|
+
wdm (0.1.0)
|
48
|
+
|
49
|
+
PLATFORMS
|
50
|
+
ruby
|
51
|
+
|
52
|
+
DEPENDENCIES
|
53
|
+
bundler (~> 1.5)
|
54
|
+
rake
|
55
|
+
vagrant!
|
56
|
+
vagrant-jenv!
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 linux_china
|
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/README.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
vagrant-jenv
|
2
|
+
===================================
|
3
|
+
jenv provision for Vagrant
|
4
|
+
|
5
|
+
### Install
|
6
|
+
$ vagrant plugin install vagrant-jenv
|
7
|
+
|
8
|
+
Because jenv needs curl, unzip etc tools, please use puppet to install curl and unzip package
|
9
|
+
|
10
|
+
### Code
|
11
|
+
|
12
|
+
config.vm.provision :jenv do |jenv|
|
13
|
+
jenv.candidates = ['maven 3.1.1','ant 1.9.2']
|
14
|
+
end
|
15
|
+
|
16
|
+
### Development
|
17
|
+
Create a new gemset named 'vagrant' then run bundle to install gems.
|
18
|
+
|
19
|
+
* rake build
|
20
|
+
* open another console tab, and execute 'vagrant plugin install pkg/vagrant-jenv-0.0.1.gem'
|
21
|
+
* vagrant up then execute vagrant provision
|
22
|
+
* flow: change code, build, uninstall plugin and install again
|
data/Rakefile
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant.require_plugin "vagrant-jenv"
|
5
|
+
|
6
|
+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
7
|
+
VAGRANTFILE_API_VERSION = "2"
|
8
|
+
|
9
|
+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
10
|
+
# All Vagrant configuration is done here. The most common configuration
|
11
|
+
# options are documented and commented below. For a complete reference,
|
12
|
+
# please see the online documentation at vagrantup.com.
|
13
|
+
|
14
|
+
# Every Vagrant virtual environment requires a box to build off of.
|
15
|
+
config.vm.box = "lucid32"
|
16
|
+
|
17
|
+
# The url from where the 'config.vm.box' box will be fetched if it
|
18
|
+
# doesn't already exist on the user's system.
|
19
|
+
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
|
20
|
+
|
21
|
+
# Create a forwarded port mapping which allows access to a specific port
|
22
|
+
# within the machine from a port on the host machine. In the example below,
|
23
|
+
# accessing "localhost:8080" will access port 80 on the guest machine.
|
24
|
+
# config.vm.network :forwarded_port, guest: 80, host: 8080
|
25
|
+
|
26
|
+
# Create a private network, which allows host-only access to the machine
|
27
|
+
# using a specific IP.
|
28
|
+
# config.vm.network :private_network, ip: "192.168.33.10"
|
29
|
+
|
30
|
+
# Create a public network, which generally matched to bridged network.
|
31
|
+
# Bridged networks make the machine appear as another physical device on
|
32
|
+
# your network.
|
33
|
+
# config.vm.network :public_network
|
34
|
+
|
35
|
+
# If true, then any SSH connections made will enable agent forwarding.
|
36
|
+
# Default value: false
|
37
|
+
# config.ssh.forward_agent = true
|
38
|
+
|
39
|
+
# Share an additional folder to the guest VM. The first argument is
|
40
|
+
# the path on the host to the actual folder. The second argument is
|
41
|
+
# the path on the guest to mount the folder. And the optional third
|
42
|
+
# argument is a set of non-required options.
|
43
|
+
# config.vm.synced_folder "../data", "/vagrant_data"
|
44
|
+
|
45
|
+
# Provider-specific configuration so you can fine-tune various
|
46
|
+
# backing providers for Vagrant. These expose provider-specific options.
|
47
|
+
# Example for VirtualBox:
|
48
|
+
#
|
49
|
+
# config.vm.provider :virtualbox do |vb|
|
50
|
+
# # Don't boot with headless mode
|
51
|
+
# vb.gui = true
|
52
|
+
#
|
53
|
+
# # Use VBoxManage to customize the VM. For example to change memory:
|
54
|
+
# vb.customize ["modifyvm", :id, "--memory", "1024"]
|
55
|
+
# end
|
56
|
+
#
|
57
|
+
# View the documentation for the provider you're using for more
|
58
|
+
# information on available options.
|
59
|
+
|
60
|
+
config.vm.provision "shell", inline: "apt-get update"
|
61
|
+
|
62
|
+
# Enable provisioning with Puppet stand alone. Puppet manifests
|
63
|
+
# are contained in a directory path relative to this Vagrantfile.
|
64
|
+
# You will need to create the manifests directory and a manifest in
|
65
|
+
# the file lucid32.pp in the manifests_path directory.
|
66
|
+
#
|
67
|
+
# An example Puppet manifest to provision the message of the day:
|
68
|
+
#
|
69
|
+
# # group { "puppet":
|
70
|
+
# # ensure => "present",
|
71
|
+
# # }
|
72
|
+
# #
|
73
|
+
# # File { owner => 0, group => 0, mode => 0644 }
|
74
|
+
# #
|
75
|
+
# # file { '/etc/motd':
|
76
|
+
# # content => "Welcome to your Vagrant-built virtual machine!
|
77
|
+
# # Managed by Puppet.\n"
|
78
|
+
# # }
|
79
|
+
#
|
80
|
+
|
81
|
+
config.vm.provision :puppet do |puppet|
|
82
|
+
puppet.manifests_path = "provision/puppet/manifests"
|
83
|
+
puppet.manifest_file = "site.pp"
|
84
|
+
end
|
85
|
+
config.vm.provision :jenv do |jenv|
|
86
|
+
jenv.candidates = ['java 1.7.0_51', 'ant 1.9.3', "maven 3.1.1"]
|
87
|
+
end
|
88
|
+
|
89
|
+
# Enable provisioning with chef solo, specifying a cookbooks path, roles
|
90
|
+
# path, and data_bags path (all relative to this Vagrantfile), and adding
|
91
|
+
# some recipes and/or roles.
|
92
|
+
#
|
93
|
+
# config.vm.provision :chef_solo do |chef|
|
94
|
+
# chef.cookbooks_path = "../my-recipes/cookbooks"
|
95
|
+
# chef.roles_path = "../my-recipes/roles"
|
96
|
+
# chef.data_bags_path = "../my-recipes/data_bags"
|
97
|
+
# chef.add_recipe "mysql"
|
98
|
+
# chef.add_role "web"
|
99
|
+
#
|
100
|
+
# # You may also specify custom JSON attributes:
|
101
|
+
# chef.json = { :mysql_password => "foo" }
|
102
|
+
# end
|
103
|
+
|
104
|
+
# Enable provisioning with chef server, specifying the chef server URL,
|
105
|
+
# and the path to the validation key (relative to this Vagrantfile).
|
106
|
+
#
|
107
|
+
# The Opscode Platform uses HTTPS. Substitute your organization for
|
108
|
+
# ORGNAME in the URL and validation key.
|
109
|
+
#
|
110
|
+
# If you have your own Chef Server, use the appropriate URL, which may be
|
111
|
+
# HTTP instead of HTTPS depending on your configuration. Also change the
|
112
|
+
# validation key to validation.pem.
|
113
|
+
#
|
114
|
+
# config.vm.provision :chef_client do |chef|
|
115
|
+
# chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
|
116
|
+
# chef.validation_key_path = "ORGNAME-validator.pem"
|
117
|
+
# end
|
118
|
+
#
|
119
|
+
# If you're using the Opscode platform, your validator client is
|
120
|
+
# ORGNAME-validator, replacing ORGNAME with your organization name.
|
121
|
+
#
|
122
|
+
# If you have your own Chef Server, the default validation client name is
|
123
|
+
# chef-validator, unless you changed the configuration.
|
124
|
+
#
|
125
|
+
# chef.validation_client_name = "ORGNAME-validator"
|
126
|
+
end
|
data/lib/vagrant-jenv.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Jenv
|
3
|
+
class Plugin < Vagrant.plugin("2")
|
4
|
+
|
5
|
+
name "Vagrant jenv plugin"
|
6
|
+
|
7
|
+
description <<-DESC
|
8
|
+
Vagrant jenv plugin
|
9
|
+
DESC
|
10
|
+
|
11
|
+
command "jenv-info" do
|
12
|
+
require_relative "vagrant-jenv/command"
|
13
|
+
Command
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
config(:jenv, :provisioner) do
|
18
|
+
require_relative "vagrant-jenv/config"
|
19
|
+
Config
|
20
|
+
end
|
21
|
+
|
22
|
+
provisioner :jenv do
|
23
|
+
require_relative "vagrant-jenv/provisioner"
|
24
|
+
Provisioner
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Jenv
|
3
|
+
class Command < Vagrant.plugin(2, "command")
|
4
|
+
|
5
|
+
# @return [String]
|
6
|
+
def self.synopsis
|
7
|
+
"Display jenv version"
|
8
|
+
end
|
9
|
+
|
10
|
+
def execute
|
11
|
+
# Execute the actual SSH
|
12
|
+
with_target_vms(nil, single_target: true) do |vm|
|
13
|
+
vm.config.exec.finalize! # TODO: do we have to call it explicitly?
|
14
|
+
|
15
|
+
@logger.info("Detect jenv version: ")
|
16
|
+
ssh_opts = {extra_args: ['-q']} # make it quiet
|
17
|
+
env = vm.action(:ssh_run, ssh_run_command: "jenv version", ssh_opts: ssh_opts)
|
18
|
+
status = env[:ssh_run_exit_status] || 0
|
19
|
+
return status
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end # Command
|
23
|
+
end # Exec
|
24
|
+
end # VagrantPlugins
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Jenv
|
3
|
+
class Config < Vagrant.plugin("2", :config)
|
4
|
+
attr_accessor :candidates
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@candidates = UNSET_VALUE
|
8
|
+
end
|
9
|
+
|
10
|
+
def finalize!
|
11
|
+
@candidates = [] if @candidates == UNSET_VALUE
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Jenv
|
3
|
+
class Provisioner < Vagrant.plugin("2", "provisioner")
|
4
|
+
def provision
|
5
|
+
@machine.communicate.execute('if [[ ! -d "${HOME}/.jenv" ]]; then curl -L -s get.jenv.io | bash ; fi') do |type, data|
|
6
|
+
@machine.env.ui.info data
|
7
|
+
end
|
8
|
+
@machine.env.ui.info "Installing jenv candidates...}"
|
9
|
+
@machine.communicate.execute('jenv config auto true')
|
10
|
+
@machine.communicate.execute('jenv repo update')
|
11
|
+
config.candidates.each do |pair|
|
12
|
+
@machine.communicate.execute("jenv install #{pair}")
|
13
|
+
@machine.env.ui.info "#{pair} installed"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'vagrant-jenv/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "vagrant-jenv"
|
8
|
+
spec.version = VagrantPlugins::Jenv::VERSION
|
9
|
+
spec.platform = Gem::Platform::RUBY
|
10
|
+
spec.authors = ["linux_china"]
|
11
|
+
spec.email = ["linux_china@hotmail.com"]
|
12
|
+
spec.summary = %q{Vagrant jenv plugin}
|
13
|
+
spec.description = %q{Vagrant jenv plugin to supply jenv provision}
|
14
|
+
spec.homepage = "http://jenv.io"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files`.split($/)
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
23
|
+
spec.add_development_dependency "rake", '~> 10.1', '>= 10.1.1'
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-jenv
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- linux_china
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-27 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.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.1'
|
34
|
+
- - '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 10.1.1
|
37
|
+
type: :development
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '10.1'
|
44
|
+
- - '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 10.1.1
|
47
|
+
description: Vagrant jenv plugin to supply jenv provision
|
48
|
+
email:
|
49
|
+
- linux_china@hotmail.com
|
50
|
+
executables: []
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- .gitignore
|
55
|
+
- Gemfile
|
56
|
+
- Gemfile.lock
|
57
|
+
- LICENSE.txt
|
58
|
+
- README.md
|
59
|
+
- Rakefile
|
60
|
+
- example-box/Vagrantfile
|
61
|
+
- example-box/provision/puppet/manifests/site.pp
|
62
|
+
- lib/vagrant-jenv.rb
|
63
|
+
- lib/vagrant-jenv/command.rb
|
64
|
+
- lib/vagrant-jenv/config.rb
|
65
|
+
- lib/vagrant-jenv/provisioner.rb
|
66
|
+
- lib/vagrant-jenv/version.rb
|
67
|
+
- vagrant-jenv.gemspec
|
68
|
+
homepage: http://jenv.io
|
69
|
+
licenses:
|
70
|
+
- MIT
|
71
|
+
metadata: {}
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options: []
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
requirements: []
|
87
|
+
rubyforge_project:
|
88
|
+
rubygems_version: 2.2.0
|
89
|
+
signing_key:
|
90
|
+
specification_version: 4
|
91
|
+
summary: Vagrant jenv plugin
|
92
|
+
test_files: []
|