solano_notify_and_deploy 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +26 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/README.md +4 -0
- data/lib/generators/solano/USAGE +9 -0
- data/lib/generators/solano/solano_generator.rb +12 -0
- data/lib/generators/solano/templates/solano.yml.erb +5 -0
- data/lib/solano_notify_and_deploy.rb +3 -0
- data/lib/solano_notify_and_deploy/railtie.rb +16 -0
- data/lib/solano_notify_and_deploy/version.rb +3 -0
- data/solano_notify_and_deploy.gemspec +29 -0
- data/tasks/solano.rake +58 -0
- metadata +154 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 381c1ed4fe6ad2789717010ff64c88c21058e1bf
|
4
|
+
data.tar.gz: 8c89cc53d3c585ed1fb428a266a8b38dee638631
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 84b81e11b97838a0e72e0d890cf8a2e3e5d1e59f0189c0473eca15e22eefc7e9cf4957f90e966f8d704b2b6548702150a0b7827aa2129268208f281482f37ffa
|
7
|
+
data.tar.gz: a4e06e1483ea035846d3625fcc177c88c43c8199876d58964da6fc1bc2bee6b8dd99becfa4b953a1d5f1eea62c63f4cb7aeb16cfce65cba36c72fdf42a358bd5
|
data/.gitignore
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
*.rbc
|
2
|
+
capybara-*.html
|
3
|
+
.rspec
|
4
|
+
/log
|
5
|
+
/tmp
|
6
|
+
/db/*.sqlite3
|
7
|
+
/public/system
|
8
|
+
/coverage/
|
9
|
+
/spec/tmp
|
10
|
+
**.orig
|
11
|
+
rerun.txt
|
12
|
+
pickle-email-*.html
|
13
|
+
config/initializers/secret_token.rb
|
14
|
+
config/secrets.yml
|
15
|
+
|
16
|
+
## Environment normalisation:
|
17
|
+
/.bundle
|
18
|
+
/vendor/bundle
|
19
|
+
|
20
|
+
# these should all be checked in to normalise the environment:
|
21
|
+
# Gemfile.lock, .ruby-version, .ruby-gemset
|
22
|
+
|
23
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
24
|
+
.rvmrc
|
25
|
+
*.gem
|
26
|
+
*.un~
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Nic Pillinger
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
Description:
|
2
|
+
Creates a solano.yml file which sends hipchat notifications on build success/failure
|
3
|
+
Will also trigger a deploy on successful build if a deploy hook url is provided
|
4
|
+
|
5
|
+
Example:
|
6
|
+
rails generate solano HIP15421CHAT2736API3436KEY, 123456, http://my.deploy.hook.on.c66/bam!
|
7
|
+
|
8
|
+
This will create:
|
9
|
+
a .solano.yml deploy file which notifies hipchat and build events and posts to http://my.deploy.hook.on.c66/bam! on a successful build
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class SolanoGenerator < Rails::Generators::Base
|
2
|
+
source_root File.expand_path('../templates', __FILE__)
|
3
|
+
|
4
|
+
argument :hipchat_api_key, type: :string, required: true
|
5
|
+
argument :hipchat_room_id, type: :string, required: true
|
6
|
+
argument :deploy_hook_url, type: :string, required: false
|
7
|
+
|
8
|
+
def create_solano_yml
|
9
|
+
template 'solano.yml.erb', 'solano.yml'
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
---
|
2
|
+
:hooks:
|
3
|
+
<%- if deploy_hook_url.nil? %> :post_build: bundle exec rake solano:notify[<%= hipchat_api_key %>, <%= hipchat_room_id %>]
|
4
|
+
<%- else %> :post_build: bundle exec rake solano:notify_and_deploy[<%= hipchat_api_key %>, <%= hipchat_room_id %>, <%= deploy_hook_url %>]
|
5
|
+
<%- end %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'solano_notify_and_deploy'
|
2
|
+
require 'rails'
|
3
|
+
|
4
|
+
module SolanoNotifyAndDeploy
|
5
|
+
class Railtie < Rails::Railtie
|
6
|
+
railtie_name :solano_notify_and_deploy
|
7
|
+
|
8
|
+
rake_tasks do
|
9
|
+
load "tasks/solano.rake"
|
10
|
+
end
|
11
|
+
|
12
|
+
generators do
|
13
|
+
require "generators/solano/solano_generator"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'solano_notify_and_deploy/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "solano_notify_and_deploy"
|
8
|
+
spec.version = SolanoNotifyAndDeploy::VERSION
|
9
|
+
spec.authors = ["Nic Pillinger"]
|
10
|
+
spec.email = ["nic@lsf.io"]
|
11
|
+
spec.summary = 'Notify on solano labs build failure or success and optionally deploy'
|
12
|
+
spec.description = 'Notify on solano labs build failure or success and optionally deploy'
|
13
|
+
spec.homepage = "http://lsf.io"
|
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_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.3"
|
23
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
24
|
+
spec.add_development_dependency "guard-rspec", "~> 4.3"
|
25
|
+
spec.add_development_dependency "pry", "~> 0.10"
|
26
|
+
|
27
|
+
spec.add_runtime_dependency 'activesupport', "~> 4.0"
|
28
|
+
spec.add_runtime_dependency 'httparty', "~> 0.13"
|
29
|
+
end
|
data/tasks/solano.rake
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
namespace :solano do
|
2
|
+
|
3
|
+
desc 'notify hipchat on build events'
|
4
|
+
task :notify, :hipchat_api_key, :hipchat_room_id do |t, args|
|
5
|
+
notify_build_status args[:hipchat_api_key], args[:hipchat_room_id]
|
6
|
+
end
|
7
|
+
|
8
|
+
desc 'notify hipchat on build events, deploy on successful build'
|
9
|
+
task :notify_and_deploy, :hipchat_api_key, :hipchat_room_id, :deploy_hook_url do |t, args|
|
10
|
+
|
11
|
+
notify_build_status args[:hipchat_api_key], args[:hipchat_room_id]
|
12
|
+
return unless build_passed?
|
13
|
+
|
14
|
+
succeeded = false
|
15
|
+
message = ""
|
16
|
+
|
17
|
+
begin
|
18
|
+
succeeded = deploy
|
19
|
+
rescue Exception => e
|
20
|
+
succeeded = false
|
21
|
+
message = e.message
|
22
|
+
end
|
23
|
+
|
24
|
+
unless succeeded
|
25
|
+
notify args[:hipchat_api_key], args[:hipchat_room_id], "Deploy failed: #{message}", 'red'
|
26
|
+
raise "deployment failed"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def tddium?
|
33
|
+
ENV['TDDIUM'].present?
|
34
|
+
end
|
35
|
+
|
36
|
+
def passed?
|
37
|
+
ENV['TDDIUM_BUILD_STATUS'] == 'passed'
|
38
|
+
end
|
39
|
+
|
40
|
+
def build_passed?
|
41
|
+
tddium? && passed?
|
42
|
+
end
|
43
|
+
|
44
|
+
def deploy(url)
|
45
|
+
system "curl -X POST -d \"\" #{url}"
|
46
|
+
end
|
47
|
+
|
48
|
+
def notify_build_status(hipchat_api_key, hipchat_room_id)
|
49
|
+
notify hipchat_api_key, hipchat_room_id, "Build succeeded", "green" and return if build_passed?
|
50
|
+
notify hipchat_api_key, hipchat_room_id, "Build failed", "red"
|
51
|
+
end
|
52
|
+
|
53
|
+
def notify(hipchat_api_key, hipchat_room_id, message, colour)
|
54
|
+
client = HipChat::Client.new(hipchat_api_key)
|
55
|
+
client[hipchat_room_id].send('Solano', message, :color => colour)
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
metadata
ADDED
@@ -0,0 +1,154 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: solano_notify_and_deploy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nic Pillinger
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: guard-rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '4.3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '4.3'
|
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.10'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.10'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: activesupport
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '4.0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '4.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: httparty
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.13'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.13'
|
111
|
+
description: Notify on solano labs build failure or success and optionally deploy
|
112
|
+
email:
|
113
|
+
- nic@lsf.io
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- Gemfile
|
120
|
+
- LICENSE
|
121
|
+
- README.md
|
122
|
+
- lib/generators/solano/USAGE
|
123
|
+
- lib/generators/solano/solano_generator.rb
|
124
|
+
- lib/generators/solano/templates/solano.yml.erb
|
125
|
+
- lib/solano_notify_and_deploy.rb
|
126
|
+
- lib/solano_notify_and_deploy/railtie.rb
|
127
|
+
- lib/solano_notify_and_deploy/version.rb
|
128
|
+
- solano_notify_and_deploy.gemspec
|
129
|
+
- tasks/solano.rake
|
130
|
+
homepage: http://lsf.io
|
131
|
+
licenses:
|
132
|
+
- MIT
|
133
|
+
metadata: {}
|
134
|
+
post_install_message:
|
135
|
+
rdoc_options: []
|
136
|
+
require_paths:
|
137
|
+
- lib
|
138
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
requirements: []
|
149
|
+
rubyforge_project:
|
150
|
+
rubygems_version: 2.2.2
|
151
|
+
signing_key:
|
152
|
+
specification_version: 4
|
153
|
+
summary: Notify on solano labs build failure or success and optionally deploy
|
154
|
+
test_files: []
|