openteam-capistrano 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +0,0 @@
1
- require "openteam/capistrano/dependencies"
2
- require "openteam/capistrano/setup"
3
- require "openteam/capistrano/hooks"
4
- require "openteam/capistrano/tagging"
@@ -1,17 +1,6 @@
1
1
  # set up hooks
2
2
  Capistrano::Configuration.instance.load do
3
- after 'multistage:ensure', 'openteam:setup'
4
-
5
- #after('multistage:ensure') do
6
- #server domain, :app, :web, :db, :primary => true
7
- #end
8
-
9
3
  after 'deploy:update_code', 'deploy:migrate'
10
-
11
4
  after 'deploy:restart', 'unicorn:restart'
12
-
13
5
  after 'deploy', 'deploy:cleanup'
14
- before 'deploy:cleanup', 'tagging:cleanup'
15
-
16
- after 'deploy', 'tagging:deploy'
17
6
  end
@@ -0,0 +1,5 @@
1
+ require "openteam/capistrano/dependencies"
2
+ require "openteam/capistrano/setup"
3
+ require "openteam/capistrano/hooks"
4
+ require "openteam/capistrano/tagging"
5
+ require "openteam/capistrano/subscriber"
@@ -1,4 +1,6 @@
1
1
  Capistrano::Configuration.instance.load do
2
+ after 'multistage:ensure', 'openteam:setup'
3
+
2
4
  namespace :openteam do
3
5
  task :setup do
4
6
  def deploy_config
@@ -50,6 +52,9 @@ Capistrano::Configuration.instance.load do
50
52
  # tagging needs this
51
53
  set :local_user, ENV['USER'] || ENV['USERNAME']
52
54
 
55
+ # subscriber name
56
+ set :subscriber_name, "#{application}-subscriber"
57
+
53
58
  # setup server
54
59
  server domain, :app, :web, :db, :primary => true
55
60
  end
@@ -0,0 +1,30 @@
1
+ if File.exists?('script/subscriber')
2
+ Capistrano::Configuration.instance.load do
3
+ # set subscriber hooks
4
+ after 'deploy:update', 'subscriber:restart'
5
+ after 'deploy:rollback', 'subscriber:restart'
6
+
7
+ namespace :subscriber do
8
+ def subsriber_pid_file
9
+ "#{current_path}/tmp/pids/#{subscriber_name}.pid"
10
+ end
11
+
12
+ desc "Stop rabbitmq subscriber"
13
+ task :stop do
14
+ # subscriber will remove pid file automatically
15
+ run "if [ -s #{subsriber_pid_file} ]; then kill `cat #{subsriber_pid_file}`; fi"
16
+ end
17
+
18
+ desc "Start rabbitmq subscriber"
19
+ task :start do
20
+ run "RAILS_ENV=#{rails_env} #{current_path}/script/subscriber --name #{subscriber_name} start"
21
+ end
22
+
23
+ desc "Restart rabbitmq subscriber"
24
+ task :restart do
25
+ stop
26
+ start
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,4 +1,7 @@
1
1
  Capistrano::Configuration.instance.load do
2
+ before 'deploy:cleanup', 'tagging:cleanup'
3
+ after 'deploy', 'tagging:deploy'
4
+
2
5
  namespace :tagging do
3
6
  def tag_name(options={})
4
7
  formatted_local_time = DateTime.strptime(options[:for], '%Y%m%d%H%M%S').to_time.strftime("%Y.%m.%d-%H%M")
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = 'openteam-capistrano'
7
- gem.version = '0.0.3'
7
+ gem.version = '0.0.4'
8
8
  gem.authors = ["OpenTeam developers"]
9
9
  gem.email = ["developers@openteam.ru"]
10
10
  gem.description = %q{OpenTeam common capistrano recipe}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openteam-capistrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-22 00:00:00.000000000 Z
12
+ date: 2013-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano-db-tasks
@@ -106,7 +106,9 @@ files:
106
106
  - lib/openteam/capistrano.rb
107
107
  - lib/openteam/capistrano/dependencies.rb
108
108
  - lib/openteam/capistrano/hooks.rb
109
+ - lib/openteam/capistrano/recipes.rb
109
110
  - lib/openteam/capistrano/setup.rb
111
+ - lib/openteam/capistrano/subscriber.rb
110
112
  - lib/openteam/capistrano/tagging.rb
111
113
  - openteam-capistrano.gemspec
112
114
  homepage: ''
@@ -123,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
125
  version: '0'
124
126
  segments:
125
127
  - 0
126
- hash: -2625722300496420793
128
+ hash: -2786004548502686108
127
129
  required_rubygems_version: !ruby/object:Gem::Requirement
128
130
  none: false
129
131
  requirements:
@@ -132,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
134
  version: '0'
133
135
  segments:
134
136
  - 0
135
- hash: -2625722300496420793
137
+ hash: -2786004548502686108
136
138
  requirements: []
137
139
  rubyforge_project:
138
140
  rubygems_version: 1.8.24