middleman/Rakefile

58 lines
1.2 KiB
Ruby
Raw Normal View History

require 'rake'
2011-12-30 04:52:00 +01:00
require 'middleman-core/version'
2011-12-30 04:52:00 +01:00
def sh_rake(command)
2014-04-29 19:44:24 +02:00
sh "#{Gem.ruby} -S rake #{command}", verbose: true
2011-12-30 04:52:00 +01:00
end
def within_each_gem(&block)
%w(middleman-core middleman).each do |dir|
Dir.chdir(dir) { block.call }
end
end
desc 'Displays the current version'
2011-12-30 04:52:00 +01:00
task :version do
2014-04-29 01:02:18 +02:00
puts "Current version: #{Middleman::VERSION}"
2011-12-30 04:52:00 +01:00
end
desc 'Pushes repository to GitHub'
2011-12-30 04:52:00 +01:00
task :push do
2014-04-29 01:02:18 +02:00
puts 'Pushing to github...'
2011-12-30 04:52:00 +01:00
sh "git tag v#{Middleman::VERSION}"
2015-02-13 23:42:17 +01:00
sh 'git push'
2011-12-30 04:52:00 +01:00
sh "git push origin v#{Middleman::VERSION}"
end
desc 'Release all middleman gems'
2014-04-29 19:44:24 +02:00
task publish: :push do
2014-04-29 01:02:18 +02:00
puts 'Pushing to rubygems...'
within_each_gem { sh_rake('release') }
2011-12-30 04:52:00 +01:00
end
desc 'Generate documentation for all middleman gems'
2012-05-02 20:13:06 +02:00
task :doc do
within_each_gem { sh_rake('yard') }
2012-05-02 20:13:06 +02:00
end
desc 'Run tests for all middleman gems'
task :test do
2014-09-09 09:14:45 +02:00
Rake::Task['rubocop'].invoke
within_each_gem { sh_rake('test') }
end
desc 'Run specs for all middleman gems'
task :spec do
within_each_gem { sh_rake('spec') }
end
2014-04-29 01:02:18 +02:00
require 'rubocop/rake_task'
desc 'Run RuboCop to check code consistency'
RuboCop::RakeTask.new(:rubocop) do |task|
2014-04-29 01:02:18 +02:00
task.fail_on_error = false
2013-05-24 00:59:26 +02:00
end
desc 'Run tests for all middleman gems'
2014-04-29 19:44:24 +02:00
task default: :test