capistrano-toolbox 0.0.8 → 0.0.9
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 +7 -0
- data/lib/capistrano-toolbox/helpers.rb +13 -8
- data/lib/capistrano-toolbox/nginx.rb +13 -8
- metadata +10 -14
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d8aedc2dac879ff0ce1105c398f6d49e2cd293ca
|
4
|
+
data.tar.gz: 5cca6709b92d33f36553dd2b79dbb7927f1244ca
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4af725d02037cbfaaf18687ed831d197b1a5406bc9f0a716661807c784a0e7f7fe1739f91d052c87e704bc375dde8118f9e1e623289aeff88255ee60f8b36e00
|
7
|
+
data.tar.gz: aec3423878638b1742fd8d2fbba25da169e3c9644089b62c57fb6b91955b31fd67b0c4000363bb536ca27d3a4ce7d223b9ca6694734a281abedfadffe7fd0603
|
@@ -1,29 +1,34 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
|
1
3
|
Capistrano::Configuration.instance(:must_exist).load do
|
2
|
-
def put_as_root(contents, target)
|
4
|
+
def put_as_root (user, contents, target, sudo=false)
|
3
5
|
tempfile = Tempfile.new(File.basename(target))
|
4
6
|
tempfile.write(contents)
|
5
7
|
tempfile.close
|
6
|
-
|
7
|
-
surun "chmod 644 #{target}"
|
8
|
+
suscp(user, tempfile.path, target, sudo)
|
9
|
+
surun(user, "chmod 644 #{target}", sudo)
|
10
|
+
surun(user, "chown root:root #{target}", sudo)
|
8
11
|
tempfile.unlink
|
9
12
|
end
|
10
13
|
|
11
|
-
def
|
14
|
+
def suscp (user, from, to, sudo=false)
|
12
15
|
servers = find_servers_for_task(current_task)
|
13
16
|
servers.each do |server|
|
14
|
-
|
17
|
+
tempfile = "~/suscp-upload-#{SecureRandom.hex(6)}"
|
18
|
+
command = "scp #{from} #{user}@#{server}:#{tempfile}"
|
15
19
|
puts " * \033[1;33mexecuting \"#{command}\"\033[0m"
|
16
|
-
system command
|
20
|
+
raise unless system command
|
21
|
+
surun(user, "mv #{tempfile} #{to}", sudo)
|
17
22
|
end
|
18
23
|
end
|
19
24
|
|
20
|
-
def surun (command)
|
25
|
+
def surun (user, command, sudo=false)
|
21
26
|
puts " * \033[1;33mexecuting sudo \"#{command}\"\033[0m"
|
22
27
|
servers = find_servers_for_task(current_task)
|
23
28
|
puts " servers: #{servers.inspect}"
|
24
29
|
servers.each do |server|
|
25
30
|
puts " [#{server}] executing command"
|
26
|
-
|
31
|
+
raise unless system %!ssh #{server} -l #{user} "#{"sudo" if sudo} #{command.gsub('"','\\"')}"!
|
27
32
|
end
|
28
33
|
end
|
29
34
|
|
@@ -6,29 +6,34 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
6
6
|
|
7
7
|
desc "Updates nginx config"
|
8
8
|
task :update_config do
|
9
|
-
|
9
|
+
nginx_user = fetch(:nginx_user, "root")
|
10
|
+
nginx_use_sudo = fetch(:nginx_use_sudo, false)
|
10
11
|
|
11
|
-
|
12
|
+
config_dir = fetch(:nginx_remote_config_dir)
|
13
|
+
config = fetch(:nginx_config, nil)
|
12
14
|
if config
|
13
15
|
available_path = File.join(config_dir, "#{application}.conf")
|
14
|
-
put_as_root(config, available_path)
|
15
|
-
surun "nxensite #{application}.conf"
|
16
|
+
put_as_root(nginx_user, config, available_path, nginx_use_sudo)
|
17
|
+
surun(nginx_user, "nxensite #{application}.conf", nginx_use_sudo)
|
16
18
|
end
|
17
19
|
|
18
20
|
ssl_config = fetch(:nginx_ssl_config, nil)
|
19
21
|
if ssl_config
|
20
22
|
available_ssl_path = File.join(config_dir, "#{application}-ssl.conf")
|
21
|
-
put_as_root(ssl_config, available_ssl_path)
|
22
|
-
surun "nxensite #{application}-ssl.conf"
|
23
|
+
put_as_root(nginx_user, ssl_config, available_ssl_path, nginx_use_sudo)
|
24
|
+
surun(nginx_user, "nxensite #{application}-ssl.conf", nginx_use_sudo)
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
26
28
|
desc "Reload nginx config"
|
27
29
|
task :reload, :roles => :app, :except => { :no_release => true } do
|
28
|
-
|
30
|
+
nginx_user = fetch(:nginx_user, "root")
|
31
|
+
nginx_use_sudo = fetch(:nginx_use_sudo, false)
|
32
|
+
|
33
|
+
surun(nginx_user, "service nginx reload", nginx_use_sudo)
|
29
34
|
end
|
30
35
|
end
|
31
36
|
end
|
32
37
|
|
33
38
|
after "deploy:nginx:update_config", "deploy:nginx:reload"
|
34
|
-
end
|
39
|
+
end
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-toolbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.9
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jean-Louis Giordano
|
@@ -11,26 +10,24 @@ authors:
|
|
11
10
|
autorequire:
|
12
11
|
bindir: bin
|
13
12
|
cert_chain: []
|
14
|
-
date: 2013-
|
13
|
+
date: 2013-09-25 00:00:00.000000000 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: capistrano
|
18
17
|
requirement: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
18
|
requirements:
|
21
|
-
- -
|
19
|
+
- - '>='
|
22
20
|
- !ruby/object:Gem::Version
|
23
21
|
version: '0'
|
24
22
|
type: :runtime
|
25
23
|
prerelease: false
|
26
24
|
version_requirements: !ruby/object:Gem::Requirement
|
27
|
-
none: false
|
28
25
|
requirements:
|
29
|
-
- -
|
26
|
+
- - '>='
|
30
27
|
- !ruby/object:Gem::Version
|
31
28
|
version: '0'
|
32
29
|
description: Some useful capistrano tools, such as unicorn restart, nginx config etc.
|
33
|
-
email: dev@
|
30
|
+
email: dev@pugglepay.com
|
34
31
|
executables: []
|
35
32
|
extensions: []
|
36
33
|
extra_rdoc_files: []
|
@@ -43,26 +40,25 @@ files:
|
|
43
40
|
- lib/capistrano-toolbox/helpers.rb
|
44
41
|
homepage: http://github.com/spnab/
|
45
42
|
licenses: []
|
43
|
+
metadata: {}
|
46
44
|
post_install_message:
|
47
45
|
rdoc_options: []
|
48
46
|
require_paths:
|
49
47
|
- lib
|
50
48
|
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
-
none: false
|
52
49
|
requirements:
|
53
|
-
- -
|
50
|
+
- - '>='
|
54
51
|
- !ruby/object:Gem::Version
|
55
52
|
version: '0'
|
56
53
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
54
|
requirements:
|
59
|
-
- -
|
55
|
+
- - '>='
|
60
56
|
- !ruby/object:Gem::Version
|
61
57
|
version: '0'
|
62
58
|
requirements: []
|
63
59
|
rubyforge_project:
|
64
|
-
rubygems_version: 1.
|
60
|
+
rubygems_version: 2.1.3
|
65
61
|
signing_key:
|
66
|
-
specification_version:
|
62
|
+
specification_version: 4
|
67
63
|
summary: Some useful capistrano tools.
|
68
64
|
test_files: []
|