mina-rails-tools 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mina/extras/apt.rb +1 -1
- data/lib/mina/extras/brew.rb +1 -1
- data/lib/mina/extras/extra.rb +1 -1
- data/lib/mina/extras/gem.rb +4 -4
- data/lib/mina/extras/god.rb +18 -18
- data/lib/mina/extras/nginx.rb +2 -2
- data/lib/mina/extras/rainbows.rb +7 -7
- data/lib/mina/extras/system.rb +1 -1
- data/lib/mina/extras/ubuntu.rb +15 -15
- data/lib/mina/extras/unicorn.rb +10 -10
- data/lib/mina/extras/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ac646a5908cb9aca9a13adeec68e1ff94dd8cf9
|
4
|
+
data.tar.gz: 8343d35a0327c0436673d7ba55a329f2161fa469
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14618d267fb7db1a13e8a8d03153353d5c578ffe604e44a4837f506d9d47d4734dc66535972de87430bc43d80af8fcdd0a3d460ba8ed24ae03193e1796378d93
|
7
|
+
data.tar.gz: 15908838581d84b329c819f25704601e027c363a3fc0e7062fe084af237fd14708045961e5b3d46f80411f51ea75fae8579e115a6ae7a1d4a982d5224911cbc8
|
data/lib/mina/extras/apt.rb
CHANGED
data/lib/mina/extras/brew.rb
CHANGED
data/lib/mina/extras/extra.rb
CHANGED
data/lib/mina/extras/gem.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
def gem_install(package, options=nil)
|
2
|
-
command
|
2
|
+
command "sudo gem install #{package} #{options} --no-rdoc --no-ri"
|
3
3
|
end
|
4
4
|
|
5
5
|
namespace :gem do
|
@@ -11,13 +11,13 @@ namespace :gem do
|
|
11
11
|
namespace :source do
|
12
12
|
task :prepare do
|
13
13
|
if in_china?
|
14
|
-
command
|
15
|
-
command
|
14
|
+
command "sudo gem source -a http://ruby.taobao.org/"
|
15
|
+
command "sudo gem source -r https://rubygems.org/"
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
task :list do
|
20
|
-
command
|
20
|
+
command "sudo gem source"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
data/lib/mina/extras/god.rb
CHANGED
@@ -10,44 +10,44 @@ set :use_god, true
|
|
10
10
|
namespace :god do
|
11
11
|
|
12
12
|
task :setup do
|
13
|
-
command
|
13
|
+
command "sudo mkdir -p #{god_path}/conf"
|
14
14
|
end
|
15
15
|
|
16
16
|
task :link do
|
17
17
|
extra_echo "Relocate god script file"
|
18
|
-
command
|
19
|
-
command
|
20
|
-
command
|
21
|
-
command
|
22
|
-
command
|
23
|
-
command
|
24
|
-
command
|
25
|
-
command
|
18
|
+
command %{sudo rm -rf "#{god_service_path}/god"}
|
19
|
+
command "sudo mkdir -p #{god_path}/conf"
|
20
|
+
command "sudo chown -R #{user} #{god_path}"
|
21
|
+
command %{sudo cp "#{god_path}/god.sh" "#{god_service_path}/god"}
|
22
|
+
command %{sudo chown #{god_user}:#{god_group} "#{god_service_path}/god"}
|
23
|
+
command %{sudo chmod +x "#{god_service_path}/god"}
|
24
|
+
command "sudo chown -R #{god_user}:#{god_group} #{god_path}"
|
25
|
+
command "sudo update-rc.d god defaults"
|
26
26
|
end
|
27
27
|
|
28
28
|
task :tmp_add_permission do
|
29
|
-
command
|
29
|
+
command "sudo chown -R #{user} #{god_path}"
|
30
30
|
end
|
31
31
|
|
32
32
|
task :set_permission do
|
33
|
-
command
|
33
|
+
command "sudo chown -R #{god_user}:#{god_group} #{god_path}"
|
34
34
|
end
|
35
35
|
|
36
36
|
task :upload => [:'upload:script', :'upload:global']
|
37
37
|
|
38
38
|
namespace :upload do
|
39
39
|
task :script do
|
40
|
-
command
|
41
|
-
command
|
40
|
+
command "sudo mkdir -p #{god_path}/conf"
|
41
|
+
command "sudo chown -R #{user} #{god_path}"
|
42
42
|
upload_file "god.sh", "#{god_path}/god.sh"
|
43
|
-
command
|
43
|
+
command "sudo chown -R #{god_user}:#{god_group} #{god_path}"
|
44
44
|
end
|
45
45
|
|
46
46
|
task :global do
|
47
|
-
command
|
48
|
-
command
|
47
|
+
command "sudo mkdir -p #{god_path}/conf"
|
48
|
+
command "sudo chown -R #{user} #{god_path}"
|
49
49
|
upload_file 'global.god', "#{god_path}/global.god"
|
50
|
-
command
|
50
|
+
command "sudo chown -R #{god_user}:#{god_group} #{god_path}"
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -56,7 +56,7 @@ namespace :god do
|
|
56
56
|
task action.to_sym do
|
57
57
|
invoke :sudo
|
58
58
|
command %{echo "-----> #{action.capitalize} God"}
|
59
|
-
command
|
59
|
+
command "sudo #{god_service_path}/god #{action}"
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
data/lib/mina/extras/nginx.rb
CHANGED
@@ -19,7 +19,7 @@ namespace :nginx do
|
|
19
19
|
invoke :sudo
|
20
20
|
extra_echo("Nginx: Symlink config file")
|
21
21
|
|
22
|
-
command
|
22
|
+
command %{sudo ln -fs "#{deploy_to}/shared/nginx.conf" "#{nginx_conf_path}/#{fetch(:app)}.conf"}
|
23
23
|
# command check_symlink nginx_conf_path
|
24
24
|
end
|
25
25
|
|
@@ -38,7 +38,7 @@ namespace :nginx do
|
|
38
38
|
task action.to_sym do
|
39
39
|
invoke :sudo
|
40
40
|
extra_echo("Nginx: #{action.capitalize}")
|
41
|
-
command
|
41
|
+
command "sudo service nginx #{action}"
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
data/lib/mina/extras/rainbows.rb
CHANGED
@@ -20,9 +20,9 @@ namespace :rainbows do
|
|
20
20
|
desc "Unicron: startup"
|
21
21
|
task :defaults do
|
22
22
|
invoke :sudo
|
23
|
-
command
|
24
|
-
command
|
25
|
-
command
|
23
|
+
command %{sudo chown root:root /etc/init.d/rainbows-#{fetch(:app)}}
|
24
|
+
command %{sudo chmod u+x /etc/init.d/rainbows-#{fetch(:app)}}
|
25
|
+
command "sudo update-rc.d rainbows-#{fetch(:app)} defaults"
|
26
26
|
end
|
27
27
|
|
28
28
|
task :log do
|
@@ -37,7 +37,7 @@ namespace :rainbows do
|
|
37
37
|
task :link do
|
38
38
|
invoke :sudo
|
39
39
|
extra_echo("Rainbows: Link script file")
|
40
|
-
command
|
40
|
+
command %{sudo cp '#{deploy_to}/shared/config/rainbows_init.sh' '/etc/init.d/rainbows-#{fetch(:app)}'}
|
41
41
|
|
42
42
|
invoke :"rainbows:defaults"
|
43
43
|
end
|
@@ -45,19 +45,19 @@ namespace :rainbows do
|
|
45
45
|
desc "Start rainbows"
|
46
46
|
task :start do
|
47
47
|
extra_echo("Rainbows: Start")
|
48
|
-
command
|
48
|
+
command "/etc/init.d/rainbows-#{fetch(:app)} start"
|
49
49
|
end
|
50
50
|
|
51
51
|
desc "Stop rainbows"
|
52
52
|
task :stop do
|
53
53
|
extra_echo("Rainbows: Stop")
|
54
|
-
command
|
54
|
+
command "/etc/init.d/rainbows-#{fetch(:app)} stop"
|
55
55
|
end
|
56
56
|
|
57
57
|
desc "Restart rainbows using 'upgrade'"
|
58
58
|
task :restart do
|
59
59
|
extra_echo("Rainbows: Restart")
|
60
|
-
command
|
60
|
+
command "/etc/init.d/rainbows-#{fetch(:app)} upgrade"
|
61
61
|
end
|
62
62
|
|
63
63
|
end
|
data/lib/mina/extras/system.rb
CHANGED
data/lib/mina/extras/ubuntu.rb
CHANGED
@@ -21,7 +21,7 @@ namespace :ubuntu do
|
|
21
21
|
namespace :remote do
|
22
22
|
task :setup do
|
23
23
|
invoke :sudo
|
24
|
-
command
|
24
|
+
command %{mkdir -p ~/.ssh}
|
25
25
|
append_template(ssh_pub_key_path, ".ssh/authorized_keys")
|
26
26
|
end
|
27
27
|
|
@@ -30,31 +30,31 @@ namespace :ubuntu do
|
|
30
30
|
add_user("deploy")
|
31
31
|
command "sudo usermod -a -G www-data deploy"
|
32
32
|
|
33
|
-
command
|
34
|
-
command
|
33
|
+
command "sudo mkdir -p /home/deploy/.ssh"
|
34
|
+
command "sudo touch /home/deploy/.ssh/authorized_keys"
|
35
35
|
append_template(ssh_pub_key_path, "/home/deploy/.ssh/authorized_keys")
|
36
|
-
command
|
37
|
-
command
|
36
|
+
command "sudo chown -R deploy:deploy /home/deploy/.ssh"
|
37
|
+
command "sudo chmod 664 /home/deploy/.ssh/authorized_keys"
|
38
38
|
end
|
39
39
|
|
40
40
|
task :add_ubuntu do
|
41
41
|
invoke :sudo
|
42
42
|
add_user("ubuntu")
|
43
|
-
command
|
44
|
-
command
|
45
|
-
command
|
46
|
-
command
|
43
|
+
command "sudo groupadd admin"
|
44
|
+
command "sudo usermod -a -G admin ubuntu"
|
45
|
+
command "sudo mkdir -p /home/ubuntu/.ssh"
|
46
|
+
command "sudo touch /home/ubuntu/.ssh/authorized_keys"
|
47
47
|
append_template(ssh_pub_key_path, "/home/ubuntu/.ssh/authorized_keys")
|
48
|
-
command
|
49
|
-
command
|
48
|
+
command "sudo chown -R ubuntu:ubuntu /home/ubuntu/.ssh"
|
49
|
+
command "sudo chmod 664 /home/ubuntu/.ssh/authorized_keys"
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
namespace :locale do
|
54
54
|
task :setup do
|
55
55
|
invoke :sudo
|
56
|
-
command
|
57
|
-
command
|
56
|
+
command %{sudo locale-gen en_US en_US.UTF8}
|
57
|
+
command %{sudo sh -c "echo 'LC_ALL=\"en_US.utf8\"' >> /etc/environment"}
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -92,8 +92,8 @@ namespace :ubuntu do
|
|
92
92
|
|
93
93
|
task :www do
|
94
94
|
invoke :sudo
|
95
|
-
command
|
96
|
-
command
|
95
|
+
command "sudo mkdir -p /var/www"
|
96
|
+
command "sudo chown -R deploy:www-data /var/www"
|
97
97
|
end
|
98
98
|
|
99
99
|
task :ssh_key do
|
data/lib/mina/extras/unicorn.rb
CHANGED
@@ -22,7 +22,7 @@ namespace :unicorn do
|
|
22
22
|
desc "Unicron: startup"
|
23
23
|
task :defaults do
|
24
24
|
invoke :sudo
|
25
|
-
command
|
25
|
+
command "sudo update-rc.d unicorn-#{fetch(:app)} defaults"
|
26
26
|
end
|
27
27
|
|
28
28
|
namespace :god do
|
@@ -32,18 +32,18 @@ namespace :unicorn do
|
|
32
32
|
|
33
33
|
task :link do
|
34
34
|
invoke :sudo
|
35
|
-
command
|
35
|
+
command %{sudo cp -rf #{deploy_to}/#{shared_path}/unicorn.god #{god_path}/conf/unicorn-#{fetch(:app)}.god}
|
36
36
|
invoke :"god:restart"
|
37
37
|
end
|
38
38
|
|
39
39
|
task :start do
|
40
40
|
invoke :sudo
|
41
|
-
command
|
41
|
+
command %{sudo god start unicorn_#{fetch(:app)}}
|
42
42
|
end
|
43
43
|
|
44
44
|
task :stop do
|
45
45
|
invoke :sudo
|
46
|
-
command
|
46
|
+
command %{sudo god stop unicorn_#{fetch(:app)}}
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -59,28 +59,28 @@ namespace :unicorn do
|
|
59
59
|
task :link do
|
60
60
|
invoke :sudo
|
61
61
|
extra_echo("Unicorn: Link script file")
|
62
|
-
command
|
63
|
-
command
|
64
|
-
command
|
62
|
+
command %{sudo cp '#{deploy_to}/shared/unicorn_init.sh' '/etc/init.d/unicorn-#{fetch(:app)}'}
|
63
|
+
command %{sudo chown #{user!}:#{group!} /etc/init.d/unicorn-#{fetch(:app)}}
|
64
|
+
command %{sudo chmod u+x /etc/init.d/unicorn-#{fetch(:app)}}
|
65
65
|
# invoke :"unicorn:defaults"
|
66
66
|
end
|
67
67
|
|
68
68
|
desc "Start unicorn"
|
69
69
|
task :start do
|
70
70
|
extra_echo("Unicorn: Start")
|
71
|
-
command
|
71
|
+
command "/etc/init.d/unicorn-#{fetch(:app)} start"
|
72
72
|
end
|
73
73
|
|
74
74
|
desc "Stop unicorn"
|
75
75
|
task :stop do
|
76
76
|
extra_echo("Unicorn: Stop")
|
77
|
-
command
|
77
|
+
command "/etc/init.d/unicorn-#{fetch(:app)} stop"
|
78
78
|
end
|
79
79
|
|
80
80
|
desc "Restart unicorn using 'upgrade'"
|
81
81
|
task :restart do
|
82
82
|
extra_echo("Unicorn: Restart")
|
83
|
-
command
|
83
|
+
command "/etc/init.d/unicorn-#{fetch(:app)} upgrade"
|
84
84
|
end
|
85
85
|
|
86
86
|
end
|
data/lib/mina/extras/version.rb
CHANGED