logaling-command 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,16 +20,14 @@ require "fileutils"
20
20
 
21
21
  module Logaling
22
22
  describe Repository do
23
- let(:project) { "spec" }
24
23
  let(:logaling_home) { @logaling_home }
25
- let(:glossary) { Glossary.new(project, 'en', 'ja', logaling_home) }
26
- let(:glossary_path) { glossary.source_path }
27
24
  let(:repository) { Logaling::Repository.new(logaling_home) }
28
- let(:db_home) { File.join(logaling_home, "db") }
25
+ let(:glossary) { repository.find_project('spec').find_glossary('en', 'ja') }
26
+ let(:glossary_source_path) { glossary.glossary_source.source_path }
29
27
 
30
28
  before do
31
29
  FileUtils.remove_entry_secure(File.join(logaling_home, 'projects', 'spec'), true)
32
- FileUtils.mkdir_p(File.dirname(glossary_path))
30
+ FileUtils.mkdir_p(File.join(logaling_home, 'projects', 'spec'))
33
31
  end
34
32
 
35
33
  describe '#lookup' do
@@ -63,7 +61,7 @@ module Logaling
63
61
  :source_term=>"user-logaling",
64
62
  :snipped_source_term=>["", {:keyword=>"user-logaling"}],
65
63
  :target_term=>"ユーザ",
66
- :snipped_target_term=>[],
64
+ :snipped_target_term=>["ユーザ"],
67
65
  :note=>"ユーザーではない"},
68
66
  {
69
67
  :glossary_name=>"spec",
@@ -72,14 +70,14 @@ module Logaling
72
70
  :source_term=>"user-logaling test",
73
71
  :snipped_source_term=>["", {:keyword=>"user-logaling"}, " test"],
74
72
  :target_term=>"ユーザーてすと",
75
- :snipped_target_term=>[],
73
+ :snipped_target_term=>["ユーザーてすと"],
76
74
  :note=>""},
77
75
  {
78
76
  :glossary_name=>"spec",
79
77
  :source_language=>"en",
80
78
  :target_language=>"ja",
81
79
  :source_term=>"ゆーざ",
82
- :snipped_source_term=>[],
80
+ :snipped_source_term=>["ゆーざ"],
83
81
  :target_term=>"test user-logaling test text",
84
82
  :snipped_target_term=>["test", {:keyword=>" user-logaling"}, " test text"],
85
83
  :note=>""}]
@@ -91,10 +89,9 @@ module Logaling
91
89
  end
92
90
 
93
91
  context 'when tsv file as glossary exists' do
94
- let(:tsv_path) { glossary_path.sub(/yml$/, 'tsv') }
92
+ let(:tsv_path) { glossary_source_path.sub(/yml$/, 'tsv') }
95
93
 
96
94
  before do
97
- FileUtils.mkdir_p(File.dirname(tsv_path))
98
95
  FileUtils.touch(tsv_path)
99
96
  File.open(tsv_path, "w"){|f| f.puts "test-logaling\tユーザー\ntest-logaling\tユーザ"}
100
97
  repository.index
@@ -112,14 +109,12 @@ module Logaling
112
109
  end
113
110
 
114
111
  describe '#index' do
115
- let(:logaling_db) { Logaling::GlossaryDB.new }
116
- let(:tsv_path) { File.join(File.dirname(glossary_path), "spec.en.ja.tsv") }
117
- let(:csv_path) { File.join(File.dirname(glossary_path), "spec.en.ja.csv") }
112
+ let(:tsv_path) { File.join(File.dirname(glossary_source_path), "spec.en.ja.tsv") }
113
+ let(:csv_path) { File.join(File.dirname(glossary_source_path), "spec.en.ja.csv") }
118
114
 
119
115
  context 'when yml file as glossary exists' do
120
116
  before do
121
- FileUtils.mkdir_p(File.dirname(glossary_path))
122
- FileUtils.touch(glossary_path)
117
+ FileUtils.touch(glossary_source_path)
123
118
  glossary.add("spec_logaling", "スペック", "備考")
124
119
  repository.index
125
120
  @terms = repository.lookup("spec_logaling", glossary)
@@ -130,20 +125,18 @@ module Logaling
130
125
  end
131
126
 
132
127
  after do
133
- FileUtils.remove_entry_secure(glossary_path, true)
128
+ FileUtils.remove_entry_secure(glossary_source_path, true)
134
129
  end
135
130
  end
136
131
 
137
132
  context 'when tsv file as glossary exists' do
138
133
  before do
139
- FileUtils.mkdir_p(File.dirname(glossary_path))
140
134
  FileUtils.touch(tsv_path)
141
135
  File.open(tsv_path, "w"){|f| f.puts "user-logaling\tユーザ"}
142
136
  repository.index
143
137
  @terms = repository.lookup("user-logaling", glossary)
144
138
  end
145
139
 
146
-
147
140
  it 'glossaries should be indexed' do
148
141
  @terms.size.should == 1
149
142
  end
@@ -155,7 +148,6 @@ module Logaling
155
148
 
156
149
  context 'when csv file as glosary exists' do
157
150
  before do
158
- FileUtils.mkdir_p(File.dirname(glossary_path))
159
151
  FileUtils.touch(csv_path)
160
152
  File.open(csv_path, "w"){|f| f.puts "test_logaling,テスト"}
161
153
  repository.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.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,11 +13,11 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2012-05-02 00:00:00.000000000Z
16
+ date: 2012-06-29 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: thor
20
- requirement: &2161067140 !ruby/object:Gem::Requirement
20
+ requirement: !ruby/object:Gem::Requirement
21
21
  none: false
22
22
  requirements:
23
23
  - - ! '>='
@@ -25,10 +25,15 @@ dependencies:
25
25
  version: 0.14.6
26
26
  type: :runtime
27
27
  prerelease: false
28
- version_requirements: *2161067140
28
+ version_requirements: !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.14.6
29
34
  - !ruby/object:Gem::Dependency
30
35
  name: bundler
31
- requirement: &2161066660 !ruby/object:Gem::Requirement
36
+ requirement: !ruby/object:Gem::Requirement
32
37
  none: false
33
38
  requirements:
34
39
  - - ! '>='
@@ -36,21 +41,31 @@ dependencies:
36
41
  version: '1.0'
37
42
  type: :runtime
38
43
  prerelease: false
39
- version_requirements: *2161066660
44
+ version_requirements: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ! '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '1.0'
40
50
  - !ruby/object:Gem::Dependency
41
51
  name: rroonga
42
- requirement: &2161066180 !ruby/object:Gem::Requirement
52
+ requirement: !ruby/object:Gem::Requirement
43
53
  none: false
44
54
  requirements:
45
55
  - - ! '>='
46
56
  - !ruby/object:Gem::Version
47
- version: 1.3.0
57
+ version: 2.0.3
48
58
  type: :runtime
49
59
  prerelease: false
50
- version_requirements: *2161066180
60
+ version_requirements: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: 2.0.3
51
66
  - !ruby/object:Gem::Dependency
52
67
  name: rainbow
53
- requirement: &2161065800 !ruby/object:Gem::Requirement
68
+ requirement: !ruby/object:Gem::Requirement
54
69
  none: false
55
70
  requirements:
56
71
  - - ! '>='
@@ -58,10 +73,15 @@ dependencies:
58
73
  version: '0'
59
74
  type: :runtime
60
75
  prerelease: false
61
- version_requirements: *2161065800
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
62
82
  - !ruby/object:Gem::Dependency
63
83
  name: nokogiri
64
- requirement: &2161065340 !ruby/object:Gem::Requirement
84
+ requirement: !ruby/object:Gem::Requirement
65
85
  none: false
66
86
  requirements:
67
87
  - - ! '>='
@@ -69,10 +89,15 @@ dependencies:
69
89
  version: '0'
70
90
  type: :runtime
71
91
  prerelease: false
72
- version_requirements: *2161065340
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ none: false
94
+ requirements:
95
+ - - ! '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
73
98
  - !ruby/object:Gem::Dependency
74
99
  name: activesupport
75
- requirement: &2161064920 !ruby/object:Gem::Requirement
100
+ requirement: !ruby/object:Gem::Requirement
76
101
  none: false
77
102
  requirements:
78
103
  - - ! '>='
@@ -80,10 +105,15 @@ dependencies:
80
105
  version: '0'
81
106
  type: :runtime
82
107
  prerelease: false
83
- version_requirements: *2161064920
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ none: false
110
+ requirements:
111
+ - - ! '>='
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
84
114
  - !ruby/object:Gem::Dependency
85
115
  name: rake
86
- requirement: &2153870360 !ruby/object:Gem::Requirement
116
+ requirement: !ruby/object:Gem::Requirement
87
117
  none: false
88
118
  requirements:
89
119
  - - ! '>='
@@ -91,10 +121,15 @@ dependencies:
91
121
  version: '0'
92
122
  type: :development
93
123
  prerelease: false
94
- version_requirements: *2153870360
124
+ version_requirements: !ruby/object:Gem::Requirement
125
+ none: false
126
+ requirements:
127
+ - - ! '>='
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
95
130
  - !ruby/object:Gem::Dependency
96
131
  name: rspec
97
- requirement: &2153869940 !ruby/object:Gem::Requirement
132
+ requirement: !ruby/object:Gem::Requirement
98
133
  none: false
99
134
  requirements:
100
135
  - - ! '>='
@@ -102,7 +137,12 @@ dependencies:
102
137
  version: '0'
103
138
  type: :development
104
139
  prerelease: false
105
- version_requirements: *2153869940
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ none: false
142
+ requirements:
143
+ - - ! '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
106
146
  description: A command line interface for logaling.
107
147
  email:
108
148
  - koji.shimada@enishi-tech.com
@@ -126,6 +166,8 @@ files:
126
166
  - lib/logaling.rb
127
167
  - lib/logaling/command.rb
128
168
  - lib/logaling/command/application.rb
169
+ - lib/logaling/command/pager.rb
170
+ - lib/logaling/command/renderers.rb
129
171
  - lib/logaling/command/version.rb
130
172
  - lib/logaling/config.rb
131
173
  - lib/logaling/external_glossaries/debian_project.rb
@@ -139,6 +181,12 @@ files:
139
181
  - lib/logaling/external_glossary.rb
140
182
  - lib/logaling/glossary.rb
141
183
  - lib/logaling/glossary_db.rb
184
+ - lib/logaling/glossary_source.rb
185
+ - lib/logaling/glossary_sources/base.rb
186
+ - lib/logaling/glossary_sources/glossary_csv_source.rb
187
+ - lib/logaling/glossary_sources/glossary_tsv_source.rb
188
+ - lib/logaling/glossary_sources/glossary_yaml_source.rb
189
+ - lib/logaling/project.rb
142
190
  - lib/logaling/repository.rb
143
191
  - logaling-command.gemspec
144
192
  - spec/logaling/command_spec.rb
@@ -165,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
213
  version: '0'
166
214
  requirements: []
167
215
  rubyforge_project: logaling-command
168
- rubygems_version: 1.8.6
216
+ rubygems_version: 1.8.24
169
217
  signing_key:
170
218
  specification_version: 3
171
219
  summary: A command line interface for logaling.