-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
41 lines (30 loc) · 887 Bytes
/
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
# # #
# Get gemspec info
gemspec_file = Dir["*.gemspec"].first
gemspec = eval File.read(gemspec_file), binding, gemspec_file
info = "#{gemspec.name} | #{gemspec.version} | " \
"#{gemspec.runtime_dependencies.size} dependencies | " \
"#{gemspec.files.size} files"
# # #
# Gem build and install task
desc info
task :gem do
puts info + "\n\n"
print " "; sh "gem build #{gemspec_file}"
FileUtils.mkdir_p "pkg"
FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", "pkg"
puts; sh %{gem install --no-document pkg/#{gemspec.name}-#{gemspec.version}.gem}
end
# # #
# Start an IRB session with the gem loaded
desc "#{gemspec.name} | IRB"
task :irb do
sh "irb -I ./lib -r #{gemspec.name.gsub '-','/'}"
end
# # #
# Run specs
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = '--backtrace --color'
end
task default: :spec