j-cap-recipes 0.0.13 → 0.0.14

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: 0a5ce42fee65e8aeb412a3f5049ee9022d76da70
4
- data.tar.gz: 370ad71ab61b0d638725e452a171c03fa9ba94bd
3
+ metadata.gz: 086e21393f0b2b5b113d801f388aba884d6c35a9
4
+ data.tar.gz: 4661e17909d7b2e47c9974d2bb04715728c955e3
5
5
  SHA512:
6
- metadata.gz: 2aafc607283fa25bb77b47599ae94ed3b0cf0bfe3f6f6bc22fc4a9eaa56cfc8aff83611b29865f5f7f03ce6809a7a7880514bf8e57fbf083fc22ed66d75276d9
7
- data.tar.gz: 1502e1f91de548eaf623ba6f49dc27affe0218fbeda5c406b1048a5066429505d283f9db2ba4631c3b93416e068f6f39b1a5eca6a60b51001c4eafe9c946d7e9
6
+ metadata.gz: 846b3cbe2a3c266b4783276febbef4b15e1181dd6d7283acbaea4784ae04bb5277b033c5beff98ecd7f737de2a7bcc563f6add00519d60cca0a20ceded44f673
7
+ data.tar.gz: 37da5b66d6d3917a885b63ae52f8b5fc3ca745d68a5c37561cc3cbe1b65b169f96773959a4b89fde7137824ff27baffa9ca8f597c20f141981432a9f52cf077c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## Changelog
2
2
 
3
+ ## 0.0.14
4
+
5
+ * Added airbrake deploy notification task.
6
+
7
+ ## 0.0.13
8
+
3
9
  ## 0.0.12
4
10
 
5
11
  * Updated recipe git to update remote with new tags.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- j-cap-recipes (0.0.13)
4
+ j-cap-recipes (0.0.14)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -35,6 +35,7 @@ If you want to load only specified recipe:
35
35
  require 'j-cap-recipes/rails'
36
36
  require 'j-cap-recipes/unicorn'
37
37
  require 'j-cap-recipes/honeybadger'
38
+ require 'j-cap-recipes/airbrake'
38
39
 
39
40
  ### Nginx
40
41
  ### Setup
@@ -114,6 +115,18 @@ To download all share folder use:
114
115
 
115
116
  To extract the archive `tar -xvf download.tar -C tmp`
116
117
 
118
+ ### Airbrake
119
+
120
+ Add 'j-cap-recipes/airbrake'` to `Capfile`. The original version capistrano task to notify airbrake service support only
121
+ Capistrano version 2. Migrate the task to support version 3.
122
+
123
+ To send Airbrake deploy notification, you should also add hook to `deploy.rb`
124
+
125
+ ```ruby
126
+ after 'deploy:finishing', 'airbrake:deploy'
127
+ ```
128
+
129
+ You can change the default api key using `ENV['API_KEY']`.
117
130
 
118
131
  ## Contributing
119
132
 
@@ -0,0 +1,2 @@
1
+ load File.expand_path("../tasks/airbrake.rake", __FILE__)
2
+
@@ -0,0 +1,45 @@
1
+ namespace :airbrake do
2
+ desc <<-DESC
3
+ Notify Airbrake of the deployment by running the notification on the REMOTE machine.
4
+ - Run remotely so we use remote API keys, environment, etc.
5
+ DESC
6
+ task :deploy do
7
+ rails_env = fetch(:rails_env, "production")
8
+ airbrake_env = fetch(:airbrake_env, fetch(:rails_env, "production"))
9
+ local_user = ENV['USER'] || ENV['USERNAME']
10
+
11
+ on roles(:app) do
12
+ within release_path do
13
+ with rails_env: fetch(:rails_env) do
14
+ notify_command = [:rake, 'environment airbrake:deploy', "TO=#{airbrake_env}", "REVISION=#{fetch(:current_revision)}",
15
+ "REPO='#{fetch(:repo_url)}' USER=#{AirbrakeCapistrano::shellescape(local_user)}"]
16
+ notify_command << "API_KEY=#{ENV['API_KEY']}" if ENV['API_KEY']
17
+ execute *notify_command
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+
24
+ module AirbrakeCapistrano
25
+ def self.shellescape(str)
26
+ str = str.to_s
27
+
28
+ # An empty argument will be skipped, so return empty quotes.
29
+ return "''" if str.empty?
30
+
31
+ str = str.dup
32
+
33
+ # Treat multibyte characters as is. It is caller's responsibility
34
+ # to encode the string in the right encoding for the shell
35
+ # environment.
36
+ str.gsub!(/([^A-Za-z0-9_\-.,:\/@\n])/, "\\\\\\1")
37
+
38
+ # A LF cannot be escaped with a backslash because a backslash + LF
39
+ # combo is regarded as line continuation and simply ignored.
40
+ str.gsub!(/\n/, "'\n'")
41
+
42
+ return str
43
+ end
44
+ end
45
+
@@ -1,5 +1,5 @@
1
1
  module JCap
2
2
  module Recipes
3
- VERSION = '0.0.13'
3
+ VERSION = '0.0.14'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: j-cap-recipes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Nikitochkin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-04 00:00:00.000000000 Z
11
+ date: 2014-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -67,6 +67,7 @@ files:
67
67
  - Rakefile
68
68
  - j-cap-recipes.gemspec
69
69
  - lib/j-cap-recipes.rb
70
+ - lib/j-cap-recipes/airbrake.rb
70
71
  - lib/j-cap-recipes/check.rb
71
72
  - lib/j-cap-recipes/database.rb
72
73
  - lib/j-cap-recipes/delayed_job.rb
@@ -82,6 +83,7 @@ files:
82
83
  - lib/j-cap-recipes/rails.rb
83
84
  - lib/j-cap-recipes/rake.rb
84
85
  - lib/j-cap-recipes/setup.rb
86
+ - lib/j-cap-recipes/tasks/airbrake.rake
85
87
  - lib/j-cap-recipes/tasks/check.rake
86
88
  - lib/j-cap-recipes/tasks/database.rake
87
89
  - lib/j-cap-recipes/tasks/delayed_job.rake