interscript 2.3.2 → 2.4.0a4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/assets.yml +75 -0
- data/.github/workflows/rake.yml +56 -0
- data/.github/workflows/release.yml +65 -0
- data/.gitignore +68 -0
- data/Gemfile +3 -0
- data/Rakefile +37 -5
- data/lib/interscript/stdlib.rb +18 -2
- data/lib/interscript/version.rb +1 -1
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c95e03973b1eb766c8f58a26be06bf870f73b5e495e7c3d6b31a2fcf7d83287
|
4
|
+
data.tar.gz: 8939841720aba5622cac696efe0f6ef8aa299da67a8a677bb632e3a6947d02c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7347ad4005222088a756a19221f664969dae811fb5ed12fb72b3665ec92cb75f78fa1f7e0149ba72bb21e58ea58a50f53239cdd7e39961304edbfedb33a52dd5
|
7
|
+
data.tar.gz: ecfd57a833dc855eb76ae040e5c51886b06e416066d0fa97ff12b30ab3a4639c9f2138e65b41d55bbd5b4b6814cc586b9c8f0d7017370444ade2672653e7f9e9
|
@@ -0,0 +1,75 @@
|
|
1
|
+
name: release-assets
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- 'v*'
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
assets:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
env:
|
12
|
+
BUNDLE_WITHOUT: "secryst:jsexec"
|
13
|
+
SKIP_JS: "1"
|
14
|
+
steps:
|
15
|
+
- name: Checkout repository
|
16
|
+
uses: actions/checkout@v2
|
17
|
+
with:
|
18
|
+
repository: interscript/interscript-bootstrap
|
19
|
+
- name: Run a bootstrap script
|
20
|
+
run: ruby bootstrap.rb
|
21
|
+
- name: Use Ruby
|
22
|
+
uses: ruby/setup-ruby@v1
|
23
|
+
with:
|
24
|
+
ruby-version: 3.0
|
25
|
+
bundler-cache: true
|
26
|
+
working-directory: ./ruby
|
27
|
+
- name: Generate visualization json
|
28
|
+
run: pushd ruby; bundle exec rake generate_visualization_json; popd
|
29
|
+
- name: Archive json files from the previous step
|
30
|
+
uses: thedoctor0/zip-release@master
|
31
|
+
with:
|
32
|
+
filename: 'vis_json.zip'
|
33
|
+
path: ./vis_json/*.json
|
34
|
+
directory: ./ruby/
|
35
|
+
exclusions: '*.git*'
|
36
|
+
type: zip
|
37
|
+
- name: Upload artifacts
|
38
|
+
id: upload_vis_json
|
39
|
+
uses: svenstaro/upload-release-action@2.2.1
|
40
|
+
with:
|
41
|
+
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
42
|
+
file: ruby/vis_json.zip
|
43
|
+
file_glob: true
|
44
|
+
tag: ${{ github.ref }}
|
45
|
+
overwrite: true
|
46
|
+
- name: Generate metadata
|
47
|
+
run: pushd ruby; bundle exec rake generate_metadata_json; popd
|
48
|
+
- name: Archive metadata from the previous step
|
49
|
+
uses: thedoctor0/zip-release@master
|
50
|
+
with:
|
51
|
+
filename: 'metadata.zip'
|
52
|
+
path: ./metadata.json
|
53
|
+
directory: ./ruby/
|
54
|
+
exclusions: '*.git*'
|
55
|
+
type: zip
|
56
|
+
- name: Upload metadata
|
57
|
+
id: upload_metadata
|
58
|
+
uses: svenstaro/upload-release-action@2.2.1
|
59
|
+
with:
|
60
|
+
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
61
|
+
file: ruby/metadata.zip
|
62
|
+
asset_name: metadata.json.zip
|
63
|
+
tag: ${{ github.ref }}
|
64
|
+
overwrite: true
|
65
|
+
- name: Output link
|
66
|
+
run: |
|
67
|
+
echo ${{ steps.upload_vis_json.outputs.browser_download_url }}
|
68
|
+
echo ${{ steps.upload_metadata.outputs.browser_download_url }}
|
69
|
+
# - name: Trigger interscript.org
|
70
|
+
# uses: peter-evans/repository-dispatch@v1
|
71
|
+
# with:
|
72
|
+
# token: ${{ secrets.INTERSCRIPT_CI_TOKEN }}
|
73
|
+
# repository: interscript/interscript.org
|
74
|
+
# event-type: ${{ github.repository }}
|
75
|
+
# client-payload: '{ "ref": "${{ github.ref }}" }'
|
@@ -0,0 +1,56 @@
|
|
1
|
+
name: rake
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master, v* ]
|
6
|
+
tags: [ v* ]
|
7
|
+
pull_request:
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
rspec:
|
11
|
+
name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
|
12
|
+
runs-on: ${{ matrix.os }}
|
13
|
+
continue-on-error: ${{ matrix.experimental }}
|
14
|
+
strategy:
|
15
|
+
fail-fast: false
|
16
|
+
matrix:
|
17
|
+
ruby: [ 2.7, 2.6, 2.5 ]
|
18
|
+
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
19
|
+
experimental: [ false ]
|
20
|
+
include:
|
21
|
+
- ruby: 3.0
|
22
|
+
os: 'ubuntu-latest'
|
23
|
+
experimental: true
|
24
|
+
- ruby: 3.0
|
25
|
+
os: 'windows-latest'
|
26
|
+
experimental: true
|
27
|
+
- ruby: 3.0
|
28
|
+
os: 'macos-latest'
|
29
|
+
experimental: true
|
30
|
+
|
31
|
+
env:
|
32
|
+
BUNDLE_WITHOUT: "secryst"
|
33
|
+
SKIP_JS: "1"
|
34
|
+
|
35
|
+
steps:
|
36
|
+
- name: Checkout repository
|
37
|
+
uses: actions/checkout@v2
|
38
|
+
with:
|
39
|
+
repository: interscript/interscript-bootstrap
|
40
|
+
|
41
|
+
- name: Run a bootstrap script
|
42
|
+
run: ruby bootstrap.rb
|
43
|
+
|
44
|
+
- name: Use Ruby
|
45
|
+
uses: ruby/setup-ruby@v1
|
46
|
+
with:
|
47
|
+
ruby-version: ${{ matrix.ruby }}
|
48
|
+
bundler-cache: true
|
49
|
+
working-directory: ./ruby
|
50
|
+
|
51
|
+
- name: Run RSpecs
|
52
|
+
run: |
|
53
|
+
pushd ruby
|
54
|
+
bundle install --with=jsexec
|
55
|
+
bundle exec rspec -f f
|
56
|
+
popd
|
@@ -0,0 +1,65 @@
|
|
1
|
+
name: release
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- 'v*'
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
release:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
steps:
|
12
|
+
- name: Checkout repository
|
13
|
+
uses: actions/checkout@v2
|
14
|
+
with:
|
15
|
+
repository: interscript/interscript-bootstrap
|
16
|
+
|
17
|
+
- name: Run a bootstrap script
|
18
|
+
run: ruby bootstrap.rb
|
19
|
+
|
20
|
+
- uses: actions/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: '2.7'
|
23
|
+
architecture: 'x64'
|
24
|
+
working-directory: ./ruby
|
25
|
+
|
26
|
+
- uses: actions/setup-node@v1
|
27
|
+
with:
|
28
|
+
node-version: 14.x
|
29
|
+
|
30
|
+
# For now let's install without secryst, as we don't necessarily need it.
|
31
|
+
# We may need to change it once we start to depend on secryst maps.
|
32
|
+
- run: pushd ruby && bundle install --jobs 4 --retry 3 --with jsexec --without secryst && popd
|
33
|
+
|
34
|
+
- name: Test the Ruby package
|
35
|
+
run: pushd ruby && bundle exec rake && popd
|
36
|
+
|
37
|
+
- name: Test the JS package
|
38
|
+
run: pushd js && npm install && npm run prepareMaps && npm test && popd
|
39
|
+
|
40
|
+
- name: Publish to rubygems.org
|
41
|
+
env:
|
42
|
+
RUBYGEMS_API_KEY: ${{secrets.INTERSCRIPT_RUBYGEMS_API_KEY}}
|
43
|
+
run: |
|
44
|
+
gem install gem-release
|
45
|
+
touch ~/.gem/credentials
|
46
|
+
cat > ~/.gem/credentials << EOF
|
47
|
+
---
|
48
|
+
:rubygems_api_key: ${RUBYGEMS_API_KEY}
|
49
|
+
EOF
|
50
|
+
chmod 0600 ~/.gem/credentials
|
51
|
+
pushd ruby
|
52
|
+
git status
|
53
|
+
gem release
|
54
|
+
popd
|
55
|
+
|
56
|
+
# Let's keep it commented out for now. Please uncomment it once you are ready with
|
57
|
+
# interscript-api to support Interscript v2.
|
58
|
+
#
|
59
|
+
#- name: Trigger interscript-api
|
60
|
+
# uses: peter-evans/repository-dispatch@v1
|
61
|
+
# with:
|
62
|
+
# token: ${{ secrets.INTERSCRIPT_CI_PAT_TOKEN }}
|
63
|
+
# repository: interscript/interscript-api
|
64
|
+
# event-type: ${{ github.repository }}
|
65
|
+
# client-payload: '{ "ref": "${{ github.ref }}" }'
|
data/.gitignore
CHANGED
@@ -1,4 +1,72 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
/Gemfile.lock
|
13
|
+
|
14
|
+
# Used by dotenv library to load environment variables.
|
15
|
+
# .env
|
16
|
+
|
17
|
+
# Ignore Byebug command history file.
|
18
|
+
.byebug_history
|
19
|
+
|
20
|
+
## Specific to RubyMotion:
|
21
|
+
.dat*
|
22
|
+
.repl_history
|
23
|
+
/build/
|
24
|
+
*.bridgesupport
|
25
|
+
/build-iPhoneOS/
|
26
|
+
/build-iPhoneSimulator/
|
27
|
+
|
28
|
+
## Specific to RubyMotion (use of CocoaPods):
|
29
|
+
#
|
30
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
31
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
32
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
33
|
+
#
|
34
|
+
# vendor/Pods/
|
35
|
+
|
36
|
+
## Documentation cache and generated files:
|
37
|
+
/.yardoc/
|
38
|
+
/_yardoc/
|
39
|
+
/doc/
|
40
|
+
/rdoc/
|
41
|
+
|
42
|
+
## Environment normalization:
|
1
43
|
/.bundle/
|
44
|
+
/vendor/bundle
|
45
|
+
/lib/bundler/man/
|
46
|
+
|
47
|
+
# for a library or gem, you might want to ignore these files since the code is
|
48
|
+
# intended to run in multiple environments; otherwise, check them in:
|
49
|
+
# Gemfile.lock
|
50
|
+
# .ruby-version
|
51
|
+
# .ruby-gemset
|
52
|
+
|
53
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
54
|
+
/.rvmrc
|
55
|
+
|
56
|
+
# Don't bundle generated files
|
57
|
+
/visualizations
|
58
|
+
/json
|
59
|
+
/vis_json
|
60
|
+
/auth_json
|
61
|
+
/metadata.json
|
62
|
+
/compiled
|
63
|
+
|
64
|
+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
65
|
+
# .rubocop-https?--*
|
66
|
+
|
67
|
+
#misic
|
68
|
+
.idea
|
69
|
+
.bundle/.bundle/
|
2
70
|
/.yardoc
|
3
71
|
/_yardoc/
|
4
72
|
/coverage/
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -37,8 +37,9 @@ task :compile, [:compiler, :target] do |t, args|
|
|
37
37
|
File.write(args[:target] + "/index.json", maplist.to_json)
|
38
38
|
end
|
39
39
|
|
40
|
-
task :version, [:ver] do |t,
|
41
|
-
ver =
|
40
|
+
task :version, [:ver, :part] do |t, args|
|
41
|
+
ver = args[:ver]
|
42
|
+
part = args[:part]
|
42
43
|
|
43
44
|
rubyver = File.read(rubyfile = __dir__+"/lib/interscript/version.rb")
|
44
45
|
jsver = File.read(jsfile = __dir__+"/../js/package.json")
|
@@ -48,9 +49,9 @@ task :version, [:ver] do |t, ver|
|
|
48
49
|
jsver = jsver.gsub(/("version": ")([0-9a-z.-]*)(")/, "\\1#{ver}\\3")
|
49
50
|
mapsver = mapsver.gsub(/(INTERSCRIPT_MAPS_VERSION=")([0-9a-z.-]*)(")/, "\\1#{ver}\\3")
|
50
51
|
|
51
|
-
File.write(rubyfile, rubyver)
|
52
|
-
File.write(jsfile, jsver)
|
53
|
-
File.write(mapsfile, mapsver)
|
52
|
+
File.write(rubyfile, rubyver) if %w[all ruby].include? part
|
53
|
+
File.write(jsfile, jsver) if %w[all js].include? part
|
54
|
+
File.write(mapsfile, mapsver) if %w[all maps].include? part
|
54
55
|
end
|
55
56
|
|
56
57
|
task :generate_visualization_html do
|
@@ -121,4 +122,35 @@ task :generate_visualization_json do
|
|
121
122
|
end
|
122
123
|
end
|
123
124
|
|
125
|
+
task :generate_authority_json do
|
126
|
+
require "interscript"
|
127
|
+
require "json"
|
128
|
+
require "iso-639-data"
|
129
|
+
|
130
|
+
FileUtils.rm_rf(dir = __dir__+"/auth_json/")
|
131
|
+
FileUtils.mkdir_p(dir)
|
132
|
+
|
133
|
+
%w[iso icao din].each do |auth|
|
134
|
+
out = Interscript.maps.select do |map_name|
|
135
|
+
map_name.start_with? "#{auth}-"
|
136
|
+
end.sort.map do |map_name|
|
137
|
+
map = Interscript.parse(map_name)
|
138
|
+
tests = map.tests&.data&.first(2)&.transpose || []
|
139
|
+
std, lang = map.metadata.data[:language].split(':')
|
140
|
+
|
141
|
+
{
|
142
|
+
lang: std.end_with?("-3") ? Iso639Data.iso_639_3[lang]['Ref_Name'] : Iso639Data.iso_639_2[lang]['eng'],
|
143
|
+
isoName: map.metadata.data[:name],
|
144
|
+
systemName: map_name,
|
145
|
+
samples: tests[0] || [],
|
146
|
+
english: [],
|
147
|
+
result: []
|
148
|
+
}
|
149
|
+
end
|
150
|
+
|
151
|
+
json = JSON.pretty_generate(out)
|
152
|
+
File.write(dir+auth+".json", json)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
124
156
|
task :default => :spec
|
data/lib/interscript/stdlib.rb
CHANGED
@@ -171,7 +171,7 @@ class Interscript::Stdlib
|
|
171
171
|
end
|
172
172
|
|
173
173
|
def self.available_functions
|
174
|
-
%i[title_case downcase compose decompose separate unseparate secryst rababa]
|
174
|
+
%i[title_case downcase compose decompose separate unseparate secryst rababa rababa_reverse]
|
175
175
|
end
|
176
176
|
|
177
177
|
def self.reverse_function
|
@@ -183,7 +183,10 @@ class Interscript::Stdlib
|
|
183
183
|
decompose: :compose,
|
184
184
|
|
185
185
|
separate: :unseparate,
|
186
|
-
unseparate: :separate
|
186
|
+
unseparate: :separate,
|
187
|
+
|
188
|
+
rababa: :rababa_reverse,
|
189
|
+
rababa_reverse: :rababa,
|
187
190
|
}
|
188
191
|
end
|
189
192
|
|
@@ -249,5 +252,18 @@ class Interscript::Stdlib
|
|
249
252
|
|
250
253
|
@rababa_diacritizer.diacritize_text(output)
|
251
254
|
end
|
255
|
+
|
256
|
+
def self.rababa_reverse(output, config:)
|
257
|
+
# require "rababa" rescue nil # Try to load rababa, but don't fail hard if not possible.
|
258
|
+
# unless defined? Rababa
|
259
|
+
# raise StandardError, "Rababa is not loaded. Please read docs/Usage_with_Rababa.adoc"
|
260
|
+
# end
|
261
|
+
|
262
|
+
# A call to allocate allows us to remove diacritics without initializing the model
|
263
|
+
# Rababa::Diacritizer.allocate.remove_diacritics(output)
|
264
|
+
|
265
|
+
# Unfortunately, this is broken as of now.
|
266
|
+
output.gsub(/[\u064e\u064b\u064f\u064c\u0650\u064d\u0652\u0651]/, '')
|
267
|
+
end
|
252
268
|
end
|
253
269
|
end
|
data/lib/interscript/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: interscript
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0a4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: 2.4.0a
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.
|
40
|
+
version: 2.4.0a
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: text
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,6 +60,9 @@ executables:
|
|
60
60
|
extensions: []
|
61
61
|
extra_rdoc_files: []
|
62
62
|
files:
|
63
|
+
- ".github/workflows/assets.yml"
|
64
|
+
- ".github/workflows/rake.yml"
|
65
|
+
- ".github/workflows/release.yml"
|
63
66
|
- ".gitignore"
|
64
67
|
- ".rspec"
|
65
68
|
- Gemfile
|
@@ -145,9 +148,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
145
148
|
version: 2.3.0
|
146
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
150
|
requirements:
|
148
|
-
- - "
|
151
|
+
- - ">"
|
149
152
|
- !ruby/object:Gem::Version
|
150
|
-
version:
|
153
|
+
version: 1.3.1
|
151
154
|
requirements: []
|
152
155
|
rubygems_version: 3.1.6
|
153
156
|
signing_key:
|