capistrano-isitdeployed 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d1e80dc7f4fbe2d68fe7e757435d40ffc1be3edf
4
- data.tar.gz: 375bfa6616de5284e778a5508b1133661bfc74b2
3
+ metadata.gz: 2471b60d8c1a097e0925f3d20ac2f5c5244b9a5d
4
+ data.tar.gz: 2fb69acafb514ac5643b4df3e64bd8666e4c8e29
5
5
  SHA512:
6
- metadata.gz: 6b7c301a01d64b3e86c66f33e4f5478145064cd44c0c8fc7b0982330f1c19e2705d5b4a41301b6ddf5977b0c68e76a312ce9c46007d4eb73d72ca35cd5d61ad9
7
- data.tar.gz: 21058ceb15e9777c116d0204e187ff0739a40eed22f5a17585c7bf7a037aecbb0fd7e160089cadb99996b91cf246f17d56d804c7e3b3f14fbd91c6894c614951
6
+ metadata.gz: f0cc676f781843e51009cbdee245ab8e035e66c85ce4d5728b123bf9bd84261088c54178d214d77a85afd8dbc7ccabf54d759d873cc61b5118e7384c42bf057c
7
+ data.tar.gz: 4b321c1a11524ca9f0649603cc2f84eb0203f5ad3e3e78c247a9e4ac47ea3cdaf8e6a497e19aa2e061567eef82618e4d11914eb5de64a85a3d71f06cee2ea2f3
@@ -1,10 +1,2 @@
1
- #
2
- # isitdeploye.yml configuration file
3
- #
4
-
5
- # required configuration
6
1
  project_id: x
7
2
  api_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
8
-
9
- # optional parameters:
10
- # "isitdeployed_app", to override :application variable
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Isitdeployed
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -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?('config/isitdeployed.yml')
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/' + Capistrano::Isitdeployed::CONFIG_SRC
36
- dest = Capistrano::Isitdeployed::CONFIG_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
- if File.exists?('config/isitdeployed.yml')
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(Capistrano::Isitdeployed::ENDPOINT + "/p/#{Capistrano::Isitdeployed::CONFIG['project_id']}/d", { :status => 1, :platform => "#{stage}", :release => "#{release_name}", :started => started, :token => Capistrano::Isitdeployed::CONFIG['api_secret'] }.to_json, :content_type => :json, :accept => :json, :timeout => 5, :open_timeout => 5){ |response, request, result| response
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 #{Capistrano::Isitdeployed::ENDPOINT}/p/#{Capistrano::Isitdeployed::CONFIG['project_id']}"
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
- task :update do
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(Capistrano::Isitdeployed::ENDPOINT + "/p/#{Capistrano::Isitdeployed::CONFIG['project_id']}/d/#{isitdeployed_did}", { :status => isitdeployed_status, :stopped => stopped, :duration => duration, :token => Capistrano::Isitdeployed::CONFIG['api_secret'] }.to_json, :content_type => :json, :accept => :json, :timeout => 5, :open_timeout => 5){ |response, request, result| response
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.3
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
- - &id001
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
- - *id001
61
+ - *id002
53
62
  requirements: []
54
63
 
55
64
  rubyforge_project: