meow-deploy 0.0.10 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,110 +1,112 @@
1
1
  require 'capistrano'
2
2
  require 'capistrano/version'
3
3
 
4
- module MeowDeploy
5
- class MeowDeployIntegration
6
- TASKS = [
7
- 'god:start',
8
- 'god:stop',
9
- 'god:restart',
10
- 'god:reload',
11
- 'bundle:install'
12
- ]
13
-
14
- def self.load_into(capistrano_config)
15
- capistrano_config.load do
16
- before(MeowDeployIntegration::TASKS) do
17
- _cset(:rbenv) { "/home/#{user}/.rbenv/bin/rbenv" }
18
- _cset(:god_sites_path) { "/home/#{user}/sites/god" }
19
- _cset(:god_app_path) { "#{current_path}/config/god.conf" }
20
- _cset :bundle_flags, "--deployment --quiet --binstubs --shebang ruby-local-exec"
21
-
22
- env = {'PATH' =>
23
- "/home/#{user}/.rbenv/shims:/home/#{user}/.rbenv/bin:$PATH" }
24
-
25
- current_env = fetch(:default_environment)
26
-
27
- if exists?(:default_environment) &&
28
- !!current_env['PATH'] &&
29
- !current_env['PATH'].include?('rbenv/shims')
30
-
31
- abort "Make sure to set :default_environment to have PATH include rbenv like this: \n#{env.inspect}"
4
+ module Meow
5
+ module Deploy
6
+ class Integration
7
+ TASKS = [
8
+ 'god:start',
9
+ 'god:stop',
10
+ 'god:restart',
11
+ 'god:reload',
12
+ 'bundle:install'
13
+ ]
14
+
15
+ def self.load_into(capistrano_config)
16
+ capistrano_config.load do
17
+ before(MeowDeployIntegration::TASKS) do
18
+ _cset(:rbenv) { "/home/#{user}/.rbenv/bin/rbenv" }
19
+ _cset(:god_sites_path) { "/home/#{user}/sites/god" }
20
+ _cset(:god_app_path) { "#{current_path}/config/god.conf" }
21
+ _cset :bundle_flags, "--deployment --quiet --binstubs --shebang ruby-local-exec"
22
+
23
+ env = {'PATH' =>
24
+ "/home/#{user}/.rbenv/shims:/home/#{user}/.rbenv/bin:$PATH" }
25
+
26
+ current_env = fetch(:default_environment)
27
+
28
+ if exists?(:default_environment) &&
29
+ !!current_env['PATH'] &&
30
+ !current_env['PATH'].include?('rbenv/shims')
31
+
32
+ abort "Make sure to set :default_environment to have PATH include rbenv like this: \n#{env.inspect}"
33
+ end
32
34
  end
33
- end
34
-
35
- after 'deploy:setup' do
36
- _cset(:god_sites_path) { "/home/#{user}/sites/god" }
37
35
 
38
- run "mkdir -p #{god_sites_path}"
39
- end
40
-
41
- namespace :db do
42
- desc "Create the indexes defined on your mongoid models"
43
- task :create_mongoid_indexes do
44
- run "cd #{current_path} && bundle exec rake db:mongoid:create_indexes RAILS_ENV=production"
45
- end
46
- end
47
-
48
- namespace :god do
49
- desc "Reload god config"
50
- task :reload, :roles => :app, :except => {:no_release => true} do
51
- run "ln -nfs #{god_app_path} #{god_sites_path}/#{application}.conf"
52
- sudo "#{rbenv} exec god load #{god_sites_path}/#{application}.conf"
53
- end
36
+ after 'deploy:setup' do
37
+ _cset(:god_sites_path) { "/home/#{user}/sites/god" }
54
38
 
55
- task :restart, :roles => :app, :except => {:no_release => true} do
56
- sudo "#{rbenv} exec god restart #{application}"
39
+ run "mkdir -p #{god_sites_path}"
57
40
  end
58
41
 
59
- task :start, :roles => :app do
60
- sudo "#{rbenv} exec god start #{application}"
42
+ namespace :db do
43
+ desc "Create the indexes defined on your mongoid models"
44
+ task :create_mongoid_indexes do
45
+ run "cd #{current_path} && bundle exec rake db:mongoid:create_indexes RAILS_ENV=production"
46
+ end
61
47
  end
62
-
63
- task :stop, :roles => :app do
64
- sudo "#{rbenv} exec god stop #{application}"
48
+
49
+ namespace :god do
50
+ desc "Reload god config"
51
+ task :reload, :roles => :app, :except => {:no_release => true} do
52
+ run "ln -nfs #{god_app_path} #{god_sites_path}/#{application}.conf"
53
+ sudo "#{rbenv} exec god load #{god_sites_path}/#{application}.conf"
54
+ end
55
+
56
+ task :restart, :roles => :app, :except => {:no_release => true} do
57
+ sudo "#{rbenv} exec god restart #{application}"
58
+ end
59
+
60
+ task :start, :roles => :app do
61
+ sudo "#{rbenv} exec god start #{application}"
62
+ end
63
+
64
+ task :stop, :roles => :app do
65
+ sudo "#{rbenv} exec god stop #{application}"
66
+ end
65
67
  end
66
- end
67
68
 
68
- namespace :secrets do
69
- desc "Upload env file"
70
- task :upload, :roles => :app do
71
- top.upload(".rbenv-vars", "#{shared_path}/.env")
69
+ namespace :secrets do
70
+ desc "Upload env file"
71
+ task :upload, :roles => :app do
72
+ top.upload(".rbenv-vars", "#{shared_path}/.env")
73
+ end
74
+
75
+ desc "Download env files"
76
+ task :download, :roles => :app do
77
+ top.download("#{shared_path}/.env", ".rbenv-vars")
78
+ end
79
+
80
+ desc "Symlink env file."
81
+ task :symlink, :roles => :app, :except => {:no_release => true} do
82
+ run "ln -nfs #{shared_path}/.env #{release_path}/.rbenv-vars"
83
+ run "ln -nfs #{shared_path}/.env #{release_path}/.env"
84
+ end
72
85
  end
73
86
 
74
- desc "Download env files"
75
- task :download, :roles => :app do
76
- top.download("#{shared_path}/.env", ".rbenv-vars")
87
+ namespace :tail do
88
+ desc "Tail production log files"
89
+ task :production, :roles => :app do
90
+ tail_log "production.log"
91
+ end
92
+
93
+ desc "Tail god log files"
94
+ task :god, :roles => :app do
95
+ tail_log "god.log"
96
+ end
97
+
98
+ desc "Tail cron log files"
99
+ task :cron, :roles => :app do
100
+ tail_log "cron.log"
101
+ end
77
102
  end
78
103
 
79
- desc "Symlink env file."
80
- task :symlink, :roles => :app, :except => {:no_release => true} do
81
- run "ln -nfs #{shared_path}/.env #{release_path}/.rbenv-vars"
82
- run "ln -nfs #{shared_path}/.env #{release_path}/.env"
83
- end
84
- end
85
-
86
- namespace :tail do
87
- desc "Tail production log files"
88
- task :production, :roles => :app do
89
- tail_log "production.log"
90
- end
91
-
92
- desc "Tail god log files"
93
- task :god, :roles => :app do
94
- tail_log "god.log"
95
- end
96
-
97
- desc "Tail cron log files"
98
- task :cron, :roles => :app do
99
- tail_log "cron.log"
100
- end
101
- end
102
-
103
- def tail_log(log)
104
- run "tail -f #{shared_path}/log/#{log}" do |channel, stream, data|
105
- trap("INT") { puts 'Interupted'; exit 0; }
106
- puts "#{data}"
107
- break if stream == :err
104
+ def tail_log(log)
105
+ run "tail -f #{shared_path}/log/#{log}" do |channel, stream, data|
106
+ trap("INT") { puts 'Interupted'; exit 0; }
107
+ puts "#{data}"
108
+ break if stream == :err
109
+ end
108
110
  end
109
111
  end
110
112
  end
@@ -113,5 +115,5 @@ module MeowDeploy
113
115
  end
114
116
 
115
117
  if Capistrano::Configuration.instance
116
- MeowDeploy::MeowDeployIntegration.load_into(Capistrano::Configuration.instance)
118
+ Meow::Deploy::Integration.load_into(Capistrano::Configuration.instance)
117
119
  end
@@ -1,3 +1,5 @@
1
- module MeowDeploy
2
- VERSION = "0.0.10"
1
+ module Meow
2
+ module Deploy
3
+ VERSION = "0.1.0"
4
+ end
3
5
  end
data/meow-deploy.gemspec CHANGED
@@ -5,7 +5,7 @@ require 'meow-deploy/version'
5
5
 
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "meow-deploy"
8
- gem.version = MeowDeploy::VERSION
8
+ gem.version = Meow::Deploy::VERSION
9
9
  gem.authors = "Kristjan Rang"
10
10
  gem.email = "mail@kristjanrang.eu"
11
11
  gem.description = %q{Tasks for deploying to a stack running god, rbenv and whatever rails server}
metadata CHANGED
@@ -1,32 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meow-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
5
4
  prerelease:
5
+ version: 0.1.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Kristjan Rang
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-23 00:00:00.000000000 Z
12
+ date: 2012-11-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: capistrano
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
15
+ version_requirements: !ruby/object:Gem::Requirement
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
20
+ none: false
21
+ name: capistrano
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
24
+ requirement: !ruby/object:Gem::Requirement
26
25
  requirements:
27
26
  - - ! '>='
28
27
  - !ruby/object:Gem::Version
29
28
  version: '0'
29
+ none: false
30
30
  description: Tasks for deploying to a stack running god, rbenv and whatever rails
31
31
  server
32
32
  email: mail@kristjanrang.eu
@@ -51,17 +51,17 @@ rdoc_options: []
51
51
  require_paths:
52
52
  - lib
53
53
  required_ruby_version: !ruby/object:Gem::Requirement
54
- none: false
55
54
  requirements:
56
55
  - - ! '>='
57
56
  - !ruby/object:Gem::Version
58
57
  version: '0'
59
- required_rubygems_version: !ruby/object:Gem::Requirement
60
58
  none: false
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
60
  requirements:
62
61
  - - ! '>='
63
62
  - !ruby/object:Gem::Version
64
63
  version: '0'
64
+ none: false
65
65
  requirements: []
66
66
  rubyforge_project:
67
67
  rubygems_version: 1.8.23