pupcap 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/pupcap/action.rb +9 -1
- data/lib/pupcap/action/apply.rb +1 -1
- data/lib/pupcap/action/apply/Capfile +16 -7
- data/lib/pupcap/action/apply/puppet.sh.erb +1 -1
- data/lib/pupcap/action/init.rb +2 -2
- data/lib/pupcap/action/init/{Capfile.erb → Pupcapfile.erb} +0 -0
- data/lib/pupcap/action/prepare.rb +1 -1
- data/lib/pupcap/action/ssh.rb +1 -1
- data/lib/pupcap/version.rb +1 -1
- data/pupcap.gemspec +3 -0
- metadata +18 -2
data/lib/pupcap/action.rb
CHANGED
@@ -39,6 +39,7 @@ module Pupcap::Action
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def cap_load_and_run_task(cap, task)
|
42
|
+
cap.load "deploy"
|
42
43
|
cap.load "#{lib_root}/#{task}/Capfile"
|
43
44
|
cap.trigger(:load)
|
44
45
|
cap.find_and_execute_task(task, :before => :start, :after => :finish)
|
@@ -54,11 +55,18 @@ module Pupcap::Action
|
|
54
55
|
cap.set :pupcap_root, File.dirname(File.expand_path __FILE__)
|
55
56
|
cap.set :provision_key, "#{cap.local_root}/.keys/provision"
|
56
57
|
cap.set :provision_key_pub, "#{cap.local_root}/.keys/provision.pub"
|
57
|
-
cap.set :deploy_to, "/tmp/
|
58
|
+
cap.set :deploy_to, "/tmp/pupcap"
|
58
59
|
cap.set :pupcap_options, parsed_options
|
59
60
|
cap.ssh_options[:keys] = cap.provision_key
|
60
61
|
cap.ssh_options[:forward_agent] = true
|
61
62
|
cap.default_run_options[:pty] = true
|
63
|
+
|
64
|
+
cap.set :deploy_via, :copy
|
65
|
+
cap.set :copy_cache, true
|
66
|
+
cap.set :copy_exclude, [".git", ".keys"]
|
67
|
+
cap.set :repository, "."
|
68
|
+
cap.set :keep_releases, 2
|
69
|
+
cap.set :use_sudo, false
|
62
70
|
cap
|
63
71
|
end
|
64
72
|
end
|
data/lib/pupcap/action/apply.rb
CHANGED
@@ -1,23 +1,32 @@
|
|
1
1
|
require 'erb'
|
2
2
|
|
3
|
+
namespace :deploy do
|
4
|
+
task :finalize_update do
|
5
|
+
run("ln -sf #{shared_path}/librarian-puppet-cache #{release_path}/puppet/.tmp")
|
6
|
+
run("cd #{release_path}/puppet && test -f #{release_path}/puppet/Puppetfile && /usr/local/bin/librarian-puppet install ; true")
|
7
|
+
end
|
8
|
+
|
9
|
+
task :restart do
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
3
13
|
namespace :apply do
|
4
14
|
task :default do
|
5
|
-
|
15
|
+
try_create_dirs
|
16
|
+
find_and_execute_task("deploy")
|
17
|
+
find_and_execute_task("deploy:cleanup")
|
6
18
|
puppet
|
7
|
-
cleanup
|
8
19
|
end
|
9
20
|
|
10
|
-
task :
|
11
|
-
|
12
|
-
to = deploy_to
|
13
|
-
upload(from, to, :recursive => true, :via => :scp)
|
21
|
+
task :try_create_dirs do
|
22
|
+
run("mkdir -p #{deploy_to}/releases ; mkdir -p #{deploy_to}/shared/librarian-puppet-cache ; chmod 0700 #{deploy_to}")
|
14
23
|
end
|
15
24
|
|
16
25
|
task :puppet do
|
17
26
|
remote_command = "#{deploy_to}/apply.sh"
|
18
27
|
|
19
28
|
puppet = "/usr/local/bin/puppet"
|
20
|
-
modules = "--modulepath=#{
|
29
|
+
modules = "--modulepath=#{current_path}/puppet/modules:#{current_path}/puppet/site-modules"
|
21
30
|
nook = pupcap_options[:noop] ? " --noop" : ""
|
22
31
|
debug = pupcap_options[:debug] ? " --debug --verbose" : ""
|
23
32
|
|
@@ -3,6 +3,6 @@ set -e
|
|
3
3
|
for role in $(echo "${1}" | tr "," "\n")
|
4
4
|
do
|
5
5
|
echo "*** Role: ${role} ***"
|
6
|
-
<%= puppet %> apply <%= nook + debug %> --detailed-exitcodes <%= modules %> <%=
|
6
|
+
<%= puppet %> apply <%= nook + debug %> --detailed-exitcodes <%= modules %> <%= current_path %>/puppet/manifests/${role}.pp || true
|
7
7
|
done
|
8
8
|
|
data/lib/pupcap/action/init.rb
CHANGED
@@ -29,9 +29,9 @@ class Pupcap::Action::Init < Pupcap::Action::Base
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def create_capfile
|
32
|
-
out = "#{work_dir}/
|
32
|
+
out = "#{work_dir}/Pupcapfile"
|
33
33
|
if !File.exists?(out) || force?
|
34
|
-
erb = ERB.new(File.read("#{lib_root}/init/
|
34
|
+
erb = ERB.new(File.read("#{lib_root}/init/Pupcapfile.erb"))
|
35
35
|
rs = erb.result(binding)
|
36
36
|
File.open(out, "w+"){ |io| io.write rs }
|
37
37
|
puts "\t create Capfile"
|
File without changes
|
data/lib/pupcap/action/ssh.rb
CHANGED
data/lib/pupcap/version.rb
CHANGED
data/pupcap.gemspec
CHANGED
@@ -23,14 +23,17 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_runtime_dependency(%q<capistrano>, [">= 2.12.0"])
|
24
24
|
s.add_runtime_dependency(%q<vagrant>, [">= 1.0.0"])
|
25
25
|
s.add_runtime_dependency(%q<librarian-puppet>, [">= 0.9.7"])
|
26
|
+
s.add_runtime_dependency(%q<net-ssh-multi>, [">= 1.1.0"])
|
26
27
|
else
|
27
28
|
s.add_dependency(%q<capistrano>, [">= 2.12.0"])
|
28
29
|
s.add_dependency(%q<vagrant>, [">= 1.0.0"])
|
29
30
|
s.add_dependency(%q<librarian-puppet>, [">= 0.9.7"])
|
31
|
+
s.add_dependency(%q<net-ssh-multi>, [">= 1.1.0"])
|
30
32
|
end
|
31
33
|
else
|
32
34
|
s.add_dependency(%q<capistrano>, [">= 2.12.0"])
|
33
35
|
s.add_dependency(%q<vagrant>, [">= 1.0.0"])
|
34
36
|
s.add_dependency(%q<librarian-puppet>, [">= 0.9.7"])
|
37
|
+
s.add_dependency(%q<net-ssh-multi>, [">= 1.1.0"])
|
35
38
|
end
|
36
39
|
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.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -59,6 +59,22 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 0.9.7
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: net-ssh-multi
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.1.0
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.1.0
|
62
78
|
description: under development description
|
63
79
|
email:
|
64
80
|
- dima.exe@gmail.com
|
@@ -78,7 +94,7 @@ files:
|
|
78
94
|
- lib/pupcap/action/apply/Capfile
|
79
95
|
- lib/pupcap/action/apply/puppet.sh.erb
|
80
96
|
- lib/pupcap/action/init.rb
|
81
|
-
- lib/pupcap/action/init/
|
97
|
+
- lib/pupcap/action/init/Pupcapfile.erb
|
82
98
|
- lib/pupcap/action/init/Vagrantfile.erb
|
83
99
|
- lib/pupcap/action/init/gitignore
|
84
100
|
- lib/pupcap/action/init/site.pp.erb
|