capistrano-isitdeployed 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/capistrano/isitdeployed/version.rb +1 -1
- data/lib/capistrano/isitdeployed.rb +29 -29
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 2471b60d8c1a097e0925f3d20ac2f5c5244b9a5d
|
4
|
-
data.tar.gz: 2fb69acafb514ac5643b4df3e64bd8666e4c8e29
|
5
2
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8228be5bb77d78ccd4cfe36ba02c2f74ebf6686c67fef258e41c4b193bdf00b623b4cf91be85473667d48be0403ea7d80210d2509e0cdbc8d4b9a42970493189
|
4
|
+
data.tar.gz: 5b340d8c407ac08fcd6459928e9ad9c3e3bb254ef0773f9007f83dfe6f573eec510f8ff71e248ea4289b6a97f23db3cd4aacfe15aa748ceb1b881394ad397eda
|
5
|
+
SHA1:
|
6
|
+
metadata.gz: cbff4dfd443b38406ea5e65bc6ab9c1c0977f26e
|
7
|
+
data.tar.gz: f6647ecdfcb4feef608aaaae17417a9aedb0f6d9
|
@@ -11,12 +11,8 @@ module Capistrano
|
|
11
11
|
return Time.now.utc.strftime("%Y%m%d%H%M%S")
|
12
12
|
end
|
13
13
|
|
14
|
-
def self.
|
15
|
-
|
16
|
-
return YAML.load_file(CONFIG_DEST)
|
17
|
-
else
|
18
|
-
logger.trace "IsItDeployed > WARNING: No configuration file found, please run cap 'isit:setup'"
|
19
|
-
end
|
14
|
+
def self.load_user_config
|
15
|
+
return YAML.load_file(CONFIG_DEST)
|
20
16
|
end
|
21
17
|
|
22
18
|
def self.load_into(configuration)
|
@@ -50,27 +46,32 @@ module Capistrano
|
|
50
46
|
|
51
47
|
desc "Creates a new deploy using the API"
|
52
48
|
task :deploy do
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
49
|
+
if File.exists?(CONFIG_DEST)
|
50
|
+
config = Capistrano::Isitdeployed.load_user_config
|
51
|
+
started = Capistrano::Isitdeployed.timestamp
|
52
|
+
RestClient.post(ENDPOINT + "/p/#{config['project_id']}/d", { :status => 1, :platform => "#{stage}", :release => "#{release_name}", :started => started, :token => config['api_secret'] }.to_json, :content_type => :json, :accept => :json, :timeout => 5, :open_timeout => 5){ |response, request, result| response
|
53
|
+
case response.code
|
54
|
+
when 201
|
55
|
+
logger.trace "IsItDeployed > New deploy created for #{application} to #{stage} with version: #{release_name}"
|
56
|
+
logger.trace "IsItDeployed > URL is #{ENDPOINT}/p/#{config['project_id']}"
|
57
|
+
set(:isitdeployed_did, response.gsub(/\s+/, ""))
|
58
|
+
set(:isitdeployed_started, started)
|
59
|
+
set(:isitdeployed_created, 1)
|
60
|
+
when 401
|
61
|
+
logger.trace "IsItDeployed > ERROR: Invalid 'api_secret'. Check your 'isitdeployed.yml'"
|
62
|
+
set(:isitdeployed_created, 0)
|
63
|
+
when 404
|
64
|
+
logger.trace "IsItDeployed > ERROR: Invalid 'project_id'. Check your 'isitdeployed.yml'"
|
65
|
+
set(:isitdeployed_created, 0)
|
66
|
+
else
|
67
|
+
logger.trace "IsItDeployed > ERROR: Can't create deploy, server returned code #{response.code}"
|
68
|
+
set(:isitdeployed_created, 0)
|
69
|
+
end
|
70
|
+
}
|
71
|
+
else
|
72
|
+
logger.trace "IsItDeployed > WARNING: No configuration file found, please run cap 'isit:setup'"
|
73
|
+
set(:isitdeployed_created, 0)
|
74
|
+
end
|
74
75
|
end
|
75
76
|
|
76
77
|
namespace :status do
|
@@ -86,9 +87,9 @@ module Capistrano
|
|
86
87
|
end
|
87
88
|
|
88
89
|
desc "Updates deploy status using the API (succes or rollback)"
|
89
|
-
config = Capistrano::Isitdeployed.get_config
|
90
90
|
task :update do
|
91
91
|
if isitdeployed_created === 1
|
92
|
+
config = Capistrano::Isitdeployed.load_user_config
|
92
93
|
stopped = Capistrano::Isitdeployed.timestamp
|
93
94
|
duration = stopped.to_i - isitdeployed_started.to_i
|
94
95
|
RestClient.put(ENDPOINT + "/p/#{config['project_id']}/d/#{isitdeployed_did}", { :status => isitdeployed_status, :stopped => stopped, :duration => duration, :token => config['api_secret'] }.to_json, :content_type => :json, :accept => :json, :timeout => 5, :open_timeout => 5){ |response, request, result| response
|
@@ -105,7 +106,6 @@ module Capistrano
|
|
105
106
|
}
|
106
107
|
end
|
107
108
|
end
|
108
|
-
|
109
109
|
end
|
110
110
|
end
|
111
111
|
end
|