-
-
Notifications
You must be signed in to change notification settings - Fork 219
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
Remove activesupport dependency #325
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am open to this. See minor comments + there needs to be an UPGRADING entry as someone might be bringing in AS via this gem, and a major version bump.
lib/tasks/web.rake
Outdated
|
||
namespace :slack do | ||
namespace :web do | ||
namespace :api do | ||
desc 'Update Web API.' | ||
task update: [:git_update] do | ||
require 'active_support' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be a developement dependency for this, otherwise the task will fail anyway without the gem installed separately. Also, maybe code can be fixed not to need it either?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since I don't know what this task is supposed to do, I do not feel comfortable refactoring it. But I will make it a development dependency 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should give it a shot. It updates the web API from its reference, and shouldn't need AS either. As long as you can run it and it succeeds and produces no diff, we're good.
@@ -2,10 +2,6 @@ | |||
module Slack | |||
module Messages | |||
class Message < Hashie::Mash | |||
def presence |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an actual Slack field. Aren't we breaking an API here? Should have had tests for it though either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked this a few times, and all the specs are indeed passing, and behavior seems correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're missing a spec. This overrides Object#presence, so when there's a presence
field in the result you get its value and not the return of that object. Either way, why remove it? I think you should put this code back, and if you care write a spec or open an issue and I will get to it.
@ianks Want to finish this? |
94ba04d
to
987ad2a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am still uncomfortable with the presence changes and I think you should fix the update task so we can really get rid of AS.
@@ -2,10 +2,6 @@ | |||
module Slack | |||
module Messages | |||
class Message < Hashie::Mash | |||
def presence |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're missing a spec. This overrides Object#presence, so when there's a presence
field in the result you get its value and not the return of that object. Either way, why remove it? I think you should put this code back, and if you care write a spec or open an issue and I will get to it.
@@ -32,14 +32,14 @@ def each | |||
|
|||
client.logger.debug("#{self.class}##{__method__}") { e.to_s } | |||
retry_count += 1 | |||
sleep(e.retry_after.seconds) | |||
sleep(e.retry_after) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did the type of retry_after
change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
retry_after
is an integer, so calling .seconds
was effectively a no-op.
lib/tasks/web.rake
Outdated
|
||
namespace :slack do | ||
namespace :web do | ||
namespace :api do | ||
desc 'Update Web API.' | ||
task update: [:git_update] do | ||
require 'active_support' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should give it a shot. It updates the web API from its reference, and shouldn't need AS either. As long as you can run it and it succeeds and produces no diff, we're good.
UPGRADING.md
Outdated
|
||
See [#325](https://github.com/slack-ruby/slack-ruby-client/pull/325) for more information. | ||
|
||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bad copy-paste?
@dblock All specs pass without the Depending on the context, things break. Could you could clone down to take a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dblock All specs pass without the
presence
method, but when I attempt to define it myself, I cannot get the specs to pass regardless of whether I use:presence
or'presence'
.Object#presence
is an ActiveSupport method, FWIW
OK, I get it, this is why we put it here, to override the behavior that AS was bringing
@@ -1,6 +1,19 @@ | |||
Upgrading Slack-Ruby-Client | |||
=========================== | |||
|
|||
### Upgrading to >= 0.16.0 | |||
|
|||
As of 0.16.0, we no longer depend on `activesupport` as a dependency. This means that if you were relying on `activesupport` functionality unintentionally, certain things in you code may break. To fix this, you have two options: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's say this simpler
As of 0.16.0 slack-ruby-client
no longer requires activesupport
. If you are using activesupport, add gem 'activesupport' to your Gemfile.
.
|
||
As of 0.16.0, we no longer depend on `activesupport` as a dependency. This means that if you were relying on `activesupport` functionality unintentionally, certain things in you code may break. To fix this, you have two options: | ||
|
||
1. Update your code to use pure Ruby, without ActiveSupport methods (*recommended*). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really none of our business in this library :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good with this. Can you please use my shorter suggested UPGRADING note and I'll merge. Feel free to squash too.
@@ -1,5 +1,7 @@ | |||
### 0.15.0 (Next) | |||
|
|||
* [#325](https://github.com/slack-ruby/slack-ruby-client/pull/325): Remove activesupport dependency - [@ianks](https://github.com/ianks). | |||
* [#326](https://github.com/slack-ruby/slack-ruby-client/pull/326): Update new methods - [@wasabigeek](https://github.com/wasabigeek). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be in this PR. remove and rebase.
@@ -1,6 +1,19 @@ | |||
Upgrading Slack-Ruby-Client | |||
=========================== | |||
|
|||
### Upgrading to >= 0.16.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be 0.15.0 AFAIK, not 0.16.0.
Merged via 7494411 |
For non-rails shops, depending on AS can be a non-starter. Luckily, this gem only relied on two small AS features from what I can tell:
class_attribute
,String#blank?
and one occasion ofActiveSupport#HashWithIndifferentAccess
. It was easy to adjust and as a result, it should be easier to adopt.Thank you for this gem, our team is very excited to start using it!