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