Basic project skeleton.
git-svn-id: https://google-api-ruby-client.googlecode.com/svn/trunk@2 c1d61fac-ed7f-fcc1-18f7-ff78120a04ef
This commit is contained in:
1 parent
6ff87d41e6
commit
d371bc3cbf
15 files changed
+563
No files matched your search
@@ -0,0 +1,2 @@
|
||||
desc "Remove all build products"
|
||||
task "clobber"
|
||||
@@ -0,0 +1,65 @@
|
||||
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."
|
||||
exit(1)
|
||||
end
|
||||
|
||||
s.name = PKG_NAME
|
||||
s.version = PKG_VERSION
|
||||
s.summary = PKG_SUMMARY
|
||||
s.description = PKG_DESCRIPTION
|
||||
|
||||
s.files = PKG_FILES.to_a
|
||||
|
||||
s.has_rdoc = true
|
||||
s.extra_rdoc_files = %w( README )
|
||||
s.rdoc_options.concat ["--main", "README"]
|
||||
|
||||
s.add_development_dependency("rake", ">= 0.8.3")
|
||||
s.add_development_dependency("rspec", ">= 1.1.11")
|
||||
s.add_development_dependency("launchy", ">= 0.3.2")
|
||||
|
||||
s.require_path = "lib"
|
||||
|
||||
s.homepage = PKG_HOMEPAGE
|
||||
end
|
||||
|
||||
Rake::GemPackageTask.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 "Install the gem"
|
||||
task :install => ["clobber", "gem:package"] do
|
||||
sh "#{SUDO} gem install --local pkg/#{GEM_SPEC.full_name}"
|
||||
end
|
||||
|
||||
desc "Uninstall the gem"
|
||||
task :uninstall do
|
||||
installed_list = Gem.source_index.find_name(PKG_NAME)
|
||||
if installed_list &&
|
||||
(installed_list.collect { |s| s.version.to_s}.include?(PKG_VERSION))
|
||||
sh(
|
||||
"#{SUDO} gem uninstall --version '#{PKG_VERSION}' " +
|
||||
"--ignore-dependencies --executables #{PKG_NAME}"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
desc "Reinstall the gem"
|
||||
task :reinstall => [:uninstall, :install]
|
||||
end
|
||||
|
||||
desc "Alias to gem:package"
|
||||
task "gem" => "gem:package"
|
||||
|
||||
task "clobber" => ["gem:clobber_package"]
|
||||
@@ -0,0 +1,40 @@
|
||||
namespace :git do
|
||||
namespace :tag do
|
||||
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")
|
||||
end
|
||||
|
||||
desc "Create a new tag in the Git repository"
|
||||
task :create do
|
||||
changelog = File.open("CHANGELOG", "r") { |file| file.read }
|
||||
puts "-" * 80
|
||||
puts changelog
|
||||
puts "-" * 80
|
||||
puts
|
||||
|
||||
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")
|
||||
if existing_tags.include?(tag)
|
||||
warn("Tag already exists, deleting...")
|
||||
unless system "git tag -d #{tag}"
|
||||
abort "Tag deletion failed."
|
||||
end
|
||||
end
|
||||
puts "Creating git tag '#{tag}'..."
|
||||
unless system "git tag -a -m \"#{msg}\" #{tag}"
|
||||
abort "Tag creation failed."
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
task "gem:release" => "git:tag:create"
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace :metrics do
|
||||
task :lines do
|
||||
lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
|
||||
for file_name in FileList["lib/**/*.rb"]
|
||||
f = File.open(file_name)
|
||||
while line = f.gets
|
||||
lines += 1
|
||||
next if line =~ /^\s*$/
|
||||
next if line =~ /^\s*#/
|
||||
codelines += 1
|
||||
end
|
||||
puts "L: #{sprintf("%4d", lines)}, " +
|
||||
"LOC #{sprintf("%4d", codelines)} | #{file_name}"
|
||||
total_lines += lines
|
||||
total_codelines += codelines
|
||||
|
||||
lines, codelines = 0, 0
|
||||
end
|
||||
|
||||
puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,29 @@
|
||||
require "rake/rdoctask"
|
||||
|
||||
namespace :doc do
|
||||
desc "Generate RDoc documentation"
|
||||
Rake::RDocTask.new do |rdoc|
|
||||
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")
|
||||
end
|
||||
|
||||
desc "Generate ri locally for testing"
|
||||
task :ri do
|
||||
sh "rdoc --ri -o ri ."
|
||||
end
|
||||
|
||||
desc "Remove ri products"
|
||||
task :clobber_ri do
|
||||
rm_r "ri" rescue nil
|
||||
end
|
||||
end
|
||||
|
||||
desc "Alias to doc:rdoc"
|
||||
task "doc" => "doc:rdoc"
|
||||
|
||||
task "clobber" => ["doc:clobber_rdoc", "doc:clobber_ri"]
|
||||
@@ -0,0 +1,63 @@
|
||||
require 'spec/rake/verify_rcov'
|
||||
|
||||
namespace :spec do
|
||||
Spec::Rake::SpecTask.new(:rcov) do |t|
|
||||
t.spec_files = FileList['spec/**/*_spec.rb']
|
||||
t.spec_opts = ['--color', '--format', 'specdoc']
|
||||
if RCOV_ENABLED
|
||||
t.rcov = true
|
||||
else
|
||||
t.rcov = false
|
||||
end
|
||||
t.rcov_opts = [
|
||||
'--exclude', 'spec',
|
||||
'--exclude', '1\\.8\\/gems',
|
||||
'--exclude', '1\\.9\\/gems'
|
||||
]
|
||||
end
|
||||
|
||||
Spec::Rake::SpecTask.new(:normal) do |t|
|
||||
t.spec_files = FileList['spec/**/*_spec.rb']
|
||||
t.spec_opts = ['--color', '--format', 'specdoc']
|
||||
t.rcov = false
|
||||
end
|
||||
|
||||
if RCOV_ENABLED
|
||||
RCov::VerifyTask.new(:verify) do |t|
|
||||
t.threshold = 100.0
|
||||
t.index_html = 'coverage/index.html'
|
||||
end
|
||||
|
||||
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
|
||||
require "launchy"
|
||||
Launchy::Browser.run("coverage/index.html")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if RCOV_ENABLED
|
||||
desc "Alias to spec:verify"
|
||||
task "spec" => "spec:verify"
|
||||
else
|
||||
desc "Alias to spec:normal"
|
||||
task "spec" => "spec:normal"
|
||||
end
|
||||
|
||||
task "clobber" => ["spec:clobber_rcov"]
|
||||
Reference in new issue
Block a user