lita-server_status 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e3c99a0e863d9a133a3a7fba170dfe1778f0299
4
- data.tar.gz: 3250bdd334143bfaeb1a1ac42d5e5c520a3598df
3
+ metadata.gz: d2e5edd896fcc8fa681f85f9f03363c93e96e896
4
+ data.tar.gz: 046ac8648153a9675034d268688aba66a4321665
5
5
  SHA512:
6
- metadata.gz: 5d0644858968f40c799291af2e4b70867cd7506289d671c45beeff4de65e4e2856cd217eea9d62a02585ac389184a83cf5d00aa3796941d35ca93083d500720a
7
- data.tar.gz: 36e4a31ba9871111aa300b5d4351b650010d3155835f6d16aaedb7ee1e2eafc1c3c8f507439ed6f76dfb2cdf739f29ccccdc0c828168b4d75363085eb1281845
6
+ metadata.gz: 2d3d0fd333ef58f378bf7d4ccd7927138769185871ff7b4a7704b5e74cf6ae05dbde9a5493e731fc9857aa37e14fa35296443a728ff26e4b92d91146a9a72f1f
7
+ data.tar.gz: db6af1edd08223a906e05288bffc6af40d9de3e442263a8b131d69aa07b825bcac3a42a398f99b7680a09a4b19cb25c11bcea3228b388db3743b48f2f7c72b27
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ vendor/bundle
@@ -1,9 +1,9 @@
1
1
  module Lita
2
2
  module Handlers
3
3
  class ServerStatus < Handler
4
- MESSAGE_REGEX = /(.+) is starting deploy of '(.+)' from branch '(.+)' to (.+)/i
5
-
4
+ MESSAGE_REGEX = /(.+) is deploying (.+)\/(.+) to (.+)\s.*/i
6
5
  route(MESSAGE_REGEX, :save_status)
6
+
7
7
  route(/server status/i, :list_statuses, command: true,
8
8
  help: { "server status" => "List out the current server statuses." }
9
9
  )
@@ -18,6 +18,20 @@ module Lita
18
18
  redis.set("server_status:#{apply_status[:id]}", apply_status[:message])
19
19
  end
20
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
+ apply_status = { id: "#{application}:#{environment}",
30
+ message: "#{application} #{environment}: #{branch} (#{user} @ #{formatted_time})" }
31
+
32
+ redis.set("server_status:#{apply_status[:id]}", apply_status[:message])
33
+ end
34
+
21
35
  def list_statuses(response)
22
36
  response.reply status_message
23
37
  end
@@ -1,8 +1,11 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-server_status"
3
- spec.version = "0.0.3"
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"]
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"]
6
9
  spec.description = %q{Store and list out the statuses of applications}
7
10
  spec.summary = %q{Store and list out the statuses of applications}
8
11
  spec.homepage = "https://github.com/amaabca/lita-server_status"
@@ -8,33 +8,67 @@ describe Lita::Handlers::ServerStatus, lita_handler: true 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
- it { routes("Waffle McRib is starting deploy of 'APPNAME' from branch 'MASTER' to PRODUCTION").to(:save_status) }
12
- it { routes_command("server status").to(:list_statuses) }
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) }
13
14
 
14
- it "saves the server status" do
15
- expect_any_instance_of(Lita::Handlers::ServerStatus).to receive(:save_status)
16
- send_message(%{Waffle McRib is starting deploy of 'APPNAME' from branch 'MASTER' to PRODUCTION})
17
- end
15
+ it "saves the server status" do
16
+ expect_any_instance_of(Lita::Handlers::ServerStatus).to receive(:save_status)
17
+ send_message(%{Waffle McRib is deploying fakeapp/master to staging (production)})
18
+ end
18
19
 
19
- it "update the server status if it changes" do
20
- Timecop.freeze(Time.now) do
21
- send_message(%{Waffle McRib is starting deploy of 'FAKEAPP' from branch 'MASTER' to PRODUCTION})
22
- send_command("server status")
23
- expect(replies.last).to include("FAKEAPP PRODUCTION: MASTER (Waffle McRib @ #{formatted_local_time})")
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})")
24
25
 
25
- send_message(%{Waffle McRib is starting deploy of 'FAKEAPP' from branch 'WAFFLE' to PRODUCTION})
26
- send_command("server status")
27
- expect(replies.last).to include("FAKEAPP PRODUCTION: WAFFLE (Waffle McRib @ #{formatted_local_time})")
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
28
40
  end
29
41
  end
30
42
 
31
- it "should list the current server statuses" do
32
- Timecop.freeze(Time.now) do
33
- send_message(%{Waffle McRib is starting deploy of 'FAKEAPP' from branch 'MASTER' to PRODUCTION})
34
- send_message(%{Waffle McRib is starting deploy of 'BATMAN' from branch 'AWESOME' to STAGING})
35
- send_command("server status")
36
- expect(replies.last).to include("FAKEAPP PRODUCTION: MASTER (Waffle McRib @ #{formatted_local_time})")
37
- expect(replies.last).to include("BATMAN STAGING: AWESOME (Waffle McRib @ #{formatted_local_time})")
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})
50
+ end
51
+
52
+ it "update the server status if it changes" do
53
+ 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})")
57
+
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})")
61
+ end
62
+ end
63
+
64
+ it "should list the current server statuses" do
65
+ 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})")
71
+ end
38
72
  end
39
73
  end
40
74
 
data/spec/spec_helper.rb CHANGED
@@ -1,11 +1,13 @@
1
1
  require "simplecov"
2
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
2
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
3
3
  SimpleCov::Formatter::HTMLFormatter,
4
- ]
4
+ )
5
5
  SimpleCov.start do
6
6
  add_filter "/spec/"
7
7
  add_filter "/vendor/"
8
8
  end
9
9
 
10
+ require "pry"
10
11
  require "lita-server_status"
11
12
  require "lita/rspec"
13
+ Lita.version_3_compatibility_mode = false
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.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael van den Beuken
@@ -10,10 +10,13 @@ authors:
10
10
  - Mathieu Gilbert
11
11
  - Ryan Jones
12
12
  - Darko Dosenovic
13
+ - Jonathan Weyermann
14
+ - Jesse Doyle
15
+ - Zoie Carnegie
13
16
  autorequire:
14
17
  bindir: bin
15
18
  cert_chain: []
16
- date: 2014-09-18 00:00:00.000000000 Z
19
+ date: 2016-12-14 00:00:00.000000000 Z
17
20
  dependencies:
18
21
  - !ruby/object:Gem::Dependency
19
22
  name: lita
@@ -135,6 +138,9 @@ email:
135
138
  - mathieu.gilbert@ama.ab.ca
136
139
  - ryan.michael.jones@gmail.com
137
140
  - darko.dosenovic@ama.ab.ca
141
+ - Jonathan.Weyermann@ama.ab.ca
142
+ - Jesse.Doyle@ama.ab.ca
143
+ - Zoie.Carnegie@ama.ab.ca
138
144
  executables:
139
145
  - rake
140
146
  extensions: []
@@ -175,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
181
  version: '0'
176
182
  requirements: []
177
183
  rubyforge_project:
178
- rubygems_version: 2.4.1
184
+ rubygems_version: 2.4.5.1
179
185
  signing_key:
180
186
  specification_version: 4
181
187
  summary: Store and list out the statuses of applications