lita-server_status 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: 908cea291aafe36dd2a564bf5d0a4a34e8af1e0e
4
+ data.tar.gz: dd97aabd137f443e9fc26bce5bca142f4f180502
5
+ SHA512:
6
+ metadata.gz: 59bf87e4b46b7ca0434dd3ee5128f3866f47302bea1f23d79795f52eafcc44e78be717c54b21ac808cdf2b505167d9f1b561b9b154c321c8918ab89cf1184a4a
7
+ data.tar.gz: 5e3119cd40ec6cf42092c73f538c24c5133a12077a15665531d8e56435a03d8913d357ea1cdad8077a4d4f80b0b1b6f956918a634b32742ecd8be4353b1312f2
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/.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,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ script: bundle exec rake
5
+ before_install:
6
+ - gem update --system
7
+ services:
8
+ - redis-server
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 Ryan Jones
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,36 @@
1
+ # lita-server_status
2
+
3
+ Store and list out the statuses of applications (prod/staging)
4
+
5
+ ## Installation
6
+
7
+ Add lita-server_status to your Lita instance's Gemfile:
8
+
9
+ ``` ruby
10
+ gem "lita-server_status"
11
+ ```
12
+
13
+ ## Configuration
14
+
15
+ No configuration variables needed.
16
+
17
+ Lita looks for strings following this regex: ```/(.+) is starting deploy of '(.+)' from branch '(.+)' to (.+)/i```
18
+
19
+ Which looks like: 'Waffle McRib is starting deploy of 'BATMAN' from branch 'AWESOME' to STAGING'
20
+
21
+ ## Usage
22
+
23
+ ``` lita server status ```
24
+
25
+ List out the server statuses.
26
+
27
+ ## Output:
28
+
29
+ ```
30
+ BATMAN STAGING: AWESOME (Waffle McRib @ 2014-07-24 12:10:54 -0600)
31
+ FAKEAPP PRODUCTION: MASTER (Waffle McRib @ 2014-07-24 12:10:54 -0600)
32
+ ```
33
+
34
+ ## License
35
+
36
+ [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,33 @@
1
+ module Lita
2
+ module Handlers
3
+ class ServerStatus < Handler
4
+ MESSAGE_REGEX = /(.+) is starting deploy of '(.+)' from branch '(.+)' to (.+)/i
5
+
6
+ route(MESSAGE_REGEX, :save_status)
7
+ route(/server status/i, :list_statuses, command: true,
8
+ help: { "server status" => "List out the current server statuses." }
9
+ )
10
+
11
+ def save_status(response)
12
+ message = response.message.body
13
+ user, application, branch, environment = message.match(MESSAGE_REGEX).captures
14
+
15
+ apply_status = { id: "#{application}:#{environment}",
16
+ message: "#{application} #{environment}: #{branch} (#{user} @ #{Time.now.to_s})" }
17
+
18
+ redis.set("server_status:#{apply_status[:id]}", apply_status[:message])
19
+ end
20
+
21
+ def list_statuses(response)
22
+ message = []
23
+ redis.keys("server_status*").each do |key|
24
+ message << redis.get(key)
25
+ end
26
+
27
+ response.reply message.join("\n")
28
+ end
29
+ end
30
+
31
+ Lita.register_handler(ServerStatus)
32
+ end
33
+ 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/server_status"
@@ -0,0 +1,26 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = "lita-server_status"
3
+ spec.version = "0.0.1"
4
+ spec.authors = ["Michael van den Beuken", "Ruben Estevez", "Jordan Babe", "Mathieu Gilbert", "Ryan Jones", "Darko Dosenovic"]
5
+ 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"]
6
+ spec.description = %q{Store and list out the statuses of applications}
7
+ spec.summary = %q{Store and list out the statuses of applications}
8
+ spec.homepage = "https://github.com/amaabca/lita-server_status"
9
+ spec.license = "MIT"
10
+ spec.metadata = { "lita_plugin_type" => "handler" }
11
+
12
+ spec.files = `git ls-files`.split($/)
13
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
14
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
+ spec.require_paths = ["lib"]
16
+
17
+ spec.add_runtime_dependency "lita", ">= 3.3"
18
+
19
+ spec.add_development_dependency "bundler", "~> 1.3"
20
+ spec.add_development_dependency "rake"
21
+ spec.add_development_dependency "rspec", ">= 3.0.0"
22
+ spec.add_development_dependency "simplecov"
23
+ spec.add_development_dependency "pry"
24
+ spec.add_development_dependency "rspec-instafail"
25
+ spec.add_development_dependency "timecop"
26
+ end
data/locales/en.yml ADDED
@@ -0,0 +1,4 @@
1
+ en:
2
+ lita:
3
+ handlers:
4
+ server_status:
@@ -0,0 +1,34 @@
1
+ require "spec_helper"
2
+ require "timecop"
3
+
4
+ describe Lita::Handlers::ServerStatus, lita_handler: true do
5
+ it { routes("Waffle McRib is starting deploy of 'APPNAME' from branch 'MASTER' to PRODUCTION").to(:save_status) }
6
+ it { routes_command("server status").to(:list_statuses) }
7
+
8
+ it "saves the server status" do
9
+ expect_any_instance_of(Lita::Handlers::ServerStatus).to receive(:save_status)
10
+ send_message(%{Waffle McRib is starting deploy of 'APPNAME' from branch 'MASTER' to PRODUCTION})
11
+ end
12
+
13
+ it "update the server status if it changes" do
14
+ Timecop.freeze do
15
+ send_message(%{Waffle McRib is starting deploy of 'FAKEAPP' from branch 'MASTER' to PRODUCTION})
16
+ send_command("server status")
17
+ expect(replies.last).to include("FAKEAPP PRODUCTION: MASTER (Waffle McRib @ #{Time.now.to_s})")
18
+
19
+ send_message(%{Waffle McRib is starting deploy of 'FAKEAPP' from branch 'WAFFLE' to PRODUCTION})
20
+ send_command("server status")
21
+ expect(replies.last).to include("FAKEAPP PRODUCTION: WAFFLE (Waffle McRib @ #{Time.now.to_s})")
22
+ end
23
+ end
24
+
25
+ it "should list the current server statuses" do
26
+ Timecop.freeze do
27
+ send_message(%{Waffle McRib is starting deploy of 'FAKEAPP' from branch 'MASTER' to PRODUCTION})
28
+ send_message(%{Waffle McRib is starting deploy of 'BATMAN' from branch 'AWESOME' to STAGING})
29
+ send_command("server status")
30
+ expect(replies.last).to include("FAKEAPP PRODUCTION: MASTER (Waffle McRib @ #{Time.now.to_s})")
31
+ expect(replies.last).to include("BATMAN STAGING: AWESOME (Waffle McRib @ #{Time.now.to_s})")
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,11 @@
1
+ require "simplecov"
2
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
3
+ SimpleCov::Formatter::HTMLFormatter,
4
+ ]
5
+ SimpleCov.start do
6
+ add_filter "/spec/"
7
+ add_filter "/vendor/"
8
+ end
9
+
10
+ require "lita-server_status"
11
+ require "lita/rspec"
metadata ADDED
@@ -0,0 +1,184 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lita-server_status
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-25 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: '3.3'
25
+ type: :runtime
26
+ prerelease: false
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: '3.3'
32
+ - !ruby/object:Gem::Dependency
33
+ name: bundler
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - "~>"
37
+ - !ruby/object:Gem::Version
38
+ version: '1.3'
39
+ type: :development
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - "~>"
44
+ - !ruby/object:Gem::Version
45
+ version: '1.3'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
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: rspec
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 3.0.0
67
+ type: :development
68
+ prerelease: false
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: 3.0.0
74
+ - !ruby/object:Gem::Dependency
75
+ name: simplecov
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: pry
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: timecop
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: Store and list out the statuses of applications
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
+ - ".rspec"
145
+ - ".travis.yml"
146
+ - Gemfile
147
+ - LICENSE
148
+ - README.md
149
+ - Rakefile
150
+ - bin/rake
151
+ - lib/lita-server_status.rb
152
+ - lib/lita/handlers/server_status.rb
153
+ - lita-server_status.gemspec
154
+ - locales/en.yml
155
+ - spec/lita/handlers/server_status_spec.rb
156
+ - spec/spec_helper.rb
157
+ homepage: https://github.com/amaabca/lita-server_status
158
+ licenses:
159
+ - MIT
160
+ metadata:
161
+ lita_plugin_type: handler
162
+ post_install_message:
163
+ rdoc_options: []
164
+ require_paths:
165
+ - lib
166
+ required_ruby_version: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - ">="
169
+ - !ruby/object:Gem::Version
170
+ version: '0'
171
+ required_rubygems_version: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ version: '0'
176
+ requirements: []
177
+ rubyforge_project:
178
+ rubygems_version: 2.2.2
179
+ signing_key:
180
+ specification_version: 4
181
+ summary: Store and list out the statuses of applications
182
+ test_files:
183
+ - spec/lita/handlers/server_status_spec.rb
184
+ - spec/spec_helper.rb