-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeminstall
executable file
·93 lines (69 loc) · 2.47 KB
/
geminstall
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/env ruby
=begin
== Description
The script manages NuoDB gems, installing them or uninstalling them, removing some
of the command line complexity from developers eyes.
== Mac Only Notes
The dylib for NuoDB must have an @rpath set on Mac, so if you find that the dylib
id is incorrect, you will need to run the install_name_tool to fix it. To see what
the current id is run this command:
otool -L libNuoRemote.dylib
Incorrect output will look like this:
libNuoRemote.dylib:
/Users/build/bamboo-agent-home/xml-data/build-dir/MASTER-PACKAGE-MACOSX/Remote/Debug/libNuoRemote.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.0.0)
Correct output will look like this:
libNuoRemote.dylib:
@rpath/libNuoRemote.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.0.0)
As necessary, to fix the id you'd run this command:
install_name_tool -id @rpath/libNuoRemote.dylib libNuoRemote.dylib
=end
require 'rake'
require 'optparse'
nuodb_root = File.expand_path('../../../', __FILE__)
task :default => :install
desc "Install NuoDB Ruby Gems"
task :install do
sh "NUODB_ROOT=#{nuodb_root} gem install nuodb-*.gem"
sh "gem install activerecord-nuodb-adapter-*.gem"
end
desc "Uninstall NuoDB Ruby Gems"
task :uninstall do
sh "gem uninstall activerecord-nuodb-adapter"
sh "gem uninstall nuodb"
end
optparse = OptionParser.new do |opts|
opts.banner = "Usage: #{$0} <options> [install|uninstall]"
opts.separator ''
opts.on('-h', '--help', 'Display this help') do
puts opts
exit
end
end
def no_command_given?
ARGV.empty?
end
def raise_argument_error (list)
raise ArgumentError, "Invalid command: #{list}"
end
def list_commands
if no_command_given?
[:install]
else
list = ARGV.select { |arg| arg =~ /^(([[:alnum:]])[[:alnum:]\_\-]+)$/ }
fail = list.reject { |entry| entry if %w(install uninstall).include? entry }
raise_argument_error fail if not fail.empty?
list.select { |entry| entry.to_sym }
end
end
begin
optparse.parse!
list_commands.each { |command| Rake::Task[command].invoke }
rescue ArgumentError, OptionParser::InvalidOption => e
puts "Error: #{e}\n"
puts optparse
exit 1
end