lib/gemfury.rb in gemfury-0.12.1 vs lib/gemfury.rb in gemfury-0.13.0.beta1
- old
+ new
@@ -1,19 +1,19 @@
-gem "multi_json", "~> 1.10"
-gem "netrc", ">= 0.10.0", "< 0.12.0.pre"
-gem "faraday", ">= 0.9.0", begin
- is_new = Gem::Dependency.new('ruby', '>= 2.3.0')
- is_new = is_new.match?('ruby', RUBY_VERSION)
- is_new ? "< 2.0.0.pre" : "< 1.5.0.pre"
-end
+# frozen_string_literal: true
+gem 'multi_json', '~> 1.10'
+gem 'netrc', '>= 0.10.0', '< 0.12.0.pre'
+gem 'faraday', '>= 2.0.0', '< 3.0.0.pre'
+gem 'faraday-multipart', '>= 1.0.0', '< 2.0.0.pre'
+
require 'time'
require 'cgi'
require 'uri'
require 'netrc'
require 'multi_json'
require 'faraday'
+require 'faraday/multipart'
require 'faraday/adapter/fury_http'
require 'faraday/request/multipart_with_file'
require 'gemfury/version'
require 'gemfury/const'
@@ -31,11 +31,11 @@
class << self
# Alias for Gemfury::Client.new
#
# @return [Gemfury::Client]
- def new(options={})
+ def new(options = {})
Gemfury::Client.new(options)
end
# Convenience method to allow configuration options to be set in a block
def configure
@@ -43,13 +43,12 @@
end
# Create a hash of options and their values
# @return [Hash] the options and their values
def options
- VALID_OPTIONS_KEYS.inject({}) do |options, k|
+ VALID_OPTIONS_KEYS.each_with_object({}) do |k, options|
options[k] = send(k)
- options
end
end
# Reset all configuration options to defaults
# @return [Configuration] The default configuration
@@ -59,25 +58,25 @@
end
# Delegate to Gemfury::Client
def method_missing(method, *args, &block)
return super unless new.respond_to?(method)
+
new.send(method, *args, &block)
end
def respond_to?(method, include_private = false)
new.respond_to?(method, include_private) || super(method, include_private)
end
-
end
end
# Initialize configuration
Gemfury.reset
# Polyfill #dig for Ruby 2.2 and earlier
class Hash
- unless self.instance_methods.include?(:dig)
+ unless instance_methods.include?(:dig)
def dig(*parts)
parts.inject(self) do |hash, part|
hash.is_a?(Hash) ? hash[part] : nil
end
end