lita-server_status 0.0.4 → 1.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d2e5edd896fcc8fa681f85f9f03363c93e96e896
4
- data.tar.gz: 046ac8648153a9675034d268688aba66a4321665
3
+ metadata.gz: 1226d985d6b1eb86a9ed1b5d82ce019436c658da
4
+ data.tar.gz: 5a8b71b67477c2fb77b31fa7489bf9f7f67ac8ab
5
5
  SHA512:
6
- metadata.gz: 2d3d0fd333ef58f378bf7d4ccd7927138769185871ff7b4a7704b5e74cf6ae05dbde9a5493e731fc9857aa37e14fa35296443a728ff26e4b92d91146a9a72f1f
7
- data.tar.gz: db6af1edd08223a906e05288bffc6af40d9de3e442263a8b131d69aa07b825bcac3a42a398f99b7680a09a4b19cb25c11bcea3228b388db3743b48f2f7c72b27
6
+ metadata.gz: 87842d2b63db2bc551e662dcd9334719a13cc99785aa905b5484ff568d810fa9740d5f7fee447c80c483139c22fd918034bc10fa15099f460bb7c36fbc9e8b06
7
+ data.tar.gz: a50708630cc97d605fa59f6f680a5896cf58ea38556bd7890d9eac67b1a663033e38f51738ce0bfdae0eb804388a5e94c61ff2349e59b9717f60a226e3238374
data/README.md CHANGED
@@ -14,9 +14,15 @@ gem "lita-server_status"
14
14
 
15
15
  No configuration variables needed.
16
16
 
17
- Lita looks for strings following this regex: ```/(.+) is starting deploy of '(.+)' from branch '(.+)' to (.+)/i```
17
+ Lita looks for strings following this regex: ```/(?::eyes:)*\s*(.+) is deploying (.+)\/(.+) to (.+)/i```
18
18
 
19
- Which looks like: 'Waffle McRib is starting deploy of 'BATMAN' from branch 'AWESOME' to STAGING'
19
+ Which looks like:
20
+
21
+ `:eyes: Tammy Tester is deploying App/Environment to BranchName`
22
+
23
+ or
24
+
25
+ `Tammy Tester is deploying App/Environment to BranchName`
20
26
 
21
27
  ## Usage
22
28
 
@@ -27,8 +33,8 @@ List out the server statuses.
27
33
  ## Output:
28
34
 
29
35
  ```
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)
36
+ App STAGING: Branch (Tammy Tester @ 2014-07-24 12:10:54 -0600)
37
+ App PRODUCTION: Branch (Tammy Tester @ 2014-07-24 12:10:54 -0600)
32
38
  ```
33
39
 
34
40
  ## License
@@ -1,31 +1,16 @@
1
1
  module Lita
2
2
  module Handlers
3
3
  class ServerStatus < Handler
4
- MESSAGE_REGEX = /(.+) is deploying (.+)\/(.+) to (.+)\s.*/i
4
+ MESSAGE_REGEX = %r/(?::eyes:)*\s*(.+) is deploying (.+)\/(.+) to (.+)/i
5
5
  route(MESSAGE_REGEX, :save_status)
6
6
 
7
- route(/server status/i, :list_statuses, command: true,
8
- help: { "server status" => "List out the current server statuses." }
9
- )
7
+ route(/server status/i, :list_statuses, command: true, help: {
8
+ 'server status' => 'List out the current server statuses.'
9
+ })
10
10
 
11
11
  def save_status(response)
12
12
  message = response.message.body
13
13
  user, application, branch, environment = message.match(MESSAGE_REGEX).captures
14
-
15
- apply_status = { id: "#{application}:#{environment}",
16
- message: "#{application} #{environment}: #{branch} (#{user} @ #{formatted_time})" }
17
-
18
- redis.set("server_status:#{apply_status[:id]}", apply_status[:message])
19
- end
20
-
21
- # we have to leave this statement here untill all apps are update to use new capistrano process
22
- OLD_MESSAGE_REGEX = /(.+) is starting deploy of '(.+)' from branch '(.+)' to (.+)/i
23
- route(OLD_MESSAGE_REGEX, :old_save_status)
24
-
25
- def old_save_status(response)
26
- message = response.message.body
27
- user, application, branch, environment = message.match(OLD_MESSAGE_REGEX).captures
28
-
29
14
  apply_status = { id: "#{application}:#{environment}",
30
15
  message: "#{application} #{environment}: #{branch} (#{user} @ #{formatted_time})" }
31
16
 
@@ -37,13 +22,13 @@ module Lita
37
22
  end
38
23
 
39
24
  def status_message
40
- messages = redis.keys("server_status*").sort.map { |key| redis.get(key) }
41
- messages << "I don't know what state the servers are in." if messages.empty?
42
- messages.join("\n")
25
+ messages = redis.keys('server_status*').sort.map { |key| redis.get(key) }
26
+ messages << 'I don\'t know what state the servers are in.' if messages.empty?
27
+ messages.join('\n')
43
28
  end
44
29
 
45
30
  def formatted_time
46
- Time.now.strftime("%Y-%m-%d %H:%M")
31
+ Time.now.strftime('%Y-%m-%d %H:%M')
47
32
  end
48
33
  end
49
34
 
@@ -1,29 +1,46 @@
1
1
  Gem::Specification.new do |spec|
2
- spec.name = "lita-server_status"
3
- spec.version = "0.0.4"
4
- spec.authors = ["Michael van den Beuken", "Ruben Estevez", "Jordan Babe", "Mathieu Gilbert", "Ryan Jones", "Darko Dosenovic",
5
- "Jonathan Weyermann", "Jesse Doyle", "Zoie Carnegie"]
6
- spec.email = ["michael.beuken@gmail.com", "ruben.a.estevez@gmail.com", "jorbabe@gmail.com", "mathieu.gilbert@ama.ab.ca",
7
- "ryan.michael.jones@gmail.com", "darko.dosenovic@ama.ab.ca", "Jonathan.Weyermann@ama.ab.ca", "Jesse.Doyle@ama.ab.ca",
8
- "Zoie.Carnegie@ama.ab.ca"]
2
+ spec.name = 'lita-server_status'
3
+ spec.version = '1.0.0'
4
+ spec.authors = [
5
+ 'Michael van den Beuken',
6
+ 'Ruben Estevez',
7
+ 'Jordan Babe',
8
+ 'Mathieu Gilbert',
9
+ 'Ryan Jones',
10
+ 'Darko Dosenovic',
11
+ 'Jonathan Weyermann',
12
+ 'Jesse Doyle',
13
+ 'Zoie Carnegie'
14
+ ]
15
+ spec.email = [
16
+ 'michael.beuken@gmail.com',
17
+ 'ruben.a.estevez@gmail.com',
18
+ 'jorbabe@gmail.com',
19
+ 'mathieu.gilbert@ama.ab.ca',
20
+ 'ryan.michael.jones@gmail.com',
21
+ 'darko.dosenovic@ama.ab.ca',
22
+ 'Jonathan.Weyermann@ama.ab.ca',
23
+ 'Jesse.Doyle@ama.ab.ca',
24
+ 'zoie.carnegie@gmail.com'
25
+ ]
9
26
  spec.description = %q{Store and list out the statuses of applications}
10
27
  spec.summary = %q{Store and list out the statuses of applications}
11
- spec.homepage = "https://github.com/amaabca/lita-server_status"
12
- spec.license = "MIT"
13
- spec.metadata = { "lita_plugin_type" => "handler" }
28
+ spec.homepage = 'https://github.com/amaabca/lita-server_status'
29
+ spec.license = 'MIT'
30
+ spec.metadata = { 'lita_plugin_type' => 'handler' }
14
31
 
15
32
  spec.files = `git ls-files`.split($/)
16
33
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
34
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
- spec.require_paths = ["lib"]
35
+ spec.require_paths = ['lib']
19
36
 
20
- spec.add_runtime_dependency "lita", ">= 3.3"
37
+ spec.add_runtime_dependency 'lita', '>= 3.3'
21
38
 
22
- spec.add_development_dependency "bundler", "~> 1.3"
23
- spec.add_development_dependency "rake"
24
- spec.add_development_dependency "rspec", ">= 3.0.0"
25
- spec.add_development_dependency "simplecov"
26
- spec.add_development_dependency "pry"
27
- spec.add_development_dependency "rspec-instafail"
28
- spec.add_development_dependency "timecop"
39
+ spec.add_development_dependency 'bundler', '~> 1.3'
40
+ spec.add_development_dependency 'rake'
41
+ spec.add_development_dependency 'rspec', '>= 3.0.0'
42
+ spec.add_development_dependency 'simplecov'
43
+ spec.add_development_dependency 'pry'
44
+ spec.add_development_dependency 'rspec-instafail'
45
+ spec.add_development_dependency 'timecop'
29
46
  end
@@ -1,79 +1,54 @@
1
- require "spec_helper"
2
- require "timecop"
1
+ require 'spec_helper'
2
+ require 'timecop'
3
3
 
4
4
  describe Lita::Handlers::ServerStatus, lita_handler: true do
5
- let(:formatted_local_time) { Time.now.strftime("%Y-%m-%d %H:%M") }
5
+ let(:formatted_local_time) { Time.now.strftime('%Y-%m-%d %H:%M') }
6
6
 
7
7
  before(:each) do
8
8
  allow_any_instance_of(Lita::Handlers::ServerStatus).to receive(:formatted_time).and_return(formatted_local_time)
9
9
  end
10
10
 
11
- context "New HipChat messaging in place" do
12
- it { is_expected.to route("Waffle McRib is deploying fakeapp/master to staging (production).").to(:save_status) }
13
- it { is_expected.to route_command("server status").to(:list_statuses) }
11
+ context 'New Slack messaging in place' do
12
+ it { is_expected.to route(':eyes: Bobby Marley is deploying fakeapp/staging to red_team_rocks').to(:save_status) }
13
+ it { is_expected.to route_command('server status').to(:list_statuses) }
14
14
 
15
- it "saves the server status" do
15
+ it 'saves the server status' do
16
16
  expect_any_instance_of(Lita::Handlers::ServerStatus).to receive(:save_status)
17
- send_message(%{Waffle McRib is deploying fakeapp/master to staging (production)})
17
+ send_message(%{:eyes: Bob Marley is deploying fakeapp/staging to red_team_rocks})
18
18
  end
19
19
 
20
- it "update the server status if it changes" do
21
- Timecop.freeze(Time.now) do
22
- send_message(%{Waffle McRib is deploying fakeapp/master to staging (production)})
23
- send_command("server status")
24
- expect(replies.last).to include("fakeapp staging: master (Waffle McRib @ #{formatted_local_time})")
25
-
26
- send_message(%{Waffle McRib is deploying fakeapp/waffle to production (production)})
27
- send_command("server status")
28
- expect(replies.last).to include("fakeapp production: waffle (Waffle McRib @ #{formatted_local_time})")
29
- end
30
- end
31
-
32
- it "should list the current server statuses" do
33
- Timecop.freeze(Time.now) do
34
- send_message(%{Waffle McRib is deploying fakeapp/master to production (production)})
35
- send_message(%{Waffle McRib is deploying batman/awesome to staging (production)})
36
- send_command("server status")
37
- expect(replies.last).to include("fakeapp production: master (Waffle McRib @ #{formatted_local_time})")
38
- expect(replies.last).to include("batman staging: awesome (Waffle McRib @ #{formatted_local_time})")
39
- end
40
- end
41
- end
42
-
43
- context "Old HipCHat messaging still has been used in some apps" do
44
- it { is_expected.to route("Waffle McRib is starting deploy of 'APPNAME' from branch 'MASTER' to PRODUCTION").to(:old_save_status) }
45
- it { is_expected.to route_command("server status").to(:list_statuses) }
46
-
47
- it "saves the server status" do
48
- expect_any_instance_of(Lita::Handlers::ServerStatus).to receive(:old_save_status)
49
- send_message(%{Waffle McRib is starting deploy of 'APPNAME' from branch 'MASTER' to PRODUCTION})
20
+ it 'saves the server status with no :eyes:' do
21
+ expect_any_instance_of(Lita::Handlers::ServerStatus).to receive(:save_status)
22
+ send_message(%{Bob Marley is deploying fakerapp/staging to red_team_rocks})
50
23
  end
51
24
 
52
- it "update the server status if it changes" do
25
+ it 'update the server status if it changes' do
53
26
  Timecop.freeze(Time.now) do
54
- send_message(%{Waffle McRib is starting deploy of 'FAKEAPP' from branch 'MASTER' to PRODUCTION})
55
- send_command("server status")
56
- expect(replies.last).to include("FAKEAPP PRODUCTION: MASTER (Waffle McRib @ #{formatted_local_time})")
27
+ send_message(%{:eyes: Bob Marley is deploying fakeapp/staging to branchname_here})
28
+ send_command('server status')
29
+ expect(replies.last).to include("fakeapp branchname_here: staging (Bob Marley @ #{formatted_local_time})")
57
30
 
58
- send_message(%{Waffle McRib is starting deploy of 'FAKEAPP' from branch 'WAFFLE' to PRODUCTION})
59
- send_command("server status")
60
- expect(replies.last).to include("FAKEAPP PRODUCTION: WAFFLE (Waffle McRib @ #{formatted_local_time})")
31
+ send_message(%{:eyes: Bob Marley is deploying fakeapp/staging to new_branch})
32
+ send_command('server status')
33
+ expect(replies.last).to include("fakeapp new_branch: staging (Bob Marley @ #{formatted_local_time})")
61
34
  end
62
35
  end
63
36
 
64
- it "should list the current server statuses" do
37
+ it 'should list the current server statuses' do
65
38
  Timecop.freeze(Time.now) do
66
- send_message(%{Waffle McRib is starting deploy of 'FAKEAPP' from branch 'MASTER' to PRODUCTION})
67
- send_message(%{Waffle McRib is starting deploy of 'BATMAN' from branch 'AWESOME' to STAGING})
68
- send_command("server status")
69
- expect(replies.last).to include("FAKEAPP PRODUCTION: MASTER (Waffle McRib @ #{formatted_local_time})")
70
- expect(replies.last).to include("BATMAN STAGING: AWESOME (Waffle McRib @ #{formatted_local_time})")
39
+ send_message(%{:eyes: Bobby Marley is deploying fakeapp/staging to red_team_rocks})
40
+ send_command('server status')
41
+ expect(replies.last).to include("fakeapp red_team_rocks: staging (Bobby Marley @ #{formatted_local_time})")
42
+
43
+ send_message(%{:eyes: Bobby Marley is deploying fakeapp/production to red_team_rocks})
44
+ send_command('server status')
45
+ expect(replies.last).to include("fakeapp red_team_rocks: production (Bobby Marley @ #{formatted_local_time})")
71
46
  end
72
47
  end
73
48
  end
74
49
 
75
- it "admits when there are no statuses" do
76
- send_command("server status")
77
- expect(replies.last).to eq("I don't know what state the servers are in.")
50
+ it 'admits when there are no statuses' do
51
+ send_command('server status')
52
+ expect(replies.last).to eq('I don\'t know what state the servers are in.')
78
53
  end
79
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-server_status
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael van den Beuken
@@ -16,7 +16,7 @@ authors:
16
16
  autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
- date: 2016-12-14 00:00:00.000000000 Z
19
+ date: 2018-09-25 00:00:00.000000000 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: lita
@@ -140,7 +140,7 @@ email:
140
140
  - darko.dosenovic@ama.ab.ca
141
141
  - Jonathan.Weyermann@ama.ab.ca
142
142
  - Jesse.Doyle@ama.ab.ca
143
- - Zoie.Carnegie@ama.ab.ca
143
+ - zoie.carnegie@gmail.com
144
144
  executables:
145
145
  - rake
146
146
  extensions: []
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  version: '0'
182
182
  requirements: []
183
183
  rubyforge_project:
184
- rubygems_version: 2.4.5.1
184
+ rubygems_version: 2.6.14
185
185
  signing_key:
186
186
  specification_version: 4
187
187
  summary: Store and list out the statuses of applications