From 53fae929866a0a13ddb5b2a6f28b14e3be6017aa Mon Sep 17 00:00:00 2001 From: Simone Carletti Date: Thu, 14 Jun 2012 10:48:29 +0200 Subject: [PATCH 1/5] Ignore .rvmrc file --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 7a4605648..67599524b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .DS_Store .yardoc .bundle +.rvmrc Gemfile.lock coverage doc From 16363939b9b30feccad515368739152c416c0959 Mon Sep 17 00:00:00 2001 From: Simone Carletti Date: Thu, 14 Jun 2012 11:18:35 +0200 Subject: [PATCH 2/5] Upgrade RSpec 1.x to RSpec 2.10-x --- .rspec | 2 ++ Gemfile | 2 +- Rakefile | 4 +-- spec/spec.opts | 2 -- spec/spec_helper.rb | 3 ++ tasks/gem.rake | 2 +- tasks/spec.rake | 69 +++++++++++++++++++-------------------------- 7 files changed, 38 insertions(+), 46 deletions(-) create mode 100644 .rspec delete mode 100644 spec/spec.opts diff --git a/.rspec b/.rspec new file mode 100644 index 000000000..7438fbe51 --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--colour +--format documentation diff --git a/Gemfile b/Gemfile index 0cfa33569..7a86b3aad 100644 --- a/Gemfile +++ b/Gemfile @@ -21,7 +21,7 @@ end group :test, :development do gem 'rake', '>= 0.9.0' - gem 'rspec', '~> 1.2.9' + gem 'rspec', '~> 2.10.0' gem 'rcov', '>= 0.9.9', :platform => :mri_18 end diff --git a/Rakefile b/Rakefile index cf1eea187..1565402c4 100644 --- a/Rakefile +++ b/Rakefile @@ -5,9 +5,9 @@ $LOAD_PATH.uniq! require 'rubygems' require 'rake' -gem 'rspec', '~> 1.2.9' +gem 'rspec', '~> 2.10.0' begin - require 'spec/rake/spectask' + require 'rspec/core/rake_task' rescue LoadError STDERR.puts "Please install rspec:" STDERR.puts "sudo gem install rspec" diff --git a/spec/spec.opts b/spec/spec.opts deleted file mode 100644 index 5779d6236..000000000 --- a/spec/spec.opts +++ /dev/null @@ -1,2 +0,0 @@ ---colour ---format specdoc diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 531fa9598..6f1dd6867 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -3,3 +3,6 @@ lib_dir = File.expand_path("../lib", spec_dir) $LOAD_PATH.unshift(lib_dir) $LOAD_PATH.uniq! + +RSpec.configure do |config| +end diff --git a/tasks/gem.rake b/tasks/gem.rake index 2f6696069..098333a3e 100644 --- a/tasks/gem.rake +++ b/tasks/gem.rake @@ -39,7 +39,7 @@ namespace :gem do s.add_development_dependency('sinatra', '>= 1.2.0') s.add_development_dependency('rake', '>= 0.9.0') - s.add_development_dependency('rspec', '~> 1.2.9') + s.add_development_dependency('rspec', '~> 2.10.0') s.add_development_dependency('rcov', '>= 0.9.9') s.require_path = 'lib' diff --git a/tasks/spec.rake b/tasks/spec.rake index 0838b646e..85d498633 100644 --- a/tasks/spec.rake +++ b/tasks/spec.rake @@ -1,16 +1,31 @@ -require 'spec/rake/verify_rcov' require 'rake/clean' CLOBBER.include('coverage', 'specdoc') namespace :spec do - Spec::Rake::SpecTask.new(:rcov) do |t| - t.spec_files = FileList['spec/**/*_spec.rb'] - t.spec_opts = ['--require', 'rubygems', '--color', '--format', 'specdoc'] + RSpec::Core::RakeTask.new(:all) do |t| + end + + RSpec::Core::RakeTask.new(:fast) do |t| + t.pattern = FileList['spec/**/*_spec.rb'].exclude( + 'spec/**/*_slow_spec.rb' + ) + end + + desc 'Generate HTML Specdocs for all specs.' + RSpec::Core::RakeTask.new(:specdoc) do |t| + specdoc_path = File.expand_path('../../specdoc', __FILE__) + Dir.mkdir(specdoc_path) if !File.exist?(specdoc_path) + + t.rspec_opts = %W( --format html --out #{File.join(specdoc_path, 'index.html')} ) + t.fail_on_error = false + end + + RSpec::Core::RakeTask.new(:rcov) do |t| if RCOV_ENABLED if `which rcov`.strip == "" STDERR.puts( - "Please install rcov and ensure that its binary is in the PATH:" + "Please install rcov and ensure that its binary is in the PATH:" ) STDERR.puts("sudo gem install rcov") exit(1) @@ -19,30 +34,16 @@ namespace :spec do else t.rcov = false end - t.rcov_opts = [ - '--exclude', 'lib\\/google\\/api_client\\/environment.rb', - '--exclude', 'lib\\/compat', - '--exclude', 'spec', - '--exclude', '\\.rvm\\/gems', - '--exclude', '1\\.8\\/gems', - '--exclude', '1\\.9\\/gems', - '--exclude', '\\.rvm', - '--exclude', '\\/Library\\/Ruby', - ] - end - - Spec::Rake::SpecTask.new(:all) do |t| - t.spec_files = FileList['spec/**/*_spec.rb'] - t.spec_opts = ['--require', 'rubygems', '--color', '--format', 'specdoc'] - t.rcov = false - end - - Spec::Rake::SpecTask.new(:fast) do |t| - t.spec_files = FileList['spec/**/*_spec.rb'].exclude( - 'spec/**/*_slow_spec.rb' + t.rcov_opts = %w( + --exclude lib/google/api_client/environment.rb, + lib/compat, + spec, + .rvm/gems, + 1.8/gems, + 1.9/gems, + .rvm, + /Library/Ruby ) - t.spec_opts = ['--require', 'rubygems', '--color', '--format', 'specdoc'] - t.rcov = false end if RCOV_ENABLED @@ -54,18 +55,6 @@ namespace :spec do task :verify => :rcov end - desc 'Generate HTML Specdocs for all specs' - Spec::Rake::SpecTask.new(:specdoc) do |t| - specdoc_path = File.expand_path( - File.join(File.dirname(__FILE__), '../specdoc/')) - Dir.mkdir(specdoc_path) if !File.exist?(specdoc_path) - - output_file = File.join(specdoc_path, 'index.html') - t.spec_files = FileList['spec/**/*_spec.rb'] - t.spec_opts = ['--format', "\"html:#{output_file}\"", '--diff'] - t.fail_on_error = false - end - namespace :rcov do desc 'Browse the code coverage report.' task :browse => 'spec:rcov' do From efb3938f7c5b5cb823eb8777f12db33f2e29503d Mon Sep 17 00:00:00 2001 From: Simone Carletti Date: Thu, 14 Jun 2012 11:32:16 +0200 Subject: [PATCH 3/5] There are now slow specs. Moreover, in RSpec 2 we will be able to use metadata to filter specs. https://www.relishapp.com/rspec/rspec-core/v/2-10/docs/metadata --- tasks/spec.rake | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tasks/spec.rake b/tasks/spec.rake index 85d498633..021b3eb74 100644 --- a/tasks/spec.rake +++ b/tasks/spec.rake @@ -6,12 +6,6 @@ namespace :spec do RSpec::Core::RakeTask.new(:all) do |t| end - RSpec::Core::RakeTask.new(:fast) do |t| - t.pattern = FileList['spec/**/*_spec.rb'].exclude( - 'spec/**/*_slow_spec.rb' - ) - end - desc 'Generate HTML Specdocs for all specs.' RSpec::Core::RakeTask.new(:specdoc) do |t| specdoc_path = File.expand_path('../../specdoc', __FILE__) From b7430aeb8cf2a57e4bbccbf620ce42d45110793d Mon Sep 17 00:00:00 2001 From: Simone Carletti Date: Thu, 14 Jun 2012 11:35:46 +0200 Subject: [PATCH 4/5] RSpec create the /specdoc folder if needed. In this way, we don't get this folder for free every time rake evaluates the tasks. --- tasks/spec.rake | 1 - 1 file changed, 1 deletion(-) diff --git a/tasks/spec.rake b/tasks/spec.rake index 021b3eb74..905935aa5 100644 --- a/tasks/spec.rake +++ b/tasks/spec.rake @@ -9,7 +9,6 @@ namespace :spec do desc 'Generate HTML Specdocs for all specs.' RSpec::Core::RakeTask.new(:specdoc) do |t| specdoc_path = File.expand_path('../../specdoc', __FILE__) - Dir.mkdir(specdoc_path) if !File.exist?(specdoc_path) t.rspec_opts = %W( --format html --out #{File.join(specdoc_path, 'index.html')} ) t.fail_on_error = false From 5858999045c59a4ad6baf7ebbba77b086f541d91 Mon Sep 17 00:00:00 2001 From: Simone Carletti Date: Thu, 14 Jun 2012 11:47:06 +0200 Subject: [PATCH 5/5] Remove multiple specifications of gem 'rspec' We should take advantage of bundler. Use gemspec in the Gemfile to merge the Gemfile with the dependencies in the .gemspec file. This solution requires rcov to be removed from .gemspec because RCov only works in MRI 1.8 and there's no way to specify platforms in the .gemspec. --- Gemfile | 3 ++- Rakefile | 9 --------- google-api-client.gemspec | 15 ++++++--------- tasks/gem.rake | 1 - tasks/spec.rake | 1 + 5 files changed, 9 insertions(+), 20 deletions(-) diff --git a/Gemfile b/Gemfile index 7a86b3aad..f04092421 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,7 @@ source :rubygems +gemspec + gem 'signet', '>= 0.3.4' gem 'addressable', '>= 2.2.3' gem 'uuidtools', '>= 2.1.0' @@ -21,7 +23,6 @@ end group :test, :development do gem 'rake', '>= 0.9.0' - gem 'rspec', '~> 2.10.0' gem 'rcov', '>= 0.9.9', :platform => :mri_18 end diff --git a/Rakefile b/Rakefile index 1565402c4..04a09f46d 100644 --- a/Rakefile +++ b/Rakefile @@ -5,15 +5,6 @@ $LOAD_PATH.uniq! require 'rubygems' require 'rake' -gem 'rspec', '~> 2.10.0' -begin - require 'rspec/core/rake_task' -rescue LoadError - STDERR.puts "Please install rspec:" - STDERR.puts "sudo gem install rspec" - exit(1) -end - require File.join(File.dirname(__FILE__), 'lib/google/api_client', 'version') PKG_DISPLAY_NAME = 'Google API Client' diff --git a/google-api-client.gemspec b/google-api-client.gemspec index 961af5585..7f726b60e 100644 --- a/google-api-client.gemspec +++ b/google-api-client.gemspec @@ -6,16 +6,16 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Bob Aman"] - s.date = "2012-06-07" + s.date = "2012-06-14" s.description = "The Google API Ruby Client makes it trivial to discover and access supported\nAPIs.\n" s.email = "bobaman@google.com" s.executables = ["google-api"] s.extra_rdoc_files = ["README.md"] - s.files = ["lib/google", "lib/google/api_client", "lib/google/api_client/batch.rb", "lib/google/api_client/client_secrets.rb", "lib/google/api_client/discovery", "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/discovery.rb", "lib/google/api_client/environment.rb", "lib/google/api_client/errors.rb", "lib/google/api_client/media.rb", "lib/google/api_client/reference.rb", "lib/google/api_client/result.rb", "lib/google/api_client/service_account.rb", "lib/google/api_client/version.rb", "lib/google/api_client.rb", "lib/google/api_client.rb.orig", "lib/google/inflection.rb", "spec/fixtures", "spec/fixtures/files", "spec/fixtures/files/sample.txt", "spec/google", "spec/google/api_client", "spec/google/api_client/batch_spec.rb", "spec/google/api_client/discovery_spec.rb", "spec/google/api_client/media_spec.rb", "spec/google/api_client/result_spec.rb", "spec/google/api_client/service_account_spec.rb", "spec/google/api_client_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/gem.rake", "tasks/git.rake", "tasks/metrics.rake", "tasks/spec.rake", "tasks/wiki.rake", "tasks/yard.rake", "CHANGELOG.md", "Gemfile", "Gemfile.lock", "LICENSE", "Rakefile", "README.md", "bin/google-api"] + s.files = ["lib/google", "lib/google/api_client", "lib/google/api_client/batch.rb", "lib/google/api_client/client_secrets.rb", "lib/google/api_client/discovery", "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/discovery.rb", "lib/google/api_client/environment.rb", "lib/google/api_client/errors.rb", "lib/google/api_client/media.rb", "lib/google/api_client/reference.rb", "lib/google/api_client/result.rb", "lib/google/api_client/service_account.rb", "lib/google/api_client/version.rb", "lib/google/api_client.rb", "lib/google/inflection.rb", "spec/fixtures", "spec/fixtures/files", "spec/fixtures/files/sample.txt", "spec/google", "spec/google/api_client", "spec/google/api_client/batch_spec.rb", "spec/google/api_client/discovery_spec.rb", "spec/google/api_client/media_spec.rb", "spec/google/api_client/result_spec.rb", "spec/google/api_client/service_account_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", "Gemfile", "Gemfile.lock", "LICENSE", "Rakefile", "README.md", "bin/google-api"] s.homepage = "http://code.google.com/p/google-api-ruby-client/" s.rdoc_options = ["--main", "README.md"] s.require_paths = ["lib"] - s.rubygems_version = "1.8.10" + s.rubygems_version = "1.8.24" s.summary = "Package Summary" if s.respond_to? :specification_version then @@ -32,8 +32,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency(%q, [">= 2.0.0"]) s.add_development_dependency(%q, [">= 1.2.0"]) s.add_development_dependency(%q, [">= 0.9.0"]) - s.add_development_dependency(%q, ["~> 1.2.9"]) - s.add_development_dependency(%q, [">= 0.9.9"]) + s.add_development_dependency(%q, ["~> 2.10.0"]) else s.add_dependency(%q, [">= 0.3.4"]) s.add_dependency(%q, [">= 2.2.3"]) @@ -45,8 +44,7 @@ Gem::Specification.new do |s| s.add_dependency(%q, [">= 2.0.0"]) s.add_dependency(%q, [">= 1.2.0"]) s.add_dependency(%q, [">= 0.9.0"]) - s.add_dependency(%q, ["~> 1.2.9"]) - s.add_dependency(%q, [">= 0.9.9"]) + s.add_dependency(%q, ["~> 2.10.0"]) end else s.add_dependency(%q, [">= 0.3.4"]) @@ -59,7 +57,6 @@ Gem::Specification.new do |s| s.add_dependency(%q, [">= 2.0.0"]) s.add_dependency(%q, [">= 1.2.0"]) s.add_dependency(%q, [">= 0.9.0"]) - s.add_dependency(%q, ["~> 1.2.9"]) - s.add_dependency(%q, [">= 0.9.9"]) + s.add_dependency(%q, ["~> 2.10.0"]) end end diff --git a/tasks/gem.rake b/tasks/gem.rake index 098333a3e..ab07b52f1 100644 --- a/tasks/gem.rake +++ b/tasks/gem.rake @@ -40,7 +40,6 @@ namespace :gem do s.add_development_dependency('rake', '>= 0.9.0') s.add_development_dependency('rspec', '~> 2.10.0') - s.add_development_dependency('rcov', '>= 0.9.9') s.require_path = 'lib' diff --git a/tasks/spec.rake b/tasks/spec.rake index 905935aa5..858c874f2 100644 --- a/tasks/spec.rake +++ b/tasks/spec.rake @@ -1,4 +1,5 @@ require 'rake/clean' +require 'rspec/core/rake_task' CLOBBER.include('coverage', 'specdoc')