forked from middleman/middleman
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
66 lines (53 loc) · 1.52 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
require 'rake'
require File.expand_path('../middleman-core/lib/middleman-core/version.rb', __FILE__)
ROOT = File.expand_path(File.dirname(__FILE__))
GEM_NAME = 'middleman'.freeze
middleman_gems = %w(middleman-core middleman-cli middleman)
GEM_PATHS = middleman_gems.freeze
def sh_rake(command)
sh "#{Gem.ruby} -S rake #{command}", verbose: true
end
desc 'Displays the current version'
task :version do
puts "Current version: #{Middleman::VERSION}"
end
desc 'Pushes repository to GitHub'
task :push do
puts 'Pushing to github...'
sh "git tag v#{Middleman::VERSION}"
sh 'git push'
sh "git push origin v#{Middleman::VERSION}"
end
desc 'Release all middleman gems'
task publish: :push do
puts 'Pushing to rubygems...'
GEM_PATHS.each do |dir|
Dir.chdir(dir) { sh_rake('release') }
end
end
desc 'Generate documentation for all middleman gems'
task :doc do
GEM_PATHS.each do |g|
Dir.chdir(File.join(ROOT, g).to_s) { sh "#{Gem.ruby} -S rake yard" }
end
end
desc 'Run tests for all middleman gems'
task :test do
Rake::Task['rubocop'].invoke
GEM_PATHS.each do |g|
Dir.chdir(File.join(ROOT, g).to_s) { sh "#{Gem.ruby} -S rake test" }
end
end
desc 'Run specs for all middleman gems'
task :spec do
GEM_PATHS.each do |g|
Dir.chdir(File.join(ROOT, g).to_s) { sh "#{Gem.ruby} -S rake spec" }
end
end
require 'rubocop/rake_task'
desc 'Run RuboCop to check code consistency'
RuboCop::RakeTask.new(:rubocop) do |task|
task.fail_on_error = false
end
desc 'Run tests for all middleman gems'
task default: :test