forked from mbryzek/schema-evolution-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.rb
executable file
·37 lines (31 loc) · 1.23 KB
/
configure.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
#!/usr/bin/env ruby
#
# Preprares schema-evolution-manager for installation. See also install.rb
# script in this directory. Main work is to simply check a few
# dependencies and to capture the directory into which the user
# would like to install schema-evolution-manager.
#
# == Usage
# ./configure.rb
# You will be asked for required options
#
# ./configure.rb --lib_dir /usr/local/lib --bin_dir /usr/local/bin
# Configure installer for the specified lib and bin directories
#
load File.join(File.dirname(__FILE__), 'lib/schema-evolution-manager.rb')
SchemaEvolutionManager::Library.set_verbose(true)
args = SchemaEvolutionManager::Args.from_stdin(:optional => %w(lib_dir bin_dir))
lib_dir = args.lib_dir || SchemaEvolutionManager::Ask.for_string("lib dir", :default => "/usr/local/lib")
if lib_dir.match(/\/lib$/)
default_bin_dir = lib_dir.sub(/\/lib$/, '/bin')
else
default_bin_dir = "/usr/local/bin"
end
bin_dir = args.bin_dir || SchemaEvolutionManager::Ask.for_string("bin dir", :default => default_bin_dir)
target = "./install.rb"
template = SchemaEvolutionManager::InstallTemplate.new(:lib_dir => lib_dir, :bin_dir => bin_dir)
template.write_to_file(target)
puts ""
puts "To complete installation, run:"
puts " sudo #{target}"
puts ""