Module: DemoInstaller
- Defined in:
- lib/ontomde-core/demoInstaller.rb
Instance Method Summary collapse
-
#installDefaultDemo(scriptFullPath) ⇒ Object
install demonstration.
- #proceed(target, source, banner) ⇒ Object
Instance Method Details
#installDefaultDemo(scriptFullPath) ⇒ Object
install demonstration
infers demo location and demo name from scriptName and and call proceed. scriptFullPath is expected to have the following structure: <path>/<demoName>/bin/<thisscript> and demo is expected to be in <path>/<demoName>/demo
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ontomde-core/demoInstaller.rb', line 43 def installDefaultDemo(scriptFullPath) scriptFullPath=File.(scriptFullPath) dn=File.dirname(scriptFullPath) bn=File.basename(scriptFullPath) target=File.basename(File.dirname(dn)) source="#{dn}/../demo" =%{#{bn} installs a demo project in target directory.} #puts "target=>#{target}<" #puts "source=>#{source}<" #puts "banner=>#{banner}<" proceed(target,source,) end |
#proceed(target, source, banner) ⇒ Object
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 |
# File 'lib/ontomde-core/demoInstaller.rb', line 6 def proceed(target,source,) = { } [:target]="#{target}" OptionParser.new do |opts| opts. = +<<END Command syntax: ---------- END opts.on("-t","--target DIRECTORY","","target directory where demo project will be installed","default: --target #{[:target]}" ) do |v| [:target] = v end # No argument, shows at tail. This will print an options summary. # Try it and see! opts.on_tail("-h", "--help", "Show this message") do puts opts exit end end.parse! if File.exist?([:target]) puts "WARNING: File already exists (#{[:target]})" puts "WARNING: Copy aborted" else cp_r("#{source}", [:target] ) puts "INFO: Project created in #{[:target]}" end end |