mina-appsignal 0.0.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 823a6d52361552cc9987f57ad299104b86f569f4
4
+ data.tar.gz: 08fabffcc45f9b3e1c2d270d7ee2a02cd9b1ddfb
5
+ SHA512:
6
+ metadata.gz: ba9e95aae2c71c5dd70d0d727d142da8001089495574e1ef82ecb04bbfc783678ec52db8261d6d6119ff0bcb8c768ca133ec232cb8b63b5886d0b3fec5b58d50
7
+ data.tar.gz: 87b0c0edbbd634ba9d86d7cf2c06062396f01b324f243039ab1e9b182fefe5489f4cfda815278c73c8f7bec5fe65b7a2da77c613f264e09d30886eae1d31d77c
@@ -0,0 +1,16 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ *.exe
15
+ mkmf.log
16
+ .idea
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in mina-rollbar.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Aramis Group, LLC dba code lever
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.
@@ -0,0 +1,61 @@
1
+ # Mina::AppSignal [![Build Status](https://travis-ci.org/code-lever/mina-appsignal.png)](https://travis-ci.org/code-lever/mina-appsignal) [![Dependency Status](https://gemnasium.com/code-lever/mina-appsignal.png)](https://gemnasium.com/code-lever/mina-appsignal) [![Code Climate](https://codeclimate.com/github/code-lever/mina-appsignal.png)](https://codeclimate.com/github/code-lever/mina-appsignal)
2
+
3
+ [Mina](https://github.com/mina-deploy/mina) tasks for interacting with [AppSignal](http://appsignal.com).
4
+
5
+ Adds the following tasks:
6
+
7
+ appsignal:notify
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'mina-appsignal', require: false
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ ## Usage
22
+
23
+ **Note:** Currently requires `curl` to be present on the server for notifications to be sent. Patches happily accepted to improve this limitation!
24
+
25
+ If you are using a `config/appsignal.yml` file, you need only:
26
+
27
+ require 'mina/appsignal'
28
+
29
+ ...
30
+
31
+ task deploy: :environment do
32
+ deploy do
33
+ ...
34
+
35
+ to :launch do
36
+ ...
37
+ invoke :'appsignal:notify'
38
+ end
39
+ end
40
+ end
41
+
42
+ If not, you'll need to set some options.
43
+
44
+ ## Options
45
+
46
+ | Name | Description |
47
+ | ------------------------------ | -----------------------------------------------------------|
48
+ | `appsignal_api_key` | AppSignal push api key |
49
+ | | Read from `config/appsignal.yml` or `ENV['APPSIGNAL_PUSH_API_KEY']` if available |
50
+ | `appsignal_app_name` | AppSignal application name |
51
+ | | Read from `config/appsignal.yml` or `ENV['APPSIGNAL_APP_NAME']` if available |
52
+ | `appsignal_local_username` | Local username of deploying user (optional) |
53
+ | `appsignal_notification_debug` | `true` to enable notification debugging info |
54
+
55
+ ## Contributing
56
+
57
+ 1. Fork it ( https://github.com/code-lever/mina-appsignal/fork )
58
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
59
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
60
+ 4. Push to the branch (`git push origin my-new-feature`)
61
+ 5. Create a new Pull Request
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ require 'bundler/gem_tasks'
3
+ require 'rspec/core/rake_task'
4
+ require 'ci/reporter/rake/rspec'
5
+
6
+ RSpec::Core::RakeTask.new('spec')
7
+ task :default => :spec
@@ -0,0 +1,3 @@
1
+ require 'mina/appsignal/support'
2
+ require 'mina/appsignal/tasks'
3
+ require 'mina/appsignal/version'
@@ -0,0 +1,14 @@
1
+ require 'yaml'
2
+
3
+ module Mina
4
+ module AppSignal
5
+
6
+ def self.from_config(env, key)
7
+ @@config ||= YAML.load(File.read('config/appsignal.yml'))
8
+ @@config[env][key]
9
+ rescue
10
+ nil
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,89 @@
1
+ # # Modules: AppSignal
2
+ # Adds settings and tasks for notifying AppSignal.
3
+ #
4
+ # require 'mina/appsignal'
5
+ #
6
+ # ## Usage example
7
+ # require 'mina/appsignal'
8
+ #
9
+ # # this is your 'post_server_item' token for your project
10
+ # set :appsignal_api_key, 'appsignal-api-key-goes-here'
11
+ #
12
+ # task :deploy do
13
+ # deploy do
14
+ # ...
15
+ #
16
+ # to :launch do
17
+ # ...
18
+ # invoke :'appsignal:notify'
19
+ # end
20
+ # end
21
+ # end
22
+
23
+ require 'mina/rails'
24
+ require 'json'
25
+
26
+ # ## Settings
27
+ # Any and all of these settings can be overriden in your `deploy.rb`.
28
+
29
+ # ### appsignal_api_key
30
+ # Sets the push api key for your AppSignal account. Will be read from
31
+ # config/appsignal.yml, or the APPSIGNAL_PUSH_API_KEY if not set. Required.
32
+ set_default :appsignal_api_key, nil
33
+
34
+ # ### appsignal_app_name
35
+ # Sets the name of the app being deployed. Will be read from
36
+ # config/appsignal.yml, or the APPSIGNAL_APP_NAME if not set. Required.
37
+ set_default :appsignal_app_name, nil
38
+
39
+ # ### appsignal_local_username
40
+ # Sets the name of the user who deployed. Defaults to `whoami`. Optional.
41
+ set_default :appsignal_local_username, %x[whoami].strip rescue nil
42
+
43
+ # ### appsignal_notification_debug
44
+ # If true, enables verbosity in the notification to help debug issues. Defaults to false.
45
+ set_default :appsignal_notification_debug, false
46
+
47
+ namespace :appsignal do
48
+
49
+ desc 'Notifies AppSignal of your deployment'
50
+ task notify: :environment do
51
+
52
+ api_key = appsignal_api_key
53
+ api_key ||= Mina::AppSignal.from_config(rails_env, 'push_api_key')
54
+ api_key ||= ENV['APPSIGNAL_PUSH_API_KEY']
55
+ unless api_key
56
+ print_error '`:appsignal_api_key` must be defined to notify'
57
+ exit
58
+ end
59
+
60
+ app_name = appsignal_app_name
61
+ app_name ||= Mina::AppSignal.from_config(rails_env, 'name')
62
+ app_name ||= ENV['APPSIGNAL_APP_NAME']
63
+ unless app_name
64
+ print_error '`:appsignal_app_name` must be defined to notify'
65
+ exit
66
+ end
67
+
68
+ unless branch? || commit?
69
+ print_error 'Must define either `:branch` or `:commit`'
70
+ exit
71
+ end
72
+
73
+ revision = commit? ? commit : %x[git rev-parse #{branch}].strip
74
+
75
+ body = { revision: revision }
76
+ body[:repository] = branch if branch?
77
+ body[:user] = appsignal_local_username.shellescape if appsignal_local_username
78
+
79
+ silent = appsignal_notification_debug ? '-v' : '-s -o /dev/null'
80
+ script = [%Q(curl #{silent} -X POST)]
81
+ script << %Q(-d '#{body.to_json}')
82
+ script << %Q("https://push.appsignal.com/1/markers?api_key=#{api_key}&name=#{app_name}&environment=#{rails_env}")
83
+
84
+ queue! 'echo "-----> Notifying AppSignal of deployment"'
85
+ queue script.join(' ')
86
+
87
+ end
88
+
89
+ end
@@ -0,0 +1,5 @@
1
+ module Mina
2
+ module AppSignal
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
@@ -0,0 +1,35 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'mina/appsignal/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'mina-appsignal'
8
+ spec.version = Mina::AppSignal::VERSION
9
+ spec.authors = ['Nick Veys']
10
+ spec.email = ['nick@codelever.com']
11
+ spec.summary = %q{Mina tasks for AppSignal}
12
+ spec.description = %q{Notify AppSignal of Mina deployments.}
13
+ spec.homepage = 'https://github.com/code-lever/mina-appsignal'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'mina', '~> 0.3'
22
+
23
+ spec.add_development_dependency 'awesome_print'
24
+ spec.add_development_dependency 'bundler', '~> 1.6'
25
+ spec.add_development_dependency 'ci_reporter', '~> 1.9'
26
+ spec.add_development_dependency 'pry'
27
+ spec.add_development_dependency 'rake', '~> 10.0'
28
+ spec.add_development_dependency 'rspec', '~> 3.0'
29
+ spec.add_development_dependency 'rubocop'
30
+ spec.add_development_dependency 'rubocop-checkstyle_formatter'
31
+ spec.add_development_dependency 'simplecov'
32
+ spec.add_development_dependency 'simplecov-gem-adapter'
33
+ spec.add_development_dependency 'simplecov-rcov'
34
+ spec.add_development_dependency 'yard'
35
+ end
metadata ADDED
@@ -0,0 +1,237 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mina-appsignal
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Nick Veys
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: mina
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: awesome_print
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.6'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: ci_reporter
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.9'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.9'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '10.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '10.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop-checkstyle_formatter
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: simplecov
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: simplecov-gem-adapter
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: simplecov-rcov
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: yard
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ description: Notify AppSignal of Mina deployments.
196
+ email:
197
+ - nick@codelever.com
198
+ executables: []
199
+ extensions: []
200
+ extra_rdoc_files: []
201
+ files:
202
+ - ".gitignore"
203
+ - Gemfile
204
+ - LICENSE.txt
205
+ - README.md
206
+ - Rakefile
207
+ - lib/mina/appsignal.rb
208
+ - lib/mina/appsignal/support.rb
209
+ - lib/mina/appsignal/tasks.rb
210
+ - lib/mina/appsignal/version.rb
211
+ - mina-appsignal.gemspec
212
+ homepage: https://github.com/code-lever/mina-appsignal
213
+ licenses:
214
+ - MIT
215
+ metadata: {}
216
+ post_install_message:
217
+ rdoc_options: []
218
+ require_paths:
219
+ - lib
220
+ required_ruby_version: !ruby/object:Gem::Requirement
221
+ requirements:
222
+ - - ">="
223
+ - !ruby/object:Gem::Version
224
+ version: '0'
225
+ required_rubygems_version: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - ">="
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ requirements: []
231
+ rubyforge_project:
232
+ rubygems_version: 2.4.6
233
+ signing_key:
234
+ specification_version: 4
235
+ summary: Mina tasks for AppSignal
236
+ test_files: []
237
+ has_rdoc: