medusa 0.0.1.3 → 0.0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/HEADER +3 -3
- data/Rakefile +17 -19
- data/lib/medusa/terminology.rb +2 -1
- metadata +67 -53
- data/bin/medusa +0 -186
data/HEADER
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
# #
|
4
4
|
# A component of medusa, the terminology management software for perseus-a. #
|
5
5
|
# #
|
6
|
-
# Copyright (C) 2007 Cologne University of Applied Sciences,
|
7
|
-
#
|
8
|
-
#
|
6
|
+
# Copyright (C) 2007-2008 Cologne University of Applied Sciences, #
|
7
|
+
# Claudiusstr. 1, #
|
8
|
+
# 50678 Cologne, Germany #
|
9
9
|
# #
|
10
10
|
# Authors: #
|
11
11
|
# Jens Wille <jens.wille@uni-koeln.de> #
|
data/Rakefile
CHANGED
@@ -1,23 +1,21 @@
|
|
1
|
-
|
1
|
+
begin
|
2
|
+
require 'hen'
|
3
|
+
rescue LoadError
|
4
|
+
abort "Please install the 'hen' gem first."
|
5
|
+
end
|
2
6
|
|
3
|
-
|
4
|
-
EXECS = FileList['bin/*'].to_a
|
5
|
-
RDOCS = %w[README COPYING ChangeLog]
|
6
|
-
OTHER = FileList['[A-Z]*'].to_a
|
7
|
+
require 'lib/medusa/version'
|
7
8
|
|
8
|
-
|
9
|
-
:
|
10
|
-
|
11
|
-
}
|
9
|
+
Hen.lay! {{
|
10
|
+
:rubyforge => {
|
11
|
+
:package => 'medusa'
|
12
|
+
},
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
:executables => EXECS,
|
21
|
-
:extra_rdoc_files => RDOCS,
|
22
|
-
:dependencies => %w[highline athena]
|
14
|
+
:gem => {
|
15
|
+
:version => Medusa::VERSION,
|
16
|
+
:summary => 'The terminology management software for perseus-a.',
|
17
|
+
:files => FileList['lib/**/*.rb'].to_a,
|
18
|
+
:extra_files => FileList['[A-Z]*'].to_a,
|
19
|
+
:dependencies => %w[highline athena]
|
20
|
+
}
|
23
21
|
}}
|
data/lib/medusa/terminology.rb
CHANGED
@@ -73,7 +73,8 @@ module Medusa
|
|
73
73
|
puts 'deleted!'
|
74
74
|
end
|
75
75
|
|
76
|
-
action :import, "Import data into a terminology (if the terminology
|
76
|
+
action :import, "Import data into a terminology (if the terminology " <<
|
77
|
+
"doesn't exist, it will be created)"
|
77
78
|
def import(file, type)
|
78
79
|
puts "imported: #{file}, #{type}"
|
79
80
|
end
|
metadata
CHANGED
@@ -1,73 +1,87 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.4
|
3
|
-
specification_version: 1
|
4
2
|
name: medusa
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.1.
|
7
|
-
date: 2007-10-11 00:00:00 +02:00
|
8
|
-
summary: The terminology management software for perseus-a
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email: jens.wille@uni-koeln.de
|
12
|
-
homepage:
|
13
|
-
rubyforge_project:
|
14
|
-
description:
|
15
|
-
autorequire:
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
4
|
+
version: 0.0.1.6
|
25
5
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
6
|
authors:
|
30
7
|
- Jens Wille
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
- lib/medusa/terminology.rb
|
35
|
-
- bin/medusa
|
36
|
-
- COPYING
|
37
|
-
- HEADER
|
38
|
-
- README
|
39
|
-
- ChangeLog
|
40
|
-
- Rakefile
|
41
|
-
test_files: []
|
42
|
-
|
43
|
-
rdoc_options: []
|
44
|
-
|
45
|
-
extra_rdoc_files:
|
46
|
-
- README
|
47
|
-
- COPYING
|
48
|
-
- ChangeLog
|
49
|
-
executables:
|
50
|
-
- medusa
|
51
|
-
extensions: []
|
52
|
-
|
53
|
-
requirements: []
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
54
11
|
|
12
|
+
date: 2008-01-08 00:00:00 +01:00
|
13
|
+
default_executable:
|
55
14
|
dependencies:
|
56
15
|
- !ruby/object:Gem::Dependency
|
57
16
|
name: highline
|
58
17
|
version_requirement:
|
59
|
-
version_requirements: !ruby/object:Gem::
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
19
|
requirements:
|
61
|
-
- - "
|
20
|
+
- - ">="
|
62
21
|
- !ruby/object:Gem::Version
|
63
|
-
version: 0
|
22
|
+
version: "0"
|
64
23
|
version:
|
65
24
|
- !ruby/object:Gem::Dependency
|
66
25
|
name: athena
|
67
26
|
version_requirement:
|
68
|
-
version_requirements: !ruby/object:Gem::
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
28
|
requirements:
|
70
|
-
- - "
|
29
|
+
- - ">="
|
71
30
|
- !ruby/object:Gem::Version
|
72
|
-
version: 0
|
31
|
+
version: "0"
|
73
32
|
version:
|
33
|
+
description: The terminology management software for perseus-a.
|
34
|
+
email: jens.wille@uni-koeln.de
|
35
|
+
executables: []
|
36
|
+
|
37
|
+
extensions: []
|
38
|
+
|
39
|
+
extra_rdoc_files:
|
40
|
+
- README
|
41
|
+
- COPYING
|
42
|
+
- ChangeLog
|
43
|
+
files:
|
44
|
+
- lib/medusa/version.rb
|
45
|
+
- lib/medusa/terminology.rb
|
46
|
+
- lib/medusa.rb
|
47
|
+
- COPYING
|
48
|
+
- HEADER
|
49
|
+
- README
|
50
|
+
- ChangeLog
|
51
|
+
- Rakefile
|
52
|
+
has_rdoc: true
|
53
|
+
homepage: http://prometheus.rubyforge.org/medusa
|
54
|
+
post_install_message:
|
55
|
+
rdoc_options:
|
56
|
+
- --all
|
57
|
+
- --inline-source
|
58
|
+
- --charset
|
59
|
+
- UTF-8
|
60
|
+
- --main
|
61
|
+
- README
|
62
|
+
- --title
|
63
|
+
- medusa Application documentation
|
64
|
+
- --line-numbers
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: "0"
|
72
|
+
version:
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: "0"
|
78
|
+
version:
|
79
|
+
requirements: []
|
80
|
+
|
81
|
+
rubyforge_project: prometheus
|
82
|
+
rubygems_version: 1.0.1
|
83
|
+
signing_key:
|
84
|
+
specification_version: 2
|
85
|
+
summary: The terminology management software for perseus-a.
|
86
|
+
test_files: []
|
87
|
+
|
data/bin/medusa
DELETED
@@ -1,186 +0,0 @@
|
|
1
|
-
#! /usr/bin/ruby
|
2
|
-
|
3
|
-
#--
|
4
|
-
###############################################################################
|
5
|
-
# #
|
6
|
-
# medusa -- The terminology manager for perseus-a #
|
7
|
-
# #
|
8
|
-
# Copyright (C) 2007 Cologne University of Applied Sciences, #
|
9
|
-
# Claudiusstr. 1, #
|
10
|
-
# 50678 Cologne, Germany #
|
11
|
-
# #
|
12
|
-
# Authors: #
|
13
|
-
# Jens Wille <jens.wille@uni-koeln.de> #
|
14
|
-
# #
|
15
|
-
# medusa is free software; you can redistribute it and/or modify it under the #
|
16
|
-
# terms of the GNU General Public License as published by the Free Software #
|
17
|
-
# Foundation; either version 3 of the License, or (at your option) any later #
|
18
|
-
# version. #
|
19
|
-
# #
|
20
|
-
# medusa is distributed in the hope that it will be useful, but WITHOUT ANY #
|
21
|
-
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
22
|
-
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more #
|
23
|
-
# details. #
|
24
|
-
# #
|
25
|
-
# You should have received a copy of the GNU General Public License along #
|
26
|
-
# with medusa. If not, see <http://www.gnu.org/licenses/>. #
|
27
|
-
# #
|
28
|
-
###############################################################################
|
29
|
-
#++
|
30
|
-
|
31
|
-
require 'optparse'
|
32
|
-
|
33
|
-
require 'rubygems'
|
34
|
-
require 'highline/import'
|
35
|
-
|
36
|
-
$: << File.join(File.dirname(__FILE__), '..', 'lib')
|
37
|
-
|
38
|
-
require 'medusa'
|
39
|
-
|
40
|
-
# overwrite to allow default value and fix regexp
|
41
|
-
def agree(yes_or_no_question, default = 'no')
|
42
|
-
ask("#{yes_or_no_question} (yes/no): ", lambda { |yn| yn =~ /\Ay/i }) { |q|
|
43
|
-
q.validate = /\A(?:y(?:es)?|no?)\Z/i
|
44
|
-
q.responses[:not_valid] = 'Please enter "yes" or "no".'
|
45
|
-
q.responses[:ask_on_error] = :question
|
46
|
-
q.default = default
|
47
|
-
}
|
48
|
-
end
|
49
|
-
|
50
|
-
def open_file_or_std(file, mode = 'r')
|
51
|
-
if file
|
52
|
-
File.open(file, mode)
|
53
|
-
else
|
54
|
-
case mode
|
55
|
-
when 'r': STDIN
|
56
|
-
when 'w': STDOUT
|
57
|
-
when 'a': STDERR
|
58
|
-
else raise ArgumentError, "don't know how to handle mode '#{mode}'"
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
PROGRAM_NAME = File.basename($0)
|
64
|
-
|
65
|
-
USAGE = "\
|
66
|
-
Usage: #{$0} <action> <terminology> [options...]
|
67
|
-
#{$0} {-h|--help}"
|
68
|
-
|
69
|
-
abort USAGE if ARGV.empty?
|
70
|
-
|
71
|
-
options = {}
|
72
|
-
|
73
|
-
OptionParser.new { |opts|
|
74
|
-
opts.banner = USAGE
|
75
|
-
|
76
|
-
opts.separator ''
|
77
|
-
opts.separator 'Required arguments:'
|
78
|
-
|
79
|
-
opts.separator ' action The action to perform'
|
80
|
-
opts.separator ' terminology The name of the terminology to operate on'
|
81
|
-
|
82
|
-
opts.separator ''
|
83
|
-
opts.separator 'Options:'
|
84
|
-
|
85
|
-
opts.on('-f', '--file FILE', 'Operates on FILE (instead of STDIN/STDOUT)') { |f|
|
86
|
-
options[:file] = f
|
87
|
-
}
|
88
|
-
|
89
|
-
opts.on('-t', '--type TYPE', 'Type of file (Import/Export format)') { |t|
|
90
|
-
options[:type] = t
|
91
|
-
}
|
92
|
-
|
93
|
-
opts.separator ''
|
94
|
-
opts.separator 'Generic options:'
|
95
|
-
|
96
|
-
opts.on('-h', '--help', 'Print this help message and exit') {
|
97
|
-
abort opts.to_s
|
98
|
-
}
|
99
|
-
|
100
|
-
opts.on('--help-actions', 'List available actions and exit') {
|
101
|
-
puts "Available actions for #{PROGRAM_NAME}:"
|
102
|
-
|
103
|
-
actions = Medusa.actions
|
104
|
-
max = actions.map { |a, _| a.length }.max
|
105
|
-
actions.each { |a, d|
|
106
|
-
puts " - %-#{max}s : %s" % [a, d]
|
107
|
-
}
|
108
|
-
|
109
|
-
abort
|
110
|
-
}
|
111
|
-
|
112
|
-
opts.on('--help-import', 'List available import formats (types) and exit') {
|
113
|
-
puts 'Available import formats (types):'
|
114
|
-
|
115
|
-
formats = Medusa.import_formats
|
116
|
-
max = formats.map { |a, _| a.length }.max
|
117
|
-
formats.each { |t, k|
|
118
|
-
puts " - %-#{max}s = %s" % [t, k]
|
119
|
-
}
|
120
|
-
|
121
|
-
abort
|
122
|
-
}
|
123
|
-
|
124
|
-
opts.on('--help-export', 'List available export formats (types) and exit') {
|
125
|
-
puts 'Available export formats (types):'
|
126
|
-
|
127
|
-
formats = Medusa.export_formats
|
128
|
-
max = formats.map { |a, _| a.length }.max
|
129
|
-
formats.each { |t, k|
|
130
|
-
puts " - %-#{max}s = %s" % [t, k]
|
131
|
-
}
|
132
|
-
|
133
|
-
abort
|
134
|
-
}
|
135
|
-
|
136
|
-
opts.on('--version', 'Print program version and exit') {
|
137
|
-
abort "#{PROGRAM_NAME} v#{Medusa::VERSION}"
|
138
|
-
}
|
139
|
-
}.parse!
|
140
|
-
|
141
|
-
unless ARGV.size == 2
|
142
|
-
abort "Both action and terminology must be given.\n\n#{USAGE}"
|
143
|
-
else
|
144
|
-
action, terminology = ARGV.slice!(0..1).map { |a| a.downcase }
|
145
|
-
end
|
146
|
-
|
147
|
-
unless Medusa.valid_action?(action)
|
148
|
-
abort "Invalid action: '#{action}'. " <<
|
149
|
-
"See '--help-actions' for a list of available actions."
|
150
|
-
end
|
151
|
-
|
152
|
-
unless %w[create import].include?(action) && Medusa.terminology_exists?(terminology)
|
153
|
-
msg = "No such terminology: '#{terminology}'."
|
154
|
-
msg << " Please create one first with '--create'." unless action == 'delete'
|
155
|
-
|
156
|
-
abort msg
|
157
|
-
end
|
158
|
-
|
159
|
-
args = [terminology]
|
160
|
-
|
161
|
-
case action
|
162
|
-
when 'create'
|
163
|
-
if Medusa.terminology_exists?(terminology)
|
164
|
-
abort "Terminology already exists: '#{terminology}'."
|
165
|
-
end
|
166
|
-
when 'delete'
|
167
|
-
unless agree("Really delete terminology '#{terminology}'?")
|
168
|
-
abort "Aborted! Won't delete terminology '#{terminology}'."
|
169
|
-
end
|
170
|
-
when 'import', 'export'
|
171
|
-
unless options[:type]
|
172
|
-
abort "No #{action} format specified. Use '--type' to do so."
|
173
|
-
end
|
174
|
-
|
175
|
-
unless Medusa.valid_format?(action, options[:type])
|
176
|
-
abort "Invalid #{action} format: '#{options[:type]}'. " <<
|
177
|
-
"See '--help-#{action}' for a list of available #{action} formats."
|
178
|
-
end
|
179
|
-
|
180
|
-
args << open_file_or_std(options[:file], action == 'export' ? 'w' : 'r')
|
181
|
-
args << options[:type]
|
182
|
-
when 'dump'
|
183
|
-
args << open_file_or_std(options[:file], 'w')
|
184
|
-
end
|
185
|
-
|
186
|
-
Medusa.run(action, *args)
|