konjac 0.2 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/konjac/version.rb +1 -1
- data/spec/config_spec.rb +7 -1
- data/spec/dictionary_spec.rb +10 -5
- metadata +23 -23
data/lib/konjac/version.rb
CHANGED
data/spec/config_spec.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require File.dirname(__FILE__) + "/spec_helper"
|
3
3
|
require "tempfile"
|
4
4
|
|
5
|
-
describe Config do
|
5
|
+
describe Konjac::Config do
|
6
6
|
before :all do
|
7
7
|
@config_path = File.expand_path("~/.konjac/config.yml")
|
8
8
|
@backup_path = File.expand_path("~/.konjac/config.yml.bak")
|
@@ -15,6 +15,12 @@ describe Config do
|
|
15
15
|
ENV["LANG"] = @env_language || ""
|
16
16
|
end
|
17
17
|
|
18
|
+
before :each do
|
19
|
+
File.open(@config_path, "w") do |file|
|
20
|
+
file.puts "--- {}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
18
24
|
it "should default to English when no system language is found" do
|
19
25
|
ENV["LANG"] = ""
|
20
26
|
Konjac::Config.load
|
data/spec/dictionary_spec.rb
CHANGED
@@ -41,15 +41,18 @@ describe Dictionary do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it "should correctly load a simple term" do
|
44
|
-
Dictionary.pairs.first.should ==
|
44
|
+
Dictionary.pairs.first[0].should == /\bdogs\b/i
|
45
|
+
Dictionary.pairs.first[1].should == "犬"
|
45
46
|
end
|
46
47
|
|
47
48
|
it "should correctly load a slightly more complex regular expression" do
|
48
|
-
Dictionary.pairs[1].should ==
|
49
|
+
Dictionary.pairs[1][0].should == /\bcats?\b/i
|
50
|
+
Dictionary.pairs[1][1].should == "猫"
|
49
51
|
end
|
50
52
|
|
51
53
|
it "should correctly load a manual regular expression" do
|
52
|
-
Dictionary.pairs[2].should ==
|
54
|
+
Dictionary.pairs[2][0].should == /\.\s?/
|
55
|
+
Dictionary.pairs[2][1].should == "。"
|
53
56
|
end
|
54
57
|
|
55
58
|
it "should ignore examples for which the source language cannot be found" do
|
@@ -72,7 +75,8 @@ describe Dictionary do
|
|
72
75
|
end
|
73
76
|
|
74
77
|
it "should add whitespace to term replacement" do
|
75
|
-
Dictionary.pairs.first.should ==
|
78
|
+
Dictionary.pairs.first[0].should == /犬/i
|
79
|
+
Dictionary.pairs.first[1].should == "dogs "
|
76
80
|
end
|
77
81
|
end
|
78
82
|
|
@@ -82,7 +86,8 @@ describe Dictionary do
|
|
82
86
|
end
|
83
87
|
|
84
88
|
it "should not add whitespace to term replacement" do
|
85
|
-
Dictionary.pairs[0].should ==
|
89
|
+
Dictionary.pairs[0][0].should == /\bmouth\b/i
|
90
|
+
Dictionary.pairs[0][1].should == "boca"
|
86
91
|
end
|
87
92
|
end
|
88
93
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: konjac
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-01-17 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: amatch
|
16
|
-
requirement: &
|
16
|
+
requirement: &70178194102620 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70178194102620
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: i18n
|
27
|
-
requirement: &
|
27
|
+
requirement: &70178194101940 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70178194101940
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: nokogiri
|
38
|
-
requirement: &
|
38
|
+
requirement: &70178194122460 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70178194122460
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: sdoc
|
49
|
-
requirement: &
|
49
|
+
requirement: &70178194122000 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70178194122000
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: term-ansicolor
|
60
|
-
requirement: &
|
60
|
+
requirement: &70178194121580 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70178194121580
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: trollop
|
71
|
-
requirement: &
|
71
|
+
requirement: &70178194121160 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70178194121160
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: autotest
|
82
|
-
requirement: &
|
82
|
+
requirement: &70178194120740 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70178194120740
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: autotest-fsevent
|
93
|
-
requirement: &
|
93
|
+
requirement: &70178194120280 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70178194120280
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: autotest-growl
|
104
|
-
requirement: &
|
104
|
+
requirement: &70178194119800 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70178194119800
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: bundler
|
115
|
-
requirement: &
|
115
|
+
requirement: &70178194119300 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ! '>='
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: '0'
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *70178194119300
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: rspec
|
126
|
-
requirement: &
|
126
|
+
requirement: &70178194118740 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ! '>='
|
@@ -131,7 +131,7 @@ dependencies:
|
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *70178194118740
|
135
135
|
description: A Ruby command-line utility for translating files using a YAML wordlist
|
136
136
|
email:
|
137
137
|
- bryan.mckelvey@gmail.com
|