2018-09-11 14:43:07 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2011-12-29 22:04:39 -05:00
|
|
|
require 'rake'
|
2011-12-29 22:52:00 -05:00
|
|
|
|
2018-09-11 14:43:07 -04:00
|
|
|
require File.expand_path('middleman-core/lib/middleman-core/version.rb', __dir__)
|
2011-12-29 22:04:39 -05:00
|
|
|
|
2018-09-11 14:43:07 -04:00
|
|
|
ROOT = __dir__
|
|
|
|
GEM_NAME = 'middleman'
|
2009-10-22 20:25:15 -04:00
|
|
|
|
2018-09-11 14:43:07 -04:00
|
|
|
middleman_gems = %w[middleman-core middleman-cli middleman]
|
2011-12-29 22:52:00 -05:00
|
|
|
GEM_PATHS = middleman_gems.freeze
|
|
|
|
|
|
|
|
def sh_rake(command)
|
2014-04-29 13:50:21 -04:00
|
|
|
sh "#{Gem.ruby} -S rake #{command}", verbose: true
|
2011-12-29 22:52:00 -05:00
|
|
|
end
|
|
|
|
|
2013-12-27 19:26:31 -05:00
|
|
|
desc 'Displays the current version'
|
2011-12-29 22:52:00 -05:00
|
|
|
task :version do
|
2014-04-28 19:02:18 -04:00
|
|
|
puts "Current version: #{Middleman::VERSION}"
|
2011-12-29 22:52:00 -05:00
|
|
|
end
|
|
|
|
|
2013-12-27 19:26:31 -05:00
|
|
|
desc 'Pushes repository to GitHub'
|
2011-12-29 22:52:00 -05:00
|
|
|
task :push do
|
2014-04-28 19:02:18 -04:00
|
|
|
puts 'Pushing to github...'
|
2011-12-29 22:52:00 -05:00
|
|
|
sh "git tag v#{Middleman::VERSION}"
|
2015-02-13 17:42:17 -05:00
|
|
|
sh 'git push'
|
2011-12-29 22:52:00 -05:00
|
|
|
sh "git push origin v#{Middleman::VERSION}"
|
|
|
|
end
|
|
|
|
|
2013-12-27 19:26:31 -05:00
|
|
|
desc 'Release all middleman gems'
|
2014-04-29 13:50:21 -04:00
|
|
|
task publish: :push do
|
2014-04-28 19:02:18 -04:00
|
|
|
puts 'Pushing to rubygems...'
|
2011-12-29 22:52:00 -05:00
|
|
|
GEM_PATHS.each do |dir|
|
2013-12-27 19:26:31 -05:00
|
|
|
Dir.chdir(dir) { sh_rake('release') }
|
2011-12-29 22:52:00 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-12-27 19:26:31 -05:00
|
|
|
desc 'Generate documentation for all middleman gems'
|
2012-05-02 14:13:06 -04:00
|
|
|
task :doc do
|
|
|
|
GEM_PATHS.each do |g|
|
2016-01-14 14:21:42 -05:00
|
|
|
Dir.chdir(File.join(ROOT, g).to_s) { sh "#{Gem.ruby} -S rake yard" }
|
2012-05-02 14:13:06 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-12-27 19:26:31 -05:00
|
|
|
desc 'Run tests for all middleman gems'
|
2011-12-29 18:09:51 -05:00
|
|
|
task :test do
|
2011-12-29 22:52:00 -05:00
|
|
|
GEM_PATHS.each do |g|
|
2016-01-14 14:21:42 -05:00
|
|
|
Dir.chdir(File.join(ROOT, g).to_s) { sh "#{Gem.ruby} -S rake test" }
|
2011-12-29 18:09:51 -05:00
|
|
|
end
|
2011-12-29 22:04:39 -05:00
|
|
|
end
|
|
|
|
|
2013-12-27 19:26:31 -05:00
|
|
|
desc 'Run specs for all middleman gems'
|
2013-02-09 18:45:45 -05:00
|
|
|
task :spec do
|
|
|
|
GEM_PATHS.each do |g|
|
2016-01-14 14:21:42 -05:00
|
|
|
Dir.chdir(File.join(ROOT, g).to_s) { sh "#{Gem.ruby} -S rake spec" }
|
2013-02-09 18:45:45 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-06-11 13:23:33 -04:00
|
|
|
require 'rubocop/rake_task'
|
|
|
|
desc 'Run RuboCop to check code consistency'
|
2018-09-11 14:43:07 -04:00
|
|
|
RuboCop::RakeTask.new(:rubocop)
|
2012-08-13 18:39:06 -04:00
|
|
|
|
2013-12-27 19:26:31 -05:00
|
|
|
desc 'Run tests for all middleman gems'
|
2020-08-16 15:08:50 -04:00
|
|
|
task default: %i[rubocop test]
|