sekka 0.9.5 → 0.9.6

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/bin/sekka-server CHANGED
@@ -11,14 +11,16 @@ require File.expand_path(File.dirname(__FILE__) + "/../lib/sekka/sekkaversion")
11
11
 
12
12
 
13
13
  DICTDIR = File.expand_path( "~/.sekka-server" )
14
- DICTURL = "http://sumibi.org/sekka/dict/" + SekkaVersion.version
14
+ DICTURL = "https://raw.github.com/kiyoka/sekka/master/public_dict/" + SekkaVersion.dictVersion
15
+
15
16
 
16
17
  PIDFILE = DICTDIR + "/pid"
17
18
 
18
19
  TC_FILE = DICTDIR + "/SEKKA-JISYO.SMALL.tch"
19
20
  TSVFILE = DICTDIR + "/SEKKA-JISYO.SMALL.tsv"
20
21
  SUMFILE = DICTDIR + "/SEKKA-JISYO.SMALL.md5"
21
- TSVURL = DICTURL + "/SEKKA-JISYO.SMALL.tsv"
22
+
23
+ URLURL = DICTURL + "/SEKKA-JISYO.SMALL.url"
22
24
  SUMURL = DICTURL + "/SEKKA-JISYO.SMALL.md5"
23
25
 
24
26
  TC_FILE_LIST = [ DICTDIR + "/SEKKA-JISYO.CUSTOM.tch",
@@ -71,7 +73,13 @@ def main
71
73
  if not File.exist?( TSVFILE )
72
74
  STDERR.printf( "Info: Downloading SEKKA-JISYO\n" )
73
75
  # 辞書をダウンロードする
74
- cmd = sprintf( "curl -o %s %s", TSVFILE, TSVURL )
76
+ cmd = sprintf( "curl %s", URLURL )
77
+ STDERR.printf( "Command : %s\n", cmd )
78
+ tsvurl = open( "|" + cmd ) { |f|
79
+ f.read
80
+ }
81
+ STDERR.printf( " download URL of tsv file : %s\n", tsvurl );
82
+ cmd = sprintf( "curl -o %s %s", TSVFILE, tsvurl )
75
83
  STDERR.printf( "Command : %s\n", cmd )
76
84
  system( cmd )
77
85
  cmd = sprintf( "curl -o %s %s", SUMFILE, SUMURL )
data/emacs/sekka.el CHANGED
@@ -1620,7 +1620,7 @@ point から行頭方向に同種の文字列が続く間を漢字変換しま
1620
1620
  (setq default-input-method "japanese-sekka")
1621
1621
 
1622
1622
  (defconst sekka-version
1623
- "0.9.5" ;;SEKKA-VERSION
1623
+ "0.9.6" ;;SEKKA-VERSION
1624
1624
  )
1625
1625
  (defun sekka-version (&optional arg)
1626
1626
  "入力モード変更"
@@ -1,5 +1,4 @@
1
1
  class SekkaVersion
2
- def self.version
3
- "0.9.5"
4
- end
2
+ def self.version() "0.9.6" end
3
+ def self.dictVersion() "0.9.2" end
5
4
  end
data/lib/sekkaserver.rb CHANGED
@@ -146,14 +146,21 @@ module SekkaServer
146
146
  format = URI.decode( req.params['format'].force_encoding("UTF-8") )
147
147
  case req.path
148
148
  when "/henkan"
149
- _yomi = URI.decode( req.params[ 'yomi'].force_encoding("UTF-8") )
150
- _limit = URI.decode( req.params[ 'limit'].force_encoding("UTF-8") )
151
- _method = URI.decode( req.params['method'].force_encoding("UTF-8") )
149
+ _yomi = URI.decode( req.params[ 'yomi'].force_encoding("UTF-8") )
150
+ _limit = URI.decode( req.params[ 'limit'].force_encoding("UTF-8") )
151
+ _method = URI.decode( req.params['method'].force_encoding("UTF-8") )
152
+ _orRedis = if :redis == SekkaServer::Config.dictType then "or Redis-server" else "" end
152
153
  @mutex.synchronize {
153
154
  begin
154
155
  @core.writeToString( @core.sekkaHenkan( userid, @kvs, @cachesv, _yomi, _limit.to_i, _method ))
155
156
  rescue MemCache::MemCacheError
156
157
  "sekka-server: memcached server is down (or may be offline)"
158
+ rescue Timeout
159
+ result = "sekka-server: Timeout to request memcached server #{_orRedis} (may be offline)"
160
+ rescue SocketError
161
+ result = "sekka-server: SocketError to request memcached server #{_orRedis} (may be offline)"
162
+ rescue Errno::ECONNREFUSED
163
+ result = "sekka-server: ConnectionRefused to request memcached server #{_orRedis} (may be offline)"
157
164
  end
158
165
  }
159
166
  when "/kakutei"
@@ -182,7 +189,7 @@ module SekkaServer
182
189
  rescue SocketError
183
190
  result = "sekka-server: SocketError to request google-ime (may be offline)"
184
191
  rescue Errno::ECONNREFUSED
185
- result = "sekka-server: http proxy server is down (or may be offline)"
192
+ result = "sekka-server: ConnectionRefused to request google-ime (or may be offline)"
186
193
  end
187
194
  @core.writeToString( result )
188
195
  else
data/test/memcache.nnd CHANGED
@@ -40,7 +40,6 @@
40
40
  (define dbtype 'memcache)
41
41
  (define userid "temp")
42
42
  (define cachesv (Kvs.new dbtype))
43
- (cachesv.open "localhost:11211")
44
43
 
45
44
  (test-start "memcached I/F")
46
45
  ;;===================================================================
@@ -48,6 +47,18 @@
48
47
  ;;-------------------------------------------------------------------
49
48
  (test-section "memcached access")
50
49
 
50
+ (test* "db connect NG and Exception"
51
+ (test-error MemCache::MemCacheError)
52
+ (let1 sv (Kvs.new dbtype)
53
+ (sv.open "localhost:11111")
54
+ (sv.put! "temp::1" "one")))
55
+
56
+ (test* "db connect OK"
57
+ "one"
58
+ (begin
59
+ (cachesv.open "localhost:11211")
60
+ (cachesv.put! "temp::1" "one")))
61
+
51
62
  (test* "db store 1"
52
63
  "one"
53
64
  (cachesv.put! "temp::1" "one"))
data/test/redis.nnd ADDED
@@ -0,0 +1,88 @@
1
+ ;;-*- mode: nendo; syntax: scheme -*-
2
+ ;;;
3
+ ;;; redis.nnd - Redisサーバーへのアクセスのテスト
4
+ ;;;
5
+ ;;; Copyright (c) 2011 Kiyoka Nishiyama <kiyoka@sumibi.org>
6
+ ;;;
7
+ ;;; Redistribution and use in source and binary forms, with or without
8
+ ;;; modification, are permitted provided that the following conditions
9
+ ;;; are met:
10
+ ;;;
11
+ ;;; 1. Redistributions of source code must retain the above copyright
12
+ ;;; notice, this list of conditions and the following disclaimer.
13
+ ;;;
14
+ ;;; 2. Redistributions in binary form must reproduce the above copyright
15
+ ;;; notice, this list of conditions and the following disclaimer in the
16
+ ;;; documentation and/or other materials provided with the distribution.
17
+ ;;;
18
+ ;;; 3. Neither the name of the authors nor the names of its contributors
19
+ ;;; may be used to endorse or promote products derived from this
20
+ ;;; software without specific prior written permission.
21
+ ;;;
22
+ ;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
+ ;;; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
+ ;;; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25
+ ;;; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26
+ ;;; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27
+ ;;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
28
+ ;;; TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29
+ ;;; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30
+ ;;; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31
+ ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32
+ ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
+ ;;;
34
+ ;;; $Id:
35
+ ;;;
36
+ (require "sekka/kvs")
37
+ (use nendo.test)
38
+ (load "./test/common.nnd")
39
+
40
+ (define dbtype 'redis)
41
+ (define userid "temp")
42
+ (define cachesv (Kvs.new dbtype))
43
+
44
+ (test-start "redis I/F")
45
+ ;;===================================================================
46
+
47
+ ;;-------------------------------------------------------------------
48
+ (test-section "redis server access")
49
+
50
+ (test* "db connect NG and Exception"
51
+ (test-error SocketError)
52
+ (let1 sv (Kvs.new dbtype)
53
+ (sv.open "nohost.example.com")
54
+ (sv.put! "temp::1" "one")))
55
+
56
+ (test* "db connect NG and Exception"
57
+ (test-error Timeout::Error)
58
+ (let1 sv (Kvs.new dbtype)
59
+ (sv.open "126.0.0.1")
60
+ (sv.put! "temp::1" "one")))
61
+
62
+ (test* "db connect OK"
63
+ "one"
64
+ (begin
65
+ (cachesv.open "localhost")
66
+ (cachesv.put! "temp::1" "one")))
67
+
68
+ (print "sleep 100")
69
+ (.sleep 100)
70
+
71
+
72
+ (test* "db store 1"
73
+ "one"
74
+ (cachesv.put! "temp::1" "one"))
75
+
76
+ (test* "db fetch 1"
77
+ "one"
78
+ (cachesv.get "temp::1"))
79
+
80
+ (test* "db fetch fallback"
81
+ false
82
+ (cachesv.get "temp::none" false))
83
+
84
+
85
+ ;;===================================================================
86
+
87
+
88
+ (test-end)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sekka
3
3
  version: !ruby/object:Gem::Version
4
- hash: 49
4
+ hash: 55
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 5
10
- version: 0.9.5
9
+ - 6
10
+ version: 0.9.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kiyoka Nishiyama
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-14 00:00:00 Z
18
+ date: 2011-11-07 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rspec
@@ -220,12 +220,12 @@ dependencies:
220
220
  requirements:
221
221
  - - "="
222
222
  - !ruby/object:Gem::Version
223
- hash: 13
223
+ hash: 5
224
224
  segments:
225
225
  - 0
226
- - 5
227
- - 3
228
- version: 0.5.3
226
+ - 6
227
+ - 1
228
+ version: 0.6.1
229
229
  type: :runtime
230
230
  prerelease: false
231
231
  version_requirements: *id015
@@ -304,6 +304,7 @@ files:
304
304
  - test/henkan-main.nnd
305
305
  - test/jisyo.nnd
306
306
  - test/memcache.nnd
307
+ - test/redis.nnd
307
308
  - test/roman-lib.nnd
308
309
  - test/sharp-number.nnd
309
310
  - test/skk-azik-table.nnd
@@ -339,7 +340,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
339
340
  requirements: []
340
341
 
341
342
  rubyforge_project:
342
- rubygems_version: 1.8.10
343
+ rubygems_version: 1.8.11
343
344
  signing_key:
344
345
  specification_version: 3
345
346
  summary: Sekka is a SKK like input method.