capistrano-isitdeployed 0.1.1 → 0.1.2

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
  SHA512:
3
- data.tar.gz: 7020950f8e3d64a246d369710e6a174bca37409b99ce7349cc053eeeb6f49b32104df06ceadc113795baba58f851d94bbb0be90ea40867a72c65fa54d205f29b
4
- metadata.gz: d5ac06b6960c869d2d8993b5d07b2da01017205cddd016d0eb4c250928cc6c6ea9943f7e0a498665212d584af9a3c298a9c71598f53a349fb298d08a890d1657
3
+ data.tar.gz: f911d28496a65239126bcc19f20569e144dcc6ac5136b9cb1181ac43484dea78cd5d42d0472ce840f7e8cabd498614f7532b7f75fb28f5ac6af98f53a95f88a8
4
+ metadata.gz: f523e801dd6b293a687b57a4dac839d21736df87fe6d5532a6358c597c3eda5d3325c9d7d4141b8ed6d223cefa45c5c36c771deb98a1c8f2975ef71872181aef
5
5
  SHA1:
6
- data.tar.gz: 5581a8cc9bc08fe8b860a61f9fc3ae4885b3c13c
7
- metadata.gz: 3c5f0bbff1a163241621a5fd796e9f1fdde129c3
6
+ data.tar.gz: 85aa8b4ea01716a5fc5a8af7c347b8ec80373dd5
7
+ metadata.gz: c7c593ac375e3eb57d4edb16223fae2901bb5311
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  This plugin works as an interface between your [Capistrano](http://capistranorb.com/) deployments and [www.isitdeployed.com](http://www.isitdeployed.com) which gives you :
4
4
  * deployments counter for your projects
5
5
  * a deployment status page for you and your team which displays current deploy status (does not nead page reload for updates)
6
- * soon : deploys statistics
6
+ * soon: deploys statistics
7
7
 
8
8
  And it's Free.
9
9
 
@@ -12,11 +12,16 @@ If not, you should! :-)
12
12
 
13
13
  Has been tested with Rails3 and Symfony2 projects.
14
14
 
15
+ ## Requirements
16
+ * some gems but dependencies are managed automatically when you install capistrano-isitdeployed
17
+ * ruby1.x**-dev** (otherwise you will get `no such file to load -- mkmf (LoadError)`)
18
+ * log level must display `logger.trace`
19
+
15
20
  ## Installation
16
21
 
17
22
  * install the gem
18
23
  * create a project on [www.isitdeployed.com](http://www.isitdeployed.com) with a valid email address
19
- * you will receive the instructions to enable capistrano-isitdeployed in you deploy.rb
24
+ * you will receive the instructions to enable capistrano-isitdeployed in your project
20
25
 
21
26
  ## Detailed installation
22
27
 
@@ -34,14 +39,14 @@ and run:
34
39
  `gem install capistrano-isitdeployed`
35
40
  (you may have to use sudo)
36
41
 
37
- ### 2. at the top of `config/deploy.rb`, add:
38
- `require 'capistrano/isitdeployed'`
39
-
40
- ### 3. generate config file running:
41
- `cap isit:setup`
42
+ ### 2. at the top of `config/deploy.rb`, add the lines you received on your email:
43
+ # isitdeplopyed settings
44
+ require 'capistrano/isitdeployed'
45
+ set :isitdeployed_project_id, 'x'
46
+ set :isitdeployed_api_secret, 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
42
47
 
43
- ### 4. edit `config/isitdeployed.yml` config file
44
- Configure `project_id` and `api_secret` with values received on your email
48
+ ### 3. Deploy!
49
+ cap deploy
45
50
 
46
51
  ## Contributing
47
52
 
@@ -4,7 +4,7 @@ module Capistrano
4
4
  ENDPOINT = 'http://www.isitdeployed.com'
5
5
  # ENDPOINT = 'http://0.0.0.0:3000'
6
6
  CONFIG_SRC = 'template/isitdeployed.yml'
7
- CONFIG_DEST = 'config/isitdeployed.yml'
7
+ # CONFIG_DEST = 'config/isitdeployed.yml'
8
8
 
9
9
  end
10
10
  end
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Isitdeployed
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -18,7 +18,7 @@ module Capistrano
18
18
 
19
19
  def self.load_into(configuration)
20
20
  configuration.load do
21
-
21
+
22
22
  # task hooks
23
23
  before 'deploy', 'isit:deploy'
24
24
  after 'deploy', 'isit:status:success'
@@ -28,57 +28,34 @@ module Capistrano
28
28
 
29
29
  # task definitions
30
30
  namespace :isit do
31
- # TODO: generate a pre-configured file using command line arguments
32
- # cap isit-setup -project_id=x -api_secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
33
- desc "Creates a configuration file"
34
- task :setup do
35
- if File.exists?(CONFIG_DEST)
36
- logger.trace "WARNING: A configuration file already exists. Remove it before running setup again."
37
- else
38
- path = File.dirname(File.expand_path(__FILE__))
39
- source = path + '/isitdeployed/' + CONFIG_SRC
40
- dest = CONFIG_DEST
41
- FileUtils.cp source, dest
42
- logger.trace "IsItDeployed > #"
43
- logger.trace "IsItDeployed > # A configuration file '#{dest}' has been created."
44
- logger.trace "IsItDeployed > # Please edit this file before your next deploy."
45
- logger.trace "IsItDeployed > #"
46
- end
47
- end
48
31
 
49
32
  desc "Creates a new deploy using the API"
50
33
  task :deploy do
51
- if File.exists?(CONFIG_DEST)
52
- config = Capistrano::Isitdeployed.load_user_config
53
- started = Capistrano::Isitdeployed.timestamp
54
- set(:stage, "my platform") unless exists?(:stage)
55
- RestClient.post(ENDPOINT + "/p/#{config['project_id']}/d", JSON.generate({ :status => 1, :platform => "#{stage}", :release => "#{release_name}", :started => started, :token => config['api_secret'], :version => VERSION }), :content_type => :json, :accept => :json, :timeout => 5, :open_timeout => 5){ |response, request, result| response
56
- case response.code
57
- when 201
58
- logger.trace "IsItDeployed > New deploy created for #{application} to #{stage} with version: #{release_name}"
59
- logger.trace "IsItDeployed > URL is #{ENDPOINT}/p/#{config['project_id']}"
60
- json = JSON.parse(response)
61
- if json['latest_version'] > VERSION
62
- logger.trace "IsItDeployed > WARNING: Your 'capistrano-isitdeployed' gem is outdated. Consider upgrade to #{json['latest_version']}"
63
- end
64
- set(:isitdeployed_did, json['deploy_id'])
65
- set(:isitdeployed_started, started)
66
- set(:isitdeployed_created, 1)
67
- when 401
68
- logger.trace "IsItDeployed > ERROR: Invalid 'api_secret'. Check your '#{CONFIG_DEST}'"
69
- set(:isitdeployed_created, 0)
70
- when 404
71
- logger.trace "IsItDeployed > ERROR: Invalid 'project_id'. Check your '#{CONFIG_DEST}'"
72
- set(:isitdeployed_created, 0)
73
- else
74
- logger.trace "IsItDeployed > ERROR: Can't create deploy, server returned code #{response.code}"
75
- set(:isitdeployed_created, 0)
34
+ started = Capistrano::Isitdeployed.timestamp
35
+ set(:stage, "my platform") unless exists?(:stage)
36
+ RestClient.post(ENDPOINT + "/p/#{isitdeployed_project_id}/d", JSON.generate({ :status => 1, :platform => "#{stage}", :release => "#{release_name}", :started => started, :token => isitdeployed_api_secret, :version => VERSION }), :content_type => :json, :accept => :json, :timeout => 5, :open_timeout => 5){ |response, request, result| response
37
+ case response.code
38
+ when 201
39
+ logger.trace "IsItDeployed > New deploy created for #{application} to #{stage} with version: #{release_name}"
40
+ logger.trace "IsItDeployed > URL is #{ENDPOINT}/p/#{isitdeployed_project_id}"
41
+ json = JSON.parse(response)
42
+ if json['latest_version'] > VERSION
43
+ logger.trace "IsItDeployed > WARNING: Your 'capistrano-isitdeployed' gem is outdated. Consider upgrade to #{json['latest_version']}"
76
44
  end
77
- }
78
- else
79
- logger.trace "IsItDeployed > WARNING: No configuration file found, please run cap 'isit:setup'"
80
- set(:isitdeployed_created, 0)
81
- end
45
+ set(:isitdeployed_did, json['deploy_id'])
46
+ set(:isitdeployed_started, started)
47
+ set(:isitdeployed_created, 1)
48
+ when 401
49
+ logger.trace "IsItDeployed > ERROR: Invalid 'isitdeployed_api_secret'. Check your 'deploy.rb' file"
50
+ set(:isitdeployed_created, 0)
51
+ when 404
52
+ logger.trace "IsItDeployed > ERROR: Invalid 'isitdeployed_project_id'. Check your 'deploy.rb' file"
53
+ set(:isitdeployed_created, 0)
54
+ else
55
+ logger.trace "IsItDeployed > ERROR: Can't create deploy, server returned code #{response.code}"
56
+ set(:isitdeployed_created, 0)
57
+ end
58
+ }
82
59
  end
83
60
 
84
61
  namespace :status do
@@ -96,17 +73,16 @@ module Capistrano
96
73
  desc "Updates deploy status using the API (success or rollback)"
97
74
  task :update do
98
75
  if isitdeployed_created === 1
99
- config = Capistrano::Isitdeployed.load_user_config
100
76
  stopped = Capistrano::Isitdeployed.timestamp
101
77
  duration = stopped.to_i - isitdeployed_started.to_i
102
- RestClient.put(ENDPOINT + "/p/#{config['project_id']}/d/#{isitdeployed_did}", JSON.generate({ :status => isitdeployed_status, :stopped => stopped, :duration => duration, :token => config['api_secret'] }), :content_type => :json, :accept => :json, :timeout => 5, :open_timeout => 5){ |response, request, result| response
78
+ RestClient.put(ENDPOINT + "/p/#{isitdeployed_project_id}/d/#{isitdeployed_did}", JSON.generate({ :status => isitdeployed_status, :stopped => stopped, :duration => duration, :token => isitdeployed_api_secret }), :content_type => :json, :accept => :json, :timeout => 5, :open_timeout => 5){ |response, request, result| response
103
79
  case response.code
104
80
  when 204
105
81
  logger.trace "IsItDeployed > Deploy ##{isitdeployed_did} has been updated for #{application} to #{stage}."
106
82
  when 401
107
- logger.trace "IsItDeployed > ERROR: Invalid 'api_secret'. Check your '#{CONFIG_DEST}'"
83
+ logger.trace "IsItDeployed > ERROR: Invalid 'isitdeployed_api_secret'. Check your 'deploy.rb' file"
108
84
  when 404
109
- logger.trace "IsItDeployed > ERROR: Invalid 'project_id'. Check your '#{CONFIG_DEST}'"
85
+ logger.trace "IsItDeployed > ERROR: Invalid 'isitdeployed_project_id'. Check your 'deploy.rb' file"
110
86
  else
111
87
  logger.trace "IsItDeployed > ERROR: Can't create deploy, server returned #{response.code}"
112
88
  end
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.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas VIAL