Rakefile in knife-solo-0.2.0.pre1 vs Rakefile in knife-solo-0.2.0

- old
+ new

@@ -1,7 +1,8 @@ require 'bundler/gem_tasks' require 'rake/testtask' +require File.join(File.dirname(__FILE__), 'lib', 'knife-solo', 'info') MANIFEST_IGNORES = %w[ .travis.yml .gitignore Gemfile @@ -11,20 +12,31 @@ knife-solo.gemspec script/newb script/test ] -desc 'Updates Manifest.txt with a list of files from git' -task :manifest do - git_files = `git ls-files`.split("\n") - File.open('Manifest.txt', 'w') do |f| - f.puts((git_files - MANIFEST_IGNORES).join("\n")) +namespace :manifest do + desc 'Checks for outstanding changes to the manifest' + task :verify => :update do + changes = `git status --porcelain Manifest.txt` + raise "Manifest has not been updated" unless changes.empty? end + + desc 'Updates Manifest.txt with a list of files from git' + task :update do + git_files = `git ls-files`.split("\n") + + File.open('Manifest.txt', 'w') do |f| + f.puts((git_files - MANIFEST_IGNORES).join("\n")) + end + end end -task :release => :manifest +desc 'Alias to manifest:update' +task :manifest => 'manifest:update' + # Returns the parsed RDoc for a single file as HTML # Somewhat gnarly, but does the job. def parsed_rdoc file options = RDoc::Options.new options.template_dir = options.template_dir_for 'darkfish' @@ -49,16 +61,15 @@ f.puts '---' f.puts parsed_rdoc("README.rdoc") end rev = `git rev-parse HEAD`[0..7] Dir.chdir(clone) do - sh "git commit --allow-empty -m 'Updated index from README.rdoc rev #{rev}' index.html" + sh "git commit --allow-empty -m 'Update index for v#{KnifeSolo.version} from README.rdoc rev #{rev}' index.html" sh "git push origin gh-pages" end end end -task :release => 'gh-pages' namespace :test do Rake::TestTask.new(:integration) do |t| t.libs << "test" t.test_files = FileList['test/integration/*_test.rb'] @@ -71,8 +82,13 @@ desc 'Run both unit and integration tests' task :all => [:units, :integration] end -desc "Alias for test:units" -task :test => ['test:units'] +desc 'Alias for test:units' +task :test => 'test:units' + task :default => :test +task :default => 'manifest:verify' + +task :release => :manifest +task :release => 'gh-pages' unless KnifeSolo.prerelease?