lita-announce 0.1.0 → 0.1.1

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: 23650169379196bfa169ae3a9cd0f7001ad15afd
4
- data.tar.gz: 1be5ebe6151241ddf78f63a47580b22158be9d5b
3
+ metadata.gz: ac55abc0764323d9b74c961c0cca40f955b2738f
4
+ data.tar.gz: 824f6477f77f077d71fe9ed618300e952fc8da75
5
5
  SHA512:
6
- metadata.gz: 1eb346cffc8598e74d029ccf8a5fc34181d72461957513887cb8a0e430b807cb0755faadc009cc5f314188b2e4c22e042a1719140c8337a4b02f958189eaaf2e
7
- data.tar.gz: aa2dc780020dfc97944cf70caad48faabdb2edb1ae7196c3c8add13a76dd41a3854ad74dbebe936dc5adaf6fe1afc84bb3c9102c1e9007ee582339d8864d6c4c
6
+ metadata.gz: ead11ac332deee1543b76d6da11aa5f35918298d412fdfeb8747d700c73f01325fb090dd4d663475cb348493f4101a3c344bdd9df44f9cc38adb6ec9307c0505
7
+ data.tar.gz: d36a450cde3408e1d5ea5791a7fc369bddce3f91af7cb757e9f6d01c2acdd627888517bc777f6e18effafedab98de46ccdade0cead986082050cf37be1e0e50d
@@ -15,7 +15,6 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require "json"
19
18
  require "time"
20
19
 
21
20
  module Lita
@@ -73,7 +72,7 @@ module Lita
73
72
  results = []
74
73
  redis.scan_each do |key|
75
74
  if key =~ /^group:(\w+)$/
76
- channels = JSON.parse(redis.get(key))["channels"]
75
+ channels = MultiJson.load(redis.get(key))["channels"]
77
76
  results << "*#{$1}*: #{channels.map { |c| "\##{c}" }.join(", ")}"
78
77
  end
79
78
  end
@@ -105,7 +104,7 @@ module Lita
105
104
  end
106
105
  return unless all_channels_exist
107
106
 
108
- redis.set("group:#{group}", { channels: channel_array }.to_json)
107
+ redis.set("group:#{group}", MultiJson.dump({ channels: channel_array }))
109
108
  response.reply(":successful: Announcement group '#{group}' updated! Will send messages to #{channel_array.map { |c| "\##{c}" }.join(", ")}")
110
109
  end
111
110
 
@@ -154,7 +153,7 @@ module Lita
154
153
  end
155
154
 
156
155
  def save_announcement(payload)
157
- redis.lpush("announcements", payload.to_json)
156
+ redis.lpush("announcements", MultiJson.dump(payload))
158
157
  redis.ltrim("announcements", 0, config.announcements_to_keep - 1)
159
158
  end
160
159
 
@@ -169,19 +168,12 @@ module Lita
169
168
  if target =~ /^group:(\w+)$/
170
169
  group = redis.get(target)
171
170
  return nil if group.nil?
172
- JSON.parse(group)["channels"]
171
+ MultiJson.load(group)["channels"]
173
172
  else
174
173
  [target]
175
174
  end
176
175
  end
177
176
 
178
- def attachment_for(payload)
179
- options = {
180
-
181
- }
182
- Lita::Adapters::Slack::Attachment.new(payload[:message], options)
183
- end
184
-
185
177
  Lita.register_handler(self)
186
178
  end
187
179
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-announce"
3
- spec.version = "0.1.0"
3
+ spec.version = "0.1.1"
4
4
  spec.authors = ["Tom Duffield"]
5
5
  spec.email = ["tom@chef.io"]
6
6
  spec.description = "Lita plugin to make announcements across multiple channels."
@@ -15,7 +15,6 @@ Gem::Specification.new do |spec|
15
15
  spec.require_paths = ["lib"]
16
16
 
17
17
  spec.add_runtime_dependency "lita", ">= 4.7"
18
- spec.add_runtime_dependency "json", "~> 2.0.0"
19
18
 
20
19
  spec.add_development_dependency "bundler", "~> 1.3"
21
20
  spec.add_development_dependency "pry-byebug"
@@ -23,7 +23,7 @@ describe Lita::Handlers::Announce, lita_handler: true do
23
23
  end
24
24
 
25
25
  describe "list-groups" do
26
- before { subject.redis.set("group:network", { channels: network_group }.to_json) }
26
+ before { subject.redis.set("group:network", MultiJson.dump({ channels: network_group })) }
27
27
 
28
28
  it "returns a list of groups" do
29
29
  send_command("announce list-groups")
@@ -34,7 +34,7 @@ describe Lita::Handlers::Announce, lita_handler: true do
34
34
  shared_examples_for "group channel modification validation" do
35
35
  it "adds group to redis" do
36
36
  send_command(command)
37
- expect(subject.redis.get("group:premium")).to eql({ channels: premium_group }.to_json)
37
+ expect(subject.redis.get("group:premium")).to eql(MultiJson.dump({ channels: premium_group }))
38
38
  expect(replies.last).to eql(":successful: Announcement group 'premium' updated! Will send messages to #{premium_group.map { |c| "##{c}" }.join(", ")}")
39
39
  end
40
40
 
@@ -80,7 +80,7 @@ describe Lita::Handlers::Announce, lita_handler: true do
80
80
  let(:command) { "announce mod-group #{group} #{channels}" }
81
81
 
82
82
  before do
83
- subject.redis.set("group:premium", { channels: premium_group }.to_json)
83
+ subject.redis.set("group:premium", MultiJson.dump({ channels: premium_group }))
84
84
  Lita::Room.create_or_update("starz")
85
85
  end
86
86
 
@@ -91,7 +91,7 @@ describe Lita::Handlers::Announce, lita_handler: true do
91
91
  let(:group) { "premium" }
92
92
  let(:command) { "announce del-group #{group}" }
93
93
 
94
- before { subject.redis.set("group:premium", { channels: premium_group }.to_json) }
94
+ before { subject.redis.set("group:premium", MultiJson.dump({ channels: premium_group })) }
95
95
 
96
96
  it "deletes group from redis" do
97
97
  send_command(command)
@@ -122,9 +122,9 @@ describe Lita::Handlers::Announce, lita_handler: true do
122
122
  end
123
123
 
124
124
  before do
125
- subject.redis.set("group:premium", { channels: premium_group }.to_json)
126
- subject.redis.set("group:network", { channels: network_group }.to_json)
127
- subject.redis.set("group:my_favorites", { channels: my_favorites }.to_json)
125
+ subject.redis.set("group:premium", MultiJson.dump({ channels: premium_group }))
126
+ subject.redis.set("group:network", MultiJson.dump({ channels: network_group }))
127
+ subject.redis.set("group:my_favorites", MultiJson.dump({ channels: my_favorites }))
128
128
  end
129
129
 
130
130
  shared_examples_for "an announcement" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-announce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Duffield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-02 00:00:00.000000000 Z
11
+ date: 2016-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.7'
27
- - !ruby/object:Gem::Dependency
28
- name: json
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 2.0.0
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 2.0.0
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: bundler
43
29
  requirement: !ruby/object:Gem::Requirement