From 03fca7b8d10857c306ac18ad61faf312c32e7fcb Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Wed, 17 Sep 2014 14:32:07 +0000 Subject: [PATCH 01/13] remove version from test . --- spec/google/api_client_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/google/api_client_spec.rb b/spec/google/api_client_spec.rb index 88c2cf63a..4944bb958 100644 --- a/spec/google/api_client_spec.rb +++ b/spec/google/api_client_spec.rb @@ -17,7 +17,6 @@ require 'spec_helper' require 'faraday' require 'signet/oauth_1/client' require 'google/api_client' -require 'google/api_client/version' shared_examples_for 'configurable user agent' do include ConnectionHelpers From d1bbe8cf9458a1ca62f4f10502be05eb243affad Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Wed, 17 Sep 2014 14:45:01 +0000 Subject: [PATCH 02/13] File is being deleted before each test anyway --- spec/google/api_client/simple_file_store_spec.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/spec/google/api_client/simple_file_store_spec.rb b/spec/google/api_client/simple_file_store_spec.rb index f041c4293..cc7208d6e 100644 --- a/spec/google/api_client/simple_file_store_spec.rb +++ b/spec/google/api_client/simple_file_store_spec.rb @@ -22,10 +22,6 @@ describe Google::APIClient::Service::SimpleFileStore do FILE_NAME = 'test.cache' - before(:all) do - File.delete(FILE_NAME) if File.exists?(FILE_NAME) - end - describe 'with no cache file' do before(:each) do File.delete(FILE_NAME) if File.exists?(FILE_NAME) From 9c7e953d1b88d1a338f2a290f10f17ee4721710c Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Wed, 17 Sep 2014 14:47:27 +0000 Subject: [PATCH 03/13] Use the app logger and require railtie --- lib/google/api_client.rb | 2 +- lib/google/api_client/railtie.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/google/api_client.rb b/lib/google/api_client.rb index c79c71b58..dc9c85379 100644 --- a/lib/google/api_client.rb +++ b/lib/google/api_client.rb @@ -32,7 +32,7 @@ require 'google/api_client/service_account' require 'google/api_client/batch' require 'google/api_client/gzip' require 'google/api_client/client_secrets' -require 'google/api_client/railtie' if defined?(Rails::Railtie) +require 'google/api_client/railtie' if defined?(Rails) module Google diff --git a/lib/google/api_client/railtie.rb b/lib/google/api_client/railtie.rb index 703921b7e..d02e63456 100644 --- a/lib/google/api_client/railtie.rb +++ b/lib/google/api_client/railtie.rb @@ -1,3 +1,4 @@ +require 'rails/railtie' require 'google/api_client/logging' module Google @@ -9,7 +10,7 @@ module Google # class Railtie < Rails::Railtie initializer 'google-api-client' do |app| - Google::APIClient.logger = Rails.logger + Google::APIClient.logger = app.logger end end end From 27df982625364471e4f92c9c1313cbc8497b0b33 Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Wed, 17 Sep 2014 14:50:07 +0000 Subject: [PATCH 04/13] Clean up gemspec. We don't support 1.8.6 anyway --- google-api-client.gemspec | 56 +++++++++------------------------------ 1 file changed, 13 insertions(+), 43 deletions(-) diff --git a/google-api-client.gemspec b/google-api-client.gemspec index 9246d9013..93a1d2d95 100644 --- a/google-api-client.gemspec +++ b/google-api-client.gemspec @@ -17,49 +17,19 @@ Gem::Specification.new do |s| s.require_paths = ["lib"] s.rubygems_version = "2.0.7" s.summary = "Package Summary" + s.required_ruby_version = '>= 1.8.7' - if s.respond_to? :specification_version then - s.specification_version = 4 + s.add_runtime_dependency(%q, '>= 0.5.0') + s.add_runtime_dependency(%q, '>= 2.3.2') + s.add_runtime_dependency(%q, '>= 2.1.0') + s.add_runtime_dependency(%q, '>= 0.3.3') + s.add_runtime_dependency(%q, '>= 0.9.0') + s.add_runtime_dependency(%q, '>= 1.0.0') + s.add_runtime_dependency(%q, '>= 0.9.15') + s.add_runtime_dependency(%q, '>= 0.1.5') + s.add_runtime_dependency(%q, '~> 1.4') + s.add_runtime_dependency(%q, '>= 2.1.1') + s.add_development_dependency(%q, '>= 0.9.0') + s.add_development_dependency(%q, '>= 2.11.0') - if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then - s.add_runtime_dependency(%q, [">= 0.5.0"]) - s.add_runtime_dependency(%q, [">= 2.3.2"]) - s.add_runtime_dependency(%q, [">= 2.1.0"]) - s.add_runtime_dependency(%q, [">= 0.3.3"]) - s.add_runtime_dependency(%q, [">= 0.9.0"]) - s.add_runtime_dependency(%q, [">= 1.0.0"]) - s.add_runtime_dependency(%q, [">= 0.9.15"]) - s.add_runtime_dependency(%q, [">= 0.1.5"]) - s.add_runtime_dependency(%q, ["~> 1.4"]) - s.add_runtime_dependency(%q, [">= 2.1.1"]) - s.add_development_dependency(%q, [">= 0.9.0"]) - s.add_development_dependency(%q, [">= 2.11.0"]) - else - s.add_dependency(%q, [">= 0.5.0"]) - s.add_dependency(%q, [">= 2.3.2"]) - s.add_dependency(%q, [">= 2.1.0"]) - s.add_dependency(%q, [">= 0.3.3"]) - s.add_dependency(%q, [">= 0.9.0"]) - s.add_dependency(%q, [">= 1.0.0"]) - s.add_dependency(%q, [">= 0.9.15"]) - s.add_dependency(%q, [">= 0.1.5"]) - s.add_dependency(%q, ["~> 1.4"]) - s.add_dependency(%q, [">= 2.1.1"]) - s.add_dependency(%q, [">= 0.9.0"]) - s.add_dependency(%q, [">= 2.11.0"]) - end - else - s.add_dependency(%q, [">= 0.5.0"]) - s.add_dependency(%q, [">= 2.3.2"]) - s.add_dependency(%q, [">= 2.1.0"]) - s.add_dependency(%q, [">= 0.3.3"]) - s.add_dependency(%q, [">= 0.9.0"]) - s.add_dependency(%q, [">= 1.0.0"]) - s.add_dependency(%q, [">= 0.9.15"]) - s.add_dependency(%q, [">= 0.1.5"]) - s.add_dependency(%q, ["~> 1.4"]) - s.add_dependency(%q, [">= 2.1.1"]) - s.add_dependency(%q, [">= 0.9.0"]) - s.add_dependency(%q, [">= 2.11.0"]) - end end From e313235b5561e1a9fbd83a7bf9406f79faae6526 Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Wed, 17 Sep 2014 14:55:52 +0000 Subject: [PATCH 05/13] Replace deprecated method that cause ruby warnings File.exit? --- lib/google/api_client/auth/file_storage.rb | 2 +- lib/google/api_client/client_secrets.rb | 2 +- lib/google/api_client/service.rb | 2 +- tasks/wiki.rake | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/google/api_client/auth/file_storage.rb b/lib/google/api_client/auth/file_storage.rb index 049ef965a..fca4ea39a 100644 --- a/lib/google/api_client/auth/file_storage.rb +++ b/lib/google/api_client/auth/file_storage.rb @@ -42,7 +42,7 @@ module Google ## # Attempt to read in credentials from the specified file. def load_credentials - if File.exist? self.path + if File.exists? self.path File.open(self.path, 'r') do |file| cached_credentials = JSON.load(file) @authorization = Signet::OAuth2::Client.new(cached_credentials) diff --git a/lib/google/api_client/client_secrets.rb b/lib/google/api_client/client_secrets.rb index 93b0046a8..0432671d4 100644 --- a/lib/google/api_client/client_secrets.rb +++ b/lib/google/api_client/client_secrets.rb @@ -63,7 +63,7 @@ module Google end while filename == nil search_path ||= File.expand_path('.') - if File.exist?(File.join(search_path, 'client_secrets.json')) + if File.exists?(File.join(search_path, 'client_secrets.json')) filename = File.join(search_path, 'client_secrets.json') elsif search_path == '/' || search_path =~ /[a-zA-Z]:[\/\\]/ raise ArgumentError, diff --git a/lib/google/api_client/service.rb b/lib/google/api_client/service.rb index 451266fe5..685c61780 100755 --- a/lib/google/api_client/service.rb +++ b/lib/google/api_client/service.rb @@ -120,7 +120,7 @@ module Google if options.include? :cache_store @cache_store = options[:cache_store] else - cache_exists = File.exist?(DEFAULT_CACHE_FILE) + cache_exists = File.exists?(DEFAULT_CACHE_FILE) if (cache_exists && File.writable?(DEFAULT_CACHE_FILE)) || (!cache_exists && File.writable?(Dir.pwd)) @cache_store = Google::APIClient::Service::SimpleFileStore.new( diff --git a/tasks/wiki.rake b/tasks/wiki.rake index 12bfe4bf0..3e0d97d2e 100644 --- a/tasks/wiki.rake +++ b/tasks/wiki.rake @@ -38,7 +38,7 @@ WIKI output.gsub!(/-32\./, "-16.") wiki_path = File.expand_path( File.join(File.dirname(__FILE__), '../wiki/')) - Dir.mkdir(wiki_path) if !File.exist?(wiki_path) + Dir.mkdir(wiki_path) unless File.exists?(wiki_path) File.open(File.join(wiki_path, 'SupportedAPIs.wiki'), 'w') do |file| file.write(output) end From 39c3e81e268fa547dc4c14e81ffe1b465f9d1bf6 Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Wed, 17 Sep 2014 14:57:32 +0000 Subject: [PATCH 06/13] So many versions!! --- lib/google/api_client.rb | 4 +--- lib/google/api_client/version.rb | 21 ++++++++------------- spec/google/api_client/batch_spec.rb | 1 - spec/google/api_client/discovery_spec.rb | 1 - spec/google/api_client/gzip_spec.rb | 1 - spec/google/api_client/media_spec.rb | 1 - spec/google/api_client/request_spec.rb | 1 - spec/google/api_client/result_spec.rb | 1 - 8 files changed, 9 insertions(+), 22 deletions(-) diff --git a/lib/google/api_client.rb b/lib/google/api_client.rb index dc9c85379..91b405150 100644 --- a/lib/google/api_client.rb +++ b/lib/google/api_client.rb @@ -687,6 +687,4 @@ module Google end -end - -require 'google/api_client/version' +end \ No newline at end of file diff --git a/lib/google/api_client/version.rb b/lib/google/api_client/version.rb index a979647d9..ee12fd33b 100644 --- a/lib/google/api_client/version.rb +++ b/lib/google/api_client/version.rb @@ -13,19 +13,14 @@ # limitations under the License. -# Used to prevent the class/module from being loaded more than once -if !defined?(::Google::APIClient::VERSION) - - - module Google - class APIClient - module VERSION - MAJOR = 0 - MINOR = 7 - TINY = 1 - PATCH = nil - STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.') - end +module Google + class APIClient + module VERSION + MAJOR = 0 + MINOR = 7 + TINY = 1 + PATCH = nil + STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.') end end end diff --git a/spec/google/api_client/batch_spec.rb b/spec/google/api_client/batch_spec.rb index 0df184e56..786c16a77 100644 --- a/spec/google/api_client/batch_spec.rb +++ b/spec/google/api_client/batch_spec.rb @@ -14,7 +14,6 @@ require 'spec_helper' require 'google/api_client' -require 'google/api_client/version' describe Google::APIClient::BatchRequest do CLIENT = Google::APIClient.new(:application_name => 'API Client Tests') unless defined?(CLIENT) diff --git a/spec/google/api_client/discovery_spec.rb b/spec/google/api_client/discovery_spec.rb index 4ec5f99e5..a047bab03 100644 --- a/spec/google/api_client/discovery_spec.rb +++ b/spec/google/api_client/discovery_spec.rb @@ -22,7 +22,6 @@ require 'multi_json' require 'compat/multi_json' require 'signet/oauth_1/client' require 'google/api_client' -require 'google/api_client/version' describe Google::APIClient do include ConnectionHelpers diff --git a/spec/google/api_client/gzip_spec.rb b/spec/google/api_client/gzip_spec.rb index 36d7fd6ca..e05e90737 100644 --- a/spec/google/api_client/gzip_spec.rb +++ b/spec/google/api_client/gzip_spec.rb @@ -15,7 +15,6 @@ require 'spec_helper' require 'google/api_client' -require 'google/api_client/version' describe Google::APIClient::Gzip do diff --git a/spec/google/api_client/media_spec.rb b/spec/google/api_client/media_spec.rb index 8c6515ea5..0fce150f5 100644 --- a/spec/google/api_client/media_spec.rb +++ b/spec/google/api_client/media_spec.rb @@ -15,7 +15,6 @@ require 'spec_helper' require 'google/api_client' -require 'google/api_client/version' fixtures_path = File.expand_path('../../../fixtures', __FILE__) diff --git a/spec/google/api_client/request_spec.rb b/spec/google/api_client/request_spec.rb index d70e217e3..760a8a34b 100644 --- a/spec/google/api_client/request_spec.rb +++ b/spec/google/api_client/request_spec.rb @@ -15,7 +15,6 @@ require 'spec_helper' require 'google/api_client' -require 'google/api_client/version' describe Google::APIClient::Request do CLIENT = Google::APIClient.new(:application_name => 'API Client Tests') unless defined?(CLIENT) diff --git a/spec/google/api_client/result_spec.rb b/spec/google/api_client/result_spec.rb index 757730386..8c5f09bc9 100644 --- a/spec/google/api_client/result_spec.rb +++ b/spec/google/api_client/result_spec.rb @@ -15,7 +15,6 @@ require 'spec_helper' require 'google/api_client' -require 'google/api_client/version' describe Google::APIClient::Result do CLIENT = Google::APIClient.new(:application_name => 'API Client Tests') unless defined?(CLIENT) From f819c4a051f33cf505c527518103041b9ca0b234 Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Wed, 17 Sep 2014 15:00:01 +0000 Subject: [PATCH 07/13] Another form of Googol typo ? --- spec/google/api_client_spec.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/google/api_client_spec.rb b/spec/google/api_client_spec.rb index 4944bb958..5d61f73ea 100644 --- a/spec/google/api_client_spec.rb +++ b/spec/google/api_client_spec.rb @@ -190,7 +190,7 @@ describe Google::APIClient do end client.execute( - :uri => 'https://www.gogole.com/foo', + :uri => 'https://www.google.com/foo', :connection => @connection ) end @@ -209,7 +209,7 @@ describe Google::APIClient do end client.execute( - :uri => 'https://www.gogole.com/foo', + :uri => 'https://www.google.com/foo', :connection => @connection ) end @@ -226,7 +226,7 @@ describe Google::APIClient do end client.execute( - :uri => 'https://www.gogole.com/foo', + :uri => 'https://www.google.com/foo', :connection => @connection ) end @@ -242,7 +242,7 @@ describe Google::APIClient do end client.execute( - :uri => 'https://www.gogole.com/foo', + :uri => 'https://www.google.com/foo', :connection => @connection, :authenticated => false ) @@ -261,7 +261,7 @@ describe Google::APIClient do end expect(client.execute( - :uri => 'https://www.gogole.com/foo', + :uri => 'https://www.google.com/foo', :connection => @connection ).status).to eq(200) @@ -278,7 +278,7 @@ describe Google::APIClient do end expect(client.execute( - :uri => 'https://www.gogole.com/foo', + :uri => 'https://www.google.com/foo', :connection => @connection ).status).to eq(500) expect(count).to eq(3) From 740289938b5bf9b8355a1f9c497d307009d675bb Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Wed, 17 Sep 2014 15:03:33 +0000 Subject: [PATCH 08/13] RSpec 3 syntax --- spec/google/api_client/batch_spec.rb | 2 +- spec/google/api_client/discovery_spec.rb | 2 +- spec/google/api_client/gzip_spec.rb | 2 +- spec/google/api_client/media_spec.rb | 6 +++--- spec/google/api_client/request_spec.rb | 2 +- spec/google/api_client/result_spec.rb | 2 +- spec/google/api_client/service_account_spec.rb | 6 +++--- spec/google/api_client/service_spec.rb | 6 +++--- spec/google/api_client/simple_file_store_spec.rb | 2 +- spec/google/api_client_spec.rb | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/spec/google/api_client/batch_spec.rb b/spec/google/api_client/batch_spec.rb index 786c16a77..3aa95a88b 100644 --- a/spec/google/api_client/batch_spec.rb +++ b/spec/google/api_client/batch_spec.rb @@ -15,7 +15,7 @@ require 'spec_helper' require 'google/api_client' -describe Google::APIClient::BatchRequest do +RSpec.describe Google::APIClient::BatchRequest do CLIENT = Google::APIClient.new(:application_name => 'API Client Tests') unless defined?(CLIENT) after do diff --git a/spec/google/api_client/discovery_spec.rb b/spec/google/api_client/discovery_spec.rb index a047bab03..d1c23759f 100644 --- a/spec/google/api_client/discovery_spec.rb +++ b/spec/google/api_client/discovery_spec.rb @@ -23,7 +23,7 @@ require 'compat/multi_json' require 'signet/oauth_1/client' require 'google/api_client' -describe Google::APIClient do +RSpec.describe Google::APIClient do include ConnectionHelpers CLIENT = Google::APIClient.new(:application_name => 'API Client Tests') unless defined?(CLIENT) diff --git a/spec/google/api_client/gzip_spec.rb b/spec/google/api_client/gzip_spec.rb index e05e90737..9448b009f 100644 --- a/spec/google/api_client/gzip_spec.rb +++ b/spec/google/api_client/gzip_spec.rb @@ -16,7 +16,7 @@ require 'spec_helper' require 'google/api_client' -describe Google::APIClient::Gzip do +RSpec.describe Google::APIClient::Gzip do def create_connection(&block) Faraday.new do |b| diff --git a/spec/google/api_client/media_spec.rb b/spec/google/api_client/media_spec.rb index 0fce150f5..f32b31efc 100644 --- a/spec/google/api_client/media_spec.rb +++ b/spec/google/api_client/media_spec.rb @@ -18,7 +18,7 @@ require 'google/api_client' fixtures_path = File.expand_path('../../../fixtures', __FILE__) -describe Google::APIClient::UploadIO do +RSpec.describe Google::APIClient::UploadIO do it 'should reject invalid file paths' do expect(lambda do media = Google::APIClient::UploadIO.new('doesnotexist', 'text/plain') @@ -56,7 +56,7 @@ describe Google::APIClient::UploadIO do end end -describe Google::APIClient::RangedIO do +RSpec.describe Google::APIClient::RangedIO do before do @source = StringIO.new("1234567890abcdef") @io = Google::APIClient::RangedIO.new(@source, 1, 5) @@ -104,7 +104,7 @@ describe Google::APIClient::RangedIO do end -describe Google::APIClient::ResumableUpload do +RSpec.describe Google::APIClient::ResumableUpload do CLIENT = Google::APIClient.new(:application_name => 'API Client Tests') unless defined?(CLIENT) after do diff --git a/spec/google/api_client/request_spec.rb b/spec/google/api_client/request_spec.rb index 760a8a34b..c63f750dc 100644 --- a/spec/google/api_client/request_spec.rb +++ b/spec/google/api_client/request_spec.rb @@ -16,7 +16,7 @@ require 'spec_helper' require 'google/api_client' -describe Google::APIClient::Request do +RSpec.describe Google::APIClient::Request do CLIENT = Google::APIClient.new(:application_name => 'API Client Tests') unless defined?(CLIENT) it 'should normalize parameter names to strings' do diff --git a/spec/google/api_client/result_spec.rb b/spec/google/api_client/result_spec.rb index 8c5f09bc9..67c63b77c 100644 --- a/spec/google/api_client/result_spec.rb +++ b/spec/google/api_client/result_spec.rb @@ -16,7 +16,7 @@ require 'spec_helper' require 'google/api_client' -describe Google::APIClient::Result do +RSpec.describe Google::APIClient::Result do CLIENT = Google::APIClient.new(:application_name => 'API Client Tests') unless defined?(CLIENT) describe 'with the plus API' do diff --git a/spec/google/api_client/service_account_spec.rb b/spec/google/api_client/service_account_spec.rb index f700dfe19..d4d9a36b6 100644 --- a/spec/google/api_client/service_account_spec.rb +++ b/spec/google/api_client/service_account_spec.rb @@ -18,7 +18,7 @@ require 'google/api_client' fixtures_path = File.expand_path('../../../fixtures', __FILE__) -describe Google::APIClient::KeyUtils do +RSpec.describe Google::APIClient::KeyUtils do it 'should read PKCS12 files from the filesystem' do if RUBY_PLATFORM == 'java' && RUBY_VERSION.start_with?('1.8') pending "Reading from PKCS12 not supported on jruby 1.8.x" @@ -53,7 +53,7 @@ describe Google::APIClient::KeyUtils do end -describe Google::APIClient::JWTAsserter do +RSpec.describe Google::APIClient::JWTAsserter do include ConnectionHelpers before do @@ -146,7 +146,7 @@ describe Google::APIClient::JWTAsserter do end end -describe Google::APIClient::ComputeServiceAccount do +RSpec.describe Google::APIClient::ComputeServiceAccount do include ConnectionHelpers it 'should query metadata server' do diff --git a/spec/google/api_client/service_spec.rb b/spec/google/api_client/service_spec.rb index e9c216454..e5184372c 100644 --- a/spec/google/api_client/service_spec.rb +++ b/spec/google/api_client/service_spec.rb @@ -21,7 +21,7 @@ require 'google/api_client/service' fixtures_path = File.expand_path('../../../fixtures', __FILE__) -describe Google::APIClient::Service do +RSpec.describe Google::APIClient::Service do include ConnectionHelpers APPLICATION_NAME = 'API Client Tests' @@ -288,7 +288,7 @@ describe Google::APIClient::Service do end -describe Google::APIClient::Service::Result do +RSpec.describe Google::APIClient::Service::Result do describe 'with the plus API' do before do @@ -492,7 +492,7 @@ describe Google::APIClient::Service::Result do end end -describe Google::APIClient::Service::BatchRequest do +RSpec.describe Google::APIClient::Service::BatchRequest do describe 'with the discovery API' do before do @discovery = Google::APIClient::Service.new('discovery', 'v1', diff --git a/spec/google/api_client/simple_file_store_spec.rb b/spec/google/api_client/simple_file_store_spec.rb index cc7208d6e..cb7d89847 100644 --- a/spec/google/api_client/simple_file_store_spec.rb +++ b/spec/google/api_client/simple_file_store_spec.rb @@ -18,7 +18,7 @@ require 'spec_helper' require 'google/api_client/service/simple_file_store' -describe Google::APIClient::Service::SimpleFileStore do +RSpec.describe Google::APIClient::Service::SimpleFileStore do FILE_NAME = 'test.cache' diff --git a/spec/google/api_client_spec.rb b/spec/google/api_client_spec.rb index 5d61f73ea..6cd4c8ee4 100644 --- a/spec/google/api_client_spec.rb +++ b/spec/google/api_client_spec.rb @@ -54,7 +54,7 @@ shared_examples_for 'configurable user agent' do end end -describe Google::APIClient do +RSpec.describe Google::APIClient do include ConnectionHelpers let(:client) { Google::APIClient.new(:application_name => 'API Client Tests') } From 1a414e7f0d3a05fe07d60195335ed971fb48bcac Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Wed, 17 Sep 2014 15:38:51 +0000 Subject: [PATCH 09/13] prefer AS's Inflector over Extlib --- lib/google/inflection.rb | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/google/inflection.rb b/lib/google/inflection.rb index cdf71ab4b..127a6d4e2 100644 --- a/lib/google/inflection.rb +++ b/lib/google/inflection.rb @@ -14,15 +14,11 @@ module Google - if defined?(ActiveSupport::Inflector) + begin + require 'active_support/inflector' INFLECTOR = ActiveSupport::Inflector - else - begin - require 'extlib/inflection' - INFLECTOR = Extlib::Inflection - rescue LoadError - require 'active_support/inflector' - INFLECTOR = ActiveSupport::Inflector - end + rescue LoadError + require 'extlib/inflection' + INFLECTOR = Extlib::Inflection end end From 9719c9f35751300cc187f94056f12f66dc3a316a Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Thu, 18 Sep 2014 18:06:15 +0000 Subject: [PATCH 10/13] Drop support for old rubies --- .travis.yml | 4 ---- google-api-client.gemspec | 26 +++++++++++++------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index d66aa8a98..be99f1c36 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,10 @@ language: ruby rvm: - - 1.8.7 - - 1.9.2 - 1.9.3 - 2.0.0 - 2.1.0 - rbx-2 - - jruby-18mode - jruby-19mode - - ree script: "bundle exec rake spec:all" before_install: - sudo apt-get update diff --git a/google-api-client.gemspec b/google-api-client.gemspec index 93a1d2d95..cced2ec63 100644 --- a/google-api-client.gemspec +++ b/google-api-client.gemspec @@ -17,19 +17,19 @@ Gem::Specification.new do |s| s.require_paths = ["lib"] s.rubygems_version = "2.0.7" s.summary = "Package Summary" - s.required_ruby_version = '>= 1.8.7' + s.required_ruby_version = '>= 1.9.3' - s.add_runtime_dependency(%q, '>= 0.5.0') - s.add_runtime_dependency(%q, '>= 2.3.2') - s.add_runtime_dependency(%q, '>= 2.1.0') - s.add_runtime_dependency(%q, '>= 0.3.3') - s.add_runtime_dependency(%q, '>= 0.9.0') - s.add_runtime_dependency(%q, '>= 1.0.0') - s.add_runtime_dependency(%q, '>= 0.9.15') - s.add_runtime_dependency(%q, '>= 0.1.5') - s.add_runtime_dependency(%q, '~> 1.4') - s.add_runtime_dependency(%q, '>= 2.1.1') - s.add_development_dependency(%q, '>= 0.9.0') - s.add_development_dependency(%q, '>= 2.11.0') + s.add_runtime_dependency('signet', '>= 0.5.0') + s.add_runtime_dependency('addressable', '>= 2.3.2') + s.add_runtime_dependency('uuidtools', '>= 2.1.0') + s.add_runtime_dependency('autoparse', '>= 0.3.3') + s.add_runtime_dependency('faraday', '>= 0.9.0') + s.add_runtime_dependency('multi_json', '>= 1.0.0') + s.add_runtime_dependency('extlib', '>= 0.9.15') + s.add_runtime_dependency('jwt', '>= 0.1.5') + s.add_runtime_dependency('retriable', '~> 1.4') + s.add_runtime_dependency('launchy', '>= 2.1.1') + s.add_development_dependency('rake', '>= 10.0.0') + s.add_development_dependency('rspec', '>= 3.1.0') end From b2343e24a5dc6592a73f5bc2c7e1244a1b3ab9e0 Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Thu, 18 Sep 2014 18:15:10 +0000 Subject: [PATCH 11/13] Use ActiveSupport instead of extlib --- google-api-client.gemspec | 2 +- lib/google/api_client/discovery/api.rb | 6 ++--- lib/google/api_client/discovery/resource.rb | 6 ++--- lib/google/api_client/discovery/schema.rb | 8 +++---- .../api_client/service/stub_generator.rb | 6 +++-- lib/google/inflection.rb | 24 ------------------- 6 files changed, 14 insertions(+), 38 deletions(-) delete mode 100644 lib/google/inflection.rb diff --git a/google-api-client.gemspec b/google-api-client.gemspec index cced2ec63..39cea1eca 100644 --- a/google-api-client.gemspec +++ b/google-api-client.gemspec @@ -25,7 +25,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency('autoparse', '>= 0.3.3') s.add_runtime_dependency('faraday', '>= 0.9.0') s.add_runtime_dependency('multi_json', '>= 1.0.0') - s.add_runtime_dependency('extlib', '>= 0.9.15') + s.add_runtime_dependency('activesupport', '>= 3.2.0') s.add_runtime_dependency('jwt', '>= 0.1.5') s.add_runtime_dependency('retriable', '~> 1.4') s.add_runtime_dependency('launchy', '>= 2.1.1') diff --git a/lib/google/api_client/discovery/api.rb b/lib/google/api_client/discovery/api.rb index 4c58d7e10..be83f6279 100644 --- a/lib/google/api_client/discovery/api.rb +++ b/lib/google/api_client/discovery/api.rb @@ -15,7 +15,7 @@ require 'addressable/uri' require 'multi_json' -require 'google/inflection' +require 'active_support/inflector' require 'google/api_client/discovery/resource' require 'google/api_client/discovery/method' require 'google/api_client/discovery/media' @@ -41,13 +41,13 @@ module Google @discovery_document = discovery_document metaclass = (class << self; self; end) self.discovered_resources.each do |resource| - method_name = Google::INFLECTOR.underscore(resource.name).to_sym + method_name = ActiveSupport::Inflector.underscore(resource.name).to_sym if !self.respond_to?(method_name) metaclass.send(:define_method, method_name) { resource } end end self.discovered_methods.each do |method| - method_name = Google::INFLECTOR.underscore(method.name).to_sym + method_name = ActiveSupport::Inflector.underscore(method.name).to_sym if !self.respond_to?(method_name) metaclass.send(:define_method, method_name) { method } end diff --git a/lib/google/api_client/discovery/resource.rb b/lib/google/api_client/discovery/resource.rb index f6493ff40..9b757c684 100644 --- a/lib/google/api_client/discovery/resource.rb +++ b/lib/google/api_client/discovery/resource.rb @@ -15,7 +15,7 @@ require 'addressable/uri' -require 'google/inflection' +require 'active_support/inflector' require 'google/api_client/discovery/method' @@ -45,13 +45,13 @@ module Google @discovery_document = discovery_document metaclass = (class < 1 diff --git a/lib/google/inflection.rb b/lib/google/inflection.rb deleted file mode 100644 index 127a6d4e2..000000000 --- a/lib/google/inflection.rb +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2010 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -module Google - begin - require 'active_support/inflector' - INFLECTOR = ActiveSupport::Inflector - rescue LoadError - require 'extlib/inflection' - INFLECTOR = Extlib::Inflection - end -end From 2ba98c3332a8c59db9c339b833ed1f7e953cf76d Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Thu, 18 Sep 2014 18:22:17 +0000 Subject: [PATCH 12/13] Dropped uuidtools --- google-api-client.gemspec | 1 - lib/google/api_client/batch.rb | 5 ++--- lib/google/api_client/client_secrets.rb | 1 - lib/google/api_client/request.rb | 1 - 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/google-api-client.gemspec b/google-api-client.gemspec index 39cea1eca..0a6b16ef5 100644 --- a/google-api-client.gemspec +++ b/google-api-client.gemspec @@ -21,7 +21,6 @@ Gem::Specification.new do |s| s.add_runtime_dependency('signet', '>= 0.5.0') s.add_runtime_dependency('addressable', '>= 2.3.2') - s.add_runtime_dependency('uuidtools', '>= 2.1.0') s.add_runtime_dependency('autoparse', '>= 0.3.3') s.add_runtime_dependency('faraday', '>= 0.9.0') s.add_runtime_dependency('multi_json', '>= 1.0.0') diff --git a/lib/google/api_client/batch.rb b/lib/google/api_client/batch.rb index 0a7e6b78c..1082516ad 100644 --- a/lib/google/api_client/batch.rb +++ b/lib/google/api_client/batch.rb @@ -14,7 +14,7 @@ require 'addressable/uri' require 'google/api_client/reference' -require 'uuidtools' +require 'securerandom' module Google class APIClient @@ -90,8 +90,7 @@ module Google @global_callback = block if block_given? @last_auto_id = 0 - # TODO(sgomes): Use SecureRandom.uuid, drop UUIDTools when we drop 1.8 - @base_id = UUIDTools::UUID.random_create.to_s + @base_id = SecureRandom.uuid options[:uri] ||= 'https://www.googleapis.com/batch' options[:http_method] ||= 'POST' diff --git a/lib/google/api_client/client_secrets.rb b/lib/google/api_client/client_secrets.rb index 0432671d4..792f1b7cf 100644 --- a/lib/google/api_client/client_secrets.rb +++ b/lib/google/api_client/client_secrets.rb @@ -13,7 +13,6 @@ # limitations under the License. -require 'multi_json' require 'compat/multi_json' diff --git a/lib/google/api_client/request.rb b/lib/google/api_client/request.rb index a8a83c4a4..bfe3abab2 100644 --- a/lib/google/api_client/request.rb +++ b/lib/google/api_client/request.rb @@ -14,7 +14,6 @@ require 'faraday' require 'faraday/request/multipart' -require 'multi_json' require 'compat/multi_json' require 'addressable/uri' require 'stringio' From f8ca44f9caf2d63a8d145e47038b2bdbd0766a26 Mon Sep 17 00:00:00 2001 From: Steven Bazyl Date: Mon, 15 Dec 2014 11:53:00 -0800 Subject: [PATCH 13/13] Restore active support dependency --- google-api-client.gemspec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/google-api-client.gemspec b/google-api-client.gemspec index 17927c4c9..b154c6c9d 100644 --- a/google-api-client.gemspec +++ b/google-api-client.gemspec @@ -30,7 +30,8 @@ Gem::Specification.new do |s| s.add_runtime_dependency 'extlib', '~> 0.9' s.add_runtime_dependency 'launchy', '~> 2.4' s.add_runtime_dependency 'retriable', '~> 1.4' - + s.add_runtime_dependency 'activesupport', '~> 3.2' + s.add_development_dependency 'rake', '~> 10.0' s.add_development_dependency 'yard', '~> 0.8' s.add_development_dependency 'rspec', '~> 3.1'