capistrano-pushover 0.0.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.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rvmrc ADDED
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
+ # Only full ruby name is supported here, for short names use:
8
+ # echo "rvm use 1.9.3" > .rvmrc
9
+ environment_id="ruby-1.9.3-p194@capistrano-pushover"
10
+
11
+ # Uncomment the following lines if you want to verify rvm version per project
12
+ # rvmrc_rvm_version="1.15.7 (latest)" # 1.10.1 seams as a safe start
13
+ # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
+ # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
+ # return 1
16
+ # }
17
+
18
+ # First we attempt to load the desired environment directly from the environment
19
+ # file. This is very fast and efficient compared to running through the entire
20
+ # CLI and selector. If you want feedback on which environment was used then
21
+ # insert the word 'use' after --create as this triggers verbose mode.
22
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24
+ then
25
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26
+ [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
27
+ \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
28
+ else
29
+ # If the environment file has not yet been created, use the RVM CLI to select.
30
+ rvm --create "$environment_id" || {
31
+ echo "Failed to create RVM environment '${environment_id}'."
32
+ return 1
33
+ }
34
+ fi
35
+
36
+ # If you use bundler, this might be useful to you:
37
+ # if [[ -s Gemfile ]] && {
38
+ # ! builtin command -v bundle >/dev/null ||
39
+ # builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
40
+ # }
41
+ # then
42
+ # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
43
+ # gem install bundler
44
+ # fi
45
+ # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
46
+ # then
47
+ # bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
48
+ # fi
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-pushover.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Shuky Dvir
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # Capistrano::Pushover
2
+
3
+ This gem adds hooks to capistrano to send push notifications using [Pushover](https://pushover.net/) service.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'capistrano-pushover'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install capistrano-pushover
18
+
19
+ ## Usage
20
+
21
+ Add to deploy.rb:
22
+
23
+ require 'hipchat/capistrano'
24
+
25
+ set :pushover_app_token, 'Your Pushover Application Token'
26
+ set :pusehover_user_key, 'Your Pushover User Token'
27
+
28
+ Now you are ready to recieve notificaion about deploys.
29
+
30
+ If a deploy fails you will also recieve notification about the failure.
31
+
32
+ ### Who did it?
33
+
34
+ To determine the user that is currently running the deploy, the capistrano tasks will look for the following:
35
+
36
+ 1. The $PUSHOVER_USER environment variable.
37
+ 2. The git user.name var.
38
+ 3. The $USER environment variable.
39
+
40
+ ## Contributing
41
+
42
+ 1. Fork it
43
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
44
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
45
+ 4. Push to the branch (`git push origin my-new-feature`)
46
+ 5. Create new Pull Request
47
+
48
+ ## Copyright
49
+
50
+ Copyright &copy; 2012 Shuky Dvir.
51
+
52
+ **MIT License.**
53
+
54
+ See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/capistrano-pushover/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Shuky Dvir"]
6
+ gem.email = ["shuky@tooveo.com"]
7
+ gem.description = %q{Send deploy notification to Pushover}
8
+ gem.summary = %q{Send deploy notification to Pushover}
9
+ gem.homepage = "https://github.com/shukydvir/capistrano-pushover"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "capistrano-pushover"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Capistrano::Pushover::VERSION
17
+
18
+ gem.add_development_dependency 'rake'
19
+ gem.add_development_dependency 'rspec'
20
+ gem.add_dependency 'rushover'
21
+ end
@@ -0,0 +1,74 @@
1
+ require "capistrano-pushover/version"
2
+ require "rushover"
3
+
4
+
5
+ module Capistrano
6
+ module Pushover
7
+ Capistrano::Configuration.instance(:must_exist).load do
8
+
9
+ set :pushover_with_migrations, false
10
+
11
+ namespace :pushover do
12
+
13
+ task :set_user do
14
+ set :pushover_client, Rushover::Client.new(pushover_app_token)
15
+ set :pushover_user, Rushover::User.new(pusehover_user_key, pushover_client)
16
+ end
17
+
18
+ task :configure_for_migrations do
19
+ set :pushover_with_migrations, true
20
+ end
21
+
22
+ task :notify_deploy_started do
23
+ on_rollback do
24
+ pushover_user.notify("#{human} cancelled deployment of #{deployment_name} to #{env}.", :title => "#{application} cancelled deployment", :priority => 1)
25
+ end
26
+
27
+ message = "#{human} is deploying #{deployment_name} to #{env}"
28
+ message << " (with migrations)" if pushover_with_migrations
29
+ message << "."
30
+
31
+ pushover_user.notify(message, :title => "#{application} started deploying", :priority => priority)
32
+ end
33
+
34
+ task :notify_deploy_finished do
35
+ pushover_user.notify("#{human} finished deploying #{deployment_name} to #{env}.", :title => "#{application} finished deploying", :priority => priority)
36
+ end
37
+
38
+ def priority
39
+ fetch(:pushover_priority, 0)
40
+ end
41
+
42
+ def deployment_name
43
+ if branch
44
+ "#{application}/#{branch}"
45
+ else
46
+ application
47
+ end
48
+ end
49
+
50
+ def human
51
+ ENV['PUSHOVER_USER'] ||
52
+ if (u = %x{git config user.name}.strip) != ""
53
+ u
54
+ elsif (u = ENV['USER']) != ""
55
+ u
56
+ else
57
+ "Someone"
58
+ end
59
+ end
60
+
61
+ def env
62
+ fetch(:pushover_env, fetch(:rack_env, fetch(:rails_env, "production")))
63
+ end
64
+
65
+ before "pushover:notify_deploy_started", "pushover:set_user"
66
+ before "deploy:migrations", "pushover:configure_for_migrations"
67
+ before "deploy:update_code", "pushover:notify_deploy_started"
68
+ after "deploy", "pushover:notify_deploy_finished"
69
+ after "deploy:migrations", "pushover:notify_deploy_finished"
70
+ end
71
+
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module Pushover
3
+ VERSION = "0.0.2"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-pushover
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Shuky Dvir
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rspec
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rushover
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: Send deploy notification to Pushover
63
+ email:
64
+ - shuky@tooveo.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - .gitignore
70
+ - .rvmrc
71
+ - Gemfile
72
+ - LICENSE
73
+ - README.md
74
+ - Rakefile
75
+ - capistrano-pushover.gemspec
76
+ - lib/capistrano-pushover.rb
77
+ - lib/capistrano-pushover/version.rb
78
+ homepage: https://github.com/shukydvir/capistrano-pushover
79
+ licenses: []
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ segments:
91
+ - 0
92
+ hash: 3940367720314031294
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ segments:
100
+ - 0
101
+ hash: 3940367720314031294
102
+ requirements: []
103
+ rubyforge_project:
104
+ rubygems_version: 1.8.24
105
+ signing_key:
106
+ specification_version: 3
107
+ summary: Send deploy notification to Pushover
108
+ test_files: []