slack_messaging 1.3.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Guardfile +2 -2
- data/LICENSE +1 -1
- data/QuoteExample.png +0 -0
- data/README.md +15 -11
- 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 +3 -0
- metadata +63 -34
- data/.codeclimate.yml +0 -37
- data/.github/code_of_conduct.md +0 -85
- data/.github/contributing.md +0 -11
- data/.github/issue_template.md +0 -99
- 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/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed1a41806773a2013660b33d83b26c0e66e674df00c67a5f669b2e891baf24c5
|
4
|
+
data.tar.gz: d57f53b3c1510be3be48b580667308bee30a7eae8500584fe7870e7ce5abc116
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09a09b96d5ead64faa64566187efc058491fbdf44b0ef1bce5f0eee20f8185f8e496333afa079b6e0956e9cab461c262017712a83daa29da238c89203a6efa9b'
|
7
|
+
data.tar.gz: 7d9cdd032f88b3aeafc365a1f9784f56bb750f6a285b405fb662cd5cc46e28ffad2bf43471a075a1301ca1c68bc78555c4aaea2ab8b8088e7e46fe4e93409cdd
|
data/Guardfile
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
guard :rspec, cmd: 'bundle exec rspec', all_on_start: true
|
1
|
+
guard :rspec, cmd: 'bundle exec rspec', all_on_start: true do
|
2
2
|
watch(%r{^spec/.+_spec\.rb$})
|
3
3
|
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
4
|
-
watch('spec/spec_helper.rb') {
|
4
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
5
5
|
end
|
data/LICENSE
CHANGED
data/QuoteExample.png
ADDED
Binary file
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Slack Messaging [![Maintainability](https://api.codeclimate.com/v1/badges/
|
1
|
+
# Slack Messaging [![Maintainability](https://api.codeclimate.com/v1/badges/9aabbea68d6522f4b308/maintainability)](https://codeclimate.com/github/emmahsax/slack_messaging/maintainability) [![Main](https://github.com/emmahsax/slack_messaging/actions/workflows/main.yml/badge.svg)](https://github.com/emmahsax/slack_messaging/actions/workflows/main.yml)
|
2
2
|
|
3
3
|
This is a simple project designed to post messages to a given Slack channel as a bot.
|
4
4
|
|
@@ -12,11 +12,15 @@ gem 'slack_messaging'
|
|
12
12
|
|
13
13
|
And then execute:
|
14
14
|
|
15
|
-
|
15
|
+
```bash
|
16
|
+
bundle install
|
17
|
+
```
|
16
18
|
|
17
19
|
Or install it yourself as:
|
18
20
|
|
19
|
-
|
21
|
+
```bash
|
22
|
+
gem install slack_messaging
|
23
|
+
```
|
20
24
|
|
21
25
|
### Usage
|
22
26
|
|
@@ -24,9 +28,9 @@ This project requires a config file that should look like this:
|
|
24
28
|
|
25
29
|
```
|
26
30
|
slack:
|
27
|
-
channel:
|
31
|
+
channel: <AWESOME CHANNEL NAME>
|
28
32
|
username: <AWESOME USER NAME>
|
29
|
-
webhook_url: <WEBHOOK URL>
|
33
|
+
webhook_url: <SLACK WEBHOOK URL>
|
30
34
|
icon_emoji: ":<SOME EMOJI>:"
|
31
35
|
```
|
32
36
|
|
@@ -46,7 +50,7 @@ To print a friendly message to Slack, run:
|
|
46
50
|
slack-messaging slack
|
47
51
|
```
|
48
52
|
|
49
|
-
from the main directory. Here, no specific message is being given to print to Slack, so slack_messaging will choose a random quote
|
53
|
+
from the main directory. Here, no specific message is being given to print to Slack, so slack_messaging will choose a random quote. The random quotes are selected using the [Quotable API](http://api.quotable.io/).
|
50
54
|
|
51
55
|
However, what if you wanted to print something specific? Well, you can! Just run:
|
52
56
|
|
@@ -62,7 +66,7 @@ slack-messaging slack "MESSAGE 1" "MESSAGE 2" "MESSAGE 3" ... "MESSAGE N"
|
|
62
66
|
|
63
67
|
The output of slack_messaging will look something like this:
|
64
68
|
|
65
|
-
<img src="https://github.com/
|
69
|
+
<img src="https://github.com/emmahsax/slack_messaging/blob/main/QuoteExample.png" width="500">
|
66
70
|
|
67
71
|
I hope you enjoy printing fun and specialized messages to Slack!
|
68
72
|
|
@@ -72,11 +76,11 @@ To run the tests, run `bundle exec rspec` from the command line. GitHub Actions
|
|
72
76
|
|
73
77
|
## Contributing
|
74
78
|
|
75
|
-
To submit a feature request, bug ticket, etc, please submit an official [GitHub Issue](https://github.com/
|
79
|
+
To submit a feature request, bug ticket, etc, please submit an official [GitHub Issue](https://github.com/emmahsax/slack_messaging/issues/new).
|
76
80
|
|
77
|
-
To report any security vulnerabilities, please view this project's [Security Policy](https://github.com/
|
81
|
+
To report any security vulnerabilities, please view this project's [Security Policy](https://github.com/emmahsax/slack_messaging/security/policy).
|
78
82
|
|
79
|
-
|
83
|
+
When interacting with this repository, please follow [Contributor Covenant's Code of Conduct](https://contributor-covenant.org).
|
80
84
|
|
81
85
|
## Releasing
|
82
86
|
|
@@ -84,7 +88,7 @@ To make a new release of this gem:
|
|
84
88
|
|
85
89
|
1. Merge the pull request via the big green button
|
86
90
|
2. Run `git tag vX.X.X` and `git push --tag`
|
87
|
-
3. Make a new release [here](https://github.com/
|
91
|
+
3. Make a new release [here](https://github.com/emmahsax/slack_messaging/releases/new)
|
88
92
|
4. Run `gem build *.gemspec`
|
89
93
|
5. Run `gem push *.gem` to push the new gem to RubyGems
|
90
94
|
6. Run `rm *.gem` to clean up your local repository
|
data/Rakefile
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
require
|
2
|
-
|
1
|
+
require 'bundler/gem_tasks'
|
data/bin/slack-messaging
CHANGED
@@ -16,7 +16,12 @@ program_long_desc """
|
|
16
16
|
DOCUMENTATION
|
17
17
|
"""
|
18
18
|
|
19
|
-
|
19
|
+
desc 'Prints a variety of messages to Slack'
|
20
|
+
command 'slack' do |c|
|
21
|
+
c.action do |global_options, options, args|
|
22
|
+
SlackMessaging::Slack.execute(args, options)
|
23
|
+
end
|
24
|
+
end
|
20
25
|
|
21
26
|
pre do |global,command,options,args|
|
22
27
|
SlackMessaging::Config.load(global[:config])
|
data/lib/slack_messaging.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
module SlackMessaging
|
1
|
+
require 'yaml'
|
2
|
+
require 'hashie'
|
3
|
+
require 'httparty'
|
4
|
+
require 'highline'
|
5
|
+
require 'json'
|
8
6
|
|
7
|
+
Dir[File.expand_path(File.join(File.dirname(File.absolute_path(__FILE__)), 'slack_messaging')) + '/**/*.rb'].each do |file|
|
8
|
+
require_relative file
|
9
9
|
end
|
10
|
+
|
11
|
+
module SlackMessaging; end
|
@@ -1,48 +1,27 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
require 'hashie'
|
3
|
-
|
4
1
|
module SlackMessaging
|
5
|
-
|
6
|
-
class DefaultPaths
|
7
|
-
class << self
|
8
|
-
def config
|
9
|
-
File.join(self.home,'.slack_messaging.yml')
|
10
|
-
end
|
11
|
-
|
12
|
-
def home
|
13
|
-
ENV['HOME'] ? ENV['HOME'] : "."
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
2
|
class Config
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
config_data.to_hash
|
23
|
-
end
|
3
|
+
def self.config
|
4
|
+
config_data.to_hash
|
5
|
+
end
|
24
6
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
7
|
+
def self.load(path)
|
8
|
+
load_config(path)
|
9
|
+
config
|
10
|
+
end
|
29
11
|
|
30
|
-
|
31
|
-
@config_data ||= Hashie::Mash.new
|
32
|
-
end
|
33
|
-
private :config_data
|
12
|
+
private
|
34
13
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
private :method_missing
|
14
|
+
def self.config_data
|
15
|
+
@config_data ||= Hashie::Mash.new
|
16
|
+
end
|
39
17
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
end
|
44
|
-
private :load_config
|
18
|
+
def self.method_missing(method, args = false)
|
19
|
+
config_data.send(method, args)
|
20
|
+
end
|
45
21
|
|
22
|
+
def self.load_config(file)
|
23
|
+
raise MissingConfig, "Missing configuration file: #{file}" unless File.exist?(file)
|
24
|
+
YAML.load_file(file).each { |key, value| config_data.assign_property(key, value) }
|
46
25
|
end
|
47
26
|
end
|
48
27
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'slack-notifier'
|
2
|
-
|
3
1
|
module SlackMessaging
|
4
2
|
class NotifySlack
|
5
3
|
attr_accessor :text, :channel, :webhook_url, :username, :icon_url, :icon_emoji
|
@@ -8,18 +6,19 @@ module SlackMessaging
|
|
8
6
|
self.text = text
|
9
7
|
self.channel = SlackMessaging::Config.slack[:channel]
|
10
8
|
self.webhook_url = SlackMessaging::Config.slack[:webhook_url]
|
11
|
-
self.username = SlackMessaging::Config.slack[:username] ||
|
12
|
-
self.icon_emoji = SlackMessaging::Config.slack[:icon_emoji] ||
|
9
|
+
self.username = SlackMessaging::Config.slack[:username] || 'MessageMe'
|
10
|
+
self.icon_emoji = SlackMessaging::Config.slack[:icon_emoji] || ':mailbox_with_mail'
|
13
11
|
end
|
14
12
|
|
15
13
|
def perform
|
16
|
-
options = {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
14
|
+
options = {
|
15
|
+
channel: channel,
|
16
|
+
username: username,
|
17
|
+
icon_emoji: icon_emoji,
|
18
|
+
text: text
|
19
|
+
}
|
20
|
+
|
21
|
+
HTTParty.post(webhook_url, body: options.to_json)
|
23
22
|
end
|
24
23
|
end
|
25
24
|
end
|
@@ -1,34 +1,10 @@
|
|
1
1
|
module SlackMessaging
|
2
2
|
class RandomMessage
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
"
|
8
|
-
"I'm convinced of this: Good done anywhere is good done everywhere.\n--Maya Angelou",
|
9
|
-
"The real trouble with reality is that there's no background music.\n--Anonymous",
|
10
|
-
"Whatever you are, be a good one.\n--Abraham Lincoln",
|
11
|
-
"Good, better, best. Never let it rest. 'Til your good is better and your better is best.\n--St. Jerome",
|
12
|
-
"Despite everything, I believe that people are really good at heart.\n--Anne Frank",
|
13
|
-
"Life is 10% what happens to you and 90% how you react to it.\n--Charles R. Swindoll",
|
14
|
-
"The way to get started is to quit talking and begin doing.\n--Walt Disney",
|
15
|
-
"A creative man is motivated by the desire to achieve, not by the desire to beat others.\n--Ayn Rand",
|
16
|
-
"Problems are not stop signs, they are guidelines.\n--Robert H. Schuller",
|
17
|
-
"Correction does much, but encouragement does more.\n--Johann Wolfgang von Goethe",
|
18
|
-
"Positive anything is better than negative nothing.\n--Elbert Hubbard",
|
19
|
-
"To succeed, you need to find something to hold on to, something to motivate you, something to inspire you.\n--Joyce Meyer",
|
20
|
-
"If you're not making mistakes, then you're not doing anything. I'm positive that a doer makes mistakes.\n--John Wooden",
|
21
|
-
"The best way to deal with other people is to just let them be other people.\n--Anonymous",
|
22
|
-
"Talk to yourself like you would to someone you love.\n--Brenee Brown",
|
23
|
-
"Don't let small minds convince you that your dreams are too big.\n--Anonymous",
|
24
|
-
]
|
25
|
-
|
26
|
-
def initialize
|
27
|
-
self.text = MESSAGE_ARRAY[rand(MESSAGE_ARRAY.length)]
|
28
|
-
end
|
29
|
-
|
30
|
-
def get_text
|
31
|
-
return self.text
|
3
|
+
def self.acquire_random_quote
|
4
|
+
random_quote = HTTParty.get('http://api.quotable.io/random', headers: { 'Content-Type': 'application/json' }).body
|
5
|
+
quote_content = JSON.parse(random_quote)['content']
|
6
|
+
quote_author = JSON.parse(random_quote)['author']
|
7
|
+
return "\"#{quote_content}\"" + "\n" + "—#{quote_author}"
|
32
8
|
end
|
33
9
|
end
|
34
10
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module SlackMessaging
|
2
|
+
class Slack
|
3
|
+
attr_accessor :options
|
4
|
+
|
5
|
+
def self.execute(args, options = nil)
|
6
|
+
if args.empty?
|
7
|
+
message = SlackMessaging::RandomMessage.acquire_random_quote
|
8
|
+
print_message(message)
|
9
|
+
else
|
10
|
+
args.each do |message|
|
11
|
+
print_message(message)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def self.print_message(message)
|
19
|
+
SlackMessaging::NotifySlack.new(message).perform
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,44 +1,53 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'slack_messaging'
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
describe SlackMessaging::Config do
|
5
|
+
context 'config key methods' do
|
6
|
+
it 'should return nil when not set' do
|
7
|
+
expect(SlackMessaging::Config.doesnt_exist).to eql(nil)
|
8
|
+
expect(SlackMessaging::Config.doesnt_exist?).to eql(false)
|
9
|
+
end
|
6
10
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
end
|
12
|
-
it "should return the config value when set" do
|
13
|
-
SlackMessaging::Config.new_value = "testing"
|
14
|
-
expect(SlackMessaging::Config.new_value).to eql("testing")
|
15
|
-
end
|
11
|
+
it 'should return the config value when set' do
|
12
|
+
config_value = Faker::Lorem.word
|
13
|
+
SlackMessaging::Config.new_value = config_value
|
14
|
+
expect(SlackMessaging::Config.new_value).to eql(config_value)
|
16
15
|
end
|
16
|
+
end
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
18
|
+
context 'after loading a config file' do
|
19
|
+
let(:domain) { Faker::Internet.domain_name }
|
20
|
+
let(:sentence) { Faker::Lorem.sentence }
|
21
|
+
|
22
|
+
let(:config_file) do
|
23
|
+
{
|
24
|
+
'domain': domain,
|
25
|
+
'slack': {
|
26
|
+
'slack_option': true,
|
27
|
+
'username': Faker::Name.name,
|
28
|
+
'icon_url': Faker::Internet.url,
|
29
|
+
'channel': Faker::Lorem.word,
|
30
|
+
'webhook': Faker::Internet.url
|
31
|
+
}
|
32
|
+
}
|
33
|
+
end
|
30
34
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
35
|
+
before do
|
36
|
+
allow(YAML).to receive(:load_file).and_return(config_file)
|
37
|
+
allow(File).to receive(:exist?).and_return(true)
|
38
|
+
SlackMessaging::Config.load(Faker::Lorem.word)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'calling a method corresponding to a key in the file should return the value' do
|
42
|
+
expect(SlackMessaging::Config.domain).to eql(domain)
|
43
|
+
expect(SlackMessaging::Config.slack).to be_kind_of(Hash)
|
44
|
+
expect(SlackMessaging::Config.slack[:slack_option]).to eql(true)
|
45
|
+
end
|
36
46
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
47
|
+
it 'overwriting values should work' do
|
48
|
+
expect(SlackMessaging::Config.slack).to be_kind_of(Hash)
|
49
|
+
SlackMessaging::Config.slack = sentence
|
50
|
+
expect(SlackMessaging::Config.slack).to eql(sentence)
|
42
51
|
end
|
43
52
|
end
|
44
53
|
end
|
@@ -1,34 +1,43 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'slack_messaging'
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
"icon_emoji" => ":wine_glass:"}
|
10
|
-
}
|
11
|
-
allow(YAML).to receive(:load_file).and_return(config_file)
|
12
|
-
allow(File).to receive(:exist?).and_return(true)
|
13
|
-
SlackMessaging::Config.load("dummy/path")
|
14
|
-
end
|
4
|
+
describe SlackMessaging::NotifySlack do
|
5
|
+
let(:sentence) { Faker::Lorem.sentence }
|
6
|
+
let(:channel) { Faker::Lorem.word }
|
7
|
+
let(:username) { Faker::Name.name }
|
8
|
+
let(:webhook) { Faker::Internet.url }
|
9
|
+
let(:emoji) { Faker::Internet.url }
|
15
10
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
11
|
+
let(:config_file) do
|
12
|
+
{
|
13
|
+
'slack': {
|
14
|
+
'slack_option': true,
|
15
|
+
'username': username,
|
16
|
+
'icon_emoji': emoji,
|
17
|
+
'channel': channel,
|
18
|
+
'webhook_url': webhook
|
19
|
+
}
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
before :each do
|
24
|
+
allow(YAML).to receive(:load_file).and_return(config_file)
|
25
|
+
allow(File).to receive(:exist?).and_return(true)
|
26
|
+
SlackMessaging::Config.load(Faker::Lorem.word)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should call HTTParty' do
|
30
|
+
expect(HTTParty).to receive(:post)
|
31
|
+
message = SlackMessaging::NotifySlack.new(sentence)
|
32
|
+
message.perform
|
33
|
+
end
|
23
34
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
end
|
32
|
-
|
35
|
+
it 'should define certain values' do
|
36
|
+
message = SlackMessaging::NotifySlack.new(sentence)
|
37
|
+
expect(message.text).to eq(sentence)
|
38
|
+
expect(message.channel).to eq(channel)
|
39
|
+
expect(message.username).to eq(username)
|
40
|
+
expect(message.webhook_url).to eq(webhook)
|
41
|
+
expect(message.icon_emoji).to eq(emoji)
|
33
42
|
end
|
34
43
|
end
|
@@ -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,3 +1,6 @@
|
|
1
|
+
require 'faker'
|
2
|
+
require 'pry'
|
3
|
+
|
1
4
|
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
5
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
6
|
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
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: 1.
|
4
|
+
version: 2.1.1
|
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-02-21 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,6 +38,20 @@ 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
|
@@ -53,19 +67,33 @@ dependencies:
|
|
53
67
|
- !ruby/object:Gem::Version
|
54
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'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: json
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.5'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.5'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: rack
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,33 +109,33 @@ dependencies:
|
|
81
109
|
- !ruby/object:Gem::Version
|
82
110
|
version: '2.2'
|
83
111
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
112
|
+
name: bundler
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
86
114
|
requirements:
|
87
115
|
- - "~>"
|
88
116
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
90
|
-
type: :
|
117
|
+
version: '2.2'
|
118
|
+
type: :development
|
91
119
|
prerelease: false
|
92
120
|
version_requirements: !ruby/object:Gem::Requirement
|
93
121
|
requirements:
|
94
122
|
- - "~>"
|
95
123
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
124
|
+
version: '2.2'
|
97
125
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
126
|
+
name: faker
|
99
127
|
requirement: !ruby/object:Gem::Requirement
|
100
128
|
requirements:
|
101
129
|
- - "~>"
|
102
130
|
- !ruby/object:Gem::Version
|
103
|
-
version: '2.
|
131
|
+
version: '2.15'
|
104
132
|
type: :development
|
105
133
|
prerelease: false
|
106
134
|
version_requirements: !ruby/object:Gem::Requirement
|
107
135
|
requirements:
|
108
136
|
- - "~>"
|
109
137
|
- !ruby/object:Gem::Version
|
110
|
-
version: '2.
|
138
|
+
version: '2.15'
|
111
139
|
- !ruby/object:Gem::Dependency
|
112
140
|
name: guard-rspec
|
113
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,6 +150,20 @@ dependencies:
|
|
122
150
|
- - "~>"
|
123
151
|
- !ruby/object:Gem::Version
|
124
152
|
version: '4.3'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: pry
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0.13'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0.13'
|
125
167
|
- !ruby/object:Gem::Dependency
|
126
168
|
name: rake
|
127
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -152,43 +194,30 @@ dependencies:
|
|
152
194
|
version: '3.9'
|
153
195
|
description: Sending Personalized Slack Messages to a Slack channel of your choice.
|
154
196
|
email:
|
155
|
-
- emma.sax4@gmail.com
|
156
197
|
executables:
|
157
198
|
- slack-messaging
|
158
199
|
extensions: []
|
159
200
|
extra_rdoc_files: []
|
160
201
|
files:
|
161
|
-
- ".codeclimate.yml"
|
162
|
-
- ".github/code_of_conduct.md"
|
163
|
-
- ".github/contributing.md"
|
164
|
-
- ".github/issue_template.md"
|
165
|
-
- ".github/pull_request_template.md"
|
166
|
-
- ".github/security.md"
|
167
|
-
- ".github/workflows/develop.yml"
|
168
|
-
- ".gitignore"
|
169
|
-
- ".ruby-gemset"
|
170
|
-
- ".ruby-version"
|
171
202
|
- Gemfile
|
172
203
|
- Guardfile
|
173
204
|
- LICENSE
|
174
|
-
-
|
205
|
+
- QuoteExample.png
|
175
206
|
- README.md
|
176
207
|
- Rakefile
|
177
208
|
- bin/slack-messaging
|
178
209
|
- lib/slack_messaging.rb
|
179
|
-
- lib/slack_messaging/commands/slack.rb
|
180
210
|
- lib/slack_messaging/config.rb
|
211
|
+
- lib/slack_messaging/default_paths.rb
|
181
212
|
- lib/slack_messaging/notify_slack.rb
|
182
|
-
- lib/slack_messaging/output.rb
|
183
213
|
- lib/slack_messaging/random_message.rb
|
184
|
-
- lib/slack_messaging/
|
214
|
+
- lib/slack_messaging/slack.rb
|
185
215
|
- lib/slack_messaging/version.rb
|
186
|
-
- slack_messaging.gemspec
|
187
216
|
- spec/slack_messaging/config_spec.rb
|
188
217
|
- spec/slack_messaging/notify_slack_spec.rb
|
189
218
|
- spec/slack_messaging/random_message_spec.rb
|
190
219
|
- spec/spec_helper.rb
|
191
|
-
homepage: https://github.com/
|
220
|
+
homepage: https://github.com/emmahsax/slack_messaging
|
192
221
|
licenses:
|
193
222
|
- MIT
|
194
223
|
metadata: {}
|
@@ -207,12 +236,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
236
|
- !ruby/object:Gem::Version
|
208
237
|
version: '0'
|
209
238
|
requirements: []
|
210
|
-
rubygems_version: 3.
|
239
|
+
rubygems_version: 3.2.3
|
211
240
|
signing_key:
|
212
241
|
specification_version: 4
|
213
242
|
summary: Personalized Slack Messages
|
214
243
|
test_files:
|
244
|
+
- spec/spec_helper.rb
|
215
245
|
- spec/slack_messaging/config_spec.rb
|
216
246
|
- spec/slack_messaging/notify_slack_spec.rb
|
217
247
|
- spec/slack_messaging/random_message_spec.rb
|
218
|
-
- 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).
|
data/.github/contributing.md
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
# Contributing
|
2
|
-
|
3
|
-
1. Fork it (https://github.com/emmasax4/slack_messaging/fork)
|
4
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
5
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
6
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
7
|
-
5. Continue making awesome changes!
|
8
|
-
6. To see how it works, follow the [Usage section in the README.md](https://github.com/emmasax4/slack_messaging#usage)
|
9
|
-
7. When you're satisfied, make a pull request to this repository
|
10
|
-
8. If I don't comment or start looking at the pull request in a couple of days, feel free to send me [an email](mailto:emma.sax4@gmail.com)
|
11
|
-
9. I approve your pull request and merge!
|
data/.github/issue_template.md
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
Please fill in the section that best describes your issue and delete all other sections.
|
2
|
-
|
3
|
-
<details><summary>Bug Report</summary>
|
4
|
-
|
5
|
-
## Bug Description
|
6
|
-
|
7
|
-
> A clear and concise description of what the bug is.
|
8
|
-
|
9
|
-
## To Reproduce
|
10
|
-
|
11
|
-
> Steps to reproduce the behavior:
|
12
|
-
>
|
13
|
-
> 1. Go to "..."
|
14
|
-
> 2. Click on "..."
|
15
|
-
> 3. Scroll down to "..."
|
16
|
-
> 4. See error
|
17
|
-
|
18
|
-
## Expected Behavior
|
19
|
-
|
20
|
-
> A clear and concise description of what you expected to happen.
|
21
|
-
|
22
|
-
## Screenshots
|
23
|
-
|
24
|
-
> If applicable, add screenshots to help explain your problem.
|
25
|
-
|
26
|
-
## Desktop
|
27
|
-
|
28
|
-
> Please complete the following information:
|
29
|
-
>
|
30
|
-
> - OS: [e.g. iOS]
|
31
|
-
> - Browser: [e.g. chrome, safari]
|
32
|
-
> - Version: [e.g. 22]
|
33
|
-
|
34
|
-
## Smartphone
|
35
|
-
|
36
|
-
> Please complete the following information:
|
37
|
-
>
|
38
|
-
> - Device: [e.g. iPhone6]
|
39
|
-
> - OS: [e.g. iOS8.1]
|
40
|
-
> - Browser: [e.g. stock browser, safari]
|
41
|
-
> - Version: [e.g. 22]
|
42
|
-
|
43
|
-
## Additional Context
|
44
|
-
|
45
|
-
> Add any other context about the problem here.
|
46
|
-
|
47
|
-
</details>
|
48
|
-
|
49
|
-
<details><summary>Feature Request</summary>
|
50
|
-
|
51
|
-
## Is this feature request related to a problem?
|
52
|
-
|
53
|
-
> A clear and concise description of what the problem is. Ex: I'm always frustrated when [...]
|
54
|
-
|
55
|
-
## The Solution I'd Prefer
|
56
|
-
|
57
|
-
> A clear and concise description of what you want to happen.
|
58
|
-
|
59
|
-
## Alternative Solutions I've Considered
|
60
|
-
|
61
|
-
> A clear and concise description of any alternative solutions or features you've considered.
|
62
|
-
|
63
|
-
## Additional Context
|
64
|
-
|
65
|
-
> Add any other context or screenshots about the feature request here.
|
66
|
-
|
67
|
-
</details>
|
68
|
-
|
69
|
-
<details><summary>Security Report</summary>
|
70
|
-
|
71
|
-
## What is the alert or vulnerability?
|
72
|
-
|
73
|
-
> A clear and concise description of what the vulnerability is. Ex: The Ruby gem [...] has reported vulnerability CVE-[...].
|
74
|
-
|
75
|
-
## Where did you find out about this vulnerability?
|
76
|
-
|
77
|
-
> A clear and concise description of where this vulnerability was first reported or where you heard about it.
|
78
|
-
|
79
|
-
## What are the risks of doing nothing?
|
80
|
-
|
81
|
-
> A clear and concise description of what will happen if we leave the vulnerability as is.
|
82
|
-
|
83
|
-
## Suggestions for improvement?
|
84
|
-
|
85
|
-
> A clear and concise description of what can be done to mitigate this vulnerability.
|
86
|
-
|
87
|
-
## Additional Context
|
88
|
-
|
89
|
-
> Add any other context, URLs, or screenshots about the alert or vulnerability.
|
90
|
-
|
91
|
-
</details>
|
92
|
-
|
93
|
-
<details><summary>General Question or Concern</summary>
|
94
|
-
|
95
|
-
## What's your question or comment?
|
96
|
-
|
97
|
-
> A clear and concise question or comment. Please add as much context as possible.
|
98
|
-
|
99
|
-
</details>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
## Changes
|
2
|
-
|
3
|
-
> A list of the changes that your pull request will make:
|
4
|
-
>
|
5
|
-
> * Adding a page "..."
|
6
|
-
> * Refactoring "..."
|
7
|
-
|
8
|
-
## Related Pull Requests and Issues
|
9
|
-
|
10
|
-
> If applicable, a list of related pull requests and issues:
|
11
|
-
>
|
12
|
-
> * Issue #1
|
13
|
-
> * Issue #2
|
14
|
-
> * Pull Request #1
|
15
|
-
> * Pull Request #2
|
16
|
-
|
17
|
-
## Additional Context
|
18
|
-
|
19
|
-
> Add any other context about the problem here.
|
data/.github/security.md
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
# Security Policy
|
2
|
-
|
3
|
-
## Reporting a Vulnerability
|
4
|
-
|
5
|
-
If you happen to find any security vulnerabilities in this project, please let me know! I've turned on GitHub's security advisory and alert suggestions, but it's always possible that I'll miss something.
|
6
|
-
|
7
|
-
To let me know there's a security vulnerability, please make a [new GitHub Issue](https://github.com/emmasax4/slack_messaging/issues/new) and fill in the Security Report section to the best of your capabilities.
|
8
|
-
|
9
|
-
I'll respond on the Issue or take appropriate action as soon as I'm able.
|
10
|
-
|
11
|
-
Thank you for helping my project to be as secure as possible.
|
@@ -1,30 +0,0 @@
|
|
1
|
-
name: Develop
|
2
|
-
on:
|
3
|
-
push:
|
4
|
-
branches: [ main ]
|
5
|
-
pull_request:
|
6
|
-
branches: [ main ]
|
7
|
-
|
8
|
-
jobs:
|
9
|
-
test:
|
10
|
-
runs-on: ubuntu-latest
|
11
|
-
steps:
|
12
|
-
- name: Check Out Code
|
13
|
-
uses: actions/checkout@v2
|
14
|
-
with:
|
15
|
-
fetch-depth: 0
|
16
|
-
|
17
|
-
- name: Define Run Variables
|
18
|
-
run: echo "::set-env name=BRANCH::$(echo ${{ github.head_ref }} | sed -E 's|refs/[a-zA-Z]+/||')"
|
19
|
-
|
20
|
-
- name: Switch to Current Branch
|
21
|
-
run: git checkout ${{ env.BRANCH }}
|
22
|
-
|
23
|
-
- name: Configure System
|
24
|
-
run: sudo gem update --system 3.0.8 && sudo gem install bundler
|
25
|
-
|
26
|
-
- name: Install Gems
|
27
|
-
run: bundle config set path "vendor/bundle" && bundle install
|
28
|
-
|
29
|
-
- name: Run Rspec Tests
|
30
|
-
run: bundle exec rspec
|
data/.gitignore
DELETED
data/.ruby-gemset
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
slack_messaging
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ruby-2.7.1
|
data/OutputFile.png
DELETED
Binary file
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'highline/import'
|
2
|
-
require_relative "../notify_slack"
|
3
|
-
require_relative "../random_message"
|
4
|
-
|
5
|
-
module SlackMessaging
|
6
|
-
module Scripts
|
7
|
-
class Slack
|
8
|
-
class << self
|
9
|
-
attr_accessor :options
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.execute(args, options=nil)
|
13
|
-
if args.empty?
|
14
|
-
message = RandomMessage.new # generate a new random message
|
15
|
-
print_message(message.get_text)
|
16
|
-
else
|
17
|
-
args.each do |message|
|
18
|
-
print_message(message)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.print_message(message)
|
24
|
-
slack_job = NotifySlack.new(message)
|
25
|
-
slack_job.perform
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
data/slack_messaging.gemspec
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'slack_messaging/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |gem|
|
7
|
-
gem.name = "slack_messaging"
|
8
|
-
gem.version = SlackMessaging::VERSION
|
9
|
-
gem.authors = ["Emma Sax"]
|
10
|
-
gem.email = ["emma.sax4@gmail.com"]
|
11
|
-
gem.summary = %q{Personalized Slack Messages}
|
12
|
-
gem.description = %q{Sending Personalized Slack Messages to a Slack channel of your choice.}
|
13
|
-
gem.homepage = "https://github.com/emmasax4/slack_messaging"
|
14
|
-
gem.license = "MIT"
|
15
|
-
|
16
|
-
gem.files = `git ls-files -z`.split("\x0")
|
17
|
-
gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
|
-
gem.require_paths = ["lib"]
|
20
|
-
|
21
|
-
gem.add_dependency 'hashie', '~> 4.1'
|
22
|
-
gem.add_dependency 'gli', '~> 2.10'
|
23
|
-
gem.add_dependency 'highline', '~> 2.0'
|
24
|
-
gem.add_dependency 'slack-notifier', '~> 1.5.1'
|
25
|
-
gem.add_dependency 'rack', '~> 2.2'
|
26
|
-
gem.add_dependency 'activesupport', '~> 6.0'
|
27
|
-
|
28
|
-
gem.add_development_dependency 'bundler', '~> 2.1'
|
29
|
-
gem.add_development_dependency 'guard-rspec', '~> 4.3'
|
30
|
-
gem.add_development_dependency 'rake', '~> 13.0'
|
31
|
-
gem.add_development_dependency 'rspec', '~> 3.9'
|
32
|
-
end
|