-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.rb
76 lines (55 loc) · 1.29 KB
/
make.rb
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
67
68
69
70
71
72
73
74
75
76
require 'rbconfig'
# This whole thing is gross and needs to change at some point
# Either need to make a gem or use something like ruby-packer
# Create dotfiles
dir = ENV['HOME'] + '/.bacchus'
if !File.exist?(dir)
cmd = 'mkdir ' + dir
system cmd
cmd = 'mkdir ' + dir + '/prefixes'
system cmd
cmd = 'mkdir ' + dir + '/presets'
system cmd
cmd = 'mkdir ' + dir + '/launchers'
system cmd
end
# Build the bacchus executable script
cmd = 'touch bacchus'
system cmd
File.open('bacchus', 'a') { |f|
f.puts '#!/usr/bin/env ruby'
f.puts "require 'optparse'"
}
cmd = "echo $'\n' >> bacchus"
system cmd
cmd = 'cat helpers.rb >> bacchus'
system cmd
cmd = "echo $'\n' >> bacchus"
system cmd
cmd = 'cat backup.rb >> bacchus'
system cmd
cmd = "echo $'\n' >> bacchus"
system cmd
cmd = 'cat search.rb >> bacchus'
system cmd
cmd = "echo $'\n' >> bacchus"
system cmd
cmd = 'cat menu.rb >> bacchus'
system cmd
cmd = "echo $'\n' >> bacchus"
system cmd
cmd = 'cat bacchus.rb | tail -n+6 >> bacchus'
system cmd
cmd = 'chmod 755 bacchus'
system cmd
# Move to /usr/bin here
os = RbConfig::CONFIG['host_os']
if os.downcase.include?('darwin')
cmd = 'mv bacchus /usr/local/bin/bacchus'
system cmd
elsif os.downcase.include?('linux')
cmd = 'mv bacchus /usr/bin/bacchus'
system cmd
else
puts "Don't use windows"
end