slack_messaging 3.1.1 → 3.1.2

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: 12ec2e4beafc03f085a3a1752070bce7e030cd02e1e57378229400f39a2284ee
4
- data.tar.gz: f6c4e26dcb8799058f144e24aee9ddf1d4f2f05c0b91deba9f19d5cd1d414303
3
+ metadata.gz: a73075c6e11593cc450ed0822939778510aadbe4b76ca4f2a7d8174a7592b1af
4
+ data.tar.gz: 50a35bda4778b110200d3ad8ada3f353b2df4b342ecec91286a8fc993907f6db
5
5
  SHA512:
6
- metadata.gz: c3dff63c5569a13e0a713b2e34ca6ef7f22a7ce858523bee5a8483b59b8c17d7053302e3a0f25a670b2ff3ce794f8bd1aef25500e2766594e51b2f35d12ad8ea
7
- data.tar.gz: 41dc15d6314e4ae1721b2e26163b1e4d6f006f9c7ae6ed93d5ff394b29e98f6399e16f604515eefa54663cb6328356fd31843d6da5228bdf92173889b0380c98
6
+ metadata.gz: 5766b459a88ced1e95b8ef00a52d09cac308503ca009ec9a8484e6a05ba50a255f49d74368d7c1104da3ab85d6705f6e25b98cf06dc98916dfb53f7d9cf685ad
7
+ data.tar.gz: ba98335745cffc5f902f8b72a6f3bdc2eca626868d18f48aba876d164509afb6eb3ac5175b577fefde47bcb0dd76981172e61c8987f457b8a30e34e97e3158ae
data/Gemfile CHANGED
@@ -2,5 +2,4 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- # Specify your gem's dependencies in slack_messaging.gemspec
6
5
  gemspec
data/Gemfile.lock CHANGED
@@ -1,11 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- slack_messaging (3.1.0)
4
+ slack_messaging (3.1.2)
5
5
  activesupport (~> 6.0)
6
6
  gli (~> 2.10)
7
7
  hashie (~> 4.1)
8
- highline_wrapper (~> 1.0)
8
+ highline_wrapper (~> 1.1)
9
9
  httparty (~> 0.18)
10
10
  json (~> 2.5)
11
11
  rack (~> 2.2)
@@ -25,7 +25,7 @@ GEM
25
25
  diff-lcs (1.4.4)
26
26
  faker (2.16.0)
27
27
  i18n (>= 1.6, < 2)
28
- ffi (1.14.2)
28
+ ffi (1.15.0)
29
29
  formatador (0.2.5)
30
30
  gli (2.20.0)
31
31
  guard (2.16.2)
@@ -44,7 +44,7 @@ GEM
44
44
  rspec (>= 2.99.0, < 4.0)
45
45
  hashie (4.1.0)
46
46
  highline (2.0.3)
47
- highline_wrapper (1.0.0)
47
+ highline_wrapper (1.1.0)
48
48
  highline (~> 2.0)
49
49
  httparty (0.18.1)
50
50
  mime-types (~> 3.0)
@@ -126,4 +126,4 @@ DEPENDENCIES
126
126
  slack_messaging!
127
127
 
128
128
  BUNDLED WITH
129
- 2.2.4
129
+ 2.2.14
@@ -22,7 +22,7 @@ module SlackMessaging
22
22
  contents = generate_config_file(answers)
23
23
  puts "Creating or updating your #{default_config} file..."
24
24
  File.open(default_config, 'w') { |file| file.puts contents }
25
- puts "\nDone!"
25
+ puts 'Done!'
26
26
  end
27
27
 
28
28
  private def generate_config_file(answers)
@@ -47,29 +47,32 @@ module SlackMessaging
47
47
  "What is your Slack webhook URL? If you don't have one yet, please navigate" \
48
48
  ' to https://api.slack.com/messaging/webhooks to create one, and then come back' \
49
49
  ' here and paste it in the Terminal.',
50
+ nil,
50
51
  required: true
51
52
  )
52
53
 
53
54
  answers[:channel] = ask_question(
54
- 'What slack channel do you wish to post to? (default is "#general")'
55
- ) || 'general'
55
+ 'What slack channel do you wish to post to? (default is "#general")',
56
+ '#general'
57
+ )
56
58
 
57
59
  answers[:username] = ask_question(
58
- "What slack username do you wish to post as? (default is \"Let's Get Quoty\")"
59
- ) || "Let's Get Quoty"
60
+ "What slack username do you wish to post as? (default is \"Let's Get Quoty\")",
61
+ "Let's Get Quoty"
62
+ )
60
63
 
61
64
  answers[:icon_emoji] = ask_question(
62
65
  'What emoji would you like to post with (include the colons at the beginning and end' \
63
- ' of the emoji name)? (default is ":mailbox_with_mail:")'
64
- ) || ':mailbox_with_mail:'
66
+ ' of the emoji name)? (default is ":mailbox_with_mail:")',
67
+ ':mailbox_with_mail:'
68
+ )
65
69
 
66
70
  answers
67
71
  end
68
72
  # rubocop:enable Metrics/MethodLength
69
73
 
70
- private def ask_question(prompt, required: false)
71
- answer = highline.ask(prompt, { required: required })
72
- answer.empty? ? nil : answer
74
+ private def ask_question(prompt, default, required: false)
75
+ highline.ask(prompt, { default: default, required: required })
73
76
  end
74
77
 
75
78
  private def highline
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SlackMessaging
4
- VERSION = '3.1.1'
4
+ VERSION = '3.1.2'
5
5
  end
@@ -88,18 +88,18 @@ describe SlackMessaging::Setup do
88
88
  describe '#self.ask_question' do
89
89
  it 'should use highline to ask a question' do
90
90
  expect(highline_wrapper).to receive(:ask).and_return('')
91
- subject.send(:ask_question, Faker::Lorem.sentence)
91
+ subject.send(:ask_question, Faker::Lorem.sentence, nil)
92
92
  end
93
93
 
94
94
  it 'should return nil if the highline client gets an empty string' do
95
- allow(highline_wrapper).to receive(:ask).and_return('')
96
- expect(subject.send(:ask_question, Faker::Lorem.sentence)).to be_nil
95
+ allow(highline_wrapper).to receive(:ask).and_return(nil)
96
+ expect(subject.send(:ask_question, Faker::Lorem.sentence, nil)).to be_nil
97
97
  end
98
98
 
99
99
  it 'should return the answer if it is given' do
100
100
  answer = Faker::Lorem.sentence
101
101
  allow(highline_wrapper).to receive(:ask).and_return(answer)
102
- expect(subject.send(:ask_question, Faker::Lorem.sentence)).to be(answer)
102
+ expect(subject.send(:ask_question, Faker::Lorem.sentence, :default)).to be(answer)
103
103
  end
104
104
  end
105
105
 
@@ -119,17 +119,21 @@ describe SlackMessaging::Setup do
119
119
  }
120
120
  allow(subject).to receive(:ask_question).with(
121
121
  "What is your Slack webhook URL? If you don't have one yet, please navigate to https://api.slack.com/messaging/webhooks to create one, and then come back here and paste it in the Terminal.",
122
+ nil,
122
123
  required: true
123
124
  ).and_return(slack_url)
124
125
  allow(subject).to receive(:ask_question).with(
125
- 'What slack channel do you wish to post to? (default is "#general")'
126
- ).and_return(nil)
126
+ 'What slack channel do you wish to post to? (default is "#general")',
127
+ '#general'
128
+ ).and_return('general')
127
129
  allow(subject).to receive(:ask_question).with(
128
- "What slack username do you wish to post as? (default is \"Let's Get Quoty\")"
129
- ).and_return(nil)
130
+ "What slack username do you wish to post as? (default is \"Let's Get Quoty\")",
131
+ "Let's Get Quoty"
132
+ ).and_return("Let's Get Quoty")
130
133
  allow(subject).to receive(:ask_question).with(
131
- 'What emoji would you like to post with (include the colons at the beginning and end of the emoji name)? (default is ":mailbox_with_mail:")'
132
- ).and_return(nil)
134
+ 'What emoji would you like to post with (include the colons at the beginning and end of the emoji name)? (default is ":mailbox_with_mail:")',
135
+ ':mailbox_with_mail:'
136
+ ).and_return(':mailbox_with_mail:')
133
137
  expect(subject.send(:ask_config_questions)).to eq(defaults)
134
138
  end
135
139
  end
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: 3.1.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emma Sax
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-04 00:00:00.000000000 Z
11
+ date: 2021-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.0'
61
+ version: '1.1'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.0'
68
+ version: '1.1'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: httparty
71
71
  requirement: !ruby/object:Gem::Requirement