forked from CocoaPods/Xcodeproj
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
123 lines (98 loc) · 2.64 KB
/
Copy pathRakefile
File metadata and controls
123 lines (98 loc) · 2.64 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# Bootstrap task
#-----------------------------------------------------------------------------#
desc 'Install dependencies'
task :bootstrap do
if system('which bundle')
sh 'bundle install'
else
$stderr.puts "\033[0;31m" \
"[!] Please install the bundler gem manually:\n" \
' $ [sudo] gem install bundler' \
"\e[0m"
exit 1
end
end
begin
task :build do
title 'Building the gem'
end
require 'bundler/gem_tasks'
# Release tasks
#-----------------------------------------------------------------------------#
desc 'Build the gem for distribution'
task :release_build => :build
desc 'Runs the tasks necessary for the release of the gem'
task :pre_release do
title 'Running pre-release tasks'
tmp = File.expand_path('../tmp', __FILE__)
sh "rm -rf '#{tmp}'"
Rake::Task[:release_build].invoke
end
# Always prebuilt for gems!
Rake::Task[:build].enhance [:pre_release]
# Travis support
def on_rvm?
`which ruby`.strip.include?('.rvm')
end
def rvm_ruby_dir
@rvm_ruby_dir ||= File.expand_path('../..', `which ruby`.strip)
end
#-----------------------------------------------------------------------------#
namespace :spec do
desc 'Run all specs'
task :all do
puts "\n\033[0;32mUsing #{`ruby --version`.chomp}\033[0m"
title 'Running the specs'
sh "bundle exec bacon #{FileList['spec/**/*_spec.rb'].join(' ')}"
Rake::Task['rubocop'].invoke if RUBY_VERSION >= '1.9.3'
end
desc 'Automatically run specs'
task :kick do
exec 'bundle exec kicker -c'
end
desc 'Run single spec'
task :single, :spec_file do |_t, args|
sh "bundle exec bacon #{args.spec_file}"
end
end
desc 'Run all specs'
task :spec => 'spec:all'
task :default => :spec
#-- RuboCop ----------------------------------------------------------------#
if RUBY_VERSION >= '1.9.3'
require 'rubocop/rake_task'
RuboCop::RakeTask.new
end
rescue LoadError, NameError => e
$stderr.puts "\033[0;31m" \
'[!] Some Rake tasks haven been disabled because the environment' \
' couldn’t be loaded. Be sure to run `rake bootstrap` first.' \
"\e[0m"
$stderr.puts e.message
$stderr.puts e.backtrace
$stderr.puts
end
# UI Helpers
#-----------------------------------------------------------------------------#
# Prints a title.
#
def title(string)
puts
puts yellow(string)
puts '-' * 80
end
# Prints a subtitle
#
def subtitle(string)
puts cyan(string)
end
# Colorizes a string to yellow.
#
def yellow(string)
"\033[0;33m#{string}\e[0m"
end
# Colorizes a string to cyan.
#
def cyan(string)
"\n\033[0;36m#{string}\033[0m"
end