This repository has been archived by the owner on Nov 28, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 198
/
Rakefile
96 lines (79 loc) · 2.04 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
require 'packaging'
Pkg::Util::RakeUtils.load_packaging_tasks
# Allow override of RELEASE using BUILD_NUMBER
ENV["RELEASE"] = ENV["BUILD_NUMBER"] if ENV["BUILD_NUMBER"]
def announce(msg='')
STDERR.puts "================"
STDERR.puts msg
STDERR.puts "================"
end
def safe_system *args
raise RuntimeError, "Failed: #{args.join(' ')}" unless system(*args)
end
def move_artifacts
mv("pkg", "build")
end
namespace :package do
task :bootstrap do
puts 'Bootstrap is no longer needed, using packaging-as-a-gem'
end
task :implode do
puts 'Implode is no longer needed, using packaging-as-a-gem'
end
end
desc "Cleanup"
task :clean do
rm_rf "build"
rm_rf "doc"
end
desc "Build documentation"
task :doc => :clean do
Rake::Task["package:doc"].invoke
end
desc "Build a gem"
task :gem => :clean do
Rake::Task["gem"].reenable
Rake::Task["package:gem"].invoke
end
desc "Create a tarball for this release"
task :package => :clean do
announce "Creating #{Pkg::Config.project}-#{Pkg::Config.version}.tar.gz"
Rake::Task["package:tar"].invoke
move_artifacts
end
desc "Run spec tests"
task :test do
sh "cd spec && rake"
end
desc "Run spec tests"
task :test => :spec
namespace :ci do
desc "Run the specs with CI options"
task :spec do
ENV["LOG_SPEC_ORDER"] = "true"
sh %{rspec -r yarjuf -f JUnit -o result.xml -fp spec}
end
end
desc "Creates the website as a tarball"
task :website => :clean do
FileUtils.mkdir_p("build/marionette-collective.org/html")
Dir.chdir("website") do
safe_system("jekyll ../build/marionette-collective.org/html")
end
unless File.exist?("build/marionette-collective.org/html/index.html")
raise "Failed to build website"
end
Dir.chdir("build") do
safe_system("tar -cvzf marionette-collective-org-#{Time.now.to_i}.tgz marionette-collective.org")
end
end
desc 'run static analysis with rubocop'
task(:rubocop) do
if RUBY_VERSION !~ /1.8/
require 'rubocop'
cli = RuboCop::CLI.new
exit cli.run(%w(-D -f s))
else
puts "Rubocop is disabled in ruby 1.8"
end
end