codebase4 1.0.16 → 1.0.17
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/codebase/capistrano3.rb +50 -0
- metadata +12 -5
@@ -0,0 +1,50 @@
|
|
1
|
+
namespace :codebase do
|
2
|
+
|
3
|
+
desc "Logs the deployment of your Codebase repository"
|
4
|
+
task :log_deployment do
|
5
|
+
repository = fetch(:repo_url)
|
6
|
+
previous_revision = fetch(:previous_revision)
|
7
|
+
current_revision = fetch(:current_revision)
|
8
|
+
environment = fetch(:stage)
|
9
|
+
branch = fetch(:branch)
|
10
|
+
roles = roles(:all)
|
11
|
+
servers = roles.map{|r| r.hostname }
|
12
|
+
|
13
|
+
if previous_revision == current_revision
|
14
|
+
puts "\e[31m The old revision & new revision are the same - you didn't deploy anything new. Skipping logging.\e[0m"
|
15
|
+
next
|
16
|
+
end
|
17
|
+
|
18
|
+
cmd = ["cb deploy #{previous_revision or "0000000000000000000000000000000000000000"} #{current_revision}"]
|
19
|
+
|
20
|
+
cmd << "-s #{servers.uniq.join(',') rescue ''}"
|
21
|
+
cmd << "-b #{branch}"
|
22
|
+
cmd << "-e #{environment}"
|
23
|
+
|
24
|
+
## get the repo and project name etc...
|
25
|
+
account, project, repo = nil, nil, nil
|
26
|
+
case repository
|
27
|
+
when /git\@codebasehq.com\:(.+)\/(.+)\/(.+)\.git\z/
|
28
|
+
account, project, repo = $1, $2, $3
|
29
|
+
when /ssh:\/\/.+\@codebasehq.com\/(.+)\/(.+)\/(.+)\.hg\z/
|
30
|
+
account, project, repo = $1, $2, $3
|
31
|
+
when /https?:\/\/.+\@(.+)\.codebasehq.com\/(.+)\/(.+)\.(?:hg|svn)\z/
|
32
|
+
account, project, repo = $1, $2, $3
|
33
|
+
when /https?:\/\/(?:.+\@)?(.+)\.svn\.codebasehq.com\/(.+?)\/(.+?)(?:\/.*)\z/
|
34
|
+
account, project, repo = $1, $2, $3
|
35
|
+
else
|
36
|
+
puts "! Repository path not supported by deployment logging"
|
37
|
+
next
|
38
|
+
end
|
39
|
+
|
40
|
+
cmd << "-r #{project}:#{repo}"
|
41
|
+
cmd << "-h #{account}.codebasehq.com"
|
42
|
+
cmd << "--protocol https"
|
43
|
+
|
44
|
+
puts " running: #{cmd.join(' ')}"
|
45
|
+
system(cmd.join(' ') + "; true")
|
46
|
+
end
|
47
|
+
|
48
|
+
after 'deploy:finished', 'codebase:log_deployment'
|
49
|
+
|
50
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codebase4
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.17
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-07-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,12 @@ dependencies:
|
|
21
21
|
version: 1.1.5
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.1.5
|
25
30
|
description:
|
26
31
|
email: adam@atechmedia.com
|
27
32
|
executables:
|
@@ -32,6 +37,7 @@ extra_rdoc_files: []
|
|
32
37
|
files:
|
33
38
|
- bin/cb
|
34
39
|
- bin/codebase
|
40
|
+
- lib/codebase/capistrano3.rb
|
35
41
|
- lib/codebase/cli.rb
|
36
42
|
- lib/codebase/config.rb
|
37
43
|
- lib/codebase/recipes.rb
|
@@ -56,9 +62,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
62
|
version: '0'
|
57
63
|
requirements: []
|
58
64
|
rubyforge_project:
|
59
|
-
rubygems_version: 1.8.
|
65
|
+
rubygems_version: 1.8.23.2
|
60
66
|
signing_key:
|
61
67
|
specification_version: 3
|
62
68
|
summary: The RubyGem for Codebase v4 Deployment Tracking (replaces previous codebase
|
63
69
|
gems)
|
64
70
|
test_files: []
|
71
|
+
has_rdoc: false
|