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

Fix to support windows #164

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2017-04-30 12:02:22 -0400 using RuboCop version 0.35.0.
# on 2017-09-13 09:10:02 +0200 using RuboCop version 0.35.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
# versions of RuboCop, may require this file to be generated again.

# Offense count: 3
# Offense count: 4
Lint/HandleExceptions:
Exclude:
- 'lib/slack-ruby-client.rb'
Expand All @@ -20,7 +20,7 @@ Lint/UnusedBlockArgument:
Exclude:
- 'lib/slack/messages/formatting.rb'

# Offense count: 14
# Offense count: 15
Metrics/AbcSize:
Max: 44

Expand All @@ -29,25 +29,25 @@ Metrics/AbcSize:
Metrics/ClassLength:
Max: 165

# Offense count: 3
# Offense count: 4
Metrics/CyclomaticComplexity:
Max: 9

# Offense count: 720
# Offense count: 615
# Configuration parameters: AllowURI, URISchemes.
Metrics/LineLength:
Max: 288
Max: 266

# Offense count: 7
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 32

# Offense count: 2
# Offense count: 3
Metrics/PerceivedComplexity:
Max: 11

# Offense count: 59
# Offense count: 63
# Configuration parameters: Exclude.
Style/Documentation:
Enabled: false
Expand All @@ -58,12 +58,12 @@ Style/FileName:
Exclude:
- 'lib/slack-ruby-client.rb'

# Offense count: 116
# Offense count: 120
# Configuration parameters: AllowedVariables.
Style/GlobalVars:
Enabled: false

# Offense count: 21
# Offense count: 22
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/MethodName:
Enabled: false
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### 0.9.2 (Next)

* [#163](https://github.com/slack-ruby/slack-ruby-client/pull/164): Use `OpenSSL::X509::DEFAULT_CERT_DIR` and `OpenSSL::X509::DEFAULT_CERT_FILE` for default ca_cert and ca_file - [@leifcr](https://github.com/leifcr).
* [#161](https://github.com/slack-ruby/slack-ruby-client/pull/161): Added support for cursor pagination - [@dblock](https://github.com/dblock).
* Your contribution here.

Expand Down
5 changes: 5 additions & 0 deletions lib/slack-ruby-client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
rescue LoadError
# ignore, only used in users_search
end
begin
require 'openssl'
rescue LoadError
# Used in slack/web/config
end
require_relative 'slack/web/config'
require_relative 'slack/web/api/errors/slack_error'
require_relative 'slack/web/api/errors/too_many_requests_error'
Expand Down
4 changes: 2 additions & 2 deletions lib/slack/web/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ module Config
def reset
self.endpoint = 'https://slack.com/api/'
self.user_agent = "Slack Ruby Client/#{Slack::VERSION}"
self.ca_path = `openssl version -a | grep OPENSSLDIR | awk '{print $2}'|sed -e 's/\"//g'`
self.ca_file = "#{ca_path}/ca-certificates.crt"
self.ca_path = defined?(OpenSSL) ? OpenSSL::X509::DEFAULT_CERT_DIR : nil
self.ca_file = defined?(OpenSSL) ? OpenSSL::X509::DEFAULT_CERT_FILE : nil
self.token = nil
self.proxy = nil
self.logger = nil
Expand Down
2 changes: 1 addition & 1 deletion lib/slack/web/faraday/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def connection

options[:headers]['User-Agent'] = user_agent if user_agent
options[:proxy] = proxy if proxy
options[:ssl] = { ca_path: ca_path, ca_file: ca_file }
options[:ssl] = { ca_path: ca_path, ca_file: ca_file } if ca_path || ca_file

request_options = {}
request_options[:timeout] = timeout if timeout
Expand Down