pupcap 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -0
- data/lib/pupcap/action.rb +9 -5
- data/lib/pupcap/action/cook.rb +1 -3
- data/lib/pupcap/action/cook/Capfile +15 -4
- data/lib/pupcap/action/cook/apply.sh.erb +8 -0
- data/lib/pupcap/action/init.rb +101 -0
- data/lib/pupcap/action/init/Puppetfile.erb +3 -0
- data/lib/pupcap/action/init/Vagrantfile.erb +99 -0
- data/lib/pupcap/action/init/default.pp.erb +2 -0
- data/lib/pupcap/action/prepare.rb +9 -8
- data/lib/pupcap/action/prepare/Capfile +19 -4
- data/lib/pupcap/action/prepare/ubuntu/precise.sh +26 -10
- data/lib/pupcap/action/ssh.rb +1 -3
- data/lib/pupcap/cli.rb +1 -1
- data/lib/pupcap/version.rb +1 -1
- data/pupcap.gemspec +3 -0
- metadata +23 -2
data/README
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Integrate puppet and capistrano
|
data/lib/pupcap/action.rb
CHANGED
@@ -16,9 +16,9 @@ module Pupcap::Action
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
20
|
-
|
21
|
-
$stderr.puts "Please specify
|
19
|
+
def check_tasks!
|
20
|
+
if parsed_options[:tasks].empty?
|
21
|
+
$stderr.puts "Please specify tasks"
|
22
22
|
exit 1
|
23
23
|
end
|
24
24
|
end
|
@@ -28,6 +28,9 @@ module Pupcap::Action
|
|
28
28
|
cap.logger.level = Capistrano::Logger::DEBUG
|
29
29
|
set_cap_vars!(cap, file)
|
30
30
|
cap.load file
|
31
|
+
parsed_options[:tasks].each do |task|
|
32
|
+
cap.find_and_execute_task(task)
|
33
|
+
end
|
31
34
|
cap
|
32
35
|
end
|
33
36
|
|
@@ -36,7 +39,6 @@ module Pupcap::Action
|
|
36
39
|
end
|
37
40
|
|
38
41
|
def cap_load_and_run_task(cap, task)
|
39
|
-
cap.set :pupcap_options, parsed_options
|
40
42
|
cap.load "#{lib_root}/#{task}/Capfile"
|
41
43
|
cap.trigger(:load)
|
42
44
|
cap.find_and_execute_task(task, :before => :start, :after => :finish)
|
@@ -48,10 +50,12 @@ module Pupcap::Action
|
|
48
50
|
def set_cap_vars!(cap, file)
|
49
51
|
app = ENV['app'] || File.basename(File.dirname(file))
|
50
52
|
cap.set :application, app
|
51
|
-
cap.set :local_root,
|
53
|
+
cap.set :local_root, File.dirname(file)
|
54
|
+
cap.set :pupcap_root, File.dirname(File.expand_path __FILE__)
|
52
55
|
cap.set :provision_key, "#{cap.local_root}/.keys/provision"
|
53
56
|
cap.set :provision_key_pub, "#{cap.local_root}/.keys/provision.pub"
|
54
57
|
cap.set :deploy_to, "/tmp/puppet"
|
58
|
+
cap.set :pupcap_options, parsed_options
|
55
59
|
cap.ssh_options[:keys] = cap.provision_key
|
56
60
|
cap.ssh_options[:forward_agent] = true
|
57
61
|
cap.default_run_options[:pty] = true
|
data/lib/pupcap/action/cook.rb
CHANGED
@@ -3,9 +3,7 @@ require 'pupcap/command'
|
|
3
3
|
|
4
4
|
class Pupcap::Action::Cook < Pupcap::Action::Base
|
5
5
|
def initialize
|
6
|
-
check_role!
|
7
6
|
check_puppetfile!
|
8
|
-
ENV["ROLES"] = parsed_options[:role]
|
9
7
|
end
|
10
8
|
|
11
9
|
def start
|
@@ -36,7 +34,7 @@ class Pupcap::Action::Cook < Pupcap::Action::Base
|
|
36
34
|
options[:noop] = true
|
37
35
|
end
|
38
36
|
end.parse!
|
39
|
-
options[:
|
37
|
+
options[:tasks] = ARGV
|
40
38
|
@parsed_options = options
|
41
39
|
end
|
42
40
|
@parsed_options
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'erb'
|
2
|
+
|
1
3
|
namespace :cook do
|
2
4
|
task :default do
|
3
5
|
rsync
|
@@ -11,17 +13,26 @@ namespace :cook do
|
|
11
13
|
host = Pupcap::Command.server_host(self, server)
|
12
14
|
ssh_cmd = "-e \"ssh -p #{port} -i #{provision_key}\""
|
13
15
|
rsync_options = "-p --chmod=o+r,g+r -az"
|
14
|
-
cmd = "rsync #{rsync_options} #{ssh_cmd} #{local_root}/ #{host}:#{deploy_to}"
|
16
|
+
cmd = "rsync #{rsync_options} #{ssh_cmd} #{local_root}/puppet/ #{host}:#{deploy_to}"
|
15
17
|
logger.important(cmd)
|
16
18
|
system(cmd)
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
20
22
|
task :apply do
|
23
|
+
remote_command = "#{deploy_to}/apply.sh"
|
24
|
+
|
25
|
+
puppet = "/usr/local/bin/puppet"
|
21
26
|
modules = "--modulepath=#{deploy_to}/modules:#{deploy_to}/manifests"
|
22
|
-
nook = pupcap_options[:noop] ? "--noop" : ""
|
23
|
-
debug = pupcap_options[:debug] ? "--debug" : ""
|
24
|
-
|
27
|
+
nook = pupcap_options[:noop] ? " --noop" : ""
|
28
|
+
debug = pupcap_options[:debug] ? " --debug --verbose" : ""
|
29
|
+
|
30
|
+
erb = ERB.new(File.read("#{pupcap_root}/action/cook/apply.sh.erb"))
|
31
|
+
rs = erb.result(binding)
|
32
|
+
|
33
|
+
put(rs, remote_command)
|
34
|
+
run("chmod +x #{remote_command}")
|
35
|
+
sudo("#{remote_command} \"$CAPISTRANO:HOSTROLES$\"")
|
25
36
|
end
|
26
37
|
|
27
38
|
task :cleanup do
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'pupcap/action'
|
2
|
+
require 'pupcap/command'
|
3
|
+
require 'fileutils'
|
4
|
+
require 'erb'
|
5
|
+
|
6
|
+
class Pupcap::Action::Init < Pupcap::Action::Base
|
7
|
+
def initialize
|
8
|
+
end
|
9
|
+
|
10
|
+
def start
|
11
|
+
create_directories
|
12
|
+
create_vagrantfile
|
13
|
+
create_puppetfile
|
14
|
+
create_pp
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_vagrantfile
|
18
|
+
out = "#{work_dir}/Vagrantfile"
|
19
|
+
if !File.exists?(out) || force?
|
20
|
+
erb = ERB.new(File.read("#{lib_root}/init/Vagrantfile.erb"))
|
21
|
+
rs = erb.result(binding)
|
22
|
+
File.open(out, "w+"){ |io| io.write rs }
|
23
|
+
else
|
24
|
+
puts "Skip file #{out}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def create_puppetfile
|
29
|
+
out = "#{work_dir}/Puppetfile"
|
30
|
+
if !File.exists?(out) || force?
|
31
|
+
erb = ERB.new(File.read("#{lib_root}/init/Puppetfile.erb"))
|
32
|
+
rs = erb.result(binding)
|
33
|
+
File.open(out, "w+"){ |io| io.write rs }
|
34
|
+
else
|
35
|
+
puts "Skip file #{out}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def create_pp
|
40
|
+
out = "#{work_dir}/puppet/manifests/default.pp"
|
41
|
+
if !File.exists?(out) || force?
|
42
|
+
erb = ERB.new(File.read("#{lib_root}/init/default.pp.erb"))
|
43
|
+
rs = erb.result(binding)
|
44
|
+
File.open(out, "w+"){ |io| io.write rs }
|
45
|
+
else
|
46
|
+
puts "Skip file #{out}"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def create_directories
|
51
|
+
FileUtils.mkdir_p("#{work_dir}/puppet/modules")
|
52
|
+
FileUtils.mkdir_p("#{work_dir}/puppet/manifests")
|
53
|
+
system("touch #{work_dir}/puppet/modules/.gitkeep")
|
54
|
+
system("touch #{work_dir}/puppet/manifests/.gitkeep")
|
55
|
+
end
|
56
|
+
|
57
|
+
def work_dir
|
58
|
+
parsed_options[:directory]
|
59
|
+
end
|
60
|
+
|
61
|
+
def ip
|
62
|
+
parsed_options[:ip]
|
63
|
+
end
|
64
|
+
|
65
|
+
def force?
|
66
|
+
parsed_options[:force]
|
67
|
+
end
|
68
|
+
|
69
|
+
def parsed_options
|
70
|
+
unless @parsed_options
|
71
|
+
options = default_options.dup
|
72
|
+
OptionParser.new do |opts|
|
73
|
+
opts.banner = "Usage: #{File.basename($0)} init [options] <directory>"
|
74
|
+
opts.on("-h", "--help", "Displays this help info") do
|
75
|
+
puts opts
|
76
|
+
exit 0
|
77
|
+
end
|
78
|
+
opts.on("-i", "--ip IP", "Address for vagrant host, default 192.168.44.10") do |ip|
|
79
|
+
options[:ip] = ip
|
80
|
+
end
|
81
|
+
opts.on("-f", "--force", "Always create a Vagrantfile and Puppetfile") do
|
82
|
+
options[:force] = true
|
83
|
+
end
|
84
|
+
end.parse!
|
85
|
+
options[:directory] = ARGV[0]
|
86
|
+
unless options[:directory]
|
87
|
+
$stderr.puts "You must specify a directory"
|
88
|
+
exit 1
|
89
|
+
end
|
90
|
+
@parsed_options = options
|
91
|
+
end
|
92
|
+
@parsed_options
|
93
|
+
end
|
94
|
+
|
95
|
+
def default_options
|
96
|
+
{
|
97
|
+
:ip => "192.168.44.10",
|
98
|
+
:force => false
|
99
|
+
}
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant::Config.run do |config|
|
5
|
+
# All Vagrant configuration is done here. The most common configuration
|
6
|
+
# options are documented and commented below. For a complete reference,
|
7
|
+
# please see the online documentation at vagrantup.com.
|
8
|
+
|
9
|
+
# Every Vagrant virtual environment requires a box to build off of.
|
10
|
+
config.vm.box = "precise64"
|
11
|
+
|
12
|
+
# The url from where the 'config.vm.box' box will be fetched if it
|
13
|
+
# doesn't already exist on the user's system.
|
14
|
+
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
|
15
|
+
|
16
|
+
# Boot with a GUI so you can see the screen. (Default is headless)
|
17
|
+
# config.vm.boot_mode = :gui
|
18
|
+
|
19
|
+
# Assign this VM to a host-only network IP, allowing you to access it
|
20
|
+
# via the IP. Host-only networks can talk to the host machine as well as
|
21
|
+
# any other machines on the same network, but cannot be accessed (through this
|
22
|
+
# network interface) by any external networks.
|
23
|
+
config.vm.network :hostonly, "<%= ip %>"
|
24
|
+
|
25
|
+
# Assign this VM to a bridged network, allowing you to connect directly to a
|
26
|
+
# network using the host's network device. This makes the VM appear as another
|
27
|
+
# physical device on your network.
|
28
|
+
# config.vm.network :bridged
|
29
|
+
|
30
|
+
# Forward a port from the guest to the host, which allows for outside
|
31
|
+
# computers to access the VM, whereas host only networking does not.
|
32
|
+
# config.vm.forward_port 80, 8080
|
33
|
+
|
34
|
+
# Share an additional folder to the guest VM. The first argument is
|
35
|
+
# an identifier, the second is the path on the guest to mount the
|
36
|
+
# folder, and the third is the path on the host to the actual folder.
|
37
|
+
config.vm.share_folder("v-root", "/vagrant", ".", :disabled => true)
|
38
|
+
|
39
|
+
# Enable provisioning with Puppet stand alone. Puppet manifests
|
40
|
+
# are contained in a directory path relative to this Vagrantfile.
|
41
|
+
# You will need to create the manifests directory and a manifest in
|
42
|
+
# the file base.pp in the manifests_path directory.
|
43
|
+
#
|
44
|
+
# An example Puppet manifest to provision the message of the day:
|
45
|
+
#
|
46
|
+
# # group { "puppet":
|
47
|
+
# # ensure => "present",
|
48
|
+
# # }
|
49
|
+
# #
|
50
|
+
# # File { owner => 0, group => 0, mode => 0644 }
|
51
|
+
# #
|
52
|
+
# # file { '/etc/motd':
|
53
|
+
# # content => "Welcome to your Vagrant-built virtual machine!
|
54
|
+
# # Managed by Puppet.\n"
|
55
|
+
# # }
|
56
|
+
#
|
57
|
+
# config.vm.provision :puppet do |puppet|
|
58
|
+
# puppet.manifests_path = "manifests"
|
59
|
+
# puppet.manifest_file = "base.pp"
|
60
|
+
# end
|
61
|
+
|
62
|
+
# Enable provisioning with chef solo, specifying a cookbooks path, roles
|
63
|
+
# path, and data_bags path (all relative to this Vagrantfile), and adding
|
64
|
+
# some recipes and/or roles.
|
65
|
+
#
|
66
|
+
# config.vm.provision :chef_solo do |chef|
|
67
|
+
# chef.cookbooks_path = "../my-recipes/cookbooks"
|
68
|
+
# chef.roles_path = "../my-recipes/roles"
|
69
|
+
# chef.data_bags_path = "../my-recipes/data_bags"
|
70
|
+
# chef.add_recipe "mysql"
|
71
|
+
# chef.add_role "web"
|
72
|
+
#
|
73
|
+
# # You may also specify custom JSON attributes:
|
74
|
+
# chef.json = { :mysql_password => "foo" }
|
75
|
+
# end
|
76
|
+
|
77
|
+
# Enable provisioning with chef server, specifying the chef server URL,
|
78
|
+
# and the path to the validation key (relative to this Vagrantfile).
|
79
|
+
#
|
80
|
+
# The Opscode Platform uses HTTPS. Substitute your organization for
|
81
|
+
# ORGNAME in the URL and validation key.
|
82
|
+
#
|
83
|
+
# If you have your own Chef Server, use the appropriate URL, which may be
|
84
|
+
# HTTP instead of HTTPS depending on your configuration. Also change the
|
85
|
+
# validation key to validation.pem.
|
86
|
+
#
|
87
|
+
# config.vm.provision :chef_client do |chef|
|
88
|
+
# chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
|
89
|
+
# chef.validation_key_path = "ORGNAME-validator.pem"
|
90
|
+
# end
|
91
|
+
#
|
92
|
+
# If you're using the Opscode platform, your validator client is
|
93
|
+
# ORGNAME-validator, replacing ORGNAME with your organization name.
|
94
|
+
#
|
95
|
+
# IF you have your own Chef Server, the default validation client name is
|
96
|
+
# chef-validator, unless you changed the configuration.
|
97
|
+
#
|
98
|
+
# chef.validation_client_name = "ORGNAME-validator"
|
99
|
+
end
|
@@ -1,20 +1,17 @@
|
|
1
1
|
require 'pupcap/action'
|
2
|
+
require 'pupcap/command'
|
2
3
|
require 'pupcap/lsb_release'
|
3
4
|
|
4
5
|
class Pupcap::Action::Prepare < Pupcap::Action::Base
|
5
6
|
def initialize
|
6
|
-
check_role!
|
7
7
|
check_puppetfile!
|
8
|
-
ENV["ROLES"] = parsed_options[:role]
|
9
8
|
end
|
10
9
|
|
11
10
|
def start
|
12
11
|
cap = create_cap_for(parsed_options[:file])
|
13
12
|
lsb = Pupcap::LsbRelease.new(cap)
|
14
|
-
|
15
|
-
|
16
|
-
cap.set :pupcap_prepare_script, prepare_script
|
17
|
-
end
|
13
|
+
prepare_proc = lambda{ "#{lib_root}/prepare/#{lsb.name.downcase}/#{lsb.codename.downcase}.sh" }
|
14
|
+
cap.set :pupcap_prepare_command, prepare_proc
|
18
15
|
cap_load_and_run_task(cap, "prepare")
|
19
16
|
end
|
20
17
|
|
@@ -22,7 +19,7 @@ class Pupcap::Action::Prepare < Pupcap::Action::Base
|
|
22
19
|
unless @parsed_options
|
23
20
|
options = default_options.dup
|
24
21
|
OptionParser.new do |opts|
|
25
|
-
opts.banner = "Usage: #{File.basename($0)} prepare [options] <
|
22
|
+
opts.banner = "Usage: #{File.basename($0)} prepare [options] <tasks>"
|
26
23
|
|
27
24
|
opts.on("-h", "--help", "Displays this help info") do
|
28
25
|
puts opts
|
@@ -36,8 +33,12 @@ class Pupcap::Action::Prepare < Pupcap::Action::Base
|
|
36
33
|
opts.on("-f", "--file FILE", "A recipe file to load") do |file|
|
37
34
|
options[:file] = File.expand_path(file)
|
38
35
|
end
|
36
|
+
|
37
|
+
opts.on("-n", "--hostname NAME", "Set hostname") do |name|
|
38
|
+
options[:hostname] = name
|
39
|
+
end
|
39
40
|
end.parse!
|
40
|
-
options[:
|
41
|
+
options[:tasks] = ARGV
|
41
42
|
@parsed_options = options
|
42
43
|
end
|
43
44
|
@parsed_options
|
@@ -1,10 +1,22 @@
|
|
1
|
+
require 'net/ssh/multi'
|
2
|
+
|
1
3
|
namespace :prepare do
|
2
4
|
task :default do
|
3
5
|
generate_keys
|
4
|
-
|
6
|
+
try_ssh_copy_id
|
5
7
|
run_script
|
6
8
|
end
|
7
9
|
|
10
|
+
task :try_ssh_copy_id do
|
11
|
+
begin
|
12
|
+
run("true")
|
13
|
+
rescue Capistrano::ConnectionError => e
|
14
|
+
pass = Capistrano::CLI.password_prompt("SSH Password: ")
|
15
|
+
set :password, pass
|
16
|
+
ssh_copy_id
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
8
20
|
task :ssh_copy_id do
|
9
21
|
remote_key_path = "/tmp/#{application}_id.pub.#{Time.now.to_i}"
|
10
22
|
upload(provision_key_pub, remote_key_path)
|
@@ -24,12 +36,15 @@ namespace :prepare do
|
|
24
36
|
end
|
25
37
|
|
26
38
|
task :run_script do
|
27
|
-
|
39
|
+
prepare_script = fetch(:pupcap_prepare_command)
|
40
|
+
set :use_sudo, true
|
41
|
+
if File.exists?(prepare_script)
|
28
42
|
remote_script_name = "/tmp/pupcap_prepare.#{Time.now.to_i}.sh"
|
29
|
-
upload(
|
43
|
+
upload(prepare_script, remote_script_name)
|
30
44
|
run("chmod 0755 #{remote_script_name}")
|
31
45
|
force = pupcap_options[:force] ? "1" : "0"
|
32
|
-
|
46
|
+
hostname = pupcap_options[:hostname] ? " PUPCAP_HOSTNAME=#{pupcap_options[:hostname]}" : ""
|
47
|
+
sudo("env PUPCAP_FORCE=#{force}#{hostname} #{remote_script_name}")
|
33
48
|
run("rm #{remote_script_name}")
|
34
49
|
end
|
35
50
|
end
|
@@ -1,16 +1,30 @@
|
|
1
1
|
set -e
|
2
|
+
set -v
|
2
3
|
|
3
|
-
test -e /root/.pupcap_prepare_ok -a ${PUPCAP_FORCE} = "
|
4
|
+
if test -e /root/.pupcap_prepare_ok -a "x${PUPCAP_FORCE}" = "x0"
|
5
|
+
then
|
6
|
+
exit 0
|
7
|
+
fi
|
8
|
+
|
9
|
+
if test ! -e /root/.pupcap_prepare_locale_ok -o "x${PUPCAP_FORCE}" = "x1"
|
10
|
+
then
|
11
|
+
locale-gen en_US.UTF-8 && update-locale LANG=en_US.UTF-8 && touch /root/pupcap_prepare_locale_ok
|
12
|
+
fi
|
4
13
|
|
5
|
-
if
|
6
|
-
|
14
|
+
if test -n "${PUPCAP_HOSTNAME}"
|
15
|
+
then
|
16
|
+
echo ${PUPCAP_HOSTNAME} > /etc/hostname
|
17
|
+
cat /etc/hosts | grep ${PUPCAP_HOSTNAME} || echo "127.0.0.1 ${PUPCAP_HOSTNAME}" >> /etc/hosts && /usr/sbin/service hostname start
|
7
18
|
fi
|
8
19
|
|
9
20
|
SOURCES_LIST=/etc/apt/sources.list
|
10
21
|
|
11
22
|
SOURCES_LIST_MD5=`md5sum ${SOURCES_LIST} | awk '{ print $1 }'`
|
12
23
|
|
13
|
-
if
|
24
|
+
if test "$SOURCES_LIST_MD5" != "14846cd43a3ef58b204b0807fa4856f8" -o "x${PUPCAP_FORCE}" = "x1"
|
25
|
+
then
|
26
|
+
|
27
|
+
cp -f ${SOURCES_LIST} ${SOURCES_LIST}.pupcap_back
|
14
28
|
|
15
29
|
cat <<EOF > ${SOURCES_LIST}
|
16
30
|
#############################################################
|
@@ -18,14 +32,14 @@ if [ "$SOURCES_LIST_MD5" != "0af83b87b34bcdebf8a81a7ccc523e26" -o ${PUPCAP_FORCE
|
|
18
32
|
#############################################################
|
19
33
|
|
20
34
|
###### Ubuntu Main Repos
|
21
|
-
deb
|
22
|
-
deb-src
|
35
|
+
deb http://us.archive.ubuntu.com/ubuntu/ precise main
|
36
|
+
deb-src http://us.archive.ubuntu.com/ubuntu/ precise main
|
23
37
|
|
24
38
|
###### Ubuntu Update Repos
|
25
|
-
deb
|
26
|
-
deb
|
27
|
-
deb-src
|
28
|
-
deb-src
|
39
|
+
deb http://us.archive.ubuntu.com/ubuntu/ precise-security main
|
40
|
+
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main
|
41
|
+
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-security main
|
42
|
+
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates main
|
29
43
|
EOF
|
30
44
|
echo >> ${SOURCES_LIST} # new line
|
31
45
|
|
@@ -38,5 +52,7 @@ apt-get install -qy rsync wget rubygems vim git-core build-essential > /dev/null
|
|
38
52
|
apt-get -qy clean
|
39
53
|
|
40
54
|
/usr/bin/gem install -q --no-ri --no-rdoc --version '~> 2.7.1' puppet
|
55
|
+
/usr/sbin/groupadd -f puppet
|
56
|
+
|
41
57
|
touch /root/.pupcap_prepare_ok
|
42
58
|
|
data/lib/pupcap/action/ssh.rb
CHANGED
@@ -3,9 +3,7 @@ require 'pupcap/command'
|
|
3
3
|
|
4
4
|
class Pupcap::Action::Ssh < Pupcap::Action::Base
|
5
5
|
def initialize
|
6
|
-
check_role!
|
7
6
|
check_puppetfile!
|
8
|
-
ENV["ROLES"] = parsed_options[:role]
|
9
7
|
end
|
10
8
|
|
11
9
|
def start
|
@@ -28,7 +26,7 @@ class Pupcap::Action::Ssh < Pupcap::Action::Base
|
|
28
26
|
exit 0
|
29
27
|
end
|
30
28
|
end.parse!
|
31
|
-
options[:
|
29
|
+
options[:tasks] = ARGV
|
32
30
|
@parsed_options = options
|
33
31
|
end
|
34
32
|
@parsed_options
|
data/lib/pupcap/cli.rb
CHANGED
data/lib/pupcap/version.rb
CHANGED
data/pupcap.gemspec
CHANGED
@@ -21,10 +21,13 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.specification_version = 3
|
22
22
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
23
23
|
s.add_runtime_dependency(%q<capistrano>, [">= 2.12.0"])
|
24
|
+
s.add_runtime_dependency(%q<vagrant>, [">= 1.0.0"])
|
24
25
|
else
|
25
26
|
s.add_dependency(%q<capistrano>, [">= 2.12.0"])
|
27
|
+
s.add_dependency(%q<vagrant>, [">= 1.0.0"])
|
26
28
|
end
|
27
29
|
else
|
28
30
|
s.add_dependency(%q<capistrano>, [">= 2.12.0"])
|
31
|
+
s.add_dependency(%q<vagrant>, [">= 1.0.0"])
|
29
32
|
end
|
30
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pupcap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 2.12.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: vagrant
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.0.0
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.0.0
|
30
46
|
description: under development description
|
31
47
|
email:
|
32
48
|
- dima.exe@gmail.com
|
@@ -37,13 +53,18 @@ extra_rdoc_files: []
|
|
37
53
|
files:
|
38
54
|
- .gitignore
|
39
55
|
- Gemfile
|
56
|
+
- README
|
40
57
|
- Rakefile
|
41
58
|
- bin/pupcap
|
42
59
|
- lib/pupcap.rb
|
43
60
|
- lib/pupcap/action.rb
|
44
|
-
- lib/pupcap/action/.prepare.rb.swp
|
45
61
|
- lib/pupcap/action/cook.rb
|
46
62
|
- lib/pupcap/action/cook/Capfile
|
63
|
+
- lib/pupcap/action/cook/apply.sh.erb
|
64
|
+
- lib/pupcap/action/init.rb
|
65
|
+
- lib/pupcap/action/init/Puppetfile.erb
|
66
|
+
- lib/pupcap/action/init/Vagrantfile.erb
|
67
|
+
- lib/pupcap/action/init/default.pp.erb
|
47
68
|
- lib/pupcap/action/prepare.rb
|
48
69
|
- lib/pupcap/action/prepare/Capfile
|
49
70
|
- lib/pupcap/action/prepare/ubuntu/precise.sh
|