logaling-command 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +3 -0
- data/lib/logaling/command/version.rb +1 -1
- data/lib/logaling/glossary.rb +2 -2
- data/lib/logaling/project.rb +24 -2
- data/lib/logaling/repository.rb +6 -2
- metadata +2 -2
data/CHANGES
CHANGED
data/lib/logaling/glossary.rb
CHANGED
@@ -53,10 +53,10 @@ module Logaling
|
|
53
53
|
!find_bilingual_pairs(source_term, target_term, note).empty?
|
54
54
|
end
|
55
55
|
|
56
|
-
def add(source_term, target_term, note)
|
56
|
+
def add(source_term, target_term, note, index_after_adding=true)
|
57
57
|
raise Logaling::TermError if bilingual_pair_exists?(source_term, target_term)
|
58
58
|
glossary_source.add(source_term, target_term, note)
|
59
|
-
index!
|
59
|
+
index! if index_after_adding
|
60
60
|
end
|
61
61
|
|
62
62
|
def update(source_term, target_term, new_target_term, note)
|
data/lib/logaling/project.rb
CHANGED
@@ -123,13 +123,17 @@ module Logaling
|
|
123
123
|
File.basename(@path).split(/\./).first
|
124
124
|
end
|
125
125
|
|
126
|
+
def bilingualr_pair
|
127
|
+
File.basename(@path).split(/\./)[1, 2]
|
128
|
+
end
|
129
|
+
|
126
130
|
def glossary_sources
|
127
|
-
|
131
|
+
source_language, target_language = bilingualr_pair
|
128
132
|
[GlossarySource.create(@path, glossary(source_language, target_language))]
|
129
133
|
end
|
130
134
|
|
131
135
|
def has_glossary?(source_language, target_language)
|
132
|
-
glossary_source_language, glossary_target_language =
|
136
|
+
glossary_source_language, glossary_target_language = bilingualr_pair
|
133
137
|
glossary_source_language == source_language && glossary_target_language == target_language
|
134
138
|
end
|
135
139
|
|
@@ -151,6 +155,24 @@ module Logaling
|
|
151
155
|
def imported?
|
152
156
|
true
|
153
157
|
end
|
158
|
+
|
159
|
+
def description
|
160
|
+
external_glossary.class.description
|
161
|
+
end
|
162
|
+
|
163
|
+
def url
|
164
|
+
external_glossary.class.url
|
165
|
+
end
|
166
|
+
|
167
|
+
private
|
168
|
+
def external_glossary
|
169
|
+
unless @external_glossary
|
170
|
+
require 'logaling/external_glossary'
|
171
|
+
Logaling::ExternalGlossary.load
|
172
|
+
@external_glossary = Logaling::ExternalGlossary.get(name)
|
173
|
+
end
|
174
|
+
@external_glossary
|
175
|
+
end
|
154
176
|
end
|
155
177
|
|
156
178
|
class PersonalProject < FileBasedProject
|
data/lib/logaling/repository.rb
CHANGED
@@ -117,10 +117,14 @@ module Logaling
|
|
117
117
|
projects += personal_glossary_paths.map do |personal_glossary_path|
|
118
118
|
Logaling::PersonalProject.new(relative_path(personal_glossary_path), self)
|
119
119
|
end
|
120
|
-
projects +=
|
120
|
+
projects += imported_projects
|
121
|
+
projects.sort_by(&:path)
|
122
|
+
end
|
123
|
+
|
124
|
+
def imported_projects
|
125
|
+
imported_glossary_paths.map do |imported_project_path|
|
121
126
|
Logaling::ImportedProject.new(relative_path(imported_project_path), self)
|
122
127
|
end
|
123
|
-
projects.sort_by(&:path)
|
124
128
|
end
|
125
129
|
|
126
130
|
def index
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logaling-command
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2012-
|
16
|
+
date: 2012-12-25 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: thor
|