logaling-command 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,6 @@
1
+ = 0.2.2 / 2012-12-25
2
+ * 内部構造の見直し
3
+
1
4
  = 0.2.1 / 2012-11-29
2
5
  * インデックスのタイミングを見直すことで検索速度が速くなりました
3
6
 
@@ -17,6 +17,6 @@
17
17
 
18
18
  module Logaling
19
19
  module Command
20
- VERSION = "0.2.1"
20
+ VERSION = "0.2.2"
21
21
  end
22
22
  end
@@ -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)
@@ -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
- name, source_language, target_language, type = File.basename(@path).split(/\./)
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 = File.basename(@path).split(/\./)[1..2]
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
@@ -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 += imported_glossary_paths.map do |imported_project_path|
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.1
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-11-29 00:00:00.000000000 Z
16
+ date: 2012-12-25 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: thor