sudachi-installer 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +5 -0
- data/.rubocop.yml +4 -0
- data/.standard.yml +3 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +22 -0
- data/LICENSE +9 -0
- data/README.md +58 -0
- data/Rakefile +27 -0
- data/lib/sudachi-installer/dicts.rb +111 -0
- data/lib/sudachi-installer/downloader.rb +41 -0
- data/lib/sudachi-installer/faraday_fake.rb +18 -0
- data/lib/sudachi-installer/releases.rb +159 -0
- data/lib/sudachi-installer/resolver.rb +78 -0
- data/lib/sudachi-installer/version.rb +5 -0
- data/lib/sudachi-installer.rb +17 -0
- data/sig/sudachi-installer/sudachi-installer.rbs +4 -0
- data/sudachi-installer.gemspec +38 -0
- metadata +147 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5be00dfec1022cf22ca79d58fd9f6ba35b93a9838702488bb9b1ab02c635f1ec
|
4
|
+
data.tar.gz: 1ec8b2fb22c9eede2afd75f03b36ad86632a11dcec6ed5716074f73cdc5532a7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4083d52259612beaba507b8195f7cdd5e8ff85ede0483f329f6eb45ebe01cf6fdf38f81e83e76cd19f9c512d7c64e6ff7e4184672901f972b9d41721118399d6
|
7
|
+
data.tar.gz: db7d82354a8dc8f08bd0700afe641d99bc6831330a6d4f8f0f353e1654b06d070185403c3a05f91fc217292a2fce6a1869e39d79aa4e622a43f68babbaa53e30
|
data/.editorconfig
ADDED
data/.rubocop.yml
ADDED
data/.standard.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in sudachi-installer.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
group :development do
|
9
|
+
gem "rake", "~> 13.0"
|
10
|
+
gem "standard", "~> 1.3"
|
11
|
+
gem "solargraph", "> 0.38"
|
12
|
+
gem "yard", ">= 0.9.30"
|
13
|
+
end
|
14
|
+
|
15
|
+
group :development, :test do
|
16
|
+
gem "minitest", "~> 5.0"
|
17
|
+
gem "minitest-reporters", "~> 1"
|
18
|
+
gem "minitest-power_assert"
|
19
|
+
gem "minitest-skip"
|
20
|
+
gem "vcr", "~> 6"
|
21
|
+
gem "webmock", "~> 3"
|
22
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
Copyright 2023 wtnabe
|
2
|
+
|
3
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
4
|
+
|
5
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
6
|
+
|
7
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
8
|
+
|
9
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# SudachiInstaller
|
2
|
+
|
3
|
+
A helper gem to downloading and extracting Sudachi executable and dictionary files.
|
4
|
+
|
5
|
+
Use with [rudachi-rb](https://github.com/songcastle/rudachi-rb) :)
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Install the gem and add to the application's Gemfile by executing:
|
10
|
+
|
11
|
+
$ bundle add sudachi-installer
|
12
|
+
|
13
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
14
|
+
|
15
|
+
$ gem install sudachi-installer
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
require "sudachi-installer/releases"
|
21
|
+
require "sudachi-installer/dicts"
|
22
|
+
require "rudachi-rb"
|
23
|
+
|
24
|
+
SudachiInstaller.configure do |c|
|
25
|
+
c.jar_dir = "/path/to/jar_dir"
|
26
|
+
c.dict_dir = "/path/to/dict_dir"
|
27
|
+
end
|
28
|
+
|
29
|
+
releases = SudachiInstaller::Releases.new
|
30
|
+
# releases.minimum_list
|
31
|
+
releases.download("v0.7.1")
|
32
|
+
|
33
|
+
dicts = SudachiInstaller::Dicts.new
|
34
|
+
# dicts.revisions(:dict)
|
35
|
+
dicts.download(:dict, "20230110", "small")
|
36
|
+
|
37
|
+
resolver = SudachiInstaller::Resolver.new
|
38
|
+
|
39
|
+
Rudachi.configure do |c|
|
40
|
+
config.jar_path = resolver.jar_path("0.7.1")
|
41
|
+
end
|
42
|
+
|
43
|
+
Rudachi::Option.configure do |c|
|
44
|
+
c.s = {"systemDict": resolver.dict_path(revision: "20230110", edition: "small")
|
45
|
+
c.a = true
|
46
|
+
c.m = "C"
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
## Development
|
51
|
+
|
52
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
53
|
+
|
54
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
55
|
+
|
56
|
+
## Contributing
|
57
|
+
|
58
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/wtnabe/sudachi-installer.
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
5
|
+
require "yard"
|
6
|
+
|
7
|
+
Rake::TestTask.new(:spec) do |t|
|
8
|
+
t.libs << "spec"
|
9
|
+
t.libs << "lib"
|
10
|
+
t.test_files = FileList["spec/**/*_spec.rb"]
|
11
|
+
end
|
12
|
+
|
13
|
+
YARD::Rake::YardocTask.new do |t|
|
14
|
+
t.files = ["lib/**/*.rb", "spec/**/*.rb"]
|
15
|
+
t.stats_options = ["--list-undoc"]
|
16
|
+
end
|
17
|
+
|
18
|
+
require "standard/rake"
|
19
|
+
|
20
|
+
desc "tmp:clear"
|
21
|
+
task "tmp:clear" do
|
22
|
+
Dir.glob(File.join(__dir__, "/tmp/*")).each { |f|
|
23
|
+
FileUtils.rm_rf(f)
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
task default: %i[spec standard]
|
@@ -0,0 +1,111 @@
|
|
1
|
+
require "faraday"
|
2
|
+
require "rexml"
|
3
|
+
require "xmlhasher"
|
4
|
+
require_relative "./downloader"
|
5
|
+
|
6
|
+
module SudachiInstaller
|
7
|
+
#
|
8
|
+
# dictionary index and download
|
9
|
+
#
|
10
|
+
class Dicts
|
11
|
+
#
|
12
|
+
# @param [Object] httpclient
|
13
|
+
#
|
14
|
+
def initialize(httpclient: Faraday)
|
15
|
+
@http = httpclient
|
16
|
+
@endpoint = {
|
17
|
+
index: "https://sudachi.s3-ap-northeast-1.amazonaws.com",
|
18
|
+
zip: "http://sudachi.s3-website-ap-northeast-1.amazonaws.com"
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
#
|
23
|
+
# @return [string]
|
24
|
+
#
|
25
|
+
def fetch
|
26
|
+
@http.get(@endpoint[:index]).body
|
27
|
+
end
|
28
|
+
|
29
|
+
#
|
30
|
+
# @return [Array]
|
31
|
+
#
|
32
|
+
def prefixes
|
33
|
+
[:dict, :synonym]
|
34
|
+
end
|
35
|
+
|
36
|
+
#
|
37
|
+
# @param [Symbol] type
|
38
|
+
# @return [RegExp]
|
39
|
+
#
|
40
|
+
def re_template(type)
|
41
|
+
case type
|
42
|
+
when :dict
|
43
|
+
%r{\Asudachidict/sudachi-dictionary-(latest|[0-9.]+)-(core|full|small)\.zip\z}
|
44
|
+
when :synonym
|
45
|
+
%r{\Asudachisynonym/sudachi-synonym-(latest|[0-9.]+)\.zip\z}
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
#
|
50
|
+
# @overload url(type, param1, ...)
|
51
|
+
# @param [Symbol] type
|
52
|
+
# @param [string] param1
|
53
|
+
# @param [string] ...
|
54
|
+
# @return [String]
|
55
|
+
#
|
56
|
+
def url(type, *param)
|
57
|
+
case type
|
58
|
+
when :dict
|
59
|
+
"sudachidict/sudachi-dictionary-#{param[0]}-#{param[1]}.zip"
|
60
|
+
when :synonym
|
61
|
+
"sudachisynonym/sudachi-synonym-#{param[0]}.zip"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
#
|
66
|
+
# parse xml Contents/ 以下
|
67
|
+
#
|
68
|
+
# @param [String] document
|
69
|
+
# @return [Array]
|
70
|
+
#
|
71
|
+
def index(document = fetch)
|
72
|
+
if !@index
|
73
|
+
doc = REXML::Document.new(document)
|
74
|
+
@index = REXML::XPath.match(doc, "//Contents").map { |content|
|
75
|
+
XmlHasher.parse(content.to_s)[:Contents]
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
79
|
+
@index
|
80
|
+
end
|
81
|
+
|
82
|
+
#
|
83
|
+
# @param [Symbol] type
|
84
|
+
# @return [Array]
|
85
|
+
#
|
86
|
+
def revisions(type)
|
87
|
+
index.map { |e|
|
88
|
+
re_template(type).match(e[:Key])
|
89
|
+
}.compact.map { |m|
|
90
|
+
m.to_a[1..]
|
91
|
+
}
|
92
|
+
end
|
93
|
+
|
94
|
+
#
|
95
|
+
# @overload download(type, param1, ...)
|
96
|
+
# @param [Symbol] type
|
97
|
+
# @param [String] param1
|
98
|
+
# @param [String] ...
|
99
|
+
#
|
100
|
+
def download(type, *param)
|
101
|
+
source = url(type, *param)
|
102
|
+
filename = File.basename(source)
|
103
|
+
|
104
|
+
Downloader.new.download(
|
105
|
+
File.join(@endpoint[:zip], source),
|
106
|
+
filename,
|
107
|
+
SudachiInstaller.config.dict_dir
|
108
|
+
)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require "dry-configurable"
|
2
|
+
require "down"
|
3
|
+
require "fileutils"
|
4
|
+
require "zip"
|
5
|
+
|
6
|
+
module SudachiInstaller
|
7
|
+
#
|
8
|
+
# download and expand archive if it is zip archive
|
9
|
+
#
|
10
|
+
class Downloader
|
11
|
+
extend Dry::Configurable
|
12
|
+
|
13
|
+
#
|
14
|
+
# @param [string] url
|
15
|
+
# @param [string] filename
|
16
|
+
# @param [string] dest_dir
|
17
|
+
#
|
18
|
+
def download(url, filename, dest_dir)
|
19
|
+
FileUtils.mkdir_p(dest_dir)
|
20
|
+
|
21
|
+
Down.download(url, destination: File.join(dest_dir, filename))
|
22
|
+
expand(File.join(dest_dir, filename), force: true) if filename.match?(/\.zip\z/i)
|
23
|
+
end
|
24
|
+
|
25
|
+
#
|
26
|
+
# @param [String] path
|
27
|
+
# @param [boolean] force
|
28
|
+
#
|
29
|
+
def expand(path, force: false)
|
30
|
+
dir = File.dirname(path)
|
31
|
+
|
32
|
+
Zip::File.open(path) { |zip|
|
33
|
+
zip.each { |entry|
|
34
|
+
dest = File.join(dir, entry.name)
|
35
|
+
FileUtils.rm_rf dest if File.exist?(dest) && force
|
36
|
+
entry.extract(File.join(dir, entry.name))
|
37
|
+
}
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# fake class for Faraday.get
|
3
|
+
#
|
4
|
+
class FaradayFake
|
5
|
+
class << self
|
6
|
+
#
|
7
|
+
# @param [string] endpoint
|
8
|
+
# @return [Object]
|
9
|
+
#
|
10
|
+
def get(endpoint)
|
11
|
+
if !@xml
|
12
|
+
@xml = Struct.new(:body).new(File.read(endpoint))
|
13
|
+
end
|
14
|
+
|
15
|
+
@xml
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,159 @@
|
|
1
|
+
require "octokit"
|
2
|
+
require_relative "../sudachi-installer"
|
3
|
+
require_relative "./downloader"
|
4
|
+
|
5
|
+
module SudachiInstaller
|
6
|
+
#
|
7
|
+
# GitHub releases
|
8
|
+
#
|
9
|
+
class Releases
|
10
|
+
class ReleaseNotExist < Error; end # rubocop:disable
|
11
|
+
class AssetsAmbiguous < Error; end # rubocop:disable
|
12
|
+
|
13
|
+
def initialize(httpclient: Faraday)
|
14
|
+
@octokit = Octokit::Client.new
|
15
|
+
@http = httpclient
|
16
|
+
end
|
17
|
+
|
18
|
+
#
|
19
|
+
# @return [string]
|
20
|
+
#
|
21
|
+
def repo
|
22
|
+
"WorksApplications/Sudachi"
|
23
|
+
end
|
24
|
+
|
25
|
+
#
|
26
|
+
# @param [Hash] release
|
27
|
+
# @return [Hash]
|
28
|
+
#
|
29
|
+
def compact_release(release)
|
30
|
+
{
|
31
|
+
id: release[:id],
|
32
|
+
name: release[:name],
|
33
|
+
tag_name: release[:tag_name],
|
34
|
+
url: release[:url],
|
35
|
+
html_url: release[:html_url],
|
36
|
+
target_commitish: release[:target_commitish],
|
37
|
+
created_at: release[:created_at],
|
38
|
+
published_at: release[:published_at],
|
39
|
+
assets: release[:assets].map { |asset| compact_asset(asset) }
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
#
|
44
|
+
# @param [Hash] asset
|
45
|
+
# @return [Hash]
|
46
|
+
#
|
47
|
+
def compact_asset(asset)
|
48
|
+
{
|
49
|
+
url: asset[:url],
|
50
|
+
name: asset[:name],
|
51
|
+
content_type: asset[:content_type],
|
52
|
+
created_at: asset[:created_at],
|
53
|
+
updated_at: asset[:updated_at],
|
54
|
+
browser_download_url: asset[:browser_download_url],
|
55
|
+
body: asset[:body]
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
#
|
60
|
+
# setup octokit
|
61
|
+
#
|
62
|
+
def prefetch
|
63
|
+
@repo = @octokit.repo(repo)
|
64
|
+
@endpoint = @repo.rels[:releases]
|
65
|
+
end
|
66
|
+
|
67
|
+
#
|
68
|
+
# fetch releases
|
69
|
+
#
|
70
|
+
def fetch
|
71
|
+
if !@releases
|
72
|
+
prefetch
|
73
|
+
@releases = @endpoint.get.data
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
#
|
78
|
+
# @return [Array]
|
79
|
+
#
|
80
|
+
def list(type: "compact")
|
81
|
+
fetch
|
82
|
+
|
83
|
+
case type
|
84
|
+
when "minimum"
|
85
|
+
minimum_list
|
86
|
+
when "compact"
|
87
|
+
@releases.map { |release| compact_release(release) }
|
88
|
+
else
|
89
|
+
@releases
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
#
|
94
|
+
# @return [Array]
|
95
|
+
#
|
96
|
+
def minimum_list
|
97
|
+
fetch
|
98
|
+
|
99
|
+
@releases.map { |release|
|
100
|
+
{
|
101
|
+
id: release[:id],
|
102
|
+
tag_name: release[:tag_name]
|
103
|
+
}
|
104
|
+
}
|
105
|
+
end
|
106
|
+
|
107
|
+
#
|
108
|
+
# @param [boolean] compact
|
109
|
+
# @return [Hash]
|
110
|
+
#
|
111
|
+
def latest(compact: true)
|
112
|
+
prefetch
|
113
|
+
release = @octokit.get(@endpoint.href + "/latest")
|
114
|
+
|
115
|
+
if compact
|
116
|
+
compact_release(release)
|
117
|
+
else
|
118
|
+
release
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
#
|
123
|
+
# @param [String] tag
|
124
|
+
# @param [boolean] compact
|
125
|
+
# @return [<Hash, nil>]
|
126
|
+
#
|
127
|
+
def version(tag, compact: false)
|
128
|
+
release = minimum_list.find { |r| r[:tag_name] == tag }
|
129
|
+
|
130
|
+
if release
|
131
|
+
release_info = @octokit.get(@endpoint.href + "/#{release[:id]}")
|
132
|
+
if compact
|
133
|
+
compact_release(release_info)
|
134
|
+
else
|
135
|
+
release_info
|
136
|
+
end
|
137
|
+
else
|
138
|
+
raise ReleaseNotExist.new(tag)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
#
|
143
|
+
# @param [String] tag
|
144
|
+
# @return [void]
|
145
|
+
#
|
146
|
+
def download(tag)
|
147
|
+
rel = version(tag, compact: true)
|
148
|
+
assets = rel[:assets]
|
149
|
+
|
150
|
+
raise AssetsAmbiguous.new(tag) if assets.size > 1
|
151
|
+
|
152
|
+
Downloader.new.download(
|
153
|
+
assets.first[:browser_download_url],
|
154
|
+
assets.first[:name],
|
155
|
+
SudachiInstaller.config.jar_dir
|
156
|
+
)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require_relative "../sudachi-installer"
|
2
|
+
|
3
|
+
module SudachiInstaller
|
4
|
+
#
|
5
|
+
# downloaded file resolver
|
6
|
+
#
|
7
|
+
class Resolver
|
8
|
+
include SudachiInstaller
|
9
|
+
|
10
|
+
class ExecutableVersionNotDownloaded < Error; end # rubocop:disable
|
11
|
+
class DictionaryNotDownloaded < Error; end # rubocop:disable
|
12
|
+
|
13
|
+
#
|
14
|
+
# @return [string]
|
15
|
+
#
|
16
|
+
def jar_dir
|
17
|
+
self.class.ancestors[1].config.jar_dir
|
18
|
+
end
|
19
|
+
|
20
|
+
#
|
21
|
+
# @return [String]
|
22
|
+
#
|
23
|
+
def dict_dir
|
24
|
+
self.class.ancestors[1].config.dict_dir
|
25
|
+
end
|
26
|
+
|
27
|
+
#
|
28
|
+
# @return [Array]
|
29
|
+
#
|
30
|
+
def executable_jars
|
31
|
+
Dir.chdir(jar_dir) {
|
32
|
+
Dir.glob("sudachi-*-executable").select { |f|
|
33
|
+
FileTest.directory? f
|
34
|
+
}
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# @param [String] revision
|
40
|
+
# @return [String]
|
41
|
+
#
|
42
|
+
def jar_path(revision)
|
43
|
+
dir = executable_jars.find { |e| e == "sudachi-#{revision}-executable" }
|
44
|
+
|
45
|
+
if dir
|
46
|
+
File.join(jar_dir, dir, "sudachi-#{revision}.jar")
|
47
|
+
else
|
48
|
+
raise ExecutableVersionNotDownloaded.new(dir)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
#
|
53
|
+
# @return [Array]
|
54
|
+
#
|
55
|
+
def dictionaries
|
56
|
+
Dir.chdir(dict_dir) {
|
57
|
+
Dir.glob("sudachi-dictionary-*").select { |f|
|
58
|
+
FileTest.directory? f
|
59
|
+
}
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
#
|
64
|
+
# @param [String] revision
|
65
|
+
# @param [String] edition
|
66
|
+
# @return [String]
|
67
|
+
#
|
68
|
+
def dict_path(revision:, edition: "core")
|
69
|
+
dir = dictionaries.find { |e| e == "sudachi-dictionary-#{revision}" }
|
70
|
+
|
71
|
+
if dir
|
72
|
+
File.join(dict_dir, dir, "system_#{edition}.dic")
|
73
|
+
else
|
74
|
+
raise DictionaryNotDownloaded.new({revision: revision, edition: edition}.to_s)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dry-configurable"
|
4
|
+
require_relative "sudachi-installer/version"
|
5
|
+
|
6
|
+
#
|
7
|
+
# Download and deploy Sudachi exectable and dictionary
|
8
|
+
#
|
9
|
+
module SudachiInstaller
|
10
|
+
extend Dry::Configurable
|
11
|
+
|
12
|
+
setting :dict_dir
|
13
|
+
setting :jar_dir
|
14
|
+
|
15
|
+
class Error < StandardError; end # rubocop:disable
|
16
|
+
# Your code goes here...
|
17
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/sudachi-installer/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "sudachi-installer"
|
7
|
+
spec.version = SudachiInstaller::VERSION
|
8
|
+
spec.authors = ["wtnabe"]
|
9
|
+
spec.email = ["18510+wtnabe@users.noreply.github.com"]
|
10
|
+
|
11
|
+
spec.summary = "download and store Sudachi jar and dict files"
|
12
|
+
spec.homepage = "https://github.com/wtnabe/sudachi-installer-rb"
|
13
|
+
spec.required_ruby_version = ">= 2.6.0"
|
14
|
+
|
15
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
19
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
spec.files = Dir.chdir(__dir__) do
|
24
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
25
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
26
|
+
end
|
27
|
+
end
|
28
|
+
spec.bindir = "exe"
|
29
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
|
32
|
+
spec.add_dependency "octokit", "~> 6"
|
33
|
+
spec.add_dependency "faraday-follow_redirects", "~> 0"
|
34
|
+
spec.add_dependency "down", "~> 5"
|
35
|
+
spec.add_dependency "xmlhasher", "~> 1"
|
36
|
+
spec.add_dependency "dry-configurable", "~> 0"
|
37
|
+
spec.add_dependency "rubyzip", "~> 2"
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sudachi-installer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- wtnabe
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-04-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: octokit
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '6'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday-follow_redirects
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: down
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: xmlhasher
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: dry-configurable
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubyzip
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2'
|
97
|
+
description:
|
98
|
+
email:
|
99
|
+
- 18510+wtnabe@users.noreply.github.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".editorconfig"
|
105
|
+
- ".rubocop.yml"
|
106
|
+
- ".standard.yml"
|
107
|
+
- CHANGELOG.md
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- lib/sudachi-installer.rb
|
113
|
+
- lib/sudachi-installer/dicts.rb
|
114
|
+
- lib/sudachi-installer/downloader.rb
|
115
|
+
- lib/sudachi-installer/faraday_fake.rb
|
116
|
+
- lib/sudachi-installer/releases.rb
|
117
|
+
- lib/sudachi-installer/resolver.rb
|
118
|
+
- lib/sudachi-installer/version.rb
|
119
|
+
- sig/sudachi-installer/sudachi-installer.rbs
|
120
|
+
- sudachi-installer.gemspec
|
121
|
+
homepage: https://github.com/wtnabe/sudachi-installer-rb
|
122
|
+
licenses: []
|
123
|
+
metadata:
|
124
|
+
allowed_push_host: https://rubygems.org
|
125
|
+
homepage_uri: https://github.com/wtnabe/sudachi-installer-rb
|
126
|
+
source_code_uri: https://github.com/wtnabe/sudachi-installer-rb
|
127
|
+
changelog_uri: https://github.com/wtnabe/sudachi-installer-rb/blob/main/CHANGELOG.md
|
128
|
+
post_install_message:
|
129
|
+
rdoc_options: []
|
130
|
+
require_paths:
|
131
|
+
- lib
|
132
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: 2.6.0
|
137
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
requirements: []
|
143
|
+
rubygems_version: 3.3.7
|
144
|
+
signing_key:
|
145
|
+
specification_version: 4
|
146
|
+
summary: download and store Sudachi jar and dict files
|
147
|
+
test_files: []
|