-
Notifications
You must be signed in to change notification settings - Fork 3
/
Rakefile
68 lines (50 loc) · 1.44 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
# -*- ruby -*-
require 'rubygems'
require 'rubygems/package_task'
require 'bundler'
# Use https://github.com/SciRuby/nmatrix/blob/master/Rakefile
# as an example. Note that the order of requires is somewhat important, or was in the past.
# You also will only need one gemspec, so you can probably simplify some of the code.
gemspec = eval(IO.read("spice_rub.gemspec"))
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
desc "Build and install into system gems."
task :install => :repackage do
gem_file = "pkg/#{gemspec.name}-#{gemspec.version}.gem"
system "gem install '#{gem_file}'"
end
require 'rake'
require 'rake/extensiontask'
gemspec.extensions.each do |extconf|
ext_name = extconf.match(/ext\/(.*)\/extconf\.rb/)[1]
Rake::ExtensionTask.new do |ext|
ext.name = ext_name
ext.ext_dir = "ext/#{ext_name}"
ext.lib_dir = "lib/"
ext.source_pattern = "**/*.{c,cpp,h}"
end
end
Gem::PackageTask.new(gemspec).define
require 'rspec/core/rake_task'
require 'rspec/core'
task :default => :spec
desc "Run rspec on tests"
RSpec::Core::RakeTask.new do |t|
t.pattern = "spec/**/*_spec.rb"
end
task :console do |task|
cmd = [ 'irb', "-r './lib/spice_rub.rb'" ]
run *cmd
end
task :pry do |task|
cmd = [ 'pry', "-r './lib/spice_rub.rb' "]
run *cmd
end
def run *cmd
sh(cmd.join(" "))
end