-
Notifications
You must be signed in to change notification settings - Fork 20
/
Rakefile
59 lines (50 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
require 'fileutils'
require 'rspec/core/rake_task'
gemspecs = %w[
paint.gemspec
paint-shortcuts.gemspec
]
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = [
'--colour',
'--format documentation',
'-r ' + File.expand_path( File.join( 'spec', 'spec_helper') ),
]
end
task :default => :spec
task :test => :spec
def gemspec_spec_for(gemspec)
eval(File.read(gemspec), binding, gemspec)
end
desc "Build the gems"
task :gems do
FileUtils.mkdir_p 'pkg'
gemspecs.each{ |gemspec|
sh "gem build #{gemspec}"
spec = gemspec_spec_for(gemspec)
FileUtils.mv "#{spec.name}-#{spec.version}.gem", 'pkg'
}
end
desc "Install the gem locally"
task :install => :gems do
gemspecs.each{ |gemspec|
spec = gemspec_spec_for(gemspec)
sh %{gem install pkg/#{spec.name}-#{spec.version}.gem --no-doc}
}
end
desc "Run a Benchmark"
task :benchmark do
ruby 'benchmark.rb'
end
desc "Print 256 colors rainbow"
task :rainbow256 do
require_relative 'lib/paint'
(0...256).each{ |color|
print Paint[' ', 48, 5, color] # print empty bg color field
}
puts
end
desc "Start console session with libraries loaded"
task :irb do
sh "irb -I ./lib -r paint -r paint/shortcuts"
end