Update depdencies, simplify gem management

This commit is contained in:
Steven Bazyl 2014-12-15 11:44:51 -08:00
parent 95823b0e19
commit 0244bf13b3
8 changed files with 69 additions and 162 deletions

27
Gemfile
View File

@ -2,31 +2,4 @@ source 'https://rubygems.org'
gemspec
gem 'signet', '>= 0.5.0'
gem 'addressable', '>= 2.3.2'
gem 'uuidtools', '>= 2.1.0'
gem 'autoparse', '>= 0.3.3'
gem 'faraday', '>= 0.9.0'
gem 'multi_json', '>= 1.0.0'
gem 'extlib', '>= 0.9.15'
gem 'jwt', '~> 0.1.5'
gem 'retriable', '~> 1.4'
gem 'jruby-openssl', :platforms => :jruby
group :development do
gem 'launchy', '>= 2.1.1'
gem 'yard'
gem 'kramdown'
end
group :examples do
gem 'sinatra'
end
group :test, :development do
gem 'json', '~> 1.7.7'
gem 'rspec', '~> 3.0'
gem 'simplecov', :platforms => [:ruby_19, :ruby_20], :require => false
end
gem 'idn', :platforms => :mri_18

View File

@ -1,65 +1,40 @@
# -*- encoding: utf-8 -*-
require File.join(File.dirname(__FILE__), 'lib/google/api_client', 'version')
Gem::Specification.new do |s|
s.name = "google-api-client"
s.version = "0.7.1"
s.version = Google::APIClient::VERSION::STRING
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Bob Aman", "Steve Bazyl"]
s.date = "2014-01-23"
s.description = "The Google API Ruby Client makes it trivial to discover and access supported\nAPIs.\n"
s.required_rubygems_version = ">= 1.3.5"
s.require_paths = ["lib"]
s.authors = ["Bob Aman", "Steven Bazyl"]
s.license = "Apache-2.0"
s.description = "The Google API Ruby Client makes it trivial to discover and access supported APIs."
s.email = "sbazyl@google.com"
s.extra_rdoc_files = ["README.md"]
s.files = ["lib/cacerts.pem", "lib/compat", "lib/compat/multi_json.rb", "lib/google", "lib/google/api_client", "lib/google/api_client.rb", "lib/google/api_client/auth", "lib/google/api_client/auth/compute_service_account.rb", "lib/google/api_client/auth/file_storage.rb", "lib/google/api_client/auth/installed_app.rb", "lib/google/api_client/auth/jwt_asserter.rb", "lib/google/api_client/auth/key_utils.rb", "lib/google/api_client/auth/pkcs12.rb", "lib/google/api_client/batch.rb", "lib/google/api_client/client_secrets.rb", "lib/google/api_client/discovery", "lib/google/api_client/discovery.rb", "lib/google/api_client/discovery/api.rb", "lib/google/api_client/discovery/media.rb", "lib/google/api_client/discovery/method.rb", "lib/google/api_client/discovery/resource.rb", "lib/google/api_client/discovery/schema.rb", "lib/google/api_client/environment.rb", "lib/google/api_client/errors.rb", "lib/google/api_client/gzip.rb", "lib/google/api_client/logging.rb", "lib/google/api_client/media.rb", "lib/google/api_client/railtie.rb", "lib/google/api_client/reference.rb", "lib/google/api_client/request.rb", "lib/google/api_client/result.rb", "lib/google/api_client/service", "lib/google/api_client/service.rb", "lib/google/api_client/service/batch.rb", "lib/google/api_client/service/request.rb", "lib/google/api_client/service/resource.rb", "lib/google/api_client/service/result.rb", "lib/google/api_client/service/simple_file_store.rb", "lib/google/api_client/service/stub_generator.rb", "lib/google/api_client/service_account.rb", "lib/google/api_client/version.rb", "lib/google/inflection.rb", "spec/fixtures", "spec/fixtures/files", "spec/fixtures/files/privatekey.p12", "spec/fixtures/files/sample.txt", "spec/fixtures/files/secret.pem", "spec/google", "spec/google/api_client", "spec/google/api_client/batch_spec.rb", "spec/google/api_client/discovery_spec.rb", "spec/google/api_client/gzip_spec.rb", "spec/google/api_client/media_spec.rb", "spec/google/api_client/request_spec.rb", "spec/google/api_client/result_spec.rb", "spec/google/api_client/service_account_spec.rb", "spec/google/api_client/service_spec.rb", "spec/google/api_client/simple_file_store_spec.rb", "spec/google/api_client_spec.rb", "spec/spec_helper.rb", "tasks/gem.rake", "tasks/git.rake", "tasks/metrics.rake", "tasks/spec.rake", "tasks/wiki.rake", "tasks/yard.rake", "CHANGELOG.md", "CONTRIBUTING.md", "Gemfile", "LICENSE", "README.md", "Rakefile"]
s.homepage = "https://github.com/google/google-api-ruby-client"
s.licenses = ["Apache 2.0"]
s.files = %w(google-api-client.gemspec Rakefile LICENSE CHANGELOG.md README.md Gemfile)
s.files += Dir.glob("lib/**/*.rb")
s.files += Dir.glob("spec/**/*.{rb,opts}")
s.files += Dir.glob("vendor/**/*.rb")
s.files += Dir.glob("tasks/**/*")
s.files += Dir.glob("website/**/*")
s.homepage = "https://github.com/google/google-api-ruby-client/"
s.rdoc_options = ["--main", "README.md"]
s.require_paths = ["lib"]
s.rubygems_version = "2.0.7"
s.summary = "Package Summary"
s.summary = "The Google API Ruby Client makes it trivial to discover and access Google's REST APIs."
if s.respond_to? :specification_version then
s.specification_version = 4
s.add_runtime_dependency 'addressable', '~> 2.3'
s.add_runtime_dependency 'signet', '~> 0.6'
s.add_runtime_dependency 'faraday', '~> 0.9'
s.add_runtime_dependency 'multi_json', '~> 1.10'
s.add_runtime_dependency 'uuidtools', "~> 2.1"
s.add_runtime_dependency 'autoparse', "~> 0.3"
s.add_runtime_dependency 'extlib', '~> 0.9'
s.add_runtime_dependency 'launchy', '~> 2.4'
s.add_runtime_dependency 'retriable', '~> 1.4'
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<signet>, [">= 0.5.0"])
s.add_runtime_dependency(%q<addressable>, [">= 2.3.2"])
s.add_runtime_dependency(%q<uuidtools>, [">= 2.1.0"])
s.add_runtime_dependency(%q<autoparse>, [">= 0.3.3"])
s.add_runtime_dependency(%q<faraday>, [">= 0.9.0"])
s.add_runtime_dependency(%q<multi_json>, [">= 1.0.0"])
s.add_runtime_dependency(%q<extlib>, [">= 0.9.15"])
s.add_runtime_dependency(%q<jwt>, [">= 0.1.5"])
s.add_runtime_dependency(%q<retriable>, ["~> 1.4"])
s.add_runtime_dependency(%q<launchy>, [">= 2.1.1"])
s.add_development_dependency(%q<rake>, [">= 0.9.0"])
s.add_development_dependency(%q<rspec>, [">= 2.11.0"])
else
s.add_dependency(%q<signet>, [">= 0.5.0"])
s.add_dependency(%q<addressable>, [">= 2.3.2"])
s.add_dependency(%q<uuidtools>, [">= 2.1.0"])
s.add_dependency(%q<autoparse>, [">= 0.3.3"])
s.add_dependency(%q<faraday>, [">= 0.9.0"])
s.add_dependency(%q<multi_json>, [">= 1.0.0"])
s.add_dependency(%q<extlib>, [">= 0.9.15"])
s.add_dependency(%q<jwt>, [">= 0.1.5"])
s.add_dependency(%q<retriable>, ["~> 1.4"])
s.add_dependency(%q<launchy>, [">= 2.1.1"])
s.add_dependency(%q<rake>, [">= 0.9.0"])
s.add_dependency(%q<rspec>, [">= 2.11.0"])
end
else
s.add_dependency(%q<signet>, [">= 0.5.0"])
s.add_dependency(%q<addressable>, [">= 2.3.2"])
s.add_dependency(%q<uuidtools>, [">= 2.1.0"])
s.add_dependency(%q<autoparse>, [">= 0.3.3"])
s.add_dependency(%q<faraday>, [">= 0.9.0"])
s.add_dependency(%q<multi_json>, [">= 1.0.0"])
s.add_dependency(%q<extlib>, [">= 0.9.15"])
s.add_dependency(%q<jwt>, [">= 0.1.5"])
s.add_dependency(%q<retriable>, ["~> 1.4"])
s.add_dependency(%q<launchy>, [">= 2.1.1"])
s.add_dependency(%q<rake>, [">= 0.9.0"])
s.add_dependency(%q<rspec>, [">= 2.11.0"])
end
s.add_development_dependency 'rake', '~> 10.0'
s.add_development_dependency 'yard', '~> 0.8'
s.add_development_dependency 'rspec', '~> 3.1'
s.add_development_dependency 'kramdown', '~> 1.5'
s.add_development_dependency 'simplecov', '~> 0.9'
end

View File

@ -21,7 +21,7 @@ module Google
def fetch_access_token(options={})
connection = options[:connection] || Faraday.default_connection
response = connection.get 'http://metadata/computeMetadata/v1beta1/instance/service-accounts/default/token'
Signet::OAuth2.parse_json_credentials(response.body)
Signet::OAuth2.parse_credentials(response.body, response.headers['content-type'])
end
end
end

8
script/package Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
# Usage: script/gem
# Updates the gemspec and builds a new gem in the pkg directory.
mkdir -p pkg
gem build *.gemspec
mv *.gem pkg

14
script/release Executable file
View File

@ -0,0 +1,14 @@
age: script/release
# Build the package, tag a commit, push it to origin, and then release the
# package publicly.
set -e
version="$(script/package | grep Version: | awk '{print $2}')"
[ -n "$version" ] || exit 1
git commit --allow-empty -a -m "Release $version"
git tag "$version"
git push --tags origin
gem push pkg/*-${version}.gem

View File

@ -77,7 +77,7 @@ describe Google::APIClient::JWTAsserter do
params = Addressable::URI.form_unencode(env[:body])
JWT.decode(params.assoc("assertion").last, @key.public_key)
expect(params.assoc("grant_type")).to eq(['grant_type','urn:ietf:params:oauth:grant-type:jwt-bearer'])
[200, {}, '{
[200, {'content-type' => 'application/json'}, '{
"access_token" : "1/abcdef1234567890",
"token_type" : "Bearer",
"expires_in" : 3600
@ -97,7 +97,7 @@ describe Google::APIClient::JWTAsserter do
params = Addressable::URI.form_unencode(env[:body])
JWT.decode(params.assoc("assertion").last, @key.public_key)
expect(params.assoc("grant_type")).to eq(['grant_type','urn:ietf:params:oauth:grant-type:jwt-bearer'])
[200, {}, '{
[200, {'content-type' => 'application/json'}, '{
"access_token" : "1/abcdef1234567890",
"token_type" : "Bearer",
"expires_in" : 3600
@ -117,7 +117,7 @@ describe Google::APIClient::JWTAsserter do
params = Addressable::URI.form_unencode(env[:body])
JWT.decode(params.assoc("assertion").last, @key.public_key)
expect(params.assoc("grant_type")).to eq(['grant_type','urn:ietf:params:oauth:grant-type:jwt-bearer'])
[200, {}, '{
[200, {'content-type' => 'application/json'}, '{
"access_token" : "1/abcdef1234567890",
"token_type" : "Bearer",
"expires_in" : 3600
@ -127,7 +127,7 @@ describe Google::APIClient::JWTAsserter do
params = Addressable::URI.form_unencode(env[:body])
JWT.decode(params.assoc("assertion").last, @key.public_key)
expect(params.assoc("grant_type")).to eq(['grant_type','urn:ietf:params:oauth:grant-type:jwt-bearer'])
[200, {}, '{
[200, {'content-type' => 'application/json'}, '{
"access_token" : "1/0987654321fedcba",
"token_type" : "Bearer",
"expires_in" : 3600
@ -153,7 +153,7 @@ describe Google::APIClient::ComputeServiceAccount do
conn = stub_connection do |stub|
stub.get('/computeMetadata/v1beta1/instance/service-accounts/default/token') do |env|
expect(env.url.host).to eq('metadata')
[200, {}, '{
[200, {'content-type' => 'application/json'}, '{
"access_token" : "1/abcdef1234567890",
"token_type" : "Bearer",
"expires_in" : 3600

View File

@ -1,81 +1,18 @@
require 'rubygems/package_task'
require 'rake/clean'
CLOBBER.include('pkg')
require "rubygems/package_task"
namespace :gem do
GEM_SPEC = Gem::Specification.new do |s|
unless s.respond_to?(:add_development_dependency)
puts 'The gem spec requires a newer version of RubyGems.'
exit(1)
end
s.name = PKG_NAME
s.version = PKG_VERSION
s.author = PKG_AUTHOR
s.email = PKG_AUTHOR_EMAIL
s.summary = PKG_SUMMARY
s.description = PKG_DESCRIPTION
s.license = 'Apache 2.0'
s.files = PKG_FILES.to_a
s.extra_rdoc_files = %w( README.md )
s.rdoc_options.concat ['--main', 'README.md']
# Dependencies used in the main library
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')
# Dependencies used in the CLI
s.add_runtime_dependency('launchy', '>= 2.1.1')
# Dependencies used in the examples
s.add_development_dependency('rake', '>= 0.9.0')
s.add_development_dependency('rspec', '~> 3.0')
s.require_path = 'lib'
s.homepage = PKG_HOMEPAGE
desc "Build the gem"
task :build do
system "gem build signet.gemspec"
end
Gem::PackageTask.new(GEM_SPEC) do |p|
p.gem_spec = GEM_SPEC
p.need_tar = true
p.need_zip = true
end
desc 'Show information about the gem'
task :debug do
puts GEM_SPEC.to_ruby
end
desc "Generates .gemspec file"
task :gemspec do
spec_string = GEM_SPEC.to_ruby
begin
Thread.new { eval("$SAFE = 3\n#{spec_string}", binding) }.join
rescue
abort "unsafe gemspec: #{$!}"
else
File.open("#{GEM_SPEC.name}.gemspec", 'w') do |file|
file.write spec_string
end
end
end
desc 'Install the gem'
task :install => ['clobber', 'gem:package'] do
desc "Install the gem"
task :install => ["clobber", "gem:package"] do
sh "#{SUDO} gem install --local pkg/#{GEM_SPEC.full_name}"
end
desc 'Uninstall the gem'
desc "Uninstall the gem"
task :uninstall do
installed_list = Gem.source_index.find_name(PKG_NAME)
if installed_list &&
@ -87,11 +24,11 @@ namespace :gem do
end
end
desc 'Reinstall the gem'
desc "Reinstall the gem"
task :reinstall => [:uninstall, :install]
end
desc 'Alias to gem:package'
task 'gem' => 'gem:package'
desc "Alias to gem:package"
task "gem" => "gem:package"
task 'gem:release' => 'gem:gemspec'
task "clobber" => ["gem:clobber_package"]

View File

@ -42,4 +42,4 @@ namespace :git do
end
end
task 'gem:release' => 'git:tag:create'
task 'gem:release' => 'git:tag:create'