codebase 4.0.9 → 4.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/codebase.rb +1 -1
- data/lib/codebase/recipes.rb +15 -15
- metadata +29 -5
data/lib/codebase.rb
CHANGED
data/lib/codebase/recipes.rb
CHANGED
@@ -13,23 +13,23 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
13
13
|
git_config_variable(:username).match(/(.+)\/(.+)/)
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
@
|
16
|
+
def codebase_domain
|
17
|
+
@codebase_domain ||= new_username? ? "#{new_username?[1]}.codebasehq.com" : git_config_variable(:domain)
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
21
|
-
@
|
20
|
+
def codebase_username
|
21
|
+
@codebase_username ||= new_username? ? new_username?[2] : git_config_variable(:username)
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
25
|
-
@
|
24
|
+
def codebase_api_username
|
25
|
+
@codebase_api_username = "#{codebase_domain.split('.').first}/#{codebase_username}"
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
29
|
-
@
|
28
|
+
def codebase_api_key
|
29
|
+
@codebase_api_key ||= git_config_variable(:apikey)
|
30
30
|
end
|
31
31
|
|
32
|
-
def
|
32
|
+
def codebase_api_request(url, data)
|
33
33
|
require 'net/http'
|
34
34
|
require 'net/https'
|
35
35
|
require 'uri'
|
@@ -39,7 +39,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
39
39
|
uri = URI.parse(url)
|
40
40
|
|
41
41
|
req = Net::HTTP::Post.new(uri.path)
|
42
|
-
req.basic_auth(
|
42
|
+
req.basic_auth(codebase_api_username, codebase_api_key)
|
43
43
|
req.add_field('Content-type', 'application/xml')
|
44
44
|
req.add_field('Accept', 'application/xml')
|
45
45
|
|
@@ -55,7 +55,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
55
55
|
when Net::HTTPFound
|
56
56
|
if res.body =~ /http:\/\/api3.codebasehq.com/ && url.include?('https://')
|
57
57
|
puts " - Status.......: Falling back to non SSL"
|
58
|
-
|
58
|
+
codebase_api_request(url.gsub("https://", "http://"), data)
|
59
59
|
end
|
60
60
|
else
|
61
61
|
puts " * \e[31mSorry, your deployment was not logged in Codebase - please check your config above.\e[0m"
|
@@ -82,7 +82,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
82
82
|
desc 'Log a deployment in Codebase'
|
83
83
|
task :deploy do
|
84
84
|
|
85
|
-
if
|
85
|
+
if codebase_api_username == '' || codebase_api_key == ''
|
86
86
|
puts " * Codebase is not configured on your computer. Run 'codebase setup' to auto configure it."
|
87
87
|
puts " * Deployments will not be tracked."
|
88
88
|
next
|
@@ -103,8 +103,8 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
103
103
|
|
104
104
|
puts " * \e[44;33mAdding Deployment to your CodebaseHQ account\e[0m"
|
105
105
|
puts " - Account......: #{url}"
|
106
|
-
puts " - Username.....: #{
|
107
|
-
puts " - API Key......: #{
|
106
|
+
puts " - Username.....: #{codebase_api_username}"
|
107
|
+
puts " - API Key......: #{codebase_api_key[0,10]}..."
|
108
108
|
|
109
109
|
puts " - Project......: #{project}"
|
110
110
|
puts " - Repository...: #{repository}"
|
@@ -141,7 +141,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
141
141
|
# http://api3.codebasehq.com/PROJECTNAME/REPO/deployments
|
142
142
|
|
143
143
|
real_url = "https://api3.codebasehq.com/#{project}/#{repository}/deployments"
|
144
|
-
|
144
|
+
codebase_api_request(real_url, xml.join)
|
145
145
|
|
146
146
|
end
|
147
147
|
end
|
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codebase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 43
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 4
|
8
|
+
- 0
|
9
|
+
- 10
|
10
|
+
version: 4.0.10
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Adam Cooke
|
@@ -10,8 +15,7 @@ autorequire:
|
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date: 2011-05-
|
14
|
-
default_executable:
|
18
|
+
date: 2011-05-24 00:00:00 Z
|
15
19
|
dependencies:
|
16
20
|
- !ruby/object:Gem::Dependency
|
17
21
|
name: highline
|
@@ -21,6 +25,11 @@ dependencies:
|
|
21
25
|
requirements:
|
22
26
|
- - ">="
|
23
27
|
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 1
|
31
|
+
- 5
|
32
|
+
- 0
|
24
33
|
version: 1.5.0
|
25
34
|
type: :runtime
|
26
35
|
version_requirements: *id001
|
@@ -32,6 +41,11 @@ dependencies:
|
|
32
41
|
requirements:
|
33
42
|
- - ">="
|
34
43
|
- !ruby/object:Gem::Version
|
44
|
+
hash: 25
|
45
|
+
segments:
|
46
|
+
- 1
|
47
|
+
- 1
|
48
|
+
- 5
|
35
49
|
version: 1.1.5
|
36
50
|
type: :runtime
|
37
51
|
version_requirements: *id002
|
@@ -43,6 +57,11 @@ dependencies:
|
|
43
57
|
requirements:
|
44
58
|
- - ">="
|
45
59
|
- !ruby/object:Gem::Version
|
60
|
+
hash: 25
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
- 2
|
64
|
+
- 7
|
46
65
|
version: 0.2.7
|
47
66
|
type: :runtime
|
48
67
|
version_requirements: *id003
|
@@ -65,7 +84,6 @@ files:
|
|
65
84
|
- lib/commands/clone.rb
|
66
85
|
- lib/commands/keys.rb
|
67
86
|
- lib/commands/setup.rb
|
68
|
-
has_rdoc: true
|
69
87
|
homepage: http://www.codebasehq.com
|
70
88
|
licenses: []
|
71
89
|
|
@@ -79,17 +97,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
79
97
|
requirements:
|
80
98
|
- - ">="
|
81
99
|
- !ruby/object:Gem::Version
|
100
|
+
hash: 3
|
101
|
+
segments:
|
102
|
+
- 0
|
82
103
|
version: "0"
|
83
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
105
|
none: false
|
85
106
|
requirements:
|
86
107
|
- - ">="
|
87
108
|
- !ruby/object:Gem::Version
|
109
|
+
hash: 3
|
110
|
+
segments:
|
111
|
+
- 0
|
88
112
|
version: "0"
|
89
113
|
requirements: []
|
90
114
|
|
91
115
|
rubyforge_project:
|
92
|
-
rubygems_version: 1.
|
116
|
+
rubygems_version: 1.7.2
|
93
117
|
signing_key:
|
94
118
|
specification_version: 3
|
95
119
|
summary: Gem companion for your Codebase account. Including interactive cloning, key management and more
|