slack_messaging 1.2.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Guardfile +5 -0
- data/{LICENSE.txt → LICENSE} +1 -1
- data/QuoteExample.png +0 -0
- data/README.md +31 -19
- data/Rakefile +1 -2
- data/bin/slack-messaging +6 -1
- data/lib/slack_messaging.rb +9 -7
- data/lib/slack_messaging/config.rb +17 -38
- data/lib/slack_messaging/default_paths.rb +13 -0
- data/lib/slack_messaging/notify_slack.rb +10 -11
- data/lib/slack_messaging/random_message.rb +5 -29
- data/lib/slack_messaging/slack.rb +22 -0
- data/lib/slack_messaging/version.rb +1 -1
- data/spec/slack_messaging/config_spec.rb +42 -33
- data/spec/slack_messaging/notify_slack_spec.rb +38 -29
- data/spec/slack_messaging/random_message_spec.rb +41 -24
- data/spec/spec_helper.rb +5 -5
- metadata +82 -56
- data/.codeclimate.yml +0 -37
- data/.github/code_of_conduct.md +0 -85
- data/.github/issue_template.md +0 -97
- data/.github/pull_request_template.md +0 -19
- data/.github/security.md +0 -11
- data/.github/workflows/develop.yml +0 -30
- data/.gitignore +0 -18
- data/.octopolo.yml +0 -4
- data/.rspec +0 -2
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/.soyuz.yml +0 -12
- data/CHANGELOG.markdown +0 -11
- data/CODE_OF_CONDUCT.md +0 -76
- data/CONTRIBUTING.md +0 -11
- data/OutputFile.png +0 -0
- data/lib/slack_messaging/commands/slack.rb +0 -7
- data/lib/slack_messaging/output.rb +0 -13
- data/lib/slack_messaging/scripts/slack.rb +0 -29
- data/slack_messaging.gemspec +0 -32
@@ -1,26 +1,43 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'slack_messaging'
|
3
|
+
|
4
|
+
describe SlackMessaging::RandomMessage do
|
5
|
+
let(:quote_object) { double(:quote_object, body: quote_json) }
|
6
|
+
|
7
|
+
let(:quote_json) do
|
8
|
+
"{\"_id\":\"4MRaRRKq4Tcg\",
|
9
|
+
\"tags\":[\"famous-quotes\"],
|
10
|
+
\"content\":\"There are two ways of spreading light: to be the candle or the mirror that reflects it.\",
|
11
|
+
\"author\":\"Edith Wharton\",\"length\":87
|
12
|
+
}"
|
13
|
+
end
|
14
|
+
|
15
|
+
before do
|
16
|
+
allow(HTTParty).to receive(:get).and_return(quote_object)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should get a string message' do
|
20
|
+
message = SlackMessaging::RandomMessage.acquire_random_quote
|
21
|
+
expect(message).to be_instance_of(String)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should get a message that includes a newline' do
|
25
|
+
message = SlackMessaging::RandomMessage.acquire_random_quote
|
26
|
+
expect(message.include?("\n")).to eq(true)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should get a message that includes a —' do
|
30
|
+
message = SlackMessaging::RandomMessage.acquire_random_quote
|
31
|
+
expect(message.include?('—')).to eq(true)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should use HTTParty to ping an API' do
|
35
|
+
expect(HTTParty).to receive(:get)
|
36
|
+
SlackMessaging::RandomMessage.acquire_random_quote
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should have the JSON parse the response content twice' do
|
40
|
+
expect(JSON).to receive(:parse).at_least(2).times.and_return(JSON.parse(quote_json))
|
41
|
+
SlackMessaging::RandomMessage.acquire_random_quote
|
25
42
|
end
|
26
43
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,8 +1,5 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
SimpleCov.start do
|
4
|
-
add_filter '/spec/'
|
5
|
-
end
|
1
|
+
require 'faker'
|
2
|
+
require 'pry'
|
6
3
|
|
7
4
|
# This file was generated by the `rspec --init` command. Conventionally, all
|
8
5
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
@@ -37,6 +34,9 @@ RSpec.configure do |config|
|
|
37
34
|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
38
35
|
end
|
39
36
|
|
37
|
+
config.filter_run :focus => true
|
38
|
+
config.run_all_when_everything_filtered = true
|
39
|
+
|
40
40
|
# rspec-mocks config goes here. You can use an alternate test double
|
41
41
|
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
42
42
|
config.mock_with :rspec do |mocks|
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack_messaging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emma Sax
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '6.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: gli
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,119 +38,161 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.10'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: hashie
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '4.1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '4.1'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: highline
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
61
|
+
version: '2.0'
|
48
62
|
type: :runtime
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
68
|
+
version: '2.0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
70
|
+
name: httparty
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
75
|
+
version: '0.18'
|
62
76
|
type: :runtime
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
82
|
+
version: '0.18'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: json
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- - "
|
87
|
+
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: 2.
|
89
|
+
version: '2.5'
|
76
90
|
type: :runtime
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- - "
|
94
|
+
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: 2.
|
96
|
+
version: '2.5'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
98
|
+
name: rack
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
103
|
+
version: '2.2'
|
90
104
|
type: :runtime
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
110
|
+
version: '2.2'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: bundler
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: '2.
|
117
|
+
version: '2.2'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: '2.
|
124
|
+
version: '2.2'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
126
|
+
name: faker
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
129
|
- - "~>"
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
131
|
+
version: '2.15'
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
136
|
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
138
|
+
version: '2.15'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
|
-
name: rspec
|
140
|
+
name: guard-rspec
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
128
142
|
requirements:
|
129
143
|
- - "~>"
|
130
144
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
145
|
+
version: '4.3'
|
132
146
|
type: :development
|
133
147
|
prerelease: false
|
134
148
|
version_requirements: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
150
|
- - "~>"
|
137
151
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
152
|
+
version: '4.3'
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
154
|
+
name: pry
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
142
156
|
requirements:
|
143
|
-
- - "
|
157
|
+
- - "~>"
|
144
158
|
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
159
|
+
version: '0.13'
|
146
160
|
type: :development
|
147
161
|
prerelease: false
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
|
-
- - "
|
164
|
+
- - "~>"
|
151
165
|
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
153
|
-
|
166
|
+
version: '0.13'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rake
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '13.0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '13.0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: rspec
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '3.9'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '3.9'
|
195
|
+
description: Sending Personalized Slack Messages to a Slack channel of your choice.
|
154
196
|
email:
|
155
197
|
- emma.sax4@gmail.com
|
156
198
|
executables:
|
@@ -158,36 +200,20 @@ executables:
|
|
158
200
|
extensions: []
|
159
201
|
extra_rdoc_files: []
|
160
202
|
files:
|
161
|
-
- ".codeclimate.yml"
|
162
|
-
- ".github/code_of_conduct.md"
|
163
|
-
- ".github/issue_template.md"
|
164
|
-
- ".github/pull_request_template.md"
|
165
|
-
- ".github/security.md"
|
166
|
-
- ".github/workflows/develop.yml"
|
167
|
-
- ".gitignore"
|
168
|
-
- ".octopolo.yml"
|
169
|
-
- ".rspec"
|
170
|
-
- ".ruby-gemset"
|
171
|
-
- ".ruby-version"
|
172
|
-
- ".soyuz.yml"
|
173
|
-
- CHANGELOG.markdown
|
174
|
-
- CODE_OF_CONDUCT.md
|
175
|
-
- CONTRIBUTING.md
|
176
203
|
- Gemfile
|
177
|
-
-
|
178
|
-
-
|
204
|
+
- Guardfile
|
205
|
+
- LICENSE
|
206
|
+
- QuoteExample.png
|
179
207
|
- README.md
|
180
208
|
- Rakefile
|
181
209
|
- bin/slack-messaging
|
182
210
|
- lib/slack_messaging.rb
|
183
|
-
- lib/slack_messaging/commands/slack.rb
|
184
211
|
- lib/slack_messaging/config.rb
|
212
|
+
- lib/slack_messaging/default_paths.rb
|
185
213
|
- lib/slack_messaging/notify_slack.rb
|
186
|
-
- lib/slack_messaging/output.rb
|
187
214
|
- lib/slack_messaging/random_message.rb
|
188
|
-
- lib/slack_messaging/
|
215
|
+
- lib/slack_messaging/slack.rb
|
189
216
|
- lib/slack_messaging/version.rb
|
190
|
-
- slack_messaging.gemspec
|
191
217
|
- spec/slack_messaging/config_spec.rb
|
192
218
|
- spec/slack_messaging/notify_slack_spec.rb
|
193
219
|
- spec/slack_messaging/random_message_spec.rb
|
@@ -211,12 +237,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
211
237
|
- !ruby/object:Gem::Version
|
212
238
|
version: '0'
|
213
239
|
requirements: []
|
214
|
-
rubygems_version: 3.
|
240
|
+
rubygems_version: 3.2.3
|
215
241
|
signing_key:
|
216
242
|
specification_version: 4
|
217
|
-
summary:
|
243
|
+
summary: Personalized Slack Messages
|
218
244
|
test_files:
|
245
|
+
- spec/spec_helper.rb
|
219
246
|
- spec/slack_messaging/config_spec.rb
|
220
247
|
- spec/slack_messaging/notify_slack_spec.rb
|
221
248
|
- spec/slack_messaging/random_message_spec.rb
|
222
|
-
- spec/spec_helper.rb
|
data/.codeclimate.yml
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
version: "2"
|
2
|
-
checks:
|
3
|
-
argument-count:
|
4
|
-
config:
|
5
|
-
threshold: 4
|
6
|
-
complex-logic:
|
7
|
-
config:
|
8
|
-
threshold: 4
|
9
|
-
file-lines:
|
10
|
-
config:
|
11
|
-
threshold: 250
|
12
|
-
method-complexity:
|
13
|
-
config:
|
14
|
-
threshold: 8
|
15
|
-
method-count:
|
16
|
-
config:
|
17
|
-
threshold: 20
|
18
|
-
method-lines:
|
19
|
-
config:
|
20
|
-
threshold: 25
|
21
|
-
nested-control-flow:
|
22
|
-
config:
|
23
|
-
threshold: 4
|
24
|
-
return-statements:
|
25
|
-
config:
|
26
|
-
threshold: 4
|
27
|
-
similar-code:
|
28
|
-
config:
|
29
|
-
threshold: # language-specific defaults. an override will affect all languages.
|
30
|
-
identical-code:
|
31
|
-
config:
|
32
|
-
threshold: # language-specific defaults. an override will affect all languages.
|
33
|
-
exclude_patterns:
|
34
|
-
- "**/spec/"
|
35
|
-
- "**/test/"
|
36
|
-
- "**/vendor/"
|
37
|
-
- "**/*.js"
|
data/.github/code_of_conduct.md
DELETED
@@ -1,85 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
### Table of Contents
|
4
|
-
|
5
|
-
* [Our Pledge](#our-pledge)
|
6
|
-
* [Our Standards](#our-standards)
|
7
|
-
* [Our Responsibilities](#our-responsibilities)
|
8
|
-
* [Scope](#scope)
|
9
|
-
* [Enforcement](#enforcement)
|
10
|
-
* [Attribution](#attribution)
|
11
|
-
|
12
|
-
## Our Pledge
|
13
|
-
|
14
|
-
In the interest of fostering an open and welcoming environment, we as
|
15
|
-
contributors and maintainers pledge to making participation in our project and
|
16
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
17
|
-
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
18
|
-
level of experience, education, socio-economic status, nationality, personal
|
19
|
-
appearance, race, religion, or sexual identity and orientation.
|
20
|
-
|
21
|
-
## Our Standards
|
22
|
-
|
23
|
-
Examples of behavior that contributes to creating a positive environment
|
24
|
-
include:
|
25
|
-
|
26
|
-
* Using welcoming and inclusive language
|
27
|
-
* Being respectful of differing viewpoints and experiences
|
28
|
-
* Gracefully accepting constructive criticism
|
29
|
-
* Focusing on what is best for the community
|
30
|
-
* Showing empathy towards other community members
|
31
|
-
|
32
|
-
Examples of unacceptable behavior by participants include:
|
33
|
-
|
34
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
35
|
-
advances
|
36
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
37
|
-
* Public or private harassment
|
38
|
-
* Publishing others' private information, such as a physical or electronic
|
39
|
-
address, without explicit permission
|
40
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
41
|
-
professional setting
|
42
|
-
|
43
|
-
## Our Responsibilities
|
44
|
-
|
45
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
46
|
-
behavior and are expected to take appropriate and fair corrective action in
|
47
|
-
response to any instances of unacceptable behavior.
|
48
|
-
|
49
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
50
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
51
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
52
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
53
|
-
threatening, offensive, or harmful.
|
54
|
-
|
55
|
-
## Scope
|
56
|
-
|
57
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
58
|
-
when an individual is representing the project or its community. Examples of
|
59
|
-
representing a project or community include using an official project e-mail
|
60
|
-
address, posting via an official social media account, or acting as an appointed
|
61
|
-
representative at an online or offline event. Representation of a project may be
|
62
|
-
further defined and clarified by project maintainers.
|
63
|
-
|
64
|
-
## Enforcement
|
65
|
-
|
66
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
67
|
-
reported by contacting the project team at emma.sax4@gmail.com. All
|
68
|
-
complaints will be reviewed and investigated and will result in a response that
|
69
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
70
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
71
|
-
Further details of specific enforcement policies may be posted separately.
|
72
|
-
|
73
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
74
|
-
faith may face temporary or permanent repercussions as determined by other
|
75
|
-
members of the project's leadership.
|
76
|
-
|
77
|
-
## Attribution
|
78
|
-
|
79
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
80
|
-
available at [https://www.contributor-covenant.org/version/1/4/code-of-conduct.html](https://www.contributor-covenant.org/version/1/4/code-of-conduct.html).
|
81
|
-
|
82
|
-
[homepage]: [https://www.contributor-covenant.org](https://www.contributor-covenant.org)
|
83
|
-
|
84
|
-
For answers to common questions about this code of conduct, see
|
85
|
-
[https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq).
|