From e6ba0f68606cf6050ecdb890d6eb7b7bcd2dcbc0 Mon Sep 17 00:00:00 2001 From: "bobaman@google.com" Date: Tue, 17 Aug 2010 01:21:17 +0000 Subject: [PATCH] Updating code to consistent coding style. git-svn-id: https://google-api-ruby-client.googlecode.com/svn/trunk@15 c1d61fac-ed7f-fcc1-18f7-ff78120a04ef --- Rakefile | 26 ++++++------ lib/google/api_client.rb | 6 +-- lib/google/api_client/auth/oauth_1.rb | 26 +++++++----- lib/google/api_client/discovery/discovery.rb | 13 +++--- spec/google/api_client/auth/oauth_1_spec.rb | 42 +++++++++---------- .../auth/services/buzz_slow_spec.rb | 38 ++++++++--------- .../api_client/discovery/discovery_spec.rb | 22 +++++----- spec/spec_helper.rb | 8 ++-- tasks/clobber.rake | 4 +- tasks/gem.rake | 38 ++++++++--------- tasks/git.rake | 28 ++++++------- tasks/metrics.rake | 6 +-- tasks/rdoc.rake | 26 ++++++------ tasks/spec.rake | 22 +++++----- tasks/yard.rake | 24 +++++------ 15 files changed, 168 insertions(+), 161 deletions(-) diff --git a/Rakefile b/Rakefile index 44441649c..273cb5849 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,6 @@ -lib_dir = File.expand_path(File.join(File.dirname(__FILE__), "lib")) -$:.unshift(lib_dir) -$:.uniq! +lib_dir = File.expand_path('../lib', __FILE__) +$LOAD_PATH.unshift(lib_dir) +$LOAD_PATH.uniq! require 'rubygems' require 'rake' @@ -12,37 +12,37 @@ require 'rake/gempackagetask' begin require 'spec/rake/spectask' rescue LoadError - STDERR.puts "Please install RSpec." + STDERR.puts 'Please install RSpec.' exit(1) end require File.join(File.dirname(__FILE__), 'lib/google/api_client', 'version') PKG_DISPLAY_NAME = 'Google API Client' -PKG_NAME = PKG_DISPLAY_NAME.downcase.gsub(/\s/, "-") +PKG_NAME = PKG_DISPLAY_NAME.downcase.gsub(/\s/, '-') PKG_VERSION = Google::APIClient::VERSION::STRING PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}" -PKG_HOMEPAGE = "http://code.google.com/p/google-api-ruby-client/" +PKG_HOMEPAGE = 'http://code.google.com/p/google-api-ruby-client/' RELEASE_NAME = "REL #{PKG_VERSION}" -PKG_SUMMARY = "Package Summary" +PKG_SUMMARY = 'Package Summary' PKG_DESCRIPTION = <<-TEXT The Google API Ruby Client makes it trivial to discover and access supported APIs. TEXT PKG_FILES = FileList[ - "lib/**/*", "spec/**/*", "vendor/**/*", - "tasks/**/*", "website/**/*", - "[A-Z]*", "Rakefile" + 'lib/**/*', 'spec/**/*', 'vendor/**/*', + 'tasks/**/*', 'website/**/*', + '[A-Z]*', 'Rakefile' ].exclude(/database\.yml/).exclude(/[_\.]git$/) -RCOV_ENABLED = (RUBY_PLATFORM != "java" && RUBY_VERSION =~ /^1\.8/) +RCOV_ENABLED = (RUBY_PLATFORM != 'java' && RUBY_VERSION =~ /^1\.8/) if RCOV_ENABLED - task :default => "spec:verify" + task :default => 'spec:verify' else - task :default => "spec" + task :default => 'spec' end WINDOWS = (RUBY_PLATFORM =~ /mswin|win32|mingw|bccwin|cygwin/) rescue false diff --git a/lib/google/api_client.rb b/lib/google/api_client.rb index 081ba7d54..3d2ec21d1 100644 --- a/lib/google/api_client.rb +++ b/lib/google/api_client.rb @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -require "google/api_client/version" +require 'google/api_client/version' module Google #:nodoc: ## @@ -23,12 +23,12 @@ module Google #:nodoc: # TODO: What configuration options need to go here? }.merge(options) unless @options[:authentication] - require "google/api_client/auth/oauth_1" + require 'google/api_client/auth/oauth_1' # NOTE: Do not rely on this default value, as it may change @options[:authentication] = OAuth1.new end unless @options[:transport] - require "google/api_client/transport/http_transport" + require 'google/api_client/transport/http_transport' @options[:transport] = HTTPTransport end end diff --git a/lib/google/api_client/auth/oauth_1.rb b/lib/google/api_client/auth/oauth_1.rb index 970bfa4c9..1e9b47ac0 100644 --- a/lib/google/api_client/auth/oauth_1.rb +++ b/lib/google/api_client/auth/oauth_1.rb @@ -12,14 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -require "addressable/uri" -require "oauth" +require 'addressable/uri' +require 'oauth' module Google #:nodoc: class APIClient #:nodoc: ## # An OAuth 1.0a handler. class OAuth1 + ## # The default OAuth 1.0a configuration values. These may be overrided # simply by passing in the same key to the constructor. @@ -33,10 +34,10 @@ module Google #:nodoc: :scopes => [], :callback => OAuth::OUT_OF_BAND, :display_name => nil, - :consumer_key => "anonymous", - :consumer_secret => "anonymous" + :consumer_key => 'anonymous', + :consumer_secret => 'anonymous' } - + ## # A set of default configuration values specific to each service. These # may be overrided simply by passing in the same key to the constructor. @@ -44,7 +45,12 @@ module Google #:nodoc: :buzz => { :authorization_uri => 'https://www.google.com/buzz/api/auth/OAuthAuthorizeToken', - :scopes => ["https://www.googleapis.com/auth/buzz"] + :scopes => ['https://www.googleapis.com/auth/buzz'] + }, + :latitude => { + :authorization_uri => + 'https://www.google.com/latitude/apps/OAuthAuthorizeToken', + :scopes => ['https://www.googleapis.com/auth/latitude'] } } @@ -96,7 +102,7 @@ module Google #:nodoc: @options[:authorization_uri].site) || (@options[:request_token_uri].site != @options[:authorization_uri].site) - raise ArgumentError, "All OAuth endpoints must be on the same site." + raise ArgumentError, 'All OAuth endpoints must be on the same site.' end @oauth_consumer = ::OAuth::Consumer.new( @options[:consumer_key], @options[:consumer_secret], { @@ -111,7 +117,7 @@ module Google #:nodoc: } ) end - + ## # Returns the configuration of the handler. Configuration options that # are not recognized by the handler are ignored. @@ -131,7 +137,7 @@ module Google #:nodoc: :oauth_callback => @options[:callback] } app_parameters = { - :scope => @options[:scopes].join(" ") + :scope => @options[:scopes].join(' ') } if @options[:display_name] app_parameters[:xoauth_displayname] = @options[:display_name] @@ -243,7 +249,7 @@ module Google #:nodoc: end ## - # Builds the authorization URI that the user will be redirected to. + # Builds the authorization URI that the user will be redirected to. # Note that this value is derived from the # {#authorization_endpoint_uri}. # diff --git a/lib/google/api_client/discovery/discovery.rb b/lib/google/api_client/discovery/discovery.rb index efc7dcc7e..882e631f7 100644 --- a/lib/google/api_client/discovery/discovery.rb +++ b/lib/google/api_client/discovery/discovery.rb @@ -12,20 +12,21 @@ # See the License for the specific language governing permissions and # limitations under the License. -require "json" -require "addressable/template" +require 'json' +require 'addressable/template' module Google #:nodoc: class APIClient #:nodoc: ## # A discovery document handler. class Discovery + ## # The default discovery configuration values. These may be overrided # simply by passing in the same key to the constructor. DEFAULTS = { } - + ## # A set of default configuration values specific to each service. These # may be overrided simply by passing in the same key to the constructor. @@ -53,14 +54,14 @@ module Google #:nodoc: @options.merge!(options) if @options[:service] && !@options[:discovery_uri] service_id = @options[:service] - service_version = @options[:service_version] || "1.0" + service_version = @options[:service_version] || '1.0' @options[:discovery_uri] = "http://www.googleapis.com/discovery/0.1/describe" + "?api=#{service_id}&apiVersion=#{service_version}" end unless @options[:discovery_uri] raise ArgumentError, - "Missing required configuration value, :discovery_uri." + 'Missing required configuration value, :discovery_uri.' end # Handle any remaining configuration here end @@ -73,7 +74,7 @@ module Google #:nodoc: def options return @options end - + ## # Returns the URI of the discovery document. # diff --git a/spec/google/api_client/auth/oauth_1_spec.rb b/spec/google/api_client/auth/oauth_1_spec.rb index d3f79f1d6..f1b280f0d 100644 --- a/spec/google/api_client/auth/oauth_1_spec.rb +++ b/spec/google/api_client/auth/oauth_1_spec.rb @@ -12,58 +12,58 @@ # See the License for the specific language governing permissions and # limitations under the License. -require "spec_helper" +require 'spec_helper' -require "oauth" -require "google/api_client/auth/oauth_1" +require 'oauth' +require 'google/api_client/auth/oauth_1' -describe Google::APIClient::OAuth1, "in the default configuration" do +describe Google::APIClient::OAuth1, 'in the default configuration' do before do @oauth = Google::APIClient::OAuth1.new end - it "should have the correct request_token_uri" do + it 'should have the correct request_token_uri' do @oauth.request_token_uri.should == - "https://www.google.com/accounts/OAuthGetRequestToken" + 'https://www.google.com/accounts/OAuthGetRequestToken' end - it "should have the correct authorization_uri" do + it 'should have the correct authorization_uri' do @oauth.authorization_endpoint_uri.should == - "https://www.google.com/accounts/OAuthAuthorizeToken" + 'https://www.google.com/accounts/OAuthAuthorizeToken' end - it "should have the correct access_token_uri" do + it 'should have the correct access_token_uri' do @oauth.access_token_uri.should == - "https://www.google.com/accounts/OAuthGetAccessToken" + 'https://www.google.com/accounts/OAuthGetAccessToken' end - it "should have the correct consumer_key" do - @oauth.consumer_key.should == "anonymous" + it 'should have the correct consumer_key' do + @oauth.consumer_key.should == 'anonymous' end - it "should have the correct consumer_secret" do - @oauth.consumer_secret.should == "anonymous" + it 'should have the correct consumer_secret' do + @oauth.consumer_secret.should == 'anonymous' end - it "should allow the request_token to be set manually" do - @oauth.request_token = OAuth::RequestToken.new(@oauth, "key", "secret") - @oauth.request_token.token.should == "key" - @oauth.request_token.secret.should == "secret" + it 'should allow the request_token to be set manually' do + @oauth.request_token = OAuth::RequestToken.new(@oauth, 'key', 'secret') + @oauth.request_token.token.should == 'key' + @oauth.request_token.secret.should == 'secret' end - it "should not allow the request_token to be set to bogus value" do + it 'should not allow the request_token to be set to bogus value' do (lambda do @oauth.request_token = 42 end).should raise_error(TypeError) end end -describe Google::APIClient::OAuth1, "configured for use with bogus service" do +describe Google::APIClient::OAuth1, 'configured for use with bogus service' do before do @oauth = Google::APIClient::OAuth1.new(:service => :bogus) end - it "should have the default configuration" do + it 'should have the default configuration' do @oauth.request_token_uri.should == Google::APIClient::OAuth1::DEFAULTS[:request_token_uri] @oauth.authorization_endpoint_uri.should == diff --git a/spec/google/api_client/auth/services/buzz_slow_spec.rb b/spec/google/api_client/auth/services/buzz_slow_spec.rb index bc30de51a..74d0f4a0c 100644 --- a/spec/google/api_client/auth/services/buzz_slow_spec.rb +++ b/spec/google/api_client/auth/services/buzz_slow_spec.rb @@ -12,49 +12,49 @@ # See the License for the specific language governing permissions and # limitations under the License. -require "spec_helper" +require 'spec_helper' -require "oauth" -require "google/api_client/auth/oauth_1" -require "addressable/uri" +require 'oauth' +require 'google/api_client/auth/oauth_1' +require 'addressable/uri' -describe Google::APIClient::OAuth1, "configured for use with Buzz" do +describe Google::APIClient::OAuth1, 'configured for use with Buzz' do before do @oauth = Google::APIClient::OAuth1.new(:service => :buzz) end - it "should not have the default configuration" do + it 'should not have the default configuration' do @oauth.authorization_endpoint_uri.should_not == Google::APIClient::OAuth1::DEFAULTS[:authorization_uri] @oauth.scopes.should_not == Google::APIClient::OAuth1::DEFAULTS[:scopes] end - it "should have the correct authorization_uri" do + it 'should have the correct authorization_uri' do @oauth.authorization_endpoint_uri.should == - "https://www.google.com/buzz/api/auth/OAuthAuthorizeToken" + 'https://www.google.com/buzz/api/auth/OAuthAuthorizeToken' end - it "should have the correct scope" do - @oauth.scopes.should include("https://www.googleapis.com/auth/buzz") + it 'should have the correct scope' do + @oauth.scopes.should include('https://www.googleapis.com/auth/buzz') end - - it "should be able to get a request token" do + + it 'should be able to get a request token' do @oauth.request_token.token.should =~ /^[a-zA-Z0-9\/\-\_\+]+$/ @oauth.request_token.secret.should =~ /^[a-zA-Z0-9\/\-\_\+]+$/ end - - it "should issue only a single request token" do + + it 'should issue only a single request token' do @oauth.request_token.token.should == @oauth.request_token.token @oauth.request_token.secret.should == @oauth.request_token.secret end - - it "should build the correct authorization URI" do - icon_uri = "http://www.google.com/images/icons/feature/padlock-g128.png" + + it 'should build the correct authorization URI' do + icon_uri = 'http://www.google.com/images/icons/feature/padlock-g128.png' uri = @oauth.authorization_uri( :domain => @oauth.consumer_key, :iconUrl => icon_uri, - :scope => @oauth.scopes.join(" ") + :scope => @oauth.scopes.join(' ') ) uri.should =~ /^https:\/\/www.google.com\/buzz\/api\/auth\/OAuthAuthorizeToken/ @@ -67,6 +67,6 @@ describe Google::APIClient::OAuth1, "configured for use with Buzz" do Regexp.new(Regexp.escape(scope)) end end - + # Not much we can do to test any further into the OAuth flow end diff --git a/spec/google/api_client/discovery/discovery_spec.rb b/spec/google/api_client/discovery/discovery_spec.rb index 828350b9c..1f7e3795b 100644 --- a/spec/google/api_client/discovery/discovery_spec.rb +++ b/spec/google/api_client/discovery/discovery_spec.rb @@ -12,25 +12,25 @@ # See the License for the specific language governing permissions and # limitations under the License. -require "spec_helper" +require 'spec_helper' -require "oauth" -require "google/api_client/discovery/discovery" +require 'oauth' +require 'google/api_client/discovery/discovery' -describe Google::APIClient::Discovery, "configured for use with a service" do +describe Google::APIClient::Discovery, 'configured for use with a service' do before do @discovery = Google::APIClient::Discovery.new(:service => :magic) end - it "should have the correct discovery document URI" do + it 'should have the correct discovery document URI' do @discovery.discovery_uri.should == - "http://www.googleapis.com/discovery/0.1/describe" + - "?api=magic&apiVersion=1.0" + 'http://www.googleapis.com/discovery/0.1/describe' + + '?api=magic&apiVersion=1.0' end end describe Google::APIClient::Discovery, - "configured for use with a specific service version" do + 'configured for use with a specific service version' do before do @discovery = Google::APIClient::Discovery.new( :service => :magic, @@ -38,9 +38,9 @@ describe Google::APIClient::Discovery, ) end - it "should have the correct discovery document URI" do + it 'should have the correct discovery document URI' do @discovery.discovery_uri.should == - "http://www.googleapis.com/discovery/0.1/describe" + - "?api=magic&apiVersion=42.0" + 'http://www.googleapis.com/discovery/0.1/describe' + + '?api=magic&apiVersion=42.0' end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c12e55a86..531fa9598 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,5 @@ -spec_dir = File.expand_path(File.dirname(__FILE__)) -lib_dir = File.expand_path(File.join(spec_dir, "../lib")) +spec_dir = File.expand_path("..", __FILE__) +lib_dir = File.expand_path("../lib", spec_dir) -$:.unshift(lib_dir) -$:.uniq! +$LOAD_PATH.unshift(lib_dir) +$LOAD_PATH.uniq! diff --git a/tasks/clobber.rake b/tasks/clobber.rake index 093ce817b..fdd58eb78 100644 --- a/tasks/clobber.rake +++ b/tasks/clobber.rake @@ -1,2 +1,2 @@ -desc "Remove all build products" -task "clobber" +desc 'Remove all build products' +task 'clobber' diff --git a/tasks/gem.rake b/tasks/gem.rake index 9219cbfa8..fde1b0345 100644 --- a/tasks/gem.rake +++ b/tasks/gem.rake @@ -1,9 +1,9 @@ -require "rake/gempackagetask" +require 'rake/gempackagetask' 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." + puts 'The gem spec requires a newer version of RubyGems.' exit(1) end @@ -16,18 +16,18 @@ namespace :gem do s.has_rdoc = true s.extra_rdoc_files = %w( README ) - s.rdoc_options.concat ["--main", "README"] + s.rdoc_options.concat ['--main', 'README'] - s.add_runtime_dependency("oauth", ">= 0.4.1") - s.add_runtime_dependency("addressable", ">= 2.2.0") - s.add_runtime_dependency("json", ">= 1.1.9") + s.add_runtime_dependency('oauth', '>= 0.4.1') + s.add_runtime_dependency('addressable', '>= 2.2.0') + s.add_runtime_dependency('json', '>= 1.1.9') - s.add_development_dependency("rake", ">= 0.7.3") - s.add_development_dependency("rspec", ">= 1.0.8") - s.add_development_dependency("launchy", ">= 0.3.2") - s.add_development_dependency("diff-lcs", ">= 1.1.2") + s.add_development_dependency('rake', '>= 0.7.3') + s.add_development_dependency('rspec', '>= 1.0.8') + s.add_development_dependency('launchy', '>= 0.3.2') + s.add_development_dependency('diff-lcs', '>= 1.1.2') - s.require_path = "lib" + s.require_path = 'lib' s.homepage = PKG_HOMEPAGE end @@ -38,17 +38,17 @@ namespace :gem do p.need_zip = true end - desc "Show information about the gem" + desc 'Show information about the gem' task :debug do puts GEM_SPEC.to_ruby 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 && @@ -60,11 +60,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 "clobber" => ["gem:clobber_package"] +task 'clobber' => ['gem:clobber_package'] diff --git a/tasks/git.rake b/tasks/git.rake index 8c318cb96..e0a0eb1b0 100644 --- a/tasks/git.rake +++ b/tasks/git.rake @@ -1,40 +1,40 @@ namespace :git do namespace :tag do - desc "List tags from the Git repository" + desc 'List tags from the Git repository' task :list do tags = `git tag -l` - tags.gsub!("\r", "") - tags = tags.split("\n").sort {|a, b| b <=> a } - puts tags.join("\n") + tags.gsub!('\r', '') + tags = tags.split('\n').sort {|a, b| b <=> a } + puts tags.join('\n') end - desc "Create a new tag in the Git repository" + desc 'Create a new tag in the Git repository' task :create do - changelog = File.open("CHANGELOG", "r") { |file| file.read } - puts "-" * 80 + changelog = File.open('CHANGELOG', 'r') { |file| file.read } + puts '-' * 80 puts changelog - puts "-" * 80 + puts '-' * 80 puts - v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z" + v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z' abort "Versions don't match #{v} vs #{PKG_VERSION}" if v != PKG_VERSION tag = "#{PKG_NAME}-#{PKG_VERSION}" msg = "Release #{PKG_NAME}-#{PKG_VERSION}" - existing_tags = `git tag -l #{PKG_NAME}-*`.split("\n") + existing_tags = `git tag -l #{PKG_NAME}-*`.split('\n') if existing_tags.include?(tag) - warn("Tag already exists, deleting...") + warn('Tag already exists, deleting...') unless system "git tag -d #{tag}" - abort "Tag deletion failed." + abort 'Tag deletion failed.' end end puts "Creating git tag '#{tag}'..." unless system "git tag -a -m \"#{msg}\" #{tag}" - abort "Tag creation failed." + abort 'Tag creation failed.' end end end end -task "gem:release" => "git:tag:create" +task 'gem:release' => 'git:tag:create' diff --git a/tasks/metrics.rake b/tasks/metrics.rake index 41fc5c2b9..67cb4eb77 100644 --- a/tasks/metrics.rake +++ b/tasks/metrics.rake @@ -1,7 +1,7 @@ namespace :metrics do task :lines do lines, codelines, total_lines, total_codelines = 0, 0, 0, 0 - for file_name in FileList["lib/**/*.rb"] + for file_name in FileList['lib/**/*.rb'] f = File.open(file_name) while line = f.gets lines += 1 @@ -9,8 +9,8 @@ namespace :metrics do next if line =~ /^\s*#/ codelines += 1 end - puts "L: #{sprintf("%4d", lines)}, " + - "LOC #{sprintf("%4d", codelines)} | #{file_name}" + puts "L: #{sprintf('%4d', lines)}, " + + "LOC #{sprintf('%4d', codelines)} | #{file_name}" total_lines += lines total_codelines += codelines diff --git a/tasks/rdoc.rake b/tasks/rdoc.rake index 00ef19be1..360e2573a 100644 --- a/tasks/rdoc.rake +++ b/tasks/rdoc.rake @@ -1,26 +1,26 @@ -require "rake/rdoctask" +require 'rake/rdoctask' namespace :doc do - desc "Generate RDoc documentation" + desc 'Generate RDoc documentation' Rake::RDocTask.new do |rdoc| - rdoc.rdoc_dir = "doc" + rdoc.rdoc_dir = 'doc' rdoc.title = "#{PKG_NAME}-#{PKG_VERSION} Documentation" - rdoc.options << "--line-numbers" << "--inline-source" << - "--accessor" << "cattr_accessor=object" << "--charset" << "utf-8" - rdoc.template = "#{ENV["template"]}.rb" if ENV["template"] - rdoc.rdoc_files.include("README", "CHANGELOG", "LICENSE") - rdoc.rdoc_files.include("lib/**/*.rb") + rdoc.options << '--line-numbers' << '--inline-source' << + '--accessor' << 'cattr_accessor=object' << '--charset' << 'utf-8' + rdoc.template = "#{ENV['template']}.rb" if ENV['template'] + rdoc.rdoc_files.include('README', 'CHANGELOG', 'LICENSE') + rdoc.rdoc_files.include('lib/**/*.rb') end - desc "Generate ri locally for testing" + desc 'Generate ri locally for testing' task :ri do - sh "rdoc --ri -o ri ." + sh 'rdoc --ri -o ri .' end - desc "Remove ri products" + desc 'Remove ri products' task :clobber_ri do - rm_r "ri" rescue nil + rm_r 'ri' rescue nil end end -task "clobber" => ["doc:clobber_rdoc", "doc:clobber_ri"] +task 'clobber' => ['doc:clobber_rdoc', 'doc:clobber_ri'] diff --git a/tasks/spec.rake b/tasks/spec.rake index 77dea59d7..0c1fe59e0 100644 --- a/tasks/spec.rake +++ b/tasks/spec.rake @@ -39,7 +39,7 @@ namespace :spec do task :verify => :rcov end - desc "Generate HTML Specdocs for all specs" + 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/')) @@ -47,25 +47,25 @@ namespace :spec do output_file = File.join(specdoc_path, 'index.html') t.spec_files = FileList['spec/**/*_spec.rb'] - t.spec_opts = ["--format", "\"html:#{output_file}\"", "--diff"] + 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 - require "launchy" - Launchy::Browser.run("coverage/index.html") + desc 'Browse the code coverage report.' + task :browse => 'spec:rcov' do + require 'launchy' + Launchy::Browser.run('coverage/index.html') end end end if RCOV_ENABLED - desc "Alias to spec:verify" - task "spec" => "spec:verify" + desc 'Alias to spec:verify' + task 'spec' => 'spec:verify' else - desc "Alias to spec:all" - task "spec" => "spec:all" + desc 'Alias to spec:all' + task 'spec' => 'spec:all' end -task "clobber" => ["spec:clobber_rcov"] +task 'clobber' => ['spec:clobber_rcov'] diff --git a/tasks/yard.rake b/tasks/yard.rake index 8d1eb51f0..991b8a628 100644 --- a/tasks/yard.rake +++ b/tasks/yard.rake @@ -1,26 +1,26 @@ -require "rake" +require 'rake' begin - require "yard" - require "yard/rake/yardoc_task" + require 'yard' + require 'yard/rake/yardoc_task' namespace :doc do - desc "Generate Yardoc documentation" + desc 'Generate Yardoc documentation' YARD::Rake::YardocTask.new do |yardoc| - yardoc.name = "yard" - yardoc.options = ["--verbose"] + yardoc.name = 'yard' + yardoc.options = ['--verbose'] yardoc.files = [ - "lib/**/*.rb", "ext/**/*.c", "README", "CHANGELOG", "LICENSE" + 'lib/**/*.rb', 'ext/**/*.c', 'README', 'CHANGELOG', 'LICENSE' ] end end - task "clobber" => ["doc:clobber_yard"] + task 'clobber' => ['doc:clobber_yard'] - desc "Alias to doc:yard" - task "doc" => "doc:yard" + desc 'Alias to doc:yard' + task 'doc' => 'doc:yard' rescue LoadError # If yard isn't available, it's not the end of the world - desc "Alias to doc:rdoc" - task "doc" => "doc:rdoc" + desc 'Alias to doc:rdoc' + task 'doc' => 'doc:rdoc' end