fix rake tasks

This commit is contained in:
Thomas Reynolds 2011-12-29 19:52:00 -08:00
parent ca10d108e3
commit 4b5174f0c8
4 changed files with 81 additions and 15 deletions

View file

@ -1,11 +1,11 @@
lib/**/*.rb
--exclude lib/middleman/vendor/
--exclude lib/middleman/extensions/automatic_image_sizes/fastimage.rb
--exclude lib/middleman/extensions/minify_css/cssmin.rb
--exclude lib/middleman/step_definitions
--exclude lib/middleman/templates/default/
--exclude lib/middleman/templates/html5/
--exclude lib/middleman/templates/mobile/
--exclude lib/middleman/templates/shared/
middleman-*/lib/**/*.rb
--exclude middleman-core/lib/middleman/vendor/
--exclude middleman-core/lib/middleman/extensions/automatic_image_sizes/fastimage.rb
--exclude middleman-more/lib/middleman/extensions/minify_css/cssmin.rb
--exclude middleman-core/lib/middleman/step_definitions
--exclude middleman-core/lib/middleman/templates/default/
--exclude middleman-core/lib/middleman/templates/html5/
--exclude middleman-core/lib/middleman/templates/mobile/
--exclude middleman-core/lib/middleman/templates/shared/
--no-private
--hide-void-return

View file

@ -2,17 +2,83 @@ require 'rubygems' unless defined?(Gem)
# require 'fileutils' unless defined?(FileUtils)
require 'rake'
require 'yard'
# require File.expand_path("../middleman-core/lib/middleman-core/version.rb", __FILE__)
require File.expand_path("../middleman-core/lib/middleman-core/version.rb", __FILE__)
ROOT = File.expand_path(File.dirname(__FILE__))
GEM_NAME = 'middleman'
middleman_gems = %w(middleman-core middleman-more)
GEM_PATHS = middleman_gems.freeze
def sh_rake(command)
sh "#{Gem.ruby} -S rake #{command}", :verbose => true
end
def say(text, color=:magenta)
n = { :bold => 1, :red => 31, :green => 32, :yellow => 33, :blue => 34, :magenta => 35 }.fetch(color, 0)
puts "\e[%dm%s\e[0m" % [n, text]
end
desc "Run 'install' for all projects"
task :install do
GEM_PATHS.each do |dir|
Dir.chdir(dir) { sh_rake(:install) }
end
end
desc "Clean pkg and other stuff"
task :clean do
GEM_PATHS.each do |g|
%w[tmp pkg coverage].each { |dir| sh 'rm -rf %s' % File.join(g, dir) }
end
end
desc "Clean pkg and other stuff"
task :uninstall do
sh "gem search --no-version middleman | grep middleman | xargs gem uninstall -a"
end
desc "Displays the current version"
task :version do
say "Current version: #{Middleman::VERSION}"
end
desc "Bumps the version number based on given version"
task :bump, [:version] do |t, args|
raise "Please specify version=x.x.x !" unless args.version
version_path = File.dirname(__FILE__) + '/middleman-core/lib/middleman-core/version.rb'
version_text = File.read(version_path).sub(/VERSION = '[\d\.\w]+'/, "VERSION = '#{args.version}'")
say "Updating Middleman to version #{args.version}"
$stderr.puts version_path, version_text
File.open(version_path, 'w') { |f| f.write version_text }
sh 'git commit -a -m "Bumped version to %s"' % args.version
end
desc "Executes a fresh install removing all middleman version and then reinstall all gems"
task :fresh => [:uninstall, :install, :clean]
desc "Pushes repository to GitHub"
task :push do
say "Pushing to github..."
sh "git tag v#{Middleman::VERSION}"
sh "git push origin master"
sh "git push origin v#{Middleman::VERSION}"
end
desc "Release all middleman gems"
task :publish => :push do
say "Pushing to rubygems..."
GEM_PATHS.each do |dir|
Dir.chdir(dir) { sh_rake("release") }
end
Rake::Task["clean"].invoke
end
desc "Run tests for all middleman gems"
task :test do
middleman_gems.each do |g|
sh "cd #{File.join(ROOT, g)} && bundle exec rake test"
GEM_PATHS.each do |g|
sh "cd #{File.join(ROOT, g)} && #{Gem.ruby} -S rake test"
end
end

View file

@ -1,8 +1,7 @@
require 'rubygems' unless defined?(Gem)
require 'rake'
require 'cucumber/rake/task'
require 'bundler/gem_tasks'
require 'yard'
# Skip the releasing tag
class Bundler::GemHelper
@ -14,6 +13,7 @@ class Bundler::GemHelper
end
end
require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:test, 'Run features that should pass') do |t|
t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
end

View file

@ -4,7 +4,7 @@ require "rubygems"
module Middleman
# Current Version
# @return [String]
VERSION = "3.0.0.alpha.7" unless const_defined?(:VERSION)
VERSION = '3.0.0.alpha.7' unless const_defined?(:VERSION)
# Parsed version for RubyGems
# @private