slack_message 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +1 -1
- data/.gitignore +1 -0
- data/CHANGELOG.md +6 -0
- data/lib/slack_message/dsl.rb +7 -5
- data/lib/slack_message/rspec.rb +5 -5
- data/slack_message.gemspec +2 -2
- data/spec/slack_message_spec.rb +8 -2
- metadata +2 -3
- data/Gemfile.lock +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25b5670dec5c6c5d2ba870180aa636f192cce3c9d899936337f553bc18108b7d
|
4
|
+
data.tar.gz: 47bd6ff799803ce186cdd01057dfa47a852422c715a2d1c550a6d41fc484ba18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 022ca4f2ffb28a3976be37d7104fd59e3ed296d406bf90176b4745c36880a159306112eb444ca1a1151720ad1cdb6a08e2b2779ad1ff2151e837fbee925c5808
|
7
|
+
data.tar.gz: a3f3d4c889e7c4036c2063f0ef038c54f515779526c6d4a9b0858e5e812bf2ba6667e08298b63988a074f82066c8d7eb9494b3d02d6c4785ff291cbfc7824f75
|
data/.github/workflows/main.yml
CHANGED
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [2.3.1] - 2021-11-30
|
4
|
+
- Adjust that minimum version by changing some syntax to older styles. Given
|
5
|
+
support for ruby 2.4 ended almost 2 years ago, going to go ahead and leave
|
6
|
+
it behind.
|
7
|
+
- Remove lockfile from repo
|
8
|
+
|
3
9
|
## [2.3.0] - 2021-11-30
|
4
10
|
- Formally require minimum version of ruby. It wouldn't have worked anyway,
|
5
11
|
but worth actually specifying.
|
data/lib/slack_message/dsl.rb
CHANGED
@@ -111,12 +111,14 @@ class SlackMessage::Dsl
|
|
111
111
|
# replace emails w/ real user IDs
|
112
112
|
def enrich_text(text_body)
|
113
113
|
text_body.scan(SlackMessage::EMAIL_TAG_PATTERN).each do |email_tag|
|
114
|
-
|
115
|
-
|
114
|
+
begin
|
115
|
+
raw_email = email_tag.gsub(/[><]/, '')
|
116
|
+
user_id = SlackMessage::Api::user_id_for(raw_email, profile)
|
116
117
|
|
117
|
-
|
118
|
-
|
119
|
-
|
118
|
+
text_body.gsub!(email_tag, "<@#{user_id}>") if user_id
|
119
|
+
rescue SlackMessage::ApiError => e
|
120
|
+
# swallow errors for not-found users
|
121
|
+
end
|
120
122
|
end
|
121
123
|
|
122
124
|
text_body
|
data/lib/slack_message/rspec.rb
CHANGED
@@ -206,11 +206,11 @@ module SlackMessage::RSpec
|
|
206
206
|
SlackMessage::RSpec.unregister_expectation_listener(self)
|
207
207
|
|
208
208
|
@captured_calls
|
209
|
-
.
|
210
|
-
.
|
211
|
-
.
|
212
|
-
.
|
213
|
-
.
|
209
|
+
.select { |call| !@channel || call[:channel] == @channel }
|
210
|
+
.select { |call| !@profile || [call[:profile][:handle], call[:username]].include?(@profile) }
|
211
|
+
.select { |call| !@content || call.fetch(:blocks).to_s =~ @content }
|
212
|
+
.select { |call| !@icon || call.fetch(:icon_emoji, call.fetch(:icon_url, '')) == @icon }
|
213
|
+
.select { |call| !@icon_matching || call.fetch(:icon_emoji, call.fetch(:icon_url, '')) =~ @icon_matching }
|
214
214
|
.any?
|
215
215
|
end
|
216
216
|
|
data/slack_message.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = 'slack_message'
|
3
|
-
gem.version = "2.3.
|
3
|
+
gem.version = "2.3.1"
|
4
4
|
gem.summary = "A nice DSL for composing rich messages in Slack"
|
5
5
|
gem.authors = ["Joe Mastey"]
|
6
6
|
gem.email = 'hello@joemastey.com'
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
"source_code_uri" => "http://github.com/jmmastey/slack_message",
|
19
19
|
}
|
20
20
|
|
21
|
-
gem.required_ruby_version = '>= 2.
|
21
|
+
gem.required_ruby_version = '>= 2.5.0'
|
22
22
|
|
23
23
|
gem.add_development_dependency "rspec", "3.10.0"
|
24
24
|
gem.add_development_dependency "pry", "0.14.1"
|
data/spec/slack_message_spec.rb
CHANGED
@@ -142,13 +142,19 @@ RSpec.describe SlackMessage do
|
|
142
142
|
expect {
|
143
143
|
SlackMessage.post_to('#general') { text("Not Tagged: hello@joemastey.com ") }
|
144
144
|
}.to post_to_slack.with_content_matching(/hello@joemastey.com/)
|
145
|
+
end
|
145
146
|
|
146
|
-
|
147
|
-
allow(SlackMessage::Api).to receive(:user_id_for).and_raise(SlackMessage::ApiError)
|
147
|
+
it "is graceful about those failures" do
|
148
|
+
allow(SlackMessage::Api).to receive(:user_id_for).with('nuffin@nuffin.nuffin', any_args).and_raise(SlackMessage::ApiError)
|
149
|
+
allow(SlackMessage::Api).to receive(:user_id_for).with('hello@joemastey.com', any_args).and_return('ABC123')
|
148
150
|
|
149
151
|
expect {
|
150
152
|
SlackMessage.post_to('#general') { text("Not User: <nuffin@nuffin.nuffin>") }
|
151
153
|
}.to post_to_slack.with_content_matching(/\<nuffin@nuffin.nuffin\>/)
|
154
|
+
|
155
|
+
expect {
|
156
|
+
SlackMessage.post_to('#general') { text("Not User: <nuffin@nuffin.nuffin>, User: <hello@joemastey.com>") }
|
157
|
+
}.to post_to_slack.with_content_matching(/ABC123/)
|
152
158
|
end
|
153
159
|
end
|
154
160
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack_message
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Mastey
|
@@ -64,7 +64,6 @@ files:
|
|
64
64
|
- CHANGELOG.md
|
65
65
|
- CODE_OF_CONDUCT.md
|
66
66
|
- Gemfile
|
67
|
-
- Gemfile.lock
|
68
67
|
- MIT-LICENSE
|
69
68
|
- README.md
|
70
69
|
- lib/slack_message.rb
|
@@ -90,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
89
|
requirements:
|
91
90
|
- - ">="
|
92
91
|
- !ruby/object:Gem::Version
|
93
|
-
version: 2.
|
92
|
+
version: 2.5.0
|
94
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
94
|
requirements:
|
96
95
|
- - ">="
|
data/Gemfile.lock
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
slack_message (2.3.0)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
coderay (1.1.3)
|
10
|
-
diff-lcs (1.4.4)
|
11
|
-
method_source (1.0.0)
|
12
|
-
pry (0.14.1)
|
13
|
-
coderay (~> 1.1)
|
14
|
-
method_source (~> 1.0)
|
15
|
-
rb-readline (0.5.5)
|
16
|
-
rspec (3.10.0)
|
17
|
-
rspec-core (~> 3.10.0)
|
18
|
-
rspec-expectations (~> 3.10.0)
|
19
|
-
rspec-mocks (~> 3.10.0)
|
20
|
-
rspec-core (3.10.1)
|
21
|
-
rspec-support (~> 3.10.0)
|
22
|
-
rspec-expectations (3.10.1)
|
23
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
24
|
-
rspec-support (~> 3.10.0)
|
25
|
-
rspec-mocks (3.10.2)
|
26
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
-
rspec-support (~> 3.10.0)
|
28
|
-
rspec-support (3.10.2)
|
29
|
-
|
30
|
-
PLATFORMS
|
31
|
-
ruby
|
32
|
-
|
33
|
-
DEPENDENCIES
|
34
|
-
pry (= 0.14.1)
|
35
|
-
rb-readline (= 0.5.5)
|
36
|
-
rspec (= 3.10.0)
|
37
|
-
slack_message!
|
38
|
-
|
39
|
-
BUNDLED WITH
|
40
|
-
2.1.4
|