textbringer 19 → 20

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9aa0a319cdc7f8e965d906b1059a76083730240463a3ed33a4cb79214d2762b6
4
- data.tar.gz: 3993baf2bf25459b7ec201b112d98c05aa96eaac68e77510b013cfd2d3cf69c8
3
+ metadata.gz: 965d78b83028b05174c4dae6ddb2f0f367650333f605f625a12f898a0fc77f7b
4
+ data.tar.gz: c2e895bf76071590e42ad89e26c6d97d246fe68aeba741b9a2ee9eeb8f1110f1
5
5
  SHA512:
6
- metadata.gz: cb57afbe902f32238deab1589433564632fcea16b43351faebf530262deafb50d36719180a120e9496206ed99eaebc56f7c7506c190cb75abfaf104b00aecea1
7
- data.tar.gz: 633f52c2fc1b4012b0e02ad06fba07d1cde388f1949ad06189a2b1354ab4952d9ae2c68898f8e4de899f58b9b800579f77212a3db6569340371d700fa3a3d12d
6
+ metadata.gz: 17a23041efd23bf5dcb1dec4671cefb0645c194435e4f6fbf332fad79959bfb71e47da2d52b07bf7c964438cfb6fc08cb43c804e01f6c59597a50659a2fae7b2
7
+ data.tar.gz: cdec4c57a320056d392cced17e7f24dcf17bbfea21bc7053b65f612e84f4353abb8f4a372a3b572b2e18d3180c325b3b4801a16b97ef904ac06dd8f98ef9bef7
@@ -1,4 +1,9 @@
1
+ require "open-uri"
2
+ require "fileutils"
3
+
1
4
  module Textbringer
5
+ CONFIG[:skk_dictionary_path] = File.expand_path("~/.textbringer/skk/SKK-JISYO.L")
6
+
2
7
  class SkkInputMethod < InputMethod
3
8
  HIRAGANA_TABLE = {
4
9
  "a" => "あ", "i" => "い", "u" => "う", "e" => "え", "o" => "お",
@@ -94,8 +99,6 @@ module Textbringer
94
99
  (s.size - 1).times.map { |i| s[0, i + 1] }
95
100
  }.uniq
96
101
 
97
- DICTIONARY_PATH = File.expand_path("~/.textbringer/skk/SKK-JISYO.L")
98
-
99
102
  DEFAULT_CURSOR_COLORS = {
100
103
  hiragana: "pink",
101
104
  katakana: "green",
@@ -569,7 +572,7 @@ module Textbringer
569
572
  def ensure_dictionary_loaded
570
573
  return if @okuriiari
571
574
 
572
- path = CONFIG[:skk_dictionary] || DICTIONARY_PATH
575
+ path = CONFIG[:skk_dictionary_path]
573
576
  @okuriiari = {}
574
577
  @okurinasi = {}
575
578
  section = :okuriiari
@@ -748,4 +751,23 @@ module Textbringer
748
751
  STDOUT.flush
749
752
  end
750
753
  end
754
+
755
+ SKK_DICTIONARY_URL = "https://github.com/skk-dev/dict/raw/090619ac57ef230a0506c191b569fc8c82b1025b/SKK-JISYO.L"
756
+
757
+ module Commands
758
+ define_command(:skk_download_dictionary, doc: "Download SKK dictionary") do
759
+ path = CONFIG[:skk_dictionary_path]
760
+ if File.exist?(path) && !yes_or_no?("#{path} already exists. Overwrite it?")
761
+ return
762
+ end
763
+ background do
764
+ URI.open(SKK_DICTIONARY_URL) do |f|
765
+ File.binwrite(path, f.read)
766
+ end
767
+ foreground do
768
+ message("Downloaded to #{path}")
769
+ end
770
+ end
771
+ end
772
+ end
751
773
  end
@@ -1,3 +1,3 @@
1
1
  module Textbringer
2
- VERSION = "19"
2
+ VERSION = "20"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: textbringer
3
3
  version: !ruby/object:Gem::Version
4
- version: '19'
4
+ version: '20'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shugo Maeda