Updating code to consistent coding style.

git-svn-id: https://google-api-ruby-client.googlecode.com/svn/trunk@15 c1d61fac-ed7f-fcc1-18f7-ff78120a04ef
This commit is contained in:
bobaman@google.com committed 2010-08-17 01:21:17 +00:00
1 parent 6331247e7a
commit e6ba0f6860
15 files changed
+168 -161

No files matched your search

+2 -2
View File
@@ -1,2 +1,2 @@
desc "Remove all build products"
task "clobber"
desc 'Remove all build products'
task 'clobber'
+19 -19
View File
@@ -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']
+14 -14
View File
@@ -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'
+3 -3
View File
@@ -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
+13 -13
View File
@@ -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']
+11 -11
View File
@@ -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']
+12 -12
View File
@@ -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