-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.rb
More file actions
25 lines (18 loc) · 727 Bytes
/
install.rb
File metadata and controls
25 lines (18 loc) · 727 Bytes
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
# install and link gems
system('bundle -j4')
gems_dir = File.expand_path(Dir.glob('vendor/bundle/ruby/*')[0]) + '/gems'
linked_gems = File.expand_path('vendor/gems')
File.unlink(linked_gems) if File.exist?(linked_gems)
system("ln -s #{gems_dir} #{linked_gems}")
# add bin to paths
bin_dir = File.expand_path('bin')
path_line = "# forge CLI\nexport PATH=\"$PATH:#{bin_dir}\""
['.bashrc', '.profile', '.bash_profile'].each do |file|
filename = File.expand_path("~/#{file}")
next if !File.exist?(filename)
file_content = File.read(filename)
next if file_content.include?(path_line)
file_content << "\n#{path_line}\n"
File.open(filename, 'w+') { |f| f.write (file_content) }
puts "#{filename} was updated"
end