Class: Corundum::Core
- Inherits:
-
Mattock::TaskLib
- Object
- Mattock::TaskLib
- Corundum::Core
- Defined in:
- lib/corundum/core.rb
Overview
This is the core tasklib for Corundum. It defines a series of lifecycle steps that define the release process. The real work is done by other Tasklibs that hook into the lifecycle.
The lifecycle steps (as implied by the Rakefile definition) are:
- preflight
-
simple tests before we do anything at all
- qa
-
quality assurance - make sure everything is acceptable before we build the gem
- build
-
construct the actual gem
- release
-
push the gem out to the world
- press
-
send out notifications that the gem has been published
Instance Method Summary collapse
Instance Method Details
#define ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/corundum/core.rb', line 81 def define in_namespace do directory finished_dir.abspath desc "Run preflight checks" task :preflight task :run_quality_assurance => [ :preflight, qa_file.abspath ] task :run_continuous_integration desc "Run quality assurance tasks" qa_task = task(:qa => :run_quality_assurance) do require 'corundum/qa-report' puts QA::ReportFormatter.new(qa_rejections).to_s unless qa_rejections.all?(&:passed) fail "There are QA tests that failed" end end desc "Run limited set of QA tasks appropriate for CI" task :ci => :run_continuous_integration do require 'corundum/qa-report' puts QA::ReportFormatter.new(qa_rejections).to_s if qa_rejections.all?(&:passed) puts "Passed" else fail "There are Continuous Integration tests that failed" end end file qa_file.abspath => [finished_dir.abspath] + file_lists.project + file_lists.code + file_lists.test do |task| qa_task.invoke touch task.name end desc "Build the package" build_task = task :build => [qa_file.abspath, :preflight, build_file.abspath] file build_file.abspath => [finished_dir.abspath] + file_lists.code + file_lists.project do |task| build_task.invoke touch task.name end desc "Push package out to the world" release_task = task(:release => [ build_file.abspath, :preflight, release_file.abspath ]) file release_file.abspath => [ build_file, finished_dir] do |task| release_task.invoke touch task.name end end end |
#guess_gemspec ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/corundum/core.rb', line 69 def guess_gemspec speclist = Dir[File.("*.gemspec", Rake::original_dir)] 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 speclist[0] end |
#resolve_configuration ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/corundum/core.rb', line 44 def resolve_configuration super self.gemspec_path ||= guess_gemspec self.gemspec ||= Gem::Specification::load(gemspec_path) self.qa_rejections ||= [] build_file.relative_path ||= gemspec.full_name + ".gem" qa_file.relative_path ||= "qa-" + gemspec.full_name.to_s release_file.relative_path ||= "release-" + gemspec.full_name.to_s resolve_paths self.files.code ||= file_patterns.code.map{ |pattern| gemspec.files.grep(pattern) }.flatten self.files.test ||= file_patterns.test.map{ |pattern| gemspec.files.grep(pattern) }.flatten self.files.docs ||= file_patterns.docs.map{ |pattern| gemspec.files.grep(pattern) }.flatten self.file_lists.project << gemspec_path self.file_lists.all ||= file_lists.code + file_lists.test + file_lists.docs end |