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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
# File 'lib/ontomde-plugin-rsm6.rb', line 8
def rsm6_install_plugin(scriptName)
s="************************************************"
puts s
puts "** Installation program for RSM rdfmda plugin v:#{RSM6_PLUGIN_VERSION} **"
puts s
puts ""
options = {}
options[:rsm]=nil
OptionParser.new do |opts|
opts.banner =<<ENDHELP
Usage: #{scriptName} [options]
------------------------------------------------------
#{scriptName} converts a UML2/RDF model file
into a protege 2000 knowledge base.
Example:
$ #{scriptName} --rsm6 myUmlModel.emx.nt
will generate these Protege files:
* myUmlModel.emx.nt_kb.pprj
* myUmlModel.emx.nt_kb.rdf
* myUmlModel.emx.nt_kb.rdfs
------------------------------------------------------
ENDHELP
opts.on("-v", "--[no|-verbose", "Run in verbose mode") do |v|
options[:verbose] = v
end
opts.on("-r","--rsm DIRECTORY",Array,"RSM 6 Directory") do |v|
options[:rsm]=v
end
opts.on("-n","--no_default","Do not use default settings","option used primarily used for testing") do |v|
options[:no_default]=v
end
opts.separator ""
opts.separator "Common options:"
opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end
end.parse!
["RSM6_HOME", "RSM_HOME"].each { |v|
if options[:rsm].nil? && !ENV[v].nil?
puts "NOTE: using environment variable #{v}"
puts "#{v}=#{ENV[v]}"
puts ""
options[:rsm]=[ENV[v]]
end
}
if options[:rsm].nil? && !options[:no_default]
puts "NOTE: using default RSM6 installation directory"
options[:rsm]=[".","C:\\Program Files\\IBM\\Rational\\SDP\\6.0"]
end
if ARGV.length > 0
puts "Incorrect syntax used"
puts "parameter #{ARGV} was not understood"
puts "Please refer to documentation with :"
puts "> #{scripName} --help"
end
[:rsm].each { |p|
puts "--#{p}=#{options[p]}" if options[:verbose]
next unless options[p].nil?
m="--#{p} parameter is mandatory"
puts("")
puts(m)
puts("For command syntax :")
puts("#{File.basename(__FILE__)} --help")
puts("")
raise Exception.new(m)
}
options[:rsm].each { |rsm_home|
tab=" "
puts "looking for IBM RSM in directory :\n\"#{rsm_home}\"."
if !File.exist?(rsm_home)
puts "ERROR: \"#{rsm_home}\" is not a directory."
next
end
rsm_plugin=rsm_home+'/radrsm_shared/eclipse/plugins/'
if !File.exist?(rsm_plugin)
puts "ERROR: \"#{rsm_home}\" is not a rsm6 directory ."
next
end
plugin_install(rsm_plugin)
puts "done !"
exit(0)
}
puts <<END
RSM directory was not found.
Please provide #{scriptName} the correct RSM6 installation directory.
Option 1) Use RSM6_HOME environnement variable.
> #{scriptName}
Option 2) Provide RSM directory on the command line.
> #{scriptName} --rsm6 "C:\\Program Files\\IBM\\Rational\\SDP\\6.0"
Option 3) Launch #{scriptName} from RSM6 directory
> cd <RSM6 DIRECTORY>
> #{scriptName}
NOTE: The root directory of RSM is the directory
containing the following folders:
* radrsm_shared
* rsm_prod
* setup
* ...
END
puts "*******************************************"
puts "Plugin installation was **not** successful."
puts "*******************************************"
exit
end
|