forked from SciRuby/daru
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
69 lines (54 loc) · 1.19 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
require 'rspec/core/rake_task'
require 'bundler/gem_tasks'
lib_folder = File.expand_path("../lib", __FILE__)
RUBIES = ['ruby-2.0.0-p643', 'ruby-2.1.5', 'ruby-2.2.1', 'ruby-2.3.0']
def spec_run_all
RUBIES.each do |ruby_v|
puts "\n Using #{ruby_v}\n\n"
command = "$rvm_path/wrappers/#{ruby_v}/rake summary"
run command
end
end
task :spec do
case ARGV[1]
when 'setup'
spec_setup
when 'run'
spec_run_all if ARGV[2] == 'all'
when nil
run 'rspec spec'
end
end
# Stubs
task :setup
task :run
task :all
def spec_setup
RUBIES.each do |ruby_v|
puts "Installing #{ruby_v}..."
run "rvm install #{ruby_v}"
path = "$rvm_path/wrappers/#{ruby_v}"
run "#{path}/gem install bundler"
run "#{path}/bundle install"
end
end
#task all: [:cop, :run_all]
task :summary do
run 'rspec spec/ -r ./.rspec_formatter.rb -f SimpleFormatter' rescue nil
end
#RSpec::Core::RakeTask.new(:spec)
task :default => :spec
task :console do |task|
cmd = [ 'irb', "-r '#{lib_folder}/daru.rb'" ]
run *cmd
end
task :cop do |task|
run 'rubocop' rescue nil
end
task :pry do |task|
cmd = [ 'pry', "-r '#{lib_folder}/daru.rb'" ]
run *cmd
end
def run *cmd
sh(cmd.join(" "))
end