-
1
require 'corundum/tasklib'
-
-
#require 'rubygems'
-
#require 'rubygems/installer'
-
-
1
module Corundum
-
1
extend Rake::DSL
-
-
1
class Toolkit < TaskLib
-
1
def default_configuration(namespace)
-
1
@configuration.marshal_load(
-
:namespace => namespace,
-
:finished_dir => "corundum",
-
:finished_files => OpenStruct.new,
-
-
:browser => "chromium",
-
:gemspec => nil,
-
:gemspec_path => nil,
-
:email => OpenStruct.new(
-
:servers => [ OpenStruct.new({ :server => "ruby-lang.org", :helo => "gmail.com" }) ],
-
:announce_to_email => "ruby-talk@ruby-lang.org"
-
),
-
:package_dir => "pkg",
-
:files => OpenStruct.new(:code => nil, :test => nil, :docs => nil),
-
:file_lists => OpenStruct.new(:code => nil, :test => nil, :docs => nil, :all => nil),
-
:rubyforge => OpenStruct.new(),
-
:doc_dir => "rubydoc"
-
)
-
end
-
-
1
def load_gemspec
-
1
@configuration.gemspec_path ||= guess_gemspec
-
1
@configuration.gemspec ||= Gem::Specification::load(@configuration.gemspec_path)
-
1
return @configuration.gemspec
-
end
-
-
1
def resolve_configuration
-
1
load_gemspec
-
-
1
@configuration.finished_files.build ||= File::join(
-
@configuration.finished_dir, "build_#{@configuration.gemspec.version}")
-
1
@configuration.finished_files.qa ||= File::join(
-
@configuration.finished_dir, "qa_#{@configuration.gemspec.version}")
-
1
@configuration.finished_files.package ||= File::join(
-
@configuration.finished_dir, "package_#{@configuration.gemspec.version}")
-
1
@configuration.finished_files.release ||= File::join(
-
@configuration.finished_dir, "release_#{@configuration.gemspec.version}")
-
1
@configuration.finished_files.press ||= File::join(
-
@configuration.finished_dir, "press_#{@configuration.gemspec.version}")
-
-
1
@configuration.files.code ||= @configuration.gemspec.files.grep(%r{^lib/})
-
1
@configuration.files.test ||= @configuration.gemspec.files.grep(%r{^spec/})
-
1
@configuration.files.docs ||= @configuration.gemspec.files.grep(%r{^doc/})
-
-
1
@configuration.file_lists.code ||= FileList['lib/**/*.rb']
-
1
@configuration.file_lists.test ||= FileList['test/**/*.rb','spec/**/*.rb','features/**/*.rb']
-
1
@configuration.file_lists.docs ||= FileList['doc/**/*.rb']
-
1
@configuration.file_lists.all ||=
-
@configuration.file_lists.code +
-
@configuration.file_lists.test +
-
@configuration.file_lists.docs
-
-
1
@configuration.rubyforge.group_id ||= @configuration.gemspec.rubyforge_project
-
1
@configuration.rubyforge.package_id ||= @configuration.gemspec.name.downcase
-
1
@configuration.rubyforge.release_name ||= @configuration.gemspec.full_name
-
1
@configuration.rubyforge.home_page ||= @configuration.gemspec.homepage
-
1
@configuration.rubyforge.project_page ||= "http://rubyforge.org/project/#{@configuration.gemspec.rubyforge_project}/"
-
end
-
-
1
def guess_gemspec
-
1
speclist = Dir[File.expand_path("*.gemspec", Rake::original_dir)]
-
1
if speclist.length == 0
-
puts "Found no *.gemspec files"
-
exit 1
-
elsif speclist.length > 1
-
puts "Found too many *.gemspec files: #{speclist.inspect}"
-
exit 1
-
end
-
1
speclist[0]
-
end
-
-
1
def define
-
1
in_namespace do
-
1
directory @configuration.finished_dir
-
-
1
desc "Run preflight checks"
-
1
task :preflight
-
-
1
desc "Run quality assurance tasks"
-
1
task :qa => :preflight
-
1
file @configuration.finished_files.qa => [:qa, @configuration.finished_dir] do |task|
-
touch task.name
-
end
-
-
1
desc "Build the package"
-
1
task :build => @configuration.finished_files.qa
-
1
file @configuration.finished_files.build => [:build, @configuration.finished_dir] do |task|
-
touch task.name
-
end
-
-
1
desc "Push package out to the world"
-
1
task :release => @configuration.finished_files.build
-
1
file @configuration.finished_files.release => [:release, @configuration.finished_dir] do |task|
-
touch task.name
-
end
-
-
1
desc "Announce publication"
-
1
task :press => @configuration.finished_files.release
-
1
file @configuration.finished_files.press => [:press, @configuration.finished_dir] do |task|
-
touch task.name
-
end
-
end
-
end
-
-
1
def old_define
-
-
task @publishing.namespace => "#{@gem_building.namespace}:push"
-
task "#{@publishing.namespace}:docs" => "#{@documentation.namespace}:docs"
-
task "#{@publishing.namespace}:rubyforge" => ["#{@quality_assurance.namespace}:sign_off", "#{@gem_building.namespace}:package"]
-
-
require 'corundum/press'
-
Press.new(@press.namespace) do |press|
-
press.rubyforge = @rubyforge
-
press.gemspec = @configuration.gemspec
-
press.announce_to_email = @email.announce_to_email
-
press.email_servers = @email.servers
-
end
-
end
-
end
-
end
-
1
require 'corundum/tasklib'
-
-
1
module Corundum
-
1
class Email < TaskLib
-
1
def default_namespace
-
2
:email
-
end
-
-
1
def receive_tasklibs(toolkit)
-
1
@toolkit = toolkit
-
end
-
-
1
def default_configuration(namespace, toolkit_config)
-
1
@configuration.namespace = namespace
-
1
@configuration.rubyforge = toolkit_config.rubyforge
-
1
@configuration.email_servers = []
-
1
@configuration.gemspec = toolkit_config.gemspec
-
1
@configuration.announce_to_email = nil
-
1
@configuration.urls = OpenStruct.new
-
end
-
-
1
def resolve_configuration
-
1
@configuration.urls.home_page ||=
-
@configuration.gemspec.homepage
-
-
1
@configuration.urls.project_page ||=
-
@configuration.rubyforge.project_page
-
-
end
-
-
1
def announcement
-
changes = ""
-
begin
-
File::open("./Changelog", "r") do |changelog|
-
changes = "Changes:\n\n"
-
changes += changelog.read
-
end
-
rescue Exception
-
end
-
-
urls = "Project: #{@configuration.urls.project_page}\n" +
-
"Homepage: #{@configuration.urls.home_page}"
-
-
subject = "#{@configuration.gemspec.name} #{@configuration.gemspec.version} Released"
-
title = "#{@configuration.gemspec.name} version #{@configuration.gemspec.version} has been released!"
-
body = "#{@configuration.gemspec.description}\n\n#{changes}\n\n#{urls}"
-
-
return subject, title, body
-
end
-
-
1
def define
-
desc 'Announce release on email'
-
task @configuration.namespace => ["#{@configuration.namespace.to_s}:rubyforge", "#{@configuration.namespace.to_s}:email"]
-
namespace @configuration.namespace do
-
file "email.txt" do |t|
-
require 'mailfactory'
-
-
subject, title, body= announcement
-
-
mail = MailFactory.new
-
mail.To = @configuration.announce_to_email
-
mail.From = @configuration.gemspec.email
-
mail.Subject = "[ANN] " + subject
-
mail.text = [title, body].join("\n\n")
-
-
File.open(t.name, "w") do |mailfile|
-
mailfile.write mail.to_s
-
end
-
end
-
-
task :email => "email.txt" do
-
require 'net/smtp'
-
-
@configuration.email_servers.each do |server_config|
-
begin
-
File::open("email.txt", "r") do |email|
-
Net::SMTP.start(server_config[:server], 25, server_config[:helo], server_config[:username], server_config[:password]) do |smtp|
-
smtp.data do |mta|
-
mta.write(email.read)
-
end
-
end
-
end
-
break
-
rescue Object => ex
-
puts ex.message
-
end
-
end
-
end
-
end
-
end
-
end
-
end
-
1
require 'corundum/tasklib'
-
-
1
module Corundum
-
1
class GemBuilding < TaskLib
-
1
def receive_tasklibs(toolkit)
-
1
@toolkit = toolkit
-
end
-
-
1
def default_configuration(namespace, toolkit_config)
-
1
@configuration.namespace = namespace || :package
-
1
@configuration.gemspec = toolkit_config.gemspec
-
1
@configuration.qa_finished_file = toolkit_config.finished_files.qa
-
1
@configuration.package_dir = "pkg"
-
end
-
-
1
def define
-
1
require 'rubygems/package_task'
-
-
1
in_namespace do
-
1
package = Gem::PackageTask.new(@configuration.gemspec) do |t|
-
1
t.need_tar_gz = true
-
1
t.need_tar_bz2 = true
-
1
t.package_dir = @configuration.package_dir
-
end
-
-
1
task(:package).prerequisites.each do |package_type|
-
3
file package_type => @configuration.qa_finished_file
-
end
-
end
-
-
1
task :build => in_namespace("gem")
-
end
-
end
-
end
-
1
require 'corundum/tasklib'
-
-
1
module Corundum
-
1
class GemCutter < TaskLib
-
1
def receive_tasklibs(toolkit, build)
-
1
@toolkit = toolkit
-
1
@build = build
-
end
-
-
1
def default_configuration(namespace, toolkit_config, build_config)
-
1
@configuration.namespace = namespace || :gemcutter
-
1
@configuration.gemspec = toolkit_config.gemspec
-
1
@configuration.build_finished_path = toolkit_config.finished_files.build
-
1
@configuration.gem_path = nil
-
1
@configuration.gem_name = nil
-
1
@configuration.package_dir = build_config.package_dir
-
end
-
-
1
def resolve_configuration
-
1
@configuration.gem_path ||=
-
File::join(@configuration.package_dir, @configuration.gemspec.file_name)
-
-
1
@configuration.gem_name ||= @configuration.gemspec.full_name
-
end
-
-
1
module CommandTweaks
-
1
def setup_args(args = nil)
-
args ||= []
-
handle_options(args)
-
end
-
-
1
def gem_list=(list)
-
@configuration.gems = list
-
end
-
-
1
def get_all_gem_names
-
return @configuration.gems if defined?(@configuration.gems)
-
super
-
end
-
-
1
def get_one_gem_name
-
return @configuration.gems.first if defined?(@configuration.gems)
-
super
-
end
-
end
-
-
1
def get_command(klass, args=nil)
-
cmd = klass.new
-
cmd.extend(CommandTweaks)
-
cmd.setup_args(args)
-
cmd
-
end
-
-
1
def define
-
1
in_namespace do
-
1
task :uninstall do |t|
-
when_writing("Uninstalling #{@configuration.gem_name}") do
-
require "rubygems/commands/uninstall_command"
-
uninstall = get_command Gem::Commands::UninstallCommand
-
uninstall.options[:args] = [@configuration.gem_path]
-
uninstall.execute
-
end
-
end
-
-
1
task :install => [@configuration.gem_path] do |t|
-
when_writing("Installing #{@configuration.gem_path}") do
-
require "rubygems/commands/install_command"
-
install = get_command Gem::Commands::InstallCommand
-
install.options[:args] = [@configuration.gem_path]
-
install.execute
-
end
-
end
-
-
1
task :reinstall => [:uninstall, :install]
-
-
1
task :dependencies_available do
-
checker = Gem::SpecFetcher.new
-
@configuration.gemspec.runtime_dependencies.each do |dep|
-
fulfilling = checker.find_matching(dep,false,false,false)
-
if fulfilling.empty?
-
fail "Dependency #{dep} is unfulfilled remotely"
-
else
-
puts "Remotely fulfilled: #{dep}" if verbose
-
end
-
end
-
end
-
-
1
task :is_unpushed do
-
checker = Gem::SpecFetcher.new
-
dep = Gem::Dependency.new(@configuration.gemspec.name, "= #{@configuration.gemspec.version}")
-
fulfilling = checker.find_matching(dep,false,false,true)
-
unless fulfilling.empty?
-
fail "Gem #{@configuration.gemspec.full_name} is already pushed"
-
end
-
end
-
-
1
desc 'Push a gem up to Gemcutter'
-
1
task :push => [:dependencies_available, :is_unpushed] do
-
require "rubygems/commands/push_command"
-
push = get_command(Gem::Commands::PushCommand)
-
push.options[:args] = [@configuration.gem_path]
-
push.execute
-
end
-
1
task :push => @configuration.build_finished_path
-
end
-
1
task :release => in_namespace(:push)
-
1
task :preflight => in_namespace(:dependencies_available, :is_unpushed)
-
end
-
end
-
end
-
1
require 'corundum/tasklib'
-
-
1
module Corundum
-
1
class GemspecSanity < TaskLib
-
1
def default_namespace
-
:gemspec_sanity
-
end
-
-
1
def receive_tasklibs(toolkit)
-
@toolkit = toolkit
-
end
-
-
1
def default_configuration(namespace, toolkit_config)
-
@configuration.namespace = namespace
-
@configuration.gemspec = toolkit_config.gemspec
-
end
-
-
1
def define
-
in_namespace do
-
task :files_exist do
-
missing = @configuration.gemspec.files.find_all do |path|
-
not File::exists?(path)
-
end
-
-
fail "Files mentioned in gemspec are missing: #{missing.join(", ")}" unless missing.empty?
-
end
-
end
-
-
task :preflight => in_namespace(:files_exist)
-
end
-
end
-
end
-
1
require 'corundum/tasklib'
-
1
require 'rspec/core'
-
-
1
module Corundum
-
#TODO: this should take two command generators as arguments: the test runner,
-
#and the coverage tool - then the various tasks are the result of the
-
#collaboration of those two.
-
#
-
1
class RSpec < TaskLib
-
1
def receive_tasklibs(toolkit)
-
1
@toolkit = toolkit
-
end
-
-
1
def default_configuration(namespace, toolkit_config)
-
1
@configuration.task_options = OpenStruct.new(
-
:pattern => nil,
-
:ruby_opts => nil,
-
:rspec_opts => nil,
-
:warning => false,
-
:verbose => true,
-
:fail_on_error => true,
-
:ruby_opts => [],
-
:rspec_opts => %w{--format documentation --out last_run --color --format documentation},
-
:failure_message => "Spec examples failed.",
-
:files_to_run => nil
-
)
-
-
1
@configuration.namespace = namespace || :rspec
-
1
@configuration.gemspec_path = toolkit_config.gemspec_path
-
1
@configuration.qa_finished_path = toolkit_config.qa_finished_path
-
end
-
-
1
def resolve_configuration
-
1
@configuration.task_options.rspec_configs = @configuration.task_options.rspec_opts
-
1
@configuration.task_options.rspec_opts = []
-
1
@configuration.task_options.rspec_path ||= 'rspec'
-
1
@configuration.task_options.rspec_path = %x"which #{@configuration.task_options.rspec_path}".chomp
-
1
@configuration.task_options.pattern ||= './spec{,/*/**}/*_spec.rb'
-
1
@configuration.task_options.files_to_run ||= "spec"
-
end
-
-
#XXX some point in the future, there needs to be a composible command
-
#object
-
1
def ruby_command(options)
-
cmd_parts = []
-
cmd_parts << RUBY
-
cmd_parts << options.ruby_opts
-
cmd_parts << "-w" if options.warning?
-
if /^1\.8/ =~ RUBY_VERSION
-
cmd_parts << "-S"
-
end
-
return cmd_parts
-
end
-
-
1
def runner_command(options)
-
cmd_parts = []
-
cmd_parts << options.rspec_path
-
cmd_parts << options.rspec_opts
-
cmd_parts << options.files_to_run
-
return cmd_parts
-
end
-
-
1
def full_command(options)
-
cmd_parts = ruby_command(options) + runner_command(options)
-
return cmd_parts.flatten.compact.reject{|part| part.nil? or part.empty?}.join(" ")
-
end
-
-
1
def custom_options
-
2
options = @configuration.task_options.dup
-
2
yield(options)
-
2
return options
-
end
-
-
1
def define_spec_task(name)
-
3
options = if block_given?
-
4
custom_options{|options| yield(options) if block_given?}
-
else
-
1
@configuration.task_options
-
end
-
3
task name do
-
RakeFileUtils.send(:verbose, verbose) do
-
if options.files_to_run.empty?
-
puts "No examples matching #{options.pattern} could be found"
-
else
-
begin
-
cmd = full_command(options)
-
puts cmd if options.verbose
-
success = system(cmd)
-
rescue
-
puts options.failure_message if options.failure_message
-
end
-
raise("ruby #{cmd} failed") if options.fail_on_error unless success
-
end
-
end
-
end
-
end
-
-
1
def define
-
1
desc "Run failing examples if any exist, otherwise, run the whole suite"
-
1
task @configuration.namespace => "#{@configuration.namespace}:quick"
-
-
1
in_namespace do
-
1
desc "Always run every spec"
-
1
define_spec_task(:all)
-
-
1
desc "Generate specifications documentation"
-
1
define_spec_task(:doc) do |t|
-
1
t.rspec_opts = %w{-o /dev/null -f d -o doc/Specifications}
-
1
t.failure_message = "Failed generating specification docs"
-
1
t.verbose = false
-
end
-
-
1
desc "Run only failing examples listed in last_run"
-
1
define_spec_task(:quick) do |t|
-
1
examples = []
-
1
begin
-
1
File.open("last_run", "r") do |fail_list|
-
1
fail_list.lines.grep(%r{^\s*\d+\)\s*(.*)}) do |line|
-
examples << $1.gsub(/'/){"[']"}
-
end
-
end
-
rescue
-
end
-
1
unless examples.empty?
-
t.rspec_opts << "--example"
-
t.rspec_opts << "\"#{examples.join("|")}\""
-
end
-
1
t.failure_message = "Spec examples failed."
-
end
-
end
-
-
1
task :qa => in_namespace(:doc)
-
end
-
end
-
end
-
1
require 'corundum/tasklib'
-
-
-
#Big XXX: this totally isn't done. It's some notes against ever wanting to
-
#publish announcements to rubyforge ever again
-
-
1
module Corundum
-
1
class Publishing < TaskLib
-
1
def default_namespace
-
:email
-
end
-
-
1
def receive_tasklibs(toolkit)
-
@toolkit = toolkit
-
end
-
-
1
def default_configuration(namespace, toolkit_config)
-
end
-
-
1
def initialize(ns = :publish)
-
@ns = ns
-
@rubyforge = OpenStruct.new(:package_id => nil, :group_id => nil, :release_name => nil)
-
@package_dir = nil
-
@gemspec = nil
-
yield self if block_given?
-
define
-
end
-
-
1
attr_accessor :ns, :rubyforge, :package_dir, :gemspec
-
-
1
def define
-
desc "Publish the gem and its documentation to Rubyforge and Gemcutter"
-
task @ns => ["#{@ns.to_s}:docs", "#{@ns.to_s}:rubyforge"]
-
-
namespace @ns do
-
desc 'Publish RDoc to RubyForge'
-
task :docs do
-
config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml")))
-
host = "#{config["username"]}@rubyforge.org"
-
remote_dir = "/var/www/gforge-projects/#{@rubyforge[:group_id]}"
-
local_dir = 'rubydoc'
-
sh %{rsync -av --delete #{local_dir}/ #{host}:#{remote_dir}}
-
end
-
-
task :scrape_rubyforge do
-
require 'rubyforge'
-
forge = RubyForge.new
-
forge.configure
-
forge.scrape_project(@rubyforge[:package_id])
-
end
-
-
desc "Publishes to RubyForge"
-
task :rubyforge => [:docs, :scrape_rubyforge] do |t|
-
require 'rubyforge'
-
forge = RubyForge.new
-
forge.configure
-
files = [".gem", ".tar.gz", ".tar.bz2"].map do |extension|
-
File::join(@package_dir, @gemspec.full_name) + extension
-
end
-
release = forge.lookup("release", @rubyforge[:package_id])[@rubyforge[:release_name]] rescue nil
-
if release.nil?
-
forge.add_release(@rubyforge[:group_id], @rubyforge[:package_id], @rubyforge[:release_name], *files)
-
else
-
files.each do |file|
-
forge.add_file(@rubyforge[:group_id], @rubyforge[:package_id], @rubyforge[:release_name], file)
-
end
-
end
-
end
-
end
-
end
-
end
-
end
-
-
-
-
1
module Corundum
-
1
class Email < TaskLib
-
1
def define
-
1
desc 'Announce release on RubyForge and email'
-
1
task @configuration.namespace => ["#{@configuration.namespace.to_s}:rubyforge", "#{@configuration.namespace.to_s}:email"]
-
1
namespace @configuration.namespace do
-
1
desc 'Post announcement to rubyforge.'
-
1
task :rubyforge do
-
require 'rubyforge'
-
subject, title, body = announcement
-
-
forge = RubyForge.new
-
forge.configure
-
forge.post_news(@configuration.rubyforge[:group_id], subject, "#{title}\n\n#{body}")
-
puts "Posted to rubyforge"
-
end
-
end
-
end
-
end
-
end
-
1
require 'corundum/tasklib'
-
-
1
module Corundum
-
1
class SimpleCov < TaskLib
-
1
def default_namespace
-
2
:coverage
-
end
-
-
1
def default_configuration(namespace, toolkit_config, testlib_config)
-
1
@configuration.namespace = namespace
-
1
@configuration.test_lib = nil
-
1
@configuration.browser = toolkit_config.browser
-
1
@configuration.report_dir = "doc/coverage"
-
1
@configuration.report_path = nil
-
1
@configuration.config_file = ".simplecov"
-
1
@configuration.config_path = nil
-
1
@configuration.filters = ["./spec"]
-
-
1
@configuration.threshold = 80
-
1
@configuration.files = OpenStruct.new(
-
:code => toolkit_config.files.code
-
)
-
1
@configuration.groups = {}
-
-
1
@configuration.all_files = toolkit_config.file_lists.code + toolkit_config.file_lists.test
-
end
-
-
1
def resolve_configuration
-
1
@configuration.config_path ||= File::expand_path(@configuration.config_file, Rake::original_dir)
-
1
@configuration.report_path ||= File::join(@configuration.report_dir, "index.html")
-
end
-
-
1
def receive_tasklibs(toolkit, test_lib)
-
1
@toolkit,@test_lib = toolkit, test_lib
-
end
-
-
1
def filters
-
@configuration.filters.map do |pattern|
-
"add_filter \"#{pattern}\""
-
end
-
end
-
-
1
def groups
-
@configuration.groups.each_pair do |group, pattern|
-
"add_group \"#{group}\", \"#{pattern}\""
-
end
-
end
-
-
1
def config_file_contents
-
contents = ["SimpleCov.start do"]
-
contents << " coverage_dir \"#{@configuration.report_dir}\""
-
contents += filters.map{|line| " " + line}
-
contents += groups.map{|line| " " + line}
-
contents << "end"
-
return contents.join("\n")
-
end
-
-
1
def define
-
1
in_namespace do
-
1
file "Rakefile"
-
-
1
task :example_config do
-
$stderr.puts "Try this in #{@configuration.config_path}"
-
$stderr.puts
-
puts config_file_contents
-
end
-
-
1
task :config_exists do
-
File::exists?(File::join(Rake::original_dir, ".simplecov")) or fail "No .simplecov"
-
end
-
-
1
directory File::dirname(@configuration.report_path)
-
1
file @configuration.report_path => @configuration.all_files do
-
options = @test_lib.custom_options do |options|
-
options.rspec_opts += %w{-r simplecov}
-
end
-
sh @test_lib.full_command(options)
-
end
-
-
1
task :generate_report => [:preflight, @configuration.report_path]
-
-
1
desc "View coverage in browser"
-
1
task :view => :generate_report do
-
sh "#{@configuration.browser} #{@configuration.report_path}"
-
end
-
-
1
task :verify_coverage => :generate_report do
-
require 'nokogiri'
-
-
doc = Nokogiri::parse(File::read(@configuration.report_path))
-
-
coverage_total_xpath = "//span[@class='covered_percent']/span"
-
percentage = doc.xpath(coverage_total_xpath).first.content.to_f
-
-
raise "Coverage must be at least #{@configuration.threshold} but was #{percentage}" if percentage < @configuration.threshold
-
puts "Coverage is #{percentage}% (required: #{@configuration.threshold}%)"
-
end
-
-
1
task :find_stragglers => :generate_report do
-
require 'nokogiri'
-
-
doc = Nokogiri::parse(File::read(@configuration.report_path))
-
-
covered_files = doc.xpath(
-
"//table[@class='file_list']//td//a[@class='src_link']").map do |link|
-
link.content
-
end
-
-
not_listed = covered_files - @configuration.files.code
-
not_covered = @configuration.files.code - covered_files
-
unless not_listed.empty? and not_covered.empty?
-
raise ["Covered files and gemspec manifest don't match:",
-
"Not in gemspec: #{not_listed.inspect}",
-
"Not covered: #{not_covered.inspect}"].join("\n")
-
end
-
end
-
end
-
1
task :preflight => in_namespace(:config_exists)
-
-
1
task :qa => in_namespace(:verify_coverage, :find_stragglers)
-
end
-
end
-
end
-
1
require 'ostruct'
-
1
require 'rake/tasklib'
-
-
1
module Corundum
-
1
class TaskLib < Rake::TaskLib
-
1
attr_accessor :configuration
-
-
1
def receive_tasklibs(*tasklibs)
-
end
-
-
1
def default_configuration(namespace, *tasklib_configs)
-
end
-
-
1
def resolve_configuration
-
end
-
-
1
def in_namespace(*tasknames)
-
20
if tasknames.empty?
-
9
if block_given?
-
9
if @configuration.namespace.nil?
-
2
yield
-
else
-
7
namespace @configuration.namespace do
-
7
yield
-
end
-
end
-
end
-
else
-
11
tasknames.map do |taskname|
-
15
[@configuration.namespace, taskname].compact.join(":")
-
end
-
end
-
end
-
-
1
def default_namespace
-
nil
-
end
-
-
1
def initialize(*tasklibs)
-
8
@configuration = OpenStruct.new(:namespace => default_namespace)
-
-
8
receive_tasklibs(*tasklibs)
-
-
8
configs = tasklibs.map do |tl|
-
9
tl.configuration
-
end
-
8
default_configuration(default_namespace, *configs)
-
-
-
8
yield @configuration if block_given?
-
-
8
resolve_configuration
-
-
8
define
-
end
-
end
-
end
-
1
require 'corundum/rspec'
-
1
require 'corundum/simplecov'
-
1
require 'corundum/gemspec_sanity'
-
1
require 'corundum/gem_building'
-
1
require 'corundum/gemcutter'
-
1
require 'corundum/email'
-
1
require 'corundum/version_control/monotone'
-
1
require 'corundum/yardoc'
-
1
require 'corundum/tasklib'
-
-
1
module Corundum
-
1
class VersionControl < TaskLib
-
1
def default_namespace
-
:version_control
-
end
-
-
1
def receive_tasklibs(toolkit)
-
1
@toolkit = toolkit
-
end
-
-
1
def default_configuration(namespace, toolkit_config)
-
1
@configuration.namespace = namespace
-
1
@configuration.gemspec = toolkit_config.gemspec
-
1
@configuration.build_finished_file = toolkit_config.finished_files.build
-
1
@configuration.tag = toolkit_config.gemspec.version
-
end
-
-
1
def define
-
1
in_namespace do
-
1
task :not_tagged
-
1
task :is_checked_in
-
1
task :tag
-
1
task :check_in => :tag
-
end
-
-
1
task :preflight => in_namespace(:not_tagged)
-
1
task :build => in_namespace(:is_checked_in)
-
1
in_namespace(:tag, :check_in).each do |taskname|
-
2
task taskname => @configuration.build_finished_file
-
end
-
1
task :release => in_namespace(:tag, :check_in)
-
end
-
end
-
end
-
1
require 'corundum/tasklib'
-
1
require 'yard/rake/yardoc_task'
-
-
1
module Corundum
-
1
class YARDoc < TaskLib
-
1
def default_namespace
-
2
:documentation
-
end
-
-
1
def default_configuration(namespace, toolkit_config)
-
1
@configuration.gemspec = toolkit_config.gemspec
-
1
@configuration.doc_dir = "rubydoc"
-
1
@configuration.files = OpenStruct.new(:code => [], :docs => [])
-
end
-
-
1
def define
-
1
directory @configuration.doc_dir
-
-
1
in_namespace do
-
1
YARD::Rake::YardocTask.new(:docs) do |rd|
-
1
rd.options += @configuration.gemspec.rdoc_options
-
1
rd.options += ["--output-dir", @configuration.doc_dir]
-
1
rd.files += @configuration.files.code
-
1
rd.files += @configuration.files.docs
-
1
rd.files += @configuration.gemspec.extra_rdoc_files
-
end
-
end
-
-
1
desc "Generate documentation based on code using YARD"
-
1
task @configuration.namespace => in_namespace("docs")
-
end
-
end
-
end