forked from skylightio/skylight-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
58 lines (48 loc) · 1.48 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
require 'bundler/setup'
require 'rbconfig'
require 'yard'
task :spec do
platform = Gem::Platform.local
ext = RbConfig::CONFIG['DLEXT']
# The possible locations for the native extension
native_ext = [
# Allows the location of the native extension to be specified externally
ENV['RUBY_SKYLIGHT_NATIVE_PATH'],
# The platform scoped location
File.expand_path("../target/#{platform.os}/#{platform.cpu}/skylight_native.#{ext}"),
# The default extconf output directory
File.expand_path("../ext/skylight_native.#{ext}")
].detect { |f| f && File.exist?(f) }
if native_ext
native_ext_dir = File.dirname(native_ext)
ENV["RUBYOPT"] = "#{ENV["RUBYOPT"]} -I#{native_ext_dir}"
end
# Shelling out to rspec vs. invoking the runner in process fixes exit
# statuses.
Dir.chdir File.expand_path('../', __FILE__) do
sh [ "ruby -rbundler/setup -S rspec", ENV['args'] ].join(' ')
end
end
desc "clean build artifacts"
task :clean do
rm_rf Dir["ext/{*.a,*.o,*.so,*.bundle}"]
rm_rf Dir["lib/skylight_native.{a,o,so,bundle}"]
rm_rf "target"
end
namespace :vendor do
namespace :update do
task :highline do
rm_rf "lib/skylight/vendor/cli/highline*"
mkdir_p "tmp/vendor"
cd "tmp/vendor" do
rm_rf "highline*"
sh "gem update highline"
sh "gem unpack highline"
end
cp_r Dir["tmp/vendor/highline*/lib/*"], "lib/skylight/vendor/cli/"
end
end
end
# See .yardopts
YARD::Rake::YardocTask.new
task :default => :spec