Skip to content

Commit

Permalink
Remove ActiveSupport dependency.
Browse files Browse the repository at this point in the history
  • Loading branch information
ianks authored and dblock committed Jun 29, 2020
1 parent 5da44ae commit 0d0514f
Show file tree
Hide file tree
Showing 15 changed files with 23 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Metrics/BlockLength:
Metrics/ClassLength:
Max: 250
Metrics/LineLength:
Max: 100
Max: 128
Style/Documentation:
Enabled: false
Style/ModuleFunction:
Expand Down
4 changes: 2 additions & 2 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2020-06-22 23:35:07 +0800 using RuboCop version 0.82.0.
# on 2020-06-29 08:44:31 -0400 using RuboCop version 0.82.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down Expand Up @@ -30,7 +30,7 @@ Lint/SuppressedException:
Metrics/AbcSize:
Max: 39

# Offense count: 1
# Offense count: 2
# Configuration parameters: IgnoredMethods.
Metrics/CyclomaticComplexity:
Max: 9
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* [#324](https://github.com/slack-ruby/slack-ruby-client/pull/324): Upgrade slack-ruby-danger, rubocop, rubocop-rspec and rubocop-performance - [@dblock](https://github.com/dblock).
* [#327](https://github.com/slack-ruby/slack-ruby-client/pull/327), [#326](https://github.com/slack-ruby/slack-ruby-client/pull/326): Added `admin_conversations_whitelist`, `admin_usergroups`, `calls` and `calls_participants` endpoints - [@wasabigeek](https://github.com/wasabigeek).
* [#329](https://github.com/slack-ruby/slack-ruby-client/pull/329): Log when methods are deprecated - [@wasabigeek](https://github.com/wasabigeek).
* [#325](https://github.com/slack-ruby/slack-ruby-client/pull/325): Remove activesupport dependency - [@ianks](https://github.com/ianks).
* Your contribution here.

### 0.14.6 (2020/3/28)
Expand Down
6 changes: 6 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Upgrading Slack-Ruby-Client
===========================

### Upgrading to >= 0.15.0

As of 0.15.0, `activesupport` is no longer required. Add `gem 'activesupport'` to your Gemfile if you required ActiveSupport via this library.

See [#325](https://github.com/slack-ruby/slack-ruby-client/pull/325) for more information.

### Upgrading to >= 0.14.0

If you are using async-websocket, lock down its version to 0.8.0 as newer versions are currently incompatible.
Expand Down
2 changes: 0 additions & 2 deletions lib/slack-ruby-client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
require_relative 'slack/web/client'

# RealTime API
require 'active_support'
require 'active_support/core_ext'
require_relative 'slack/real_time/concurrency'
require_relative 'slack/real_time/socket'
require_relative 'slack/real_time/api/message_id'
Expand Down
4 changes: 0 additions & 4 deletions lib/slack/messages/message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
module Slack
module Messages
class Message < Hashie::Mash
def presence
super['presence']
end

def to_s
keys.sort_by(&:to_s).map do |key|
"#{key}=#{self[key]}"
Expand Down
4 changes: 1 addition & 3 deletions lib/slack/real_time/concurrency/async.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ def build_ssl_context

def build_endpoint
endpoint = ::Async::IO::Endpoint.tcp(addr, port)
if secure?
endpoint = ::Async::IO::SSLEndpoint.new(endpoint, ssl_context: build_ssl_context)
end
endpoint = ::Async::IO::SSLEndpoint.new(endpoint, ssl_context: build_ssl_context) if secure?
endpoint
end

Expand Down
6 changes: 3 additions & 3 deletions lib/slack/real_time/concurrency/eventmachine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ module Concurrency
module Eventmachine
class Client < Faye::WebSocket::Client
def initialize(url, protocols = nil, options = {})
@logger =
options.fetch(:logger) || Slack::RealTime::Config.logger || Slack::Config.logger
super url, protocols, options.except(:logger)
options = options.dup
@logger = options.delete(:logger) || Slack::RealTime::Config.logger || Slack::Config.logger
super url, protocols, options
end

def parse(data)
Expand Down
4 changes: 0 additions & 4 deletions lib/slack/real_time/models/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ module Slack
module RealTime
module Models
class Base < Hashie::Mash
def presence
super['presence']
end

# see https://github.com/intridea/hashie/issues/394
def log_built_in_message(*); end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/slack/real_time/socket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ class Socket

def initialize(url, options = {})
@url = url
@options = options
@options = options.dup
@driver = nil
@logger = options.delete(:logger) || Slack::RealTime::Config.logger || Slack::Config.logger
@logger = @options.delete(:logger) || Slack::RealTime::Config.logger || Slack::Config.logger
@last_message_at = nil
end

Expand Down
4 changes: 3 additions & 1 deletion lib/slack/real_time/stores/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ module RealTime
module Stores
# Doesn't store anything.
class Base
class_attribute :events
class << self
attr_accessor :events
end

attr_accessor :users
attr_accessor :bots
Expand Down
4 changes: 1 addition & 3 deletions lib/slack/web/api/mixins/ids.id.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ def id_for(key, name, prefix, list_method, not_found_error)

yield.tap do |list|
list.public_send(list_method).each do |li|
if li.name == name[1..-1]
return Slack::Messages::Message.new('ok' => true, key.to_s => { 'id' => li.id })
end
return Slack::Messages::Message.new('ok' => true, key.to_s => { 'id' => li.id }) if li.name == name[1..-1]
end
end

Expand Down
4 changes: 2 additions & 2 deletions lib/slack/web/pagination/cursor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
next
end
yield response
break unless response.response_metadata

next_cursor = response.response_metadata.next_cursor
break if next_cursor.blank?
break if next_cursor.nil? || next_cursor == ''

retry_count = 0
sleep(sleep_interval) if sleep_interval
Expand Down
2 changes: 0 additions & 2 deletions lib/tasks/web.rake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# largely from https://github.com/aki017/slack-ruby-gem
require 'json-schema'
require 'erubis'
require 'active_support'
require 'active_support/core_ext'

namespace :slack do
namespace :web do
Expand Down
2 changes: 1 addition & 1 deletion slack-ruby-client.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ Gem::Specification.new do |s|
s.homepage = 'http://github.com/slack-ruby/slack-ruby-client'
s.licenses = ['MIT']
s.summary = 'Slack Web and RealTime API client.'
s.add_dependency 'activesupport'
s.add_dependency 'faraday', '>= 1.0'
s.add_dependency 'faraday_middleware'
s.add_dependency 'gli'
s.add_dependency 'hashie'
s.add_dependency 'websocket-driver'
s.add_development_dependency 'activesupport'
s.add_development_dependency 'erubis'
s.add_development_dependency 'json-schema'
s.add_development_dependency 'rake', '~> 10'
Expand Down

0 comments on commit 0d0514f

Please sign in to comment.