capobvious 0.3.pre2 → 0.3.pre3

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.
data/README.md CHANGED
@@ -91,6 +91,15 @@ require 'capobvious/recipes/log'
91
91
  cap log:tail # stream production.log
92
92
  ```
93
93
 
94
+ ### logrotate
95
+ ```ruby
96
+ require 'capobvious/recipes/logrotate'
97
+ ```
98
+ ```sh
99
+ cap logrotate:init # uses logrotate to clean logs automaticly
100
+ ```
101
+
102
+
94
103
  ## Contributing
95
104
 
96
105
  1. Fork it
@@ -1,9 +1,7 @@
1
1
  Capistrano::Configuration.instance(:must_exist).load do
2
2
 
3
- if exists?(:assets) && fetch(:assets) == true
4
- after 'bundle:install', 'assets:precompile'
5
- before 'deploy:finalize_update', 'assets:symlink'
6
- end
3
+ after 'bundle:install', 'assets:precompile'
4
+ before 'deploy:finalize_update', 'assets:symlink'
7
5
 
8
6
  namespace :assets do
9
7
  desc "Local Assets precompile"
@@ -1,9 +1,10 @@
1
1
  Capistrano::Configuration.instance(:must_exist).load do
2
2
  after 'deploy:setup', 'logrotate:init'
3
3
 
4
- set :logrotate_path, '/etc/logrotate.d'
5
- set :logrotate_file_name, "cap_#{application}"
6
- set :logrotate_file, "#{logrotate_path}/#{logrotate_file_name}"
4
+ _cset :logrotate_path, '/etc/logrotate.d'
5
+ _cset(:logrotate_file_name){ "cap_#{application}_#{rails_env}"}
6
+ _cset(:logrotate_file){ "#{logrotate_path}/#{logrotate_file_name}"}
7
+
7
8
  namespace :logrotate do
8
9
  #http://stackoverflow.com/questions/4883891/ruby-on-rails-production-log-rotation
9
10
  task :init do
@@ -5,6 +5,26 @@ Capistrano::Configuration.instance(:must_exist).load do
5
5
  _cset(:unicorn_pid){"#{shared_path}/pids/unicorn.pid"}
6
6
 
7
7
  namespace :unicorn do
8
+ desc "init autostart unicorn"
9
+ task :autostart do
10
+ #cd /home/rails/www/three-elements/current && sudo -u rails -H /home/rails/.rvm/bin/193_bundle exec /home/rails/.rvm/bin/193_unicorn -c /home/rails/www/three-elements/current/config/unicorn.rb -E production -D
11
+ join_ruby = ruby_version[/\d.\d.\d/].delete('.')
12
+ ruby_wrapper = "#{join_ruby}_unicorn"
13
+ ruby_wrapper_path = "/home/#{user}/.rvm/bin/#{ruby_wrapper}"
14
+ bundle_wrapper = "#{join_ruby}_bundle"
15
+ bundle_wrapper_path = "/home/#{user}/.rvm/bin/#{bundle_wrapper}"
16
+
17
+ run "rvm wrapper #{ruby_version} #{join_ruby} unicorn"
18
+ run "rvm wrapper #{ruby_version} #{join_ruby} bundle"
19
+ #puts "sudo -u #{user} -H /home/#{user}/.rvm/bin/#{wrapper} -c #{unicorn_conf} -E production -D"
20
+ command = "cd #{current_path} && sudo -u #{user} -H #{bundle_wrapper_path} exec #{ruby_wrapper_path} -c #{unicorn_conf} -E #{fetch(:rails_env)} -D"
21
+ puts command
22
+
23
+ run "#{sudo} sed -i 's/exit 0//g' /etc/rc.local"
24
+ run "echo \"#{command}\" | #{sudo} tee -a /etc/rc.local"
25
+ run "echo \"exit 0\" | #{sudo} tee -a /etc/rc.local"
26
+ end
27
+
8
28
  desc "start unicorn"
9
29
  task :start do
10
30
  if remote_file_exists?(unicorn_pid)
@@ -45,24 +65,5 @@ Capistrano::Configuration.instance(:must_exist).load do
45
65
  end
46
66
  end
47
67
 
48
- desc "init autostart unicorn"
49
- task :autostart do
50
- #cd /home/rails/www/three-elements/current && sudo -u rails -H /home/rails/.rvm/bin/193_bundle exec /home/rails/.rvm/bin/193_unicorn -c /home/rails/www/three-elements/current/config/unicorn.rb -E production -D
51
- join_ruby = ruby_version[/\d.\d.\d/].delete('.')
52
- ruby_wrapper = "#{join_ruby}_unicorn"
53
- ruby_wrapper_path = "/home/#{user}/.rvm/bin/#{ruby_wrapper}"
54
- bundle_wrapper = "#{join_ruby}_bundle"
55
- bundle_wrapper_path = "/home/#{user}/.rvm/bin/#{bundle_wrapper}"
56
-
57
- run "rvm wrapper #{ruby_version} #{join_ruby} unicorn"
58
- run "rvm wrapper #{ruby_version} #{join_ruby} bundle"
59
- #puts "sudo -u #{user} -H /home/#{user}/.rvm/bin/#{wrapper} -c #{unicorn_conf} -E production -D"
60
- command = "cd #{current_path} && sudo -u #{user} -H #{bundle_wrapper_path} exec #{ruby_wrapper_path} -c #{unicorn_conf} -E production -D"
61
- puts command
62
-
63
- run "#{sudo} sed -i 's/exit 0//g' /etc/rc.local"
64
- run "echo \"#{command}\" | #{sudo} tee -a /etc/rc.local"
65
- run "echo \"exit 0\" | #{sudo} tee -a /etc/rc.local"
66
- end
67
68
 
68
69
  end
@@ -1,3 +1,3 @@
1
1
  module Capobvious
2
- VERSION = "0.3.pre2"
2
+ VERSION = "0.3.pre3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capobvious
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.pre2
4
+ version: 0.3.pre3
5
5
  prerelease: 4
6
6
  platform: ruby
7
7
  authors: