capistrano-isitdeployed 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2471b60d8c1a097e0925f3d20ac2f5c5244b9a5d
|
4
|
+
data.tar.gz: 2fb69acafb514ac5643b4df3e64bd8666e4c8e29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0cc676f781843e51009cbdee245ab8e035e66c85ce4d5728b123bf9bd84261088c54178d214d77a85afd8dbc7ccabf54d759d873cc61b5118e7384c42bf057c
|
7
|
+
data.tar.gz: 4b321c1a11524ca9f0649603cc2f84eb0203f5ad3e3e78c247a9e4ac47ea3cdaf8e6a497e19aa2e061567eef82618e4d11914eb5de64a85a3d71f06cee2ea2f3
|
@@ -7,12 +7,18 @@ require 'rest_client'
|
|
7
7
|
module Capistrano
|
8
8
|
module Isitdeployed
|
9
9
|
|
10
|
-
CONFIG = YAML.load_file(Capistrano::Isitdeployed::CONFIG_DEST)
|
11
|
-
|
12
10
|
def self.timestamp
|
13
11
|
return Time.now.utc.strftime("%Y%m%d%H%M%S")
|
14
12
|
end
|
15
13
|
|
14
|
+
def self.get_config
|
15
|
+
if File.exists?(CONFIG_DEST)
|
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
|
20
|
+
end
|
21
|
+
|
16
22
|
def self.load_into(configuration)
|
17
23
|
configuration.load do
|
18
24
|
|
@@ -28,12 +34,12 @@ module Capistrano
|
|
28
34
|
|
29
35
|
desc "Creates a configuration file"
|
30
36
|
task :setup do
|
31
|
-
if File.exists?(
|
37
|
+
if File.exists?(CONFIG_DEST)
|
32
38
|
logger.trace "WARNING: A configuration file already exists. Remove it before running setup again."
|
33
39
|
else
|
34
40
|
path = File.dirname(File.expand_path(__FILE__))
|
35
|
-
source = path + '/isitdeployed/' +
|
36
|
-
dest =
|
41
|
+
source = path + '/isitdeployed/' + CONFIG_SRC
|
42
|
+
dest = CONFIG_DEST
|
37
43
|
FileUtils.cp source, dest
|
38
44
|
logger.trace "IsItDeployed > #"
|
39
45
|
logger.trace "IsItDeployed > # A configuration file '#{dest}' has been created."
|
@@ -44,17 +50,13 @@ module Capistrano
|
|
44
50
|
|
45
51
|
desc "Creates a new deploy using the API"
|
46
52
|
task :deploy do
|
47
|
-
|
48
|
-
else
|
49
|
-
logger.trace "IsItDeployed > WARNING: No configuration file found, please run cap 'isit:setup'"
|
50
|
-
end
|
53
|
+
config = Capistrano::Isitdeployed.get_config
|
51
54
|
started = Capistrano::Isitdeployed.timestamp
|
52
|
-
RestClient.post(
|
55
|
+
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
56
|
case response.code
|
54
57
|
when 201
|
55
58
|
logger.trace "IsItDeployed > New deploy created for #{application} to #{stage} with version: #{release_name}"
|
56
|
-
logger.trace "IsItDeployed > URL is #{
|
57
|
-
logger.trace "IsItDeployed > #{response.gsub(/\s+/, "")}"
|
59
|
+
logger.trace "IsItDeployed > URL is #{ENDPOINT}/p/#{config['project_id']}"
|
58
60
|
set(:isitdeployed_did, response.gsub(/\s+/, ""))
|
59
61
|
set(:isitdeployed_started, started)
|
60
62
|
set(:isitdeployed_created, 1)
|
@@ -84,11 +86,12 @@ module Capistrano
|
|
84
86
|
end
|
85
87
|
|
86
88
|
desc "Updates deploy status using the API (succes or rollback)"
|
87
|
-
|
89
|
+
config = Capistrano::Isitdeployed.get_config
|
90
|
+
task :update do
|
88
91
|
if isitdeployed_created === 1
|
89
92
|
stopped = Capistrano::Isitdeployed.timestamp
|
90
93
|
duration = stopped.to_i - isitdeployed_started.to_i
|
91
|
-
RestClient.put(
|
94
|
+
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
|
92
95
|
case response.code
|
93
96
|
when 204
|
94
97
|
logger.trace "IsItDeployed > Deploy ##{isitdeployed_did} has been updated for #{application} to #{stage}."
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-isitdeployed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas VIAL
|
@@ -10,8 +10,17 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
|
12
12
|
date: 2013-04-02 00:00:00 Z
|
13
|
-
dependencies:
|
14
|
-
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rest-client
|
16
|
+
prerelease: false
|
17
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.6.7
|
22
|
+
type: :runtime
|
23
|
+
version_requirements: *id001
|
15
24
|
description: This is a pre-alpha build for test purpose.
|
16
25
|
email:
|
17
26
|
- rubygems@ifusio.com
|
@@ -43,13 +52,13 @@ require_paths:
|
|
43
52
|
- lib
|
44
53
|
required_ruby_version: !ruby/object:Gem::Requirement
|
45
54
|
requirements:
|
46
|
-
- &
|
55
|
+
- &id002
|
47
56
|
- ">="
|
48
57
|
- !ruby/object:Gem::Version
|
49
58
|
version: "0"
|
50
59
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
60
|
requirements:
|
52
|
-
- *
|
61
|
+
- *id002
|
53
62
|
requirements: []
|
54
63
|
|
55
64
|
rubyforge_project:
|