slack_messaging 1.3.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21d4c79502e68eea2cf007a81f3a1e49a1f2b3fc670a68515f91d2671470c7b6
4
- data.tar.gz: 013f88ec707d9bea10b2186962bd4b82e0106cb8754185f0fedb9448b8e3dfb4
3
+ metadata.gz: bd3e90f703693ae103c78862c1c506cc48dcab4f04065d4aee1b6e60a9cab9da
4
+ data.tar.gz: 9cf11baa6f0d033e3c944a7a6d30255eb4ed94233a3a54cfa277c59566bdd91b
5
5
  SHA512:
6
- metadata.gz: d4cc5277991115cb449882eb7f069b6eb135c2c0d944692fbab654c2938c84441ab6bd3b0c9c47f748402d5b8390d34fe2a65ee433b165b3c10df1f230b4d672
7
- data.tar.gz: bb984c22a6a030630daec5848b91fcc73dd5a08090a2711878895741f8cc3317dbc37182a918b00e33b0790a69024f4a251cbfd13aabf214a7ae39f1d24a9c70
6
+ metadata.gz: cc3b3d202c84093c07a6d0aae39f05dad04aa16a7b28fb66a57b4399e4f1bccdff049909d92fba9a56431a4171422d589a3b616c56b7ee72dad2aca0d48e5560
7
+ data.tar.gz: cab8ff992b73a96e41f4f8cb996df80b644ec304a58292d728f54ba5b3965695d4421c5f1df6819aad530981be893a1bfe8fb2c51cf2338142440787f3eff390
data/Gemfile.lock CHANGED
@@ -1,27 +1,30 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- slack_messaging (1.3.1)
4
+ slack_messaging (2.2.0)
5
5
  activesupport (~> 6.0)
6
6
  gli (~> 2.10)
7
7
  hashie (~> 4.1)
8
8
  highline (~> 2.0)
9
+ httparty (~> 0.18)
10
+ json (~> 2.5)
9
11
  rack (~> 2.2)
10
- slack-notifier (~> 1.5.1)
11
12
 
12
13
  GEM
13
14
  remote: https://rubygems.org/
14
15
  specs:
15
- activesupport (6.0.3.3)
16
+ activesupport (6.1.2.1)
16
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
- i18n (>= 0.7, < 2)
18
- minitest (~> 5.1)
19
- tzinfo (~> 1.1)
20
- zeitwerk (~> 2.2, >= 2.2.2)
18
+ i18n (>= 1.6, < 2)
19
+ minitest (>= 5.1)
20
+ tzinfo (~> 2.0)
21
+ zeitwerk (~> 2.3)
21
22
  coderay (1.1.3)
22
- concurrent-ruby (1.1.7)
23
+ concurrent-ruby (1.1.8)
23
24
  diff-lcs (1.4.4)
24
- ffi (1.13.1)
25
+ faker (2.15.1)
26
+ i18n (>= 1.6, < 2)
27
+ ffi (1.14.2)
25
28
  formatador (0.2.5)
26
29
  gli (2.19.2)
27
30
  guard (2.16.2)
@@ -40,56 +43,64 @@ GEM
40
43
  rspec (>= 2.99.0, < 4.0)
41
44
  hashie (4.1.0)
42
45
  highline (2.0.3)
43
- i18n (1.8.5)
46
+ httparty (0.18.1)
47
+ mime-types (~> 3.0)
48
+ multi_xml (>= 0.5.2)
49
+ i18n (1.8.8)
44
50
  concurrent-ruby (~> 1.0)
45
- listen (3.2.1)
51
+ json (2.5.1)
52
+ listen (3.4.1)
46
53
  rb-fsevent (~> 0.10, >= 0.10.3)
47
54
  rb-inotify (~> 0.9, >= 0.9.10)
48
55
  lumberjack (1.2.8)
49
56
  method_source (1.0.0)
50
- minitest (5.14.2)
57
+ mime-types (3.3.1)
58
+ mime-types-data (~> 3.2015)
59
+ mime-types-data (3.2020.1104)
60
+ minitest (5.14.3)
61
+ multi_xml (0.6.0)
51
62
  nenv (0.3.0)
52
63
  notiffany (0.1.3)
53
64
  nenv (~> 0.1)
54
65
  shellany (~> 0.0)
55
- pry (0.13.1)
66
+ pry (0.14.0)
56
67
  coderay (~> 1.1)
57
68
  method_source (~> 1.0)
58
69
  rack (2.2.3)
59
- rake (13.0.1)
70
+ rake (13.0.3)
60
71
  rb-fsevent (0.10.4)
61
72
  rb-inotify (0.10.1)
62
73
  ffi (~> 1.0)
63
- rspec (3.9.0)
64
- rspec-core (~> 3.9.0)
65
- rspec-expectations (~> 3.9.0)
66
- rspec-mocks (~> 3.9.0)
67
- rspec-core (3.9.3)
68
- rspec-support (~> 3.9.3)
69
- rspec-expectations (3.9.2)
74
+ rspec (3.10.0)
75
+ rspec-core (~> 3.10.0)
76
+ rspec-expectations (~> 3.10.0)
77
+ rspec-mocks (~> 3.10.0)
78
+ rspec-core (3.10.1)
79
+ rspec-support (~> 3.10.0)
80
+ rspec-expectations (3.10.1)
70
81
  diff-lcs (>= 1.2.0, < 2.0)
71
- rspec-support (~> 3.9.0)
72
- rspec-mocks (3.9.1)
82
+ rspec-support (~> 3.10.0)
83
+ rspec-mocks (3.10.2)
73
84
  diff-lcs (>= 1.2.0, < 2.0)
74
- rspec-support (~> 3.9.0)
75
- rspec-support (3.9.3)
85
+ rspec-support (~> 3.10.0)
86
+ rspec-support (3.10.2)
76
87
  shellany (0.0.1)
77
- slack-notifier (1.5.1)
78
- thor (1.0.1)
79
- thread_safe (0.3.6)
80
- tzinfo (1.2.7)
81
- thread_safe (~> 0.1)
82
- zeitwerk (2.4.0)
88
+ thor (1.1.0)
89
+ tzinfo (2.0.4)
90
+ concurrent-ruby (~> 1.0)
91
+ zeitwerk (2.4.2)
83
92
 
84
93
  PLATFORMS
85
- ruby
94
+ x86_64-darwin-19
86
95
 
87
96
  DEPENDENCIES
88
- bundler (~> 2.1)
97
+ bundler (~> 2.2)
98
+ faker (~> 2.15)
89
99
  guard-rspec (~> 4.3)
100
+ pry (~> 0.13)
90
101
  rake (~> 13.0)
91
102
  rspec (~> 3.9)
92
103
  slack_messaging!
93
104
 
94
105
  BUNDLED WITH
95
- 2.1.4
106
+ 2.2.9
data/Guardfile CHANGED
@@ -1,5 +1,5 @@
1
- guard :rspec, cmd: 'bundle exec rspec', all_on_start: true, all_after_pass: true do
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') { "spec" }
4
+ watch('spec/spec_helper.rb') { 'spec' }
5
5
  end
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 Elliot Hursh
1
+ Copyright (c) 2014 Emma Sax
2
2
 
3
3
  MIT License
4
4
 
data/QuoteExample.png ADDED
Binary file
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Slack Messaging [![Maintainability](https://api.codeclimate.com/v1/badges/c74baada70ad96048dc7/maintainability)](https://codeclimate.com/github/emmasax4/slack_messaging/maintainability) ![Develop](https://github.com/emmasax4/slack_messaging/workflows/Develop/badge.svg)
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,57 +12,75 @@ gem 'slack_messaging'
12
12
 
13
13
  And then execute:
14
14
 
15
- $ bundle
15
+ ```bash
16
+ bundle install
17
+ ```
16
18
 
17
19
  Or install it yourself as:
18
20
 
19
- $ gem install slack_messaging
21
+ ```bash
22
+ gem install slack_messaging
23
+ ```
20
24
 
21
25
  ### Usage
22
26
 
23
27
  This project requires a config file that should look like this:
24
28
 
25
- ```
29
+ ```yml
26
30
  slack:
27
- channel: "#<AWESOME CHANNEL NAME>"
31
+ channel: <AWESOME CHANNEL NAME>
28
32
  username: <AWESOME USER NAME>
29
- webhook_url: <WEBHOOK URL>
30
- icon_emoji: ":<SOME EMOJI>:"
33
+ webhook_url: <SLACK WEBHOOK URL>
34
+ icon_emoji: ':<SOME EMOJI>:'
31
35
  ```
32
36
 
33
- The default is for the file to be named `~/.slack_messaging.yml`, but a different path can be passed in like this:
37
+ To generate this file at `~/.slack_messaging.yml`, please run this command:
34
38
 
39
+ ```bash
40
+ slack-messaging setup
35
41
  ```
36
- $ slack-messaging --config="/PATH/TO/FILE/config.yml" slack
42
+
43
+ To obtain the webhook URL, go to [this link](https://api.slack.com/messaging/webhooks).
44
+
45
+ If you'd like to create the config file at a different directory, I recommend using the `setup` command, and then manually moving the file to your desired location:
46
+
47
+ ```bash
48
+ slack-messaging setup
49
+ # Walk through the prompts to create the file
50
+ mv ~/.slack_messaging.yml /PATH/TO/FILE/config.yml
37
51
  ```
38
52
 
39
- To obtain the webhook url, go to [this link](https://api.slack.com/incoming-webhooks).
53
+ And then you can pass in that specific file location like this:
40
54
 
41
- Okay, now the project will be ready to rock and roll.
55
+ ```bash
56
+ slack-messaging --config="/PATH/TO/FILE/config.yml" slack
57
+ ```
58
+
59
+ Once the config file is set up, the project is ready to go!
42
60
 
43
61
  To print a friendly message to Slack, run:
44
62
 
45
- ```
63
+ ```bash
46
64
  slack-messaging slack
47
65
  ```
48
66
 
49
- from the main directory. Here, no specific message is being given to print to Slack, so slack_messaging will choose a random quote, which are all defined in [`lib/slack_messaging/random_message.rb`](https://github.com/emmasax4/slack_messaging/blob/main/lib/slack_messaging/random_message.rb). Feel free to change the messages or add more to cater what you'd like slack_messaging to say.
67
+ 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
68
 
51
69
  However, what if you wanted to print something specific? Well, you can! Just run:
52
70
 
53
- ```
54
- slack-messaging slack "MESSAGE 1"
71
+ ```bash
72
+ slack-messaging slack 'MESSAGE 1'
55
73
  ```
56
74
 
57
75
  You can even print multiple messages at once:
58
76
 
59
- ```
60
- slack-messaging slack "MESSAGE 1" "MESSAGE 2" "MESSAGE 3" ... "MESSAGE N"
77
+ ```bash
78
+ slack-messaging slack 'MESSAGE 1' 'MESSAGE 2' 'MESSAGE 3' ... 'MESSAGE N'
61
79
  ```
62
80
 
63
81
  The output of slack_messaging will look something like this:
64
82
 
65
- <img src="https://github.com/emmasax4/slack_messaging/blob/main/OutputFile.png" width="1000">
83
+ <img src="https://github.com/emmahsax/slack_messaging/blob/main/QuoteExample.png" width="500">
66
84
 
67
85
  I hope you enjoy printing fun and specialized messages to Slack!
68
86
 
@@ -72,11 +90,11 @@ To run the tests, run `bundle exec rspec` from the command line. GitHub Actions
72
90
 
73
91
  ## Contributing
74
92
 
75
- To submit a feature request, bug ticket, etc, please submit an official [GitHub Issue](https://github.com/emmasax4/slack_messaging/issues/new).
93
+ To submit a feature request, bug ticket, etc, please submit an official [GitHub Issue](https://github.com/emmahsax/slack_messaging/issues/new).
76
94
 
77
- To report any security vulnerabilities, please view this project's [Security Policy](https://github.com/emmasax4/slack_messaging/security/policy).
95
+ To report any security vulnerabilities, please view this project's [Security Policy](https://github.com/emmahsax/slack_messaging/security/policy).
78
96
 
79
- This repository does have a standard [Code of Conduct](https://github.com/emmasax4/slack_messaging/blob/main/.github/code_of_conduct.md).
97
+ When interacting with this repository, please follow [Contributor Covenant's Code of Conduct](https://contributor-covenant.org).
80
98
 
81
99
  ## Releasing
82
100
 
@@ -84,7 +102,7 @@ To make a new release of this gem:
84
102
 
85
103
  1. Merge the pull request via the big green button
86
104
  2. Run `git tag vX.X.X` and `git push --tag`
87
- 3. Make a new release [here](https://github.com/emmasax4/slack_messaging/releases/new)
105
+ 3. Make a new release [here](https://github.com/emmahsax/slack_messaging/releases/new)
88
106
  4. Run `gem build *.gemspec`
89
107
  5. Run `gem push *.gem` to push the new gem to RubyGems
90
108
  6. Run `rm *.gem` to clean up your local repository
data/Rakefile CHANGED
@@ -1 +1 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
data/bin/slack-messaging CHANGED
@@ -10,23 +10,31 @@ version SlackMessaging::VERSION
10
10
 
11
11
  wrap_help_text :verbatim
12
12
 
13
- flag [:config], :desc => 'SlackMessaging config file path', :default_value => SlackMessaging::DefaultPaths.config
13
+ flag [:config], :desc => 'Slack Messaging config file path', :default_value => SlackMessaging::DefaultPaths.config
14
14
 
15
15
  program_long_desc """
16
16
  DOCUMENTATION
17
+ For documentation and help in setting up your configuration files,
18
+ see Slack Messaging's GitHub repo: https://github.com/emmahsax/slack_messaging
17
19
  """
18
20
 
19
21
  desc 'Prints a variety of messages to Slack'
20
22
  command 'slack' do |c|
23
+ pre do |global, command, options, args|
24
+ SlackMessaging::Config.load(global[:config])
25
+ true
26
+ end
27
+
21
28
  c.action do |global_options, options, args|
22
- SlackMessaging::Slack.execute(args, options) # args are optional string to print
29
+ SlackMessaging::Slack.execute(args, options)
23
30
  end
24
31
  end
25
32
 
26
- pre do |global,command,options,args|
27
- SlackMessaging::Config.load(global[:config])
28
- SlackMessaging::Config.set_config_options(global)
29
- true
33
+ desc 'Sets up a Slack Messaging config file at ~/.slack_messaging.yml'
34
+ command 'setup' do |c|
35
+ c.action do ||
36
+ SlackMessaging::Setup.execute
37
+ end
30
38
  end
31
39
 
32
40
  exit run(ARGV)
@@ -1,4 +1,10 @@
1
- Dir[File.expand_path(File.join(File.dirname(File.absolute_path(__FILE__)), 'slack_messaging')) + "/**/*.rb"].each do |file|
1
+ require 'yaml'
2
+ require 'hashie'
3
+ require 'httparty'
4
+ require 'highline'
5
+ require 'json'
6
+
7
+ Dir[File.expand_path(File.join(File.dirname(File.absolute_path(__FILE__)), 'slack_messaging')) + '/**/*.rb'].each do |file|
2
8
  require_relative file
3
9
  end
4
10
 
@@ -1,43 +1,27 @@
1
- require 'yaml'
2
- require 'hashie'
3
-
4
1
  module SlackMessaging
5
- class DefaultPaths
6
- class << self
7
- def config
8
- File.join(self.home,'.slack_messaging.yml')
9
- end
10
-
11
- def home
12
- ENV['HOME'] ? ENV['HOME'] : "."
13
- end
14
- end
15
- end
16
-
17
2
  class Config
18
- class << self
3
+ def self.config
4
+ config_data.to_hash
5
+ end
19
6
 
20
- def config
21
- config_data.to_hash
22
- end
7
+ def self.load(path)
8
+ load_config(path)
9
+ config
10
+ end
23
11
 
24
- def load(path)
25
- load_config(path)
26
- config
27
- end
12
+ private
28
13
 
29
- private def config_data
30
- @config_data ||= Hashie::Mash.new
31
- end
14
+ def self.config_data
15
+ @config_data ||= Hashie::Mash.new
16
+ end
32
17
 
33
- private def method_missing(method, args=false)
34
- config_data.send(method, args)
35
- end
18
+ def self.method_missing(method, args = false)
19
+ config_data.send(method, args)
20
+ end
36
21
 
37
- private def load_config(file)
38
- raise MissingConfig, "Missing configuration file: #{file}" unless File.exist?(file)
39
- YAML.load_file(file).each{ |key,value| config_data.assign_property(key, value) }
40
- end
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) }
41
25
  end
42
26
  end
43
27
  end
@@ -0,0 +1,13 @@
1
+ module SlackMessaging
2
+ class DefaultPaths
3
+ def self.config
4
+ File.join(self.home, '.slack_messaging.yml')
5
+ end
6
+
7
+ private
8
+
9
+ def self.home
10
+ ENV['HOME'] ? ENV['HOME'] : '.'
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,33 @@
1
+ module SlackMessaging
2
+ class HighlineCli
3
+ def ask(prompt)
4
+ highline_client.ask(prompt) do |conf|
5
+ conf.readline = true
6
+ end.to_s
7
+ end
8
+
9
+ def ask_yes_no(prompt)
10
+ answer = highline_client.ask(prompt) do |conf|
11
+ conf.readline = true
12
+ end.to_s
13
+
14
+ answer.empty? ? true : !!(answer =~ /^y/i)
15
+ end
16
+
17
+ def ask_options(prompt, choices)
18
+ choices_as_string_options = ''
19
+ choices.each { |choice| choices_as_string_options << "#{choices.index(choice) + 1}. #{choice}\n" }
20
+ compiled_prompt = "#{prompt}\n#{choices_as_string_options.strip}"
21
+
22
+ index = highline_client.ask(compiled_prompt) do |conf|
23
+ conf.readline = true
24
+ end.to_i - 1
25
+
26
+ choices[index]
27
+ end
28
+
29
+ private def highline_client
30
+ @highline_client ||= HighLine.new
31
+ end
32
+ end
33
+ 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,19 +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] || "MessageMe"
12
- self.icon_emoji = SlackMessaging::Config.slack[:icon_emoji] || ":mailbox_with_mail"
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
14
  options = {
17
- webhook_url: webhook_url,
18
15
  channel: channel,
19
16
  username: username,
20
17
  icon_emoji: icon_emoji,
21
- http_options: { open_timeout: 10 }
18
+ text: text
22
19
  }
23
- ::Slack::Notifier.new(webhook_url, options).ping(text)
20
+
21
+ HTTParty.post(webhook_url, body: options.to_json)
24
22
  end
25
23
  end
26
24
  end
@@ -1,34 +1,10 @@
1
1
  module SlackMessaging
2
2
  class RandomMessage
3
- attr_accessor :text
4
-
5
- MESSAGE_ARRAY = [
6
- "A true friend is someone who thinks that you are a good egg even though he knows that you are slightly cracked.\n--Bernard Meltzer",
7
- "If you can't make it good, at least make it look good.\n--Bill Gates",
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,81 @@
1
+ module SlackMessaging
2
+ class Setup
3
+ def self.execute
4
+ if config_file_exists?
5
+ answer = highline.ask_yes_no("It looks like the #{default_config} file already exists. Do you wish to replace it? (y/n)")
6
+
7
+ unless answer
8
+ puts "\nExiting because you selected to not replace the #{default_config} file..."
9
+ exit
10
+ end
11
+ end
12
+
13
+ create_or_update_config_file(ask_config_questions)
14
+ end
15
+
16
+ private
17
+
18
+ def self.create_or_update_config_file(answers)
19
+ contents = generate_config_file(answers)
20
+ puts "\nCreating or updating your #{default_config} file..."
21
+ File.open(default_config, 'w') { |file| file.puts contents }
22
+ puts "\nDone!"
23
+ end
24
+
25
+ def self.generate_config_file(answers)
26
+ file_contents = ''
27
+ file_contents << "slack:\n"
28
+ file_contents << " channel: #{answers[:channel].tr('#', '').strip}\n"
29
+ file_contents << " username: #{answers[:username].strip}\n"
30
+ file_contents << " webhook_url: #{answers[:webhook_url].strip}\n"
31
+ file_contents << " icon_emoji: '#{answers[:icon_emoji].strip}'"
32
+ file_contents
33
+ end
34
+
35
+ def self.config_file_exists?
36
+ File.exists?(default_config)
37
+ end
38
+
39
+ def self.ask_config_questions
40
+ answers = {}
41
+
42
+ answers[:webhook_url] = ask_question(
43
+ "\nWhat is your Slack webhook URL? If you don't have one yet, please navigate" \
44
+ " to https://api.slack.com/messaging/webhooks to create one, and then come back" \
45
+ " here and paste it in the Terminal."
46
+ )
47
+
48
+ unless answers[:webhook_url]
49
+ puts "\nExiting because Slack webhoook is required..."
50
+ exit
51
+ end
52
+
53
+ answers[:channel] = ask_question(
54
+ "\nWhat slack channel do you wish to post to? (default is \"#general\")"
55
+ ) || 'general'
56
+
57
+ answers[:username] = ask_question(
58
+ "\nWhat slack username do you wish to post as? (default is \"Let's Get Quoty\")"
59
+ ) || "Let's Get Quoty"
60
+
61
+ answers[:icon_emoji] = ask_question(
62
+ "\nWhat emoji would you like to post with (include the colons at the beginning and end of the emoji name)? (default is \":mailbox_with_mail:\")"
63
+ ) || ":mailbox_with_mail:"
64
+
65
+ answers
66
+ end
67
+
68
+ def self.ask_question(prompt)
69
+ answer = highline.ask(prompt)
70
+ answer.empty? ? nil : answer
71
+ end
72
+
73
+ def self.highline
74
+ @highline ||= SlackMessaging::HighlineCli.new
75
+ end
76
+
77
+ def self.default_config
78
+ SlackMessaging::DefaultPaths.config
79
+ end
80
+ end
81
+ end
@@ -1,15 +1,11 @@
1
- require 'highline'
2
-
3
1
  module SlackMessaging
4
2
  class Slack
5
- class << self
6
- attr_accessor :options
7
- end
3
+ attr_accessor :options
8
4
 
9
- def self.execute(args, options=nil)
5
+ def self.execute(args, options = nil)
10
6
  if args.empty?
11
- message = SlackMessaging::RandomMessage.new # generate a new random message
12
- print_message(message.get_text)
7
+ message = SlackMessaging::RandomMessage.acquire_random_quote
8
+ print_message(message)
13
9
  else
14
10
  args.each do |message|
15
11
  print_message(message)
@@ -17,9 +13,10 @@ module SlackMessaging
17
13
  end
18
14
  end
19
15
 
16
+ private
17
+
20
18
  def self.print_message(message)
21
- slack_job = SlackMessaging::NotifySlack.new(message)
22
- slack_job.perform
19
+ SlackMessaging::NotifySlack.new(message).perform
23
20
  end
24
21
  end
25
22
  end
@@ -1,3 +1,3 @@
1
1
  module SlackMessaging
2
- VERSION = "1.3.1"
2
+ VERSION = '2.2.0'
3
3
  end
@@ -1,44 +1,55 @@
1
1
  require 'spec_helper'
2
2
  require 'slack_messaging'
3
3
 
4
- module SlackMessaging
5
- describe Config do
6
-
7
- context "config key methods" do
8
- it "should return nil when not set" do
9
- expect(SlackMessaging::Config.doesnt_exist).to eql(nil)
10
- expect(SlackMessaging::Config.doesnt_exist?).to eql(false)
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
4
+ describe SlackMessaging::Config do
5
+ subject { SlackMessaging::Config }
6
+
7
+ context 'config key methods' do
8
+ it 'should return nil when not set' do
9
+ expect(subject.doesnt_exist).to eql(nil)
10
+ expect(subject.doesnt_exist?).to eql(false)
11
+ end
12
+
13
+ it 'should return the config value when set' do
14
+ config_value = Faker::Lorem.word
15
+ subject.new_value = config_value
16
+ expect(subject.new_value).to eql(config_value)
17
+ end
18
+ end
19
+
20
+ context 'after loading a config file' do
21
+ let(:domain) { Faker::Internet.domain_name }
22
+ let(:sentence) { Faker::Lorem.sentence }
23
+
24
+ let(:config_file) do
25
+ {
26
+ 'domain': domain,
27
+ 'slack': {
28
+ 'slack_option': true,
29
+ 'username': Faker::Name.name,
30
+ 'icon_url': Faker::Internet.url,
31
+ 'channel': Faker::Lorem.word,
32
+ 'webhook': Faker::Internet.url
33
+ }
34
+ }
35
+ end
36
+
37
+ before do
38
+ allow(YAML).to receive(:load_file).and_return(config_file)
39
+ allow(File).to receive(:exist?).and_return(true)
40
+ subject.load(Faker::Lorem.word)
41
+ end
42
+
43
+ it 'calling a method corresponding to a key in the file should return the value' do
44
+ expect(subject.domain).to eql(domain)
45
+ expect(subject.slack).to be_kind_of(Hash)
46
+ expect(subject.slack[:slack_option]).to eql(true)
16
47
  end
17
48
 
18
- context "after loading a config file" do
19
- before do
20
- config_file = {"domain" => "example_domain",
21
- "slack" => {"slack_option" => true,
22
- "username" => "Rspec Tester",
23
- "icon_url" => "http://fake.url",
24
- "channel" => "#test-channel",
25
- "webhook" => "https://slack.web.hook"}}
26
- allow(YAML).to receive(:load_file).and_return(config_file)
27
- allow(File).to receive(:exist?).and_return(true)
28
- SlackMessaging::Config.load("dummy/path")
29
- end
30
-
31
- it "calling a method corresponding to a key in the file should return the value" do
32
- expect(SlackMessaging::Config.domain).to eql("example_domain")
33
- expect(SlackMessaging::Config.slack).to be_kind_of(Hash)
34
- expect(SlackMessaging::Config.slack[:slack_option]).to eql(true)
35
- end
36
-
37
- it "overwriting values should work" do
38
- expect(SlackMessaging::Config.slack).to be_kind_of(Hash)
39
- SlackMessaging::Config.slack = "this is a string now"
40
- expect(SlackMessaging::Config.slack).to eql("this is a string now")
41
- end
49
+ it 'overwriting values should work' do
50
+ expect(subject.slack).to be_kind_of(Hash)
51
+ subject.slack = sentence
52
+ expect(subject.slack).to eql(sentence)
42
53
  end
43
54
  end
44
55
  end
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+ require 'slack_messaging'
3
+
4
+ describe SlackMessaging::HighlineCli do
5
+ let(:response) { double(:response, readline: true, to_i: 3) }
6
+ let(:highline_client) { double(:highline_cli, ask: response) }
7
+
8
+ before do
9
+ allow(HighLine).to receive(:new).and_return(highline_client)
10
+ end
11
+
12
+ describe '#ask' do
13
+ it 'should ask the highline client ask'do
14
+ expect(highline_client).to receive(:ask)
15
+ subject.ask(Faker::Lorem.sentence)
16
+ end
17
+
18
+ it 'should return a string' do
19
+ expect(subject.ask(Faker::Lorem.sentence)).to be_a(String)
20
+ end
21
+ end
22
+
23
+ describe '#ask_yes_no' do
24
+ it 'should ask the highline client ask'do
25
+ expect(highline_client).to receive(:ask)
26
+ subject.ask_yes_no(Faker::Lorem.sentence)
27
+ end
28
+
29
+ it 'should return a boolean' do
30
+ expect(subject.ask_yes_no(Faker::Lorem.sentence)).to be_falsey
31
+ end
32
+
33
+ it 'should return true if we say yes' do
34
+ allow(response).to receive(:to_s).and_return('y')
35
+ expect(subject.ask_yes_no(Faker::Lorem.sentence)).to be_truthy
36
+ end
37
+ end
38
+
39
+ describe '#ask_options' do
40
+ it 'should ask the highline client ask'do
41
+ expect(highline_client).to receive(:ask)
42
+ subject.ask_options(Faker::Lorem.sentence, ['one', 'two', 'three'])
43
+ end
44
+
45
+ it 'should return a string from the options' do
46
+ expect(subject.ask_options(Faker::Lorem.sentence, ['one', 'two', 'three'])).to be_a(String)
47
+ end
48
+ end
49
+ end
@@ -1,34 +1,45 @@
1
1
  require 'spec_helper'
2
2
  require 'slack_messaging'
3
3
 
4
- module SlackMessaging
5
- describe NotifySlack do
6
- before :each do
7
- config_file = {"slack" => {"channel" => "#random-test-channel",
8
- "username" => "Random User",
9
- "webhook_url" => "https://hooks.slack.com/services/totallyrandom/fakewebhookurl",
10
- "icon_emoji" => ":wine_glass:"}
11
- }
12
- allow(YAML).to receive(:load_file).and_return(config_file)
13
- allow(File).to receive(:exist?).and_return(true)
14
- SlackMessaging::Config.load("dummy/path")
15
- 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 }
16
10
 
17
- it 'should ping Slack Notifier' do
18
- notifier = double('notifier', ping: true)
19
- allow(::Slack::Notifier).to receive(:new).and_return(notifier)
20
- expect(notifier).to receive(:ping).and_return(true)
21
- message = NotifySlack.new("Test message")
22
- message.perform
23
- end
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
+ subject { SlackMessaging::NotifySlack }
30
+
31
+ it 'should call HTTParty' do
32
+ expect(HTTParty).to receive(:post)
33
+ message = subject.new(sentence)
34
+ message.perform
35
+ end
24
36
 
25
- it 'should define certain values' do
26
- message = NotifySlack.new("Test message")
27
- expect(message.text).to eq("Test message")
28
- expect(message.channel).to eq("#random-test-channel")
29
- expect(message.username).to eq("Random User")
30
- expect(message.webhook_url).to eq("https://hooks.slack.com/services/totallyrandom/fakewebhookurl")
31
- expect(message.icon_emoji).to eq(":wine_glass:")
32
- end
37
+ it 'should define certain values' do
38
+ message = subject.new(sentence)
39
+ expect(message.text).to eq(sentence)
40
+ expect(message.channel).to eq(channel)
41
+ expect(message.username).to eq(username)
42
+ expect(message.webhook_url).to eq(webhook)
43
+ expect(message.icon_emoji).to eq(emoji)
33
44
  end
34
45
  end
@@ -1,27 +1,45 @@
1
1
  require 'spec_helper'
2
2
  require 'slack_messaging'
3
3
 
4
- module SlackMessaging
5
- describe RandomMessage do
6
-
7
- it "should get a string message" do
8
- message = RandomMessage.new
9
- expect(message.get_text).to be_instance_of(String)
10
- end
11
-
12
- it "should get a message greater than 25 characters" do
13
- message = RandomMessage.new
14
- expect(message.get_text.length).to be >= 50
15
- end
16
-
17
- it "should get a message that includes a new line" do
18
- message = RandomMessage.new
19
- expect(message.get_text.include?("\n")).to eq(true)
20
- end
21
-
22
- it "should get a message that includes a '--'" do
23
- message = RandomMessage.new
24
- expect(message.get_text.include?("--")).to eq(true)
25
- end
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
+ subject { SlackMessaging::RandomMessage }
20
+
21
+ it 'should get a string message' do
22
+ message = subject.acquire_random_quote
23
+ expect(message).to be_instance_of(String)
24
+ end
25
+
26
+ it 'should get a message that includes a newline' do
27
+ message = subject.acquire_random_quote
28
+ expect(message.include?("\n")).to eq(true)
29
+ end
30
+
31
+ it 'should get a message that includes a —' do
32
+ message = subject.acquire_random_quote
33
+ expect(message.include?('—')).to eq(true)
34
+ end
35
+
36
+ it 'should use HTTParty to ping an API' do
37
+ expect(HTTParty).to receive(:get)
38
+ subject.acquire_random_quote
39
+ end
40
+
41
+ it 'should have the JSON parse the response content twice' do
42
+ expect(JSON).to receive(:parse).at_least(2).times.and_return(JSON.parse(quote_json))
43
+ subject.acquire_random_quote
26
44
  end
27
45
  end
@@ -0,0 +1,132 @@
1
+ require 'spec_helper'
2
+ require 'slack_messaging'
3
+
4
+ describe SlackMessaging::Setup do
5
+ let(:response) { double(:response, readline: true, to_s: Faker::Lorem.sentence) }
6
+ let(:highline_cli) { double(:highline_cli, ask: response, ask_yes_no: true) }
7
+ let(:answers) do
8
+ {
9
+ channel: Faker::Lorem.word,
10
+ username: Faker::Lorem.word,
11
+ webhook_url: Faker::Internet.url,
12
+ icon_emoji: ":#{Faker::Lorem.word}:"
13
+ }
14
+ end
15
+
16
+ before do
17
+ allow(SlackMessaging::HighlineCli).to receive(:new).and_return(highline_cli)
18
+ allow(subject).to receive(:puts)
19
+ end
20
+
21
+ after do
22
+ SlackMessaging::Setup.instance_variable_set("@highline", nil)
23
+ end
24
+
25
+ subject { SlackMessaging::Setup }
26
+
27
+ describe '#self.execute' do
28
+ it 'should ask a question if the config file exists' do
29
+ allow(File).to receive(:exists?).and_return(true)
30
+ expect(highline_cli).to receive(:ask_yes_no).and_return(true)
31
+ allow(subject).to receive(:create_or_update_config_file).and_return(true)
32
+ allow(subject).to receive(:ask_config_questions).and_return(true)
33
+ subject.execute
34
+ end
35
+
36
+ it 'should call to create or update the config file' do
37
+ allow(File).to receive(:exists?).and_return(true)
38
+ allow(highline_cli).to receive(:ask_yes_no).and_return(true)
39
+ expect(subject).to receive(:create_or_update_config_file).and_return(true)
40
+ expect(subject).to receive(:ask_config_questions).and_return(true)
41
+ subject.execute
42
+ end
43
+
44
+ it 'should exit if the user opts not to continue' do
45
+ allow(File).to receive(:exists?).and_return(true)
46
+ allow(highline_cli).to receive(:ask_yes_no).and_return(false)
47
+ expect(subject).not_to receive(:create_or_update_config_file)
48
+ expect(subject).not_to receive(:ask_config_questions)
49
+ expect{ subject.execute }.to raise_error(SystemExit)
50
+ end
51
+ end
52
+
53
+ describe '#self.create_or_update_config_file' do
54
+ it 'should generate the file based on the answers to the questions' do
55
+ expect(subject).to receive(:generate_config_file)
56
+ allow(File).to receive(:open).and_return(nil)
57
+ subject.send(:create_or_update_config_file, answers)
58
+ end
59
+
60
+ it 'should open the file for writing' do
61
+ allow(subject).to receive(:generate_config_file)
62
+ expect(File).to receive(:open).and_return(nil)
63
+ subject.send(:create_or_update_config_file, answers)
64
+ end
65
+ end
66
+
67
+ describe '#self.generate_config_file' do
68
+ it 'returns a string' do
69
+ expect(subject.send(:generate_config_file, answers)).to be_a(String)
70
+ end
71
+ end
72
+
73
+ describe '#self.config_file_exists?' do
74
+ it 'should return true if the file exists' do
75
+ allow(File).to receive(:exists?).and_return(true)
76
+ expect(subject.send(:config_file_exists?)).to eq(true)
77
+ end
78
+
79
+ it 'should return false if the file does not exist' do
80
+ allow(File).to receive(:exists?).and_return(false)
81
+ expect(subject.send(:config_file_exists?)).to eq(false)
82
+ end
83
+ end
84
+
85
+ describe '#self.ask_question' do
86
+ it 'should use highline to ask a question' do
87
+ expect(highline_cli).to receive(:ask).and_return('')
88
+ subject.send(:ask_question, Faker::Lorem.sentence)
89
+ end
90
+
91
+ it 'should return nil if the highline client gets an empty string' do
92
+ allow(highline_cli).to receive(:ask).and_return('')
93
+ expect(subject.send(:ask_question, Faker::Lorem.sentence)).to be_nil
94
+ end
95
+
96
+ it 'should return the answer if it is given' do
97
+ answer = Faker::Lorem.sentence
98
+ allow(highline_cli).to receive(:ask).and_return(answer)
99
+ expect(subject.send(:ask_question, Faker::Lorem.sentence)).to be(answer)
100
+ end
101
+ end
102
+
103
+ describe '#self.ask_config_questions' do
104
+ it 'should call to ask at least four questions' do
105
+ expect(subject).to receive(:ask_question).at_least(4).times
106
+ subject.send(:ask_config_questions)
107
+ end
108
+
109
+ it 'should exit if the slack URL is not given' do
110
+ allow(subject).to receive(:ask_question).and_return(nil)
111
+ expect{ subject.send(:ask_config_questions) }.to raise_error(SystemExit)
112
+ end
113
+
114
+ it 'should return the defaults if nothing is given' do
115
+ slack_url = Faker::Internet.url
116
+ allow(subject).to receive(:ask_question).with(
117
+ "\nWhat is your Slack webhook URL? If you don't have one yet, please navigate" \
118
+ " to https://api.slack.com/messaging/webhooks to create one, and then come back" \
119
+ " here and paste it in the Terminal."
120
+ ).and_return(slack_url)
121
+ allow(subject).to receive(:ask_question).and_return(nil)
122
+ expect(subject.send(:ask_config_questions)).to eq(
123
+ {
124
+ channel: 'general',
125
+ username: "Let's Get Quoty",
126
+ webhook_url: slack_url,
127
+ icon_emoji: ":mailbox_with_mail:"
128
+ }
129
+ )
130
+ end
131
+ end
132
+ 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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack_messaging
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 2.2.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: 2020-10-02 00:00:00.000000000 Z
11
+ date: 2021-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -66,6 +66,34 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '2.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: httparty
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.18'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::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: slack-notifier
112
+ name: bundler
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
115
  - - "~>"
88
116
  - !ruby/object:Gem::Version
89
- version: 1.5.1
90
- type: :runtime
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: 1.5.1
124
+ version: '2.2'
97
125
  - !ruby/object:Gem::Dependency
98
- name: bundler
126
+ name: faker
99
127
  requirement: !ruby/object:Gem::Requirement
100
128
  requirements:
101
129
  - - "~>"
102
130
  - !ruby/object:Gem::Version
103
- version: '2.1'
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.1'
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,7 +194,6 @@ 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: []
@@ -162,22 +203,26 @@ files:
162
203
  - Gemfile.lock
163
204
  - Guardfile
164
205
  - LICENSE
165
- - OutputFile.png
206
+ - QuoteExample.png
166
207
  - README.md
167
208
  - Rakefile
168
209
  - bin/slack-messaging
169
210
  - lib/slack_messaging.rb
170
211
  - lib/slack_messaging/config.rb
212
+ - lib/slack_messaging/default_paths.rb
213
+ - lib/slack_messaging/highline_cli.rb
171
214
  - lib/slack_messaging/notify_slack.rb
172
- - lib/slack_messaging/output.rb
173
215
  - lib/slack_messaging/random_message.rb
216
+ - lib/slack_messaging/setup.rb
174
217
  - lib/slack_messaging/slack.rb
175
218
  - lib/slack_messaging/version.rb
176
219
  - spec/slack_messaging/config_spec.rb
220
+ - spec/slack_messaging/highline_cli_spec.rb
177
221
  - spec/slack_messaging/notify_slack_spec.rb
178
222
  - spec/slack_messaging/random_message_spec.rb
223
+ - spec/slack_messaging/setup_spec.rb
179
224
  - spec/spec_helper.rb
180
- homepage: https://github.com/emmasax4/slack_messaging
225
+ homepage: https://github.com/emmahsax/slack_messaging
181
226
  licenses:
182
227
  - MIT
183
228
  metadata: {}
@@ -196,12 +241,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
241
  - !ruby/object:Gem::Version
197
242
  version: '0'
198
243
  requirements: []
199
- rubygems_version: 3.1.2
244
+ rubygems_version: 3.2.3
200
245
  signing_key:
201
246
  specification_version: 4
202
247
  summary: Personalized Slack Messages
203
248
  test_files:
204
249
  - spec/spec_helper.rb
205
250
  - spec/slack_messaging/config_spec.rb
206
- - spec/slack_messaging/random_message_spec.rb
251
+ - spec/slack_messaging/highline_cli_spec.rb
207
252
  - spec/slack_messaging/notify_slack_spec.rb
253
+ - spec/slack_messaging/random_message_spec.rb
254
+ - spec/slack_messaging/setup_spec.rb
data/OutputFile.png DELETED
Binary file
@@ -1,13 +0,0 @@
1
- require 'highline'
2
-
3
- module SlackMessaging
4
- module Output
5
- def self.terminal
6
- @terminal ||= HighLine.new
7
- end
8
-
9
- def self.ask(*args, &block)
10
- terminal.ask(*args, &block)
11
- end
12
- end
13
- end