rdeunicode 0.1.0
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 +7 -0
- data/Cargo.lock +39 -0
- data/Cargo.toml +16 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +21 -0
- data/README.md +67 -0
- data/Rakefile +22 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/ext/Rakefile +10 -0
- data/lib/rdeunicode.rb +9 -0
- data/lib/rdeunicode/thermite_initialize.rb +29 -0
- data/lib/rdeunicode/version.rb +5 -0
- data/rdeunicode.gemspec +36 -0
- data/src/lib.rs +35 -0
- metadata +144 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 81841e21cd126dbe0fbf21bb283aeae5293ead62adcb105864adb3c95415eb78
|
4
|
+
data.tar.gz: 1a9225cbb90d5ecd4ed528d1fe9d6a243d3d5a24c95a2ef23b93a131311cbe1b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: '086ff11d281bf362fb50daaeb44ee049991c563829cb876cbdd37877b5ec7d297434c24bf1c4f3472e8487073083112d58f492e9781d49107ed0dcf5dd249d10'
|
7
|
+
data.tar.gz: 5021239a73bf19fd4acb8393a3e9a95c9e64db0f892ea096a0fa063c37eade18bcd86780fdfa0ad1f2077014a38275ae3a85008fab6da6aae2bc721ab261f3c9
|
data/Cargo.lock
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
2
|
+
# It is not intended for manual editing.
|
3
|
+
[[package]]
|
4
|
+
name = "deunicode"
|
5
|
+
version = "1.1.1"
|
6
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
7
|
+
|
8
|
+
[[package]]
|
9
|
+
name = "lazy_static"
|
10
|
+
version = "1.4.0"
|
11
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
12
|
+
|
13
|
+
[[package]]
|
14
|
+
name = "libc"
|
15
|
+
version = "0.2.69"
|
16
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
17
|
+
|
18
|
+
[[package]]
|
19
|
+
name = "rdeunicode"
|
20
|
+
version = "0.1.0"
|
21
|
+
dependencies = [
|
22
|
+
"deunicode 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
23
|
+
"rutie 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
24
|
+
]
|
25
|
+
|
26
|
+
[[package]]
|
27
|
+
name = "rutie"
|
28
|
+
version = "0.6.1"
|
29
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
30
|
+
dependencies = [
|
31
|
+
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
32
|
+
"libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)",
|
33
|
+
]
|
34
|
+
|
35
|
+
[metadata]
|
36
|
+
"checksum deunicode 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "80115a2dfde04491e181c2440a39e4be26e52d9ca4e92bed213f65b94e0b8db1"
|
37
|
+
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
38
|
+
"checksum libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)" = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005"
|
39
|
+
"checksum rutie 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8ed4df3604d82e3fbd9e4657dd8a8fb23c5d9c0be5779751f0d18bdbb6017c50"
|
data/Cargo.toml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
[package]
|
2
|
+
name = "rdeunicode"
|
3
|
+
version = "0.1.0"
|
4
|
+
authors = ["Denis Savchuk <mordorreal@gmail.com>"]
|
5
|
+
edition = "2018"
|
6
|
+
|
7
|
+
[package.metadata.thermite]
|
8
|
+
github_releases = true
|
9
|
+
|
10
|
+
[dependencies]
|
11
|
+
rutie = "0.6.1"
|
12
|
+
deunicode = "1.1.1"
|
13
|
+
|
14
|
+
[lib]
|
15
|
+
name = "rdeunicode"
|
16
|
+
crate-type = ["dylib"]
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Denis Savchuk
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# Rdeunicode
|
2
|
+
|
3
|
+
[](https://badge.fury.io/rb/rdeunicode)
|
4
|
+
[](https://github.com/Mordorreal/rdeunicode/pulse)
|
5
|
+
[](https://github.com/Mordorreal/rdeunicode/releases)
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Ensure Rust is installed:
|
10
|
+
|
11
|
+
[Rust Downloads](https://www.rust-lang.org/downloads.html)
|
12
|
+
|
13
|
+
```
|
14
|
+
curl -sSf https://static.rust-lang.org/rustup.sh | sh
|
15
|
+
```
|
16
|
+
|
17
|
+
Add this line to your application's Gemfile:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
gem 'rdeunicode', '~> 0.1.0'
|
21
|
+
```
|
22
|
+
|
23
|
+
And then execute:
|
24
|
+
|
25
|
+
$ bundle
|
26
|
+
|
27
|
+
Or install it yourself as:
|
28
|
+
|
29
|
+
$ gem install rdeunicode
|
30
|
+
|
31
|
+
## Usage
|
32
|
+
|
33
|
+
Add the proper require to your project.
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
require "rdeunicode"
|
37
|
+
|
38
|
+
Rdeunicode.deunicode('Æneid') # 'AEneid'
|
39
|
+
Rdeunicode.deunicode('étude') # 'etude'
|
40
|
+
Rdeunicode.deunicode('北亰') # 'Bei Jing'
|
41
|
+
Rdeunicode.deunicode('ᔕᓇᓇ') # 'shanana'
|
42
|
+
Rdeunicode.deunicode('げんまい茶') # 'genmaiCha'
|
43
|
+
Rdeunicode.deunicode('🦄☣') # 'unicorn biohazard'
|
44
|
+
|
45
|
+
```
|
46
|
+
|
47
|
+
## Development
|
48
|
+
|
49
|
+
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.
|
50
|
+
|
51
|
+
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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
52
|
+
|
53
|
+
## Contributing
|
54
|
+
|
55
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Mordorreal/rdeunicode. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
56
|
+
|
57
|
+
## License
|
58
|
+
|
59
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
60
|
+
|
61
|
+
## Code of Conduct
|
62
|
+
|
63
|
+
Everyone interacting in the Rdeunicode project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Mordorreal/rdeunicode/blob/master/CODE_OF_CONDUCT.md).
|
64
|
+
|
65
|
+
## Changelog
|
66
|
+
|
67
|
+
[Changelog](https://github.com/Mordorreal/rdeunicode/blob/master/CHANGELOG.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
require 'thermite/tasks'
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new(:spec)
|
8
|
+
Thermite::Tasks.new
|
9
|
+
|
10
|
+
task default: :spec
|
11
|
+
|
12
|
+
desc 'Code Quality Check'
|
13
|
+
task :lint do
|
14
|
+
puts
|
15
|
+
puts 'Quality check starting...'
|
16
|
+
sh 'rubocop'
|
17
|
+
puts
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'Run Rust & Ruby testsuites'
|
21
|
+
task test: ['thermite:build', 'thermite:test', 'lint', 'spec'] do
|
22
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'rdeunicode'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/ext/Rakefile
ADDED
data/lib/rdeunicode.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rake/tasklib'
|
5
|
+
require_relative './version'
|
6
|
+
|
7
|
+
# @private :nodoc:
|
8
|
+
module Thermite
|
9
|
+
# @private :nodoc:
|
10
|
+
class Config
|
11
|
+
# @private :nodoc:
|
12
|
+
def ruby_version
|
13
|
+
"ruby#{RUBY_VERSION}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# @private :nodoc:
|
18
|
+
class Tasks < Rake::TaskLib
|
19
|
+
# @private :nodoc:
|
20
|
+
def github_download_uri(_tag, version)
|
21
|
+
[
|
22
|
+
github_uri,
|
23
|
+
'/releases/download/v',
|
24
|
+
FasterPath::VERSION,
|
25
|
+
config.tarball_filename(version)
|
26
|
+
].join('')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/rdeunicode.gemspec
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'rdeunicode/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'rdeunicode'
|
9
|
+
spec.version = Rdeunicode::VERSION
|
10
|
+
spec.authors = ['Denis Savchuk']
|
11
|
+
spec.email = ['mordorreal@gmail.com']
|
12
|
+
|
13
|
+
spec.summary = 'Ruby gem that is wrapper for deunicode rust crate'
|
14
|
+
spec.description = %(Rdeunicode is wrapper around deunicode that bring that
|
15
|
+
awesome crate to Ruby. Enjoy.)
|
16
|
+
spec.homepage = 'https://github.com/Mordorreal/rdeunicode'
|
17
|
+
spec.license = 'MIT'
|
18
|
+
|
19
|
+
spec.files = [
|
20
|
+
'Cargo.lock', 'Cargo.toml', 'Gemfile', 'LICENSE.txt', 'README.md',
|
21
|
+
'bin/console', 'bin/setup', 'Rakefile', 'rdeunicode.gemspec',
|
22
|
+
'lib/rdeunicode.rb', 'lib/rdeunicode/version.rb', 'ext/Rakefile',
|
23
|
+
'Rakefile', 'lib/rdeunicode/thermite_initialize.rb'
|
24
|
+
]
|
25
|
+
|
26
|
+
spec.files += Dir['src/**/*']
|
27
|
+
spec.extensions << 'ext/Rakefile'
|
28
|
+
spec.require_paths = ['lib']
|
29
|
+
|
30
|
+
spec.add_dependency 'rutie', '~> 0.0.3'
|
31
|
+
spec.add_runtime_dependency 'thermite', '~> 0'
|
32
|
+
spec.add_development_dependency 'bundler', '~> 1.17'
|
33
|
+
spec.add_development_dependency 'rake', '>= 12.3.3'
|
34
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
35
|
+
spec.add_development_dependency 'rubocop', '~> 0.82.0'
|
36
|
+
end
|
data/src/lib.rs
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
#[macro_use]
|
2
|
+
extern crate rutie;
|
3
|
+
extern crate deunicode;
|
4
|
+
|
5
|
+
use rutie::{Module, Object, RString, VM};
|
6
|
+
use deunicode::deunicode;
|
7
|
+
|
8
|
+
module!(Rdeunicode);
|
9
|
+
|
10
|
+
methods!(
|
11
|
+
Rdeunicode,
|
12
|
+
_itself,
|
13
|
+
|
14
|
+
fn pub_deunicode(input: RString) -> RString {
|
15
|
+
let ruby_string = input.
|
16
|
+
map_err(|e| VM::raise_ex(e) ).
|
17
|
+
unwrap();
|
18
|
+
|
19
|
+
RString::new_utf8(
|
20
|
+
&deunicode(
|
21
|
+
&ruby_string.
|
22
|
+
to_string()
|
23
|
+
)
|
24
|
+
)
|
25
|
+
}
|
26
|
+
);
|
27
|
+
|
28
|
+
#[allow(non_snake_case)]
|
29
|
+
#[no_mangle]
|
30
|
+
pub extern "C" fn Init_rdeunicode() {
|
31
|
+
Module::from_existing("Rdeunicode").define(|itself| {
|
32
|
+
itself.def_self("deunicode", pub_deunicode);
|
33
|
+
itself.define_nested_class("Public", None);
|
34
|
+
});
|
35
|
+
}
|
metadata
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rdeunicode
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Denis Savchuk
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-04-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rutie
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.0.3
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.0.3
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thermite
|
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: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.17'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.17'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 12.3.3
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 12.3.3
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.82.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.82.0
|
97
|
+
description: |-
|
98
|
+
Rdeunicode is wrapper around deunicode that bring that
|
99
|
+
awesome crate to Ruby. Enjoy.
|
100
|
+
email:
|
101
|
+
- mordorreal@gmail.com
|
102
|
+
executables: []
|
103
|
+
extensions:
|
104
|
+
- ext/Rakefile
|
105
|
+
extra_rdoc_files: []
|
106
|
+
files:
|
107
|
+
- Cargo.lock
|
108
|
+
- Cargo.toml
|
109
|
+
- Gemfile
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- bin/console
|
114
|
+
- bin/setup
|
115
|
+
- ext/Rakefile
|
116
|
+
- lib/rdeunicode.rb
|
117
|
+
- lib/rdeunicode/thermite_initialize.rb
|
118
|
+
- lib/rdeunicode/version.rb
|
119
|
+
- rdeunicode.gemspec
|
120
|
+
- src/lib.rs
|
121
|
+
homepage: https://github.com/Mordorreal/rdeunicode
|
122
|
+
licenses:
|
123
|
+
- MIT
|
124
|
+
metadata: {}
|
125
|
+
post_install_message:
|
126
|
+
rdoc_options: []
|
127
|
+
require_paths:
|
128
|
+
- lib
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
requirements: []
|
140
|
+
rubygems_version: 3.0.3
|
141
|
+
signing_key:
|
142
|
+
specification_version: 4
|
143
|
+
summary: Ruby gem that is wrapper for deunicode rust crate
|
144
|
+
test_files: []
|