Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support more channels #33

Merged
merged 1 commit into from
Jan 26, 2018

Conversation

Scuottolinx
Copy link

I have adde the feature requested in the issue #32.
Now it's possible send notification in more channels.

README.md Outdated
set :slack_channel, '#devops'
set :slack_channel, '#devops'
# it's possible usage more channel with comma separated
# set :slack_channel, '#devops,#other-channel'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Scuottolinx thanks for pull request! Could we be more explicit here and accept an array of strings rather than splitting a single string? So something like:

set :slack_channel, ['#devops', '#other-channel']

This would mean we would need to make use of Array(fetch(:slack_channel)).each in the cap task itself to ensure that the current set :slack_channel, '#devops' continues to work, but it would avoid any unexpected behaviour from splitting a string such as '#devops, #other-channel'

fetch(:slack_url)
fetch(:slack_channel).split(',').each {|channel|
pay = Slackify::Payload.new(self, :starting)
pay.channel = (channel)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're going to pass the channel value into the Payload instance, would it be preferable to pass it as another argument on the initializer? Or alternatively as an argument to build?

@Scuottolinx
Copy link
Author

hi, i have modified

@seenmyfate seenmyfate self-assigned this Jan 22, 2018
@JellyBellyDev
Copy link

ping please!

@@ -41,12 +41,18 @@ module Slackify

let(:text) { context.fetch(:slack_text) }

let(:builded_payload) {
Payload.build(context, :success)
def buildedPayload(channel)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please revert the test changes here and instead just add the channel variable to Payload.build to match the interface changes? We don't need to iterate over Array(context.fetch(:slack_channel)) here in the test, as we're only passing a single channel to Payload for each iteration.

@seenmyfate
Copy link
Contributor

Great thanks for that, I'll do some testing and if all is well, I'll try to get this merged later on today 👍

fetch(:slack_url)
Array(fetch(:slack_channel)).each {|channel|
execute :curl, '-X POST', '-s', '--data-urlencode',
Slackify::Payload.new(self, :starting, channel),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, one more thing brought up during test - this should be calling build instead of new

@paulingham paulingham merged commit 6f420ba into craigbrad:master Jan 26, 2018
@seenmyfate
Copy link
Contributor

@Scuottolinx thanks for that, now available via Rubygems as v2.10.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants