forked from grobie/soundcloud2000
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Rakefile
62 lines (55 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
require 'bundler/gem_tasks'
require 'rake'
require 'yaml'
def dependencies(file)
`otool -L #{file}`.split("\n")[1..-1].map { |line| line.split[0] }
end
task :dirs do
begin
Dir.mkdir 'vendor'
rescue StandardError
nil
end
begin
Dir.mkdir 'vendor/bin'
rescue StandardError
nil
end
begin
Dir.mkdir 'vendor/lib'
rescue StandardError
nil
end
begin
Dir.mkdir 'vendor/dyld'
rescue StandardError
nil
end
end
task ruby: :dirs do
lines = `rvm info`.split("\n")[6..-1]
ruby = YAML.safe_load(lines.join("\n"))
version = ruby.keys.first
home = ruby[version]['homes']['ruby']
bin = ruby[version]['binaries']['ruby']
# dylib = dependencies(bin)[0]
`cp -a #{home}/lib/ruby/1.9.1/* vendor/lib`
`cp #{bin} vendor/`
# `cp #{dylib} vendor/dyld`
end
task libs: :dirs do
%i[audite portaudio mpg123].each do |name|
lib = `gem which #{name}`.chomp
`cp #{lib} vendor/lib`
if File.extname(lib) == '.bundle'
dylib = dependencies(lib)[0]
`cp #{dylib} vendor/dyld`
end
end
end
task package: %i[ruby libs] do
`cp soundcloud9000 vendor`
`cp -a bin/* vendor/bin`
`cp -a lib/* vendor/lib`
`tar czf soundcloud9000.tgz vendor`
end