mina-rails-tools 0.1.6 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea17f38f2a04830990509fd0d1a0e566446d5096
4
- data.tar.gz: 496372cda307abf7dd4545fb809718fcb27c15c9
3
+ metadata.gz: 557849364ded29fbbf2daec36623167cf3e60b5e
4
+ data.tar.gz: 697ea46e24df21c081c95c38d825455cf8795df1
5
5
  SHA512:
6
- metadata.gz: ce0a8651f31a4de42189f44142db3a558e740f7781e5b0ca57202c2987e1761729b4b805e5f65f6738141c6dbb2ddec4cb7f504a2dc663575b559da8a7be66f9
7
- data.tar.gz: 0bc5007462e0594038dd13c66014febefc33604618998057f969749e997bc59c6ee8fcc867773176a608569616dfa13bcd5bb7c6dbcf9f4f70e935c0767dee09
6
+ metadata.gz: 1020ad59edd4551e19b129a503109dfc4ea593a53bd2421e33f50f831a056ce67e706a6e71ecfff2f03c9ec4318afaf5782681b5ccd01ea2670c56259079ab88
7
+ data.tar.gz: 5566e87139272c5a402effa3a738efdae5f31be6fc90b3b08ae71913e4522ebc614883430b7a5ea6b477db52f4f18ce910463372b5ac49c8dac96c6853ecbbf5
@@ -57,7 +57,7 @@ namespace :extra do
57
57
  end.uniq
58
58
 
59
59
  folders.map do |dir|
60
- command %{mkdir -p "#{deploy_to}/shared/#{dir}"}
60
+ command %{mkdir -p "#{fetch(:deploy_to)}/shared/#{dir}"}
61
61
  end
62
62
  end
63
63
 
@@ -1,5 +1,5 @@
1
1
  def mv_config(source, destination)
2
- command %{mv #{deploy_to}/shared/config/#{source} #{deploy_to}/shared/config/#{destination}}
2
+ command %{mv #{fetch(:deploy_to)}/shared/config/#{source} #{fetch(:deploy_to)}/shared/config/#{destination}}
3
3
  end
4
4
 
5
5
  def extra_echo(desc)
@@ -29,9 +29,9 @@ def upload_shared_file(filename)
29
29
  src = custom_conf_path(filename)
30
30
 
31
31
  if src
32
- upload_template src, "#{deploy_to}/shared/#{filename}"
32
+ upload_template src, "#{fetch(:deploy_to)}/shared/#{filename}"
33
33
  else
34
- upload_default_template filename, "#{deploy_to}/shared/#{filename}"
34
+ upload_default_template filename, "#{fetch(:deploy_to)}/shared/#{filename}"
35
35
  end
36
36
  end
37
37
 
@@ -119,7 +119,7 @@ def upload_shared_folder(folder, base)
119
119
  else
120
120
  filename = File.basename(path)
121
121
  shared_folder = path.gsub(base, "").gsub(filename, "").gsub(/\A\//, "").gsub(/\/\Z/, "")
122
- des = "#{deploy_to}/shared/#{shared_folder}/#{filename.gsub(/\.erb$/, "")}"
122
+ des = "#{fetch(:deploy_to)}/shared/#{shared_folder}/#{filename.gsub(/\.erb$/, "")}"
123
123
  upload_template path, des
124
124
  end
125
125
  end
@@ -19,7 +19,7 @@ namespace :nginx do
19
19
  invoke :sudo
20
20
  extra_echo("Nginx: Symlink config file")
21
21
 
22
- command %{sudo ln -fs "#{deploy_to}/shared/nginx.conf" "#{nginx_conf_path}/#{fetch(:app)}.conf"}
22
+ command %{sudo ln -fs "#{fetch(:deploy_to)}/shared/nginx.conf" "#{nginx_conf_path}/#{fetch(:app)}.conf"}
23
23
  # command check_symlink nginx_conf_path
24
24
  end
25
25
 
@@ -16,14 +16,14 @@ task :rollback => :environment do
16
16
  # remove latest release folder (active release)
17
17
  extra_echo("Deleting active release: ")
18
18
 
19
- command %[ls "#{deploy_to}/releases" -Art | sort | tail -n 1]
20
- command %[ls "#{deploy_to}/releases" -Art | sort | tail -n 1 | xargs -I active rm -rf "#{deploy_to}/releases/active"]
19
+ command %[ls "#{fetch(:deploy_to)}/releases" -Art | sort | tail -n 1]
20
+ command %[ls "#{fetch(:deploy_to)}/releases" -Art | sort | tail -n 1 | xargs -I active rm -rf "#{fetch(:deploy_to)}/releases/active"]
21
21
 
22
22
  # delete existing sym link and create a new symlink pointing to the previous release
23
23
  extra_echo("Creating new symlink from the previous release: ")
24
- command %[ls "#{deploy_to}/releases" -Art | sort | tail -n 1]
25
- command %[rm "#{deploy_to}/current"]
26
- command %[ls -Art "#{deploy_to}/releases" | sort | tail -n 1 | xargs -I active ln -s "#{deploy_to}/releases/active" "#{deploy_to}/current"]
24
+ command %[ls "#{fetch(:deploy_to)}/releases" -Art | sort | tail -n 1]
25
+ command %[rm "#{fetch(:deploy_to)}/current"]
26
+ command %[ls -Art "#{fetch(:deploy_to)}/releases" | sort | tail -n 1 | xargs -I active ln -s "#{fetch(:deploy_to)}/releases/active" "#{fetch(:deploy_to)}/current"]
27
27
 
28
28
  invoke :'unicorn:restart'
29
29
  end
@@ -2,10 +2,10 @@ set :log_line, 200
2
2
 
3
3
  desc "Rails Log"
4
4
  task :log => :environment do
5
- command echo_cmd("cd #{deploy_to}/current && tail -f log/production.log -n #{ENV["n"] || log_line}")
5
+ command echo_cmd("cd #{fetch(:deploy_to)}/current && tail -f log/production.log -n #{ENV["n"] || log_line}")
6
6
  end
7
7
 
8
8
  desc "Rails Console"
9
9
  task :console => :environment do
10
- command echo_cmd("cd #{deploy_to}/current && RAILS_ENV=production bundle exec rails c")
10
+ command echo_cmd("cd #{fetch(:deploy_to)}/current && RAILS_ENV=production bundle exec rails c")
11
11
  end
@@ -26,18 +26,18 @@ namespace :rainbows do
26
26
  end
27
27
 
28
28
  task :log do
29
- command %{tail -f "#{deploy_to!}/#{shared_path}/log/rainbows.log" -n 200}
29
+ command %{tail -f "#{fetch(:deploy_to)!}/#{shared_path}/log/rainbows.log" -n 200}
30
30
  end
31
31
 
32
32
  task :err_log do
33
- command %{tail -f "#{deploy_to!}/#{shared_path}/log/rainbows.error.log" -n 200}
33
+ command %{tail -f "#{fetch(:deploy_to)!}/#{shared_path}/log/rainbows.error.log" -n 200}
34
34
  end
35
35
 
36
36
  desc "Rainbows: Link script files"
37
37
  task :link do
38
38
  invoke :sudo
39
39
  extra_echo("Rainbows: Link script file")
40
- command %{sudo cp '#{deploy_to}/shared/config/rainbows_init.sh' '/etc/init.d/rainbows-#{fetch(:app)}'}
40
+ command %{sudo cp '#{fetch(:deploy_to)}/shared/config/rainbows_init.sh' '/etc/init.d/rainbows-#{fetch(:app)}'}
41
41
 
42
42
  invoke :"rainbows:defaults"
43
43
  end
@@ -7,7 +7,7 @@ server {
7
7
  listen <%= nginx_port %><%= ' default' if nginx_default %>;
8
8
  server_name <%= domain %>;
9
9
 
10
- root <%= deploy_to %>/<%= current_path %>/public;
10
+ root <%= fetch(:deploy_to) %>/<%= current_path %>/public;
11
11
 
12
12
  gzip on;
13
13
  gzip_types text/plain text/xml application/xml application/xml+rss
@@ -1,12 +1,12 @@
1
1
  # http://unicorn.bogomips.org/SIGNALS.html
2
2
 
3
3
  rails_env = "production"
4
- rails_root = "<%= "#{deploy_to!}/#{current_path!}" %>"
5
- shared_root = "<%= "#{deploy_to!}/#{shared_path!}" %>"
4
+ rails_root = "<%= "#{fetch(:deploy_to)!}/#{current_path!}" %>"
5
+ shared_root = "<%= "#{fetch(:deploy_to)!}/#{shared_path!}" %>"
6
6
  config = "#{shared_root}/unicorn.rb"
7
- unicorn_pid = "<%= "#{deploy_to!}/#{shared_path!}/pids/unicorn.pid" %>"
7
+ unicorn_pid = "<%= "#{fetch(:deploy_to)!}/#{shared_path!}/pids/unicorn.pid" %>"
8
8
 
9
- # God.pid_file_directory = File.join("<%= deploy_to! %>", "shared", "pids")
9
+ # God.pid_file_directory = File.join("<%= fetch(:deploy_to)! %>", "shared", "pids")
10
10
  God.watch do |w|
11
11
  w.name = "unicorn_<%= "#{fetch(:app)}" %>"
12
12
  w.interval = 30.seconds # default
@@ -1,9 +1,9 @@
1
- rails_root = "<%= "#{deploy_to!}/#{current_path!}" %>"
1
+ rails_root = "<%= "#{fetch(:deploy_to)!}/#{current_path!}" %>"
2
2
  rails_env = "<%= rails_env || "production" %>"
3
- pid_file = "<%= "#{deploy_to!}/#{shared_path}" %>/pids/unicorn.pid"
3
+ pid_file = "<%= "#{fetch(:deploy_to)!}/#{shared_path}" %>/pids/unicorn.pid"
4
4
  socket_file= "/tmp/unicorn.<%= fetch(:app) %>.socket"
5
- log_file = "<%= "#{deploy_to!}/#{shared_path}" %>/log/unicorn.log"
6
- err_log = "<%= "#{deploy_to!}/#{shared_path}" %>/log/unicorn.error.log"
5
+ log_file = "<%= "#{fetch(:deploy_to)!}/#{shared_path}" %>/log/unicorn.log"
6
+ err_log = "<%= "#{fetch(:deploy_to)!}/#{shared_path}" %>/log/unicorn.error.log"
7
7
  old_pid = pid_file + '.oldbin'
8
8
 
9
9
  timeout 60
@@ -3,8 +3,8 @@ set -e
3
3
 
4
4
  AS_USER=deploy
5
5
  TIMEOUT=60
6
- APP_ROOT="<%= "#{deploy_to!}" %>"
7
- PID_PATH="<%= "#{deploy_to!}/#{shared_path!}/pids" %>"
6
+ APP_ROOT="<%= "#{fetch(:deploy_to)!}" %>"
7
+ PID_PATH="<%= "#{fetch(:deploy_to)!}/#{shared_path!}/pids" %>"
8
8
  PID="$PID_PATH/unicorn.pid"
9
9
  ENVIRONMENT="<%= rails_env || "production" %>"
10
10
  CONFIG="$APP_ROOT/<%= "#{shared_path!}/unicorn.rb" %>"
@@ -32,7 +32,7 @@ namespace :unicorn do
32
32
 
33
33
  task :link do
34
34
  invoke :sudo
35
- command %{sudo cp -rf #{deploy_to}/#{shared_path}/unicorn.god #{god_path}/conf/unicorn-#{fetch(:app)}.god}
35
+ command %{sudo cp -rf #{fetch(:deploy_to)}/#{shared_path}/unicorn.god #{god_path}/conf/unicorn-#{fetch(:app)}.god}
36
36
  invoke :"god:restart"
37
37
  end
38
38
 
@@ -48,18 +48,18 @@ namespace :unicorn do
48
48
  end
49
49
 
50
50
  task :log do
51
- command %{tail -f "#{deploy_to!}/#{shared_path}/log/unicorn.log" -n 200}
51
+ command %{tail -f "#{fetch(:deploy_to)!}/#{shared_path}/log/unicorn.log" -n 200}
52
52
  end
53
53
 
54
54
  task :err_log do
55
- command %{tail -f "#{deploy_to!}/#{shared_path}/log/unicorn.error.log" -n 200}
55
+ command %{tail -f "#{fetch(:deploy_to)!}/#{shared_path}/log/unicorn.error.log" -n 200}
56
56
  end
57
57
 
58
58
  desc "Unicorn: Link script files"
59
59
  task :link do
60
60
  invoke :sudo
61
61
  extra_echo("Unicorn: Link script file")
62
- command %{sudo cp '#{deploy_to}/shared/unicorn_init.sh' '/etc/init.d/unicorn-#{fetch(:app)}'}
62
+ command %{sudo cp '#{fetch(:deploy_to)}/shared/unicorn_init.sh' '/etc/init.d/unicorn-#{fetch(:app)}'}
63
63
  command %{sudo chown #{user!}:#{group!} /etc/init.d/unicorn-#{fetch(:app)}}
64
64
  command %{sudo chmod u+x /etc/init.d/unicorn-#{fetch(:app)}}
65
65
  # invoke :"unicorn:defaults"
@@ -1,5 +1,5 @@
1
1
  module Mina
2
2
  module Extras
3
- VERSION = "0.1.6"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -14,7 +14,7 @@ set :sudoer, "joey"
14
14
 
15
15
  set :keep_releases, 5
16
16
  set :domain, '192.168.11.107'
17
- set :deploy_to, "/var/www/test"
17
+ set :fetch(:deploy_to), "/var/www/test"
18
18
  set :shared_paths, ["config/database.yml", "tmp", "log", "pids", "config/application.yml"]
19
19
  set :repository, "git@xxxx:test.git"
20
20
  # set :branch, "master"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mina-rails-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joey Lin