crazycode-cap-recipes 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  Using Jeweler for Gem Packaging...
3
3
 
4
- * Update the version and release version to github:
4
+ * Update the version and release version to github:
5
5
  $ rake version:bump:patch && rake release && rake gemcutter:release
6
-
6
+
7
7
  * Build and install the latest version locally:
8
8
  $ rake install
9
-
9
+
10
10
  =end
11
11
 
12
12
  require 'rake'
@@ -23,6 +23,10 @@ begin
23
23
  s.description = "Battle-tested capistrano recipes for debian, passenger, apache, hudson, delayed_job, juggernaut, rubygems, backgroundrb, rails and more"
24
24
  s.authors = ["crazycode"]
25
25
  s.rubyforge_project = 'crazycode-cap-recipes'
26
+
27
+ s.add_dependency "capistrano"
28
+ s.add_dependency "json"
29
+ s.add_dependency "addressable"
26
30
  end
27
31
  Jeweler::GemcutterTasks.new
28
32
  rescue LoadError
@@ -1,5 +1,5 @@
1
1
  ---
2
- :major: 0
3
2
  :minor: 4
4
- :patch: 1
3
+ :patch: 2
5
4
  :build:
5
+ :major: 0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{crazycode-cap-recipes}
8
- s.version = "0.4.1"
8
+ s.version = "0.4.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["crazycode"]
12
- s.date = %q{2011-08-22}
12
+ s.date = %q{2011-08-23}
13
13
  s.default_executable = %q{cap-recipes}
14
14
  s.description = %q{Battle-tested capistrano recipes for debian, passenger, apache, hudson, delayed_job, juggernaut, rubygems, backgroundrb, rails and more}
15
15
  s.email = %q{crazycode@gmail.com}
@@ -120,24 +120,24 @@ Gem::Specification.new do |s|
120
120
  s.rubyforge_project = %q{crazycode-cap-recipes}
121
121
  s.rubygems_version = %q{1.3.7}
122
122
  s.summary = %q{Battle-tested capistrano recipes for passenger, delayed_job, and more}
123
- s.test_files = [
124
- "examples/advanced/deploy.rb",
125
- "examples/advanced/deploy/experimental.rb",
126
- "examples/advanced/deploy/production.rb",
127
- "examples/simple/deploy.rb",
128
- "spec/cap/helper.rb",
129
- "spec/cap_recipes_spec.rb",
130
- "spec/spec_helper.rb"
131
- ]
132
123
 
133
124
  if s.respond_to? :specification_version then
134
125
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
135
126
  s.specification_version = 3
136
127
 
137
128
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
129
+ s.add_runtime_dependency(%q<capistrano>, [">= 0"])
130
+ s.add_runtime_dependency(%q<json>, [">= 0"])
131
+ s.add_runtime_dependency(%q<addressable>, [">= 0"])
138
132
  else
133
+ s.add_dependency(%q<capistrano>, [">= 0"])
134
+ s.add_dependency(%q<json>, [">= 0"])
135
+ s.add_dependency(%q<addressable>, [">= 0"])
139
136
  end
140
137
  else
138
+ s.add_dependency(%q<capistrano>, [">= 0"])
139
+ s.add_dependency(%q<json>, [">= 0"])
140
+ s.add_dependency(%q<addressable>, [">= 0"])
141
141
  end
142
142
  end
143
143
 
@@ -18,52 +18,25 @@ Capistrano::Configuration.instance(true).load do |configuration|
18
18
  set :deploy_id_file, ".deploy_id"
19
19
  set :tag, ""
20
20
 
21
- role :app do
21
+ role :app, :primary => true do
22
22
  CmdbService.get_app_role("#{cse_base}", deploy_unit_code, deploy_stage)
23
23
  end
24
+ role :single, "1.1.1.1"
24
25
 
25
26
  namespace :cmdb do
26
27
 
27
-
28
- task :start do
29
- if File.exists? deploy_id_file
30
- puts "Previous Deploy NOT Complete, please run 'cap cmdb:failback' first."
31
- exit(1)
32
- end
33
-
34
- deploy_id = CmdbService.start_deploy("#{cse_base}", deploy_unit_code, deploy_stage, tag)
35
-
36
- open(deploy_id_file, 'w') do |f|
37
- f.write deploy_id
38
- end
39
- end
40
-
41
- desc "set current deploy FAILBACK!"
42
- task :failback do
43
- deploy_id = CmdbService.get_deploy_id(deploy_id_file)
44
- unless deploy_id.nil?
45
- CmdbService.complete_deploy(cse_base, deploy_unit_code, deploy_id, false, "capistrano部署失败,撤销发布")
46
- end
47
- end
48
-
49
- desc "set current deploy success DONE!"
50
- task :done do
51
- deploy_id = CmdbService.get_deploy_id(deploy_id_file)
52
- puts "deploy_id=#{deploy_id}, file=#{deploy_id_file}"
53
- CmdbService.complete_deploy(cse_base, deploy_unit_code, deploy_id, true, "通过capistrano部署成功")
54
- File.delete deploy_id_file
55
- end
56
-
57
28
  desc "deploy to tomcat"
58
- task :deploy_to_tomcat do
59
- cmdb.start
60
- deploy_id = CmdbService.get_deploy_id(deploy_id_file) || CmdbService.start_deploy("#{cse_base}", deploy_unit_code, deploy_stage, tag)
61
- puts "deploy_id=#{deploy_id}"
62
-
63
- gitdeploy.deploy
64
- tomcat.restart
65
-
66
- cmdb.done
29
+ task :deploy_to_tomcat, :roles => :single do
30
+ codes = deploy_unit_code.split(/[,;\s]+/)
31
+ deploy_hash = Hash.new
32
+ codes.each {|code| deploy_hash[code] = CmdbService.start_deploy(cse_base, code, deploy_stage, tag) }
33
+ begin
34
+ gitdeploy.deploy
35
+ tomcat.restart
36
+ deploy_hash.each {|code, deployid| CmdbService.complete_deploy(cse_base, code, deployid, true, "通过capistrano部署成功") }
37
+ rescue Exception => e
38
+ deploy_hash.each {|code, deployid| CmdbService.complete_deploy(cse_base, code, deployid, false, "capistrano部署失败,撤销发布,原因:#{e.message}") }
39
+ end
67
40
  end
68
41
 
69
42
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crazycode-cap-recipes
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 11
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 4
8
- - 1
9
- version: 0.4.1
9
+ - 2
10
+ version: 0.4.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - crazycode
@@ -14,10 +15,51 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-08-22 00:00:00 +08:00
18
+ date: 2011-08-23 00:00:00 +08:00
18
19
  default_executable: cap-recipes
19
- dependencies: []
20
-
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: capistrano
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: json
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: addressable
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ type: :runtime
62
+ version_requirements: *id003
21
63
  description: Battle-tested capistrano recipes for debian, passenger, apache, hudson, delayed_job, juggernaut, rubygems, backgroundrb, rails and more
22
64
  email: crazycode@gmail.com
23
65
  executables:
@@ -137,6 +179,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
137
179
  requirements:
138
180
  - - ">="
139
181
  - !ruby/object:Gem::Version
182
+ hash: 3
140
183
  segments:
141
184
  - 0
142
185
  version: "0"
@@ -145,6 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
188
  requirements:
146
189
  - - ">="
147
190
  - !ruby/object:Gem::Version
191
+ hash: 3
148
192
  segments:
149
193
  - 0
150
194
  version: "0"
@@ -155,11 +199,5 @@ rubygems_version: 1.3.7
155
199
  signing_key:
156
200
  specification_version: 3
157
201
  summary: Battle-tested capistrano recipes for passenger, delayed_job, and more
158
- test_files:
159
- - examples/advanced/deploy.rb
160
- - examples/advanced/deploy/experimental.rb
161
- - examples/advanced/deploy/production.rb
162
- - examples/simple/deploy.rb
163
- - spec/cap/helper.rb
164
- - spec/cap_recipes_spec.rb
165
- - spec/spec_helper.rb
202
+ test_files: []
203
+