lita-karotz_deploy_hook 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 997ebf9140d36def8928513b53334f65db13633c
4
+ data.tar.gz: d2814177fa7c73b89b4b152c6ee8c75b6bda0da3
5
+ SHA512:
6
+ metadata.gz: 78843004ca7a993bc791644c881076fce4cc4b1ff60631a32721fd789bc89e369b4374536777dff77d716ca7b8c815752c832313c45aaa0ab842d933d7f34a23
7
+ data.tar.gz: 8ad98db0faaec0000fec87e7ba85580b90a5872a67fc548cdb57a80266818f357974cac566179d79b1723cfa5eb380f04dbff9e819cf0dc72abafc86344b98f6
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/.hound.yml ADDED
@@ -0,0 +1,8 @@
1
+ LineLength:
2
+ Max: 130
3
+
4
+ StringLiterals:
5
+ Enabled: false
6
+
7
+ EmptyLinesAroundBody:
8
+ Enabled: false
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ --require spec_helper
3
+ --require rspec/instafail
4
+ --format documentation
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2014 Mathieu Gilbert
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # lita-karotz_deploy_hook
2
+
3
+ TODO: Add a description of the plugin.
4
+
5
+ ## Installation
6
+
7
+ Add lita-karotz_deploy_hook to your Lita instance's Gemfile:
8
+
9
+ ``` ruby
10
+ gem "lita-karotz_deploy_hook"
11
+ ```
12
+
13
+
14
+ ## Configuration
15
+
16
+ Lita.configure do |config|
17
+ config.handlers.karotz_deploy_hook.karotz_deployment_endpoint = "http://my-karotz-app.com/deployments"
18
+ end
19
+
20
+ ## Usage
21
+
22
+ The deployment message we use, which gets matched is in the form:
23
+
24
+ User_Name is starting deploy of 'project_name' from branch 'branch_name' to environment_name
25
+
26
+ ## License
27
+
28
+ [MIT](http://opensource.org/licenses/MIT)
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/rake ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rake' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rake', 'rake')
@@ -0,0 +1,36 @@
1
+ require 'rest_client'
2
+
3
+ module Lita
4
+ module Handlers
5
+ class KarotzDeployHook < Handler
6
+ def self.default_config(config)
7
+ config.karotz_deployment_endpoint = nil
8
+ end
9
+
10
+ route(/(.*) is starting deploy of '(.*)' from branch '(.*)' to (.*)/i, :notify_karotz, command: false,
11
+ help: { "<user_name> is starting deploy of '<project_name>' from branch '<branch_name>' to <environment_name>" =>
12
+ "Sends a directive to Karotz to vocalize the deployment details." }
13
+ )
14
+
15
+ def notify_karotz(message)
16
+ matches = message.matches[0]
17
+ data = { deployer: matches[0], project: matches[1], branch: matches[2], environment: matches[3] }
18
+ RestClient.post "#{karotz_deployment_endpoint}?#{query_string(data)}", {}
19
+ end
20
+
21
+ private
22
+
23
+ def karotz_deployment_endpoint
24
+ Lita.config.handlers.karotz_deploy_hook.karotz_deployment_endpoint || raise("Karotz deployment endpoint URL is required.")
25
+ end
26
+
27
+ def query_string(hash)
28
+ hash.map do |key, value|
29
+ "#{key}=#{value}"
30
+ end.join "&"
31
+ end
32
+ end
33
+
34
+ Lita.register_handler(KarotzDeployHook)
35
+ end
36
+ end
@@ -0,0 +1,5 @@
1
+ module Lita
2
+ module KarotzDeployHook
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ require "lita"
2
+
3
+ Lita.load_locales Dir[File.expand_path(
4
+ File.join("..", "..", "locales", "*.yml"), __FILE__
5
+ )]
6
+
7
+ require "lita/handlers/karotz_deploy_hook"
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'lita/karotz_deploy_hook/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "lita-karotz_deploy_hook"
8
+ spec.version = Lita::KarotzDeployHook::VERSION
9
+ spec.authors = ["Michael van den Beuken", "Ruben Estevez", "Jordan Babe", "Mathieu Gilbert", "Ryan Jones", "Darko Dosenovic"]
10
+ spec.email = ["michael.beuken@gmail.com", "ruben.a.estevez@gmail.com", "jorbabe@gmail.com", "mathieu.gilbert@ama.ab.ca", "ryan.michael.jones@gmail.com", "darko.dosenovic@ama.ab.ca"]
11
+ spec.summary = %q{Sends a directive to Karotz to vocalize the deployment details.}
12
+ spec.description = %q{Sends a directive to Karotz to vocalize the deployment details.}
13
+ spec.homepage = "https://github.com/amaabca/lita-karotz_deploy_hook"
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_runtime_dependency "lita"
22
+ spec.add_runtime_dependency "rest_client"
23
+
24
+ spec.add_development_dependency "bundler"
25
+ spec.add_development_dependency "rake"
26
+ spec.add_development_dependency "pry"
27
+ spec.add_development_dependency "rspec"
28
+ spec.add_development_dependency "rspec-instafail"
29
+ spec.add_development_dependency "simplecov"
30
+ end
data/locales/en.yml ADDED
@@ -0,0 +1,4 @@
1
+ en:
2
+ lita:
3
+ handlers:
4
+ karotz_deploy_hook:
@@ -0,0 +1,16 @@
1
+ require "spec_helper"
2
+ require 'rest_client'
3
+
4
+ describe Lita::Handlers::KarotzDeployHook, lita_handler: true do
5
+ it 'posts data to the Karotz deployments endpoint' do
6
+ Lita.config.handlers.karotz_deploy_hook.karotz_deployment_endpoint = 'http://www.google.com/deployments'
7
+ expect(RestClient).to receive(:post)
8
+ send_message "teddy is starting deploy of 't_y_l_f' from branch 'ice-cream' to production"
9
+ end
10
+
11
+ it 'throws an exception when endpoint not set' do
12
+ expect {
13
+ send_message "teddy is starting deploy of 't_y_l_f' from branch 'ice-cream' to production"
14
+ }.to raise_error
15
+ end
16
+ end
@@ -0,0 +1,2 @@
1
+ require "lita-karotz_deploy_hook"
2
+ require "lita/rspec"
metadata ADDED
@@ -0,0 +1,185 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lita-karotz_deploy_hook
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Michael van den Beuken
8
+ - Ruben Estevez
9
+ - Jordan Babe
10
+ - Mathieu Gilbert
11
+ - Ryan Jones
12
+ - Darko Dosenovic
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+ date: 2014-07-22 00:00:00.000000000 Z
17
+ dependencies:
18
+ - !ruby/object:Gem::Dependency
19
+ name: lita
20
+ requirement: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: '0'
25
+ type: :runtime
26
+ prerelease: false
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: '0'
32
+ - !ruby/object:Gem::Dependency
33
+ name: rest_client
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ type: :runtime
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: bundler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ type: :development
54
+ prerelease: false
55
+ version_requirements: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ - !ruby/object:Gem::Dependency
61
+ name: rake
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ type: :development
68
+ prerelease: false
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ - !ruby/object:Gem::Dependency
75
+ name: pry
76
+ requirement: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ type: :development
82
+ prerelease: false
83
+ version_requirements: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ - !ruby/object:Gem::Dependency
89
+ name: rspec
90
+ requirement: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ type: :development
96
+ prerelease: false
97
+ version_requirements: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ - !ruby/object:Gem::Dependency
103
+ name: rspec-instafail
104
+ requirement: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ type: :development
110
+ prerelease: false
111
+ version_requirements: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ - !ruby/object:Gem::Dependency
117
+ name: simplecov
118
+ requirement: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ type: :development
124
+ prerelease: false
125
+ version_requirements: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ description: Sends a directive to Karotz to vocalize the deployment details.
131
+ email:
132
+ - michael.beuken@gmail.com
133
+ - ruben.a.estevez@gmail.com
134
+ - jorbabe@gmail.com
135
+ - mathieu.gilbert@ama.ab.ca
136
+ - ryan.michael.jones@gmail.com
137
+ - darko.dosenovic@ama.ab.ca
138
+ executables:
139
+ - rake
140
+ extensions: []
141
+ extra_rdoc_files: []
142
+ files:
143
+ - ".gitignore"
144
+ - ".hound.yml"
145
+ - ".rspec"
146
+ - ".travis.yml"
147
+ - Gemfile
148
+ - LICENSE
149
+ - README.md
150
+ - Rakefile
151
+ - bin/rake
152
+ - lib/lita-karotz_deploy_hook.rb
153
+ - lib/lita/handlers/karotz_deploy_hook.rb
154
+ - lib/lita/karotz_deploy_hook/version.rb
155
+ - lita-karotz_deploy_hook.gemspec
156
+ - locales/en.yml
157
+ - spec/lita/handlers/karotz_deploy_hook_spec.rb
158
+ - spec/spec_helper.rb
159
+ homepage: https://github.com/amaabca/lita-karotz_deploy_hook
160
+ licenses:
161
+ - MIT
162
+ metadata: {}
163
+ post_install_message:
164
+ rdoc_options: []
165
+ require_paths:
166
+ - lib
167
+ required_ruby_version: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - ">="
170
+ - !ruby/object:Gem::Version
171
+ version: '0'
172
+ required_rubygems_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ requirements: []
178
+ rubyforge_project:
179
+ rubygems_version: 2.4.1
180
+ signing_key:
181
+ specification_version: 4
182
+ summary: Sends a directive to Karotz to vocalize the deployment details.
183
+ test_files:
184
+ - spec/lita/handlers/karotz_deploy_hook_spec.rb
185
+ - spec/spec_helper.rb