mini_phone 1.1.7 → 1.2.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/Gemfile +1 -1
- data/README.md +14 -0
- data/Rakefile +7 -39
- data/certs/ianks.pem +21 -0
- data/ext/mini_phone/extconf.rb +11 -3
- data/ext/mini_phone/mini_phone.cc +3 -1
- data/lib/mini_phone/version.rb +1 -1
- data/mini_phone.gemspec +6 -1
- data.tar.gz.sig +0 -0
- metadata +32 -8
- metadata.gz.sig +3 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c398c60b592f86860c4e077e2c645d6a581dbac7819f1ddfa2a15af5bcf5d6bf
|
|
4
|
+
data.tar.gz: 2332e7b03cf3a703d98a3bca80a5eeadfbcb285136a1c1402240c10e2d189021
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4004538e8696f32e6ca6947c6ee66ff18ccd2383c53ee5097c9597d2614f6107273e6beaee7a959a365f8063dde1543be013d803b9e2afff44bceb29b8fdb1b6
|
|
7
|
+
data.tar.gz: f9c11923842410cfbb77e78289d7c2f181d1f8cca95902b2b7d506f6a00c4435fbe82fc3b9aac0bb6c1aeed78f1b1562e98b56668ea9247ea60d952879c9d0f8
|
checksums.yaml.gz.sig
ADDED
|
Binary file
|
data/Gemfile
CHANGED
|
@@ -9,7 +9,7 @@ gem 'rake', require: false
|
|
|
9
9
|
# https://github.com/rake-compiler/rake-compiler/pull/166
|
|
10
10
|
gem 'get_process_mem', require: false
|
|
11
11
|
gem 'pry', require: false
|
|
12
|
-
gem 'rake-compiler'
|
|
12
|
+
gem 'rake-compiler'
|
|
13
13
|
gem 'rspec', '~> 3.0', require: false
|
|
14
14
|
gem 'rspec-github', require: false
|
|
15
15
|
gem 'rubocop', require: false
|
data/README.md
CHANGED
|
@@ -121,6 +121,20 @@ TelephoneNumber: e164: 228.8 i/s - 179.99x (± 0.00) slower
|
|
|
121
121
|
gem install mini_phone
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
+
### Installation on Heroku
|
|
125
|
+
|
|
126
|
+
1. In addition to the steps above add the [apt buildpack](https://github.com/heroku/heroku-buildpack-apt) to your Heroku app:
|
|
127
|
+
|
|
128
|
+
```sh
|
|
129
|
+
heroku buildpacks:add --index 1 heroku-community/apt
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
2. Create Aptfile in your repo with the following content:
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
libphonenumber-dev
|
|
136
|
+
```
|
|
137
|
+
|
|
124
138
|
## Development
|
|
125
139
|
|
|
126
140
|
After checking out the repo, run `bin/setup` to install dependencies. Then,
|
data/Rakefile
CHANGED
|
@@ -5,9 +5,9 @@ require 'rspec/core/rake_task'
|
|
|
5
5
|
require 'rubygems/package_task'
|
|
6
6
|
require 'rake/extensiontask'
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
CXX_FILES = FileList['ext/**/*.{c,cc,cpp,cxx,h}']
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
11
11
|
|
|
12
12
|
task default: %i[clobber compile spec lint]
|
|
13
13
|
|
|
@@ -29,62 +29,30 @@ task bench: %i[clobber compile] do
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
task :lint do
|
|
32
|
+
require 'mkmf'
|
|
32
33
|
sh 'bundle exec rubocop'
|
|
34
|
+
sh 'clang-format', '--dry-run', '-i', *CXX_FILES if find_executable('clang-format')
|
|
33
35
|
end
|
|
34
36
|
|
|
35
37
|
task :format do
|
|
36
38
|
sh 'bundle exec rubocop -A'
|
|
37
|
-
sh 'clang-format -i
|
|
39
|
+
sh 'clang-format', '--dry-run', '-i', *CXX_FILES
|
|
38
40
|
end
|
|
39
41
|
|
|
40
42
|
task deploy: :default do
|
|
41
43
|
sh 'code -w ./lib/mini_phone/version.rb'
|
|
42
44
|
version = `ruby -r ./lib/mini_phone/version.rb -e 'print MiniPhone::VERSION'`.strip
|
|
43
45
|
sh "git commit -am 'Bump to v#{version} :confetti_ball:'"
|
|
44
|
-
sh '
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
namespace :publish do
|
|
48
|
-
def push_to_github_registry(gem)
|
|
49
|
-
puts "Pushing #{gem} to GitHub Package Registry"
|
|
50
|
-
sh "gem push #{gem} --host https://rubygems.pkg.github.com/ianks --key github"
|
|
51
|
-
true
|
|
52
|
-
rescue StandardError
|
|
53
|
-
warn 'Could not publish to Github Package Registry'
|
|
54
|
-
false
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def push_to_rubygems(gem)
|
|
58
|
-
puts "Pushing #{gem} to rubygems"
|
|
59
|
-
sh "gem push #{gem}"
|
|
60
|
-
true
|
|
61
|
-
rescue StandardError
|
|
62
|
-
warn 'Could not publish to rubygems'
|
|
63
|
-
false
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
task native: %i[native gem] do
|
|
67
|
-
g = "./pkg/mini_phone-#{MiniPhone::VERSION}-#{Gem::Platform.new(RUBY_PLATFORM)}.gem"
|
|
68
|
-
|
|
69
|
-
push_to_rubygems(g)
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
task non_native: [:gem] do
|
|
73
|
-
g = "./pkg/mini_phone-#{MiniPhone::VERSION}.gem"
|
|
74
|
-
|
|
75
|
-
push_to_rubygems(g)
|
|
76
|
-
push_to_github_registry(g)
|
|
77
|
-
end
|
|
46
|
+
sh 'bundle exec rake release'
|
|
78
47
|
end
|
|
79
48
|
|
|
80
|
-
desc 'Run valgrind test'
|
|
81
|
-
|
|
82
49
|
namespace :debug do
|
|
83
50
|
desc 'Plot memory'
|
|
84
51
|
task :memory do
|
|
85
52
|
sh 'debug/memory_plot/plot.sh'
|
|
86
53
|
end
|
|
87
54
|
|
|
55
|
+
desc 'Run valgrind test'
|
|
88
56
|
task :valgrind do
|
|
89
57
|
sh 'docker build --tag mini_phone_dev -f Dockerfile.dev .'
|
|
90
58
|
args = '--tool=memcheck --num-callers=15 --partial-loads-ok=yes --undef-value-errors=no'
|
data/certs/ianks.pem
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
|
2
|
+
MIIDfDCCAmSgAwIBAgIBATANBgkqhkiG9w0BAQsFADBCMRQwEgYDVQQDDAtpLmtl
|
|
3
|
+
cnNleW1lcjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYD
|
|
4
|
+
Y29tMB4XDTIzMDQxNDEzMzYxNVoXDTI0MDQxMzEzMzYxNVowQjEUMBIGA1UEAwwL
|
|
5
|
+
aS5rZXJzZXltZXIxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixk
|
|
6
|
+
ARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMJ2pG+er4cP
|
|
7
|
+
PasxsMIKL9/tmLL4gh80EMuF3SCS0qZoh+Oo8dkvRYxW8NXdwEIcp3cCNgE+5G+J
|
|
8
|
+
TCMOVF8S15n1Z1P7xxXiXxa/BIofKKbtatVRngm14uR/6pjdkvLXqlrWdS57bNwv
|
|
9
|
+
7LtpzYVfDHfsl/qRWaEi4jq00PNCRSWjcva8teqswjBg8KlwGtyygpezPbVSWP8Y
|
|
10
|
+
vzWZmVF7fqRBXU78Ah0+pNOhslBXDTvI3xJdN4hQ3H7rLjpD/qxKWq/8o+Qvx6cX
|
|
11
|
+
dNZ3ugH/Pr3BAsqt4JFLXin9AK7PO9GDMH5JXJrUb+hAt2VNIZqpz9VlKA6BA0jN
|
|
12
|
+
eWGea+yCZkECAwEAAaN9MHswCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
|
|
13
|
+
BBYEFOkrF6hsocaIMOjR/K3JBzyXCLJPMCAGA1UdEQQZMBeBFWkua2Vyc2V5bWVy
|
|
14
|
+
QGdtYWlsLmNvbTAgBgNVHRIEGTAXgRVpLmtlcnNleW1lckBnbWFpbC5jb20wDQYJ
|
|
15
|
+
KoZIhvcNAQELBQADggEBAMAohCl0cdVlYrJl9viGtzbEyLV/Krn0ZD/LM9d2cIRj
|
|
16
|
+
WBu7HRkP6AfYVzhZwdgUgDYw67d715kOMpLNGeWQw3QGEHFqbVzRML64jL8IxuTz
|
|
17
|
+
J8ttZVqM8f4GrHyISJnL92u6iP4WzdbVqx89EFjrrHd14OJXK+ZpdRh0YvnN/vMJ
|
|
18
|
+
t2EcDweRHkN/MEdrwbH+PbYjELnKcTIEZqcCWTk8pgssGrNyjkMhxGSsSUo9qTz0
|
|
19
|
+
DIZ6NVmpBvohJVCCCDxQQxFKLXZp1ivoxjN+m7eJSW7yzIz062pH4u8pPNQsiVSb
|
|
20
|
+
I5rgRPbDr2rAFGXKoQ0+u6CLkRxqrVsITl/OPfZhBQI=
|
|
21
|
+
-----END CERTIFICATE-----
|
data/ext/mini_phone/extconf.rb
CHANGED
|
@@ -4,7 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
require 'mkmf'
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
conf = RbConfig::MAKEFILE_CONFIG
|
|
8
|
+
|
|
9
|
+
if conf['target_cpu'] == 'arm64' && conf['target_os'].start_with?('darwin')
|
|
10
|
+
$LIBPATH << '/opt/homebrew/lib'
|
|
11
|
+
$INCFLAGS << ' -I/opt/homebrew/include '
|
|
12
|
+
$CXXFLAGS << ' -I/opt/homebrew/include '
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
unless have_library('phonenumber') && have_library('protobuf')
|
|
8
16
|
abort <<~MSG
|
|
9
17
|
|
|
10
18
|
,----------------------------------------------------------------------,
|
|
@@ -30,8 +38,8 @@ unless have_library('phonenumber')
|
|
|
30
38
|
end
|
|
31
39
|
|
|
32
40
|
dir_config('mini_phone')
|
|
33
|
-
|
|
34
|
-
$CXXFLAGS
|
|
41
|
+
append_cppflags('-O3')
|
|
42
|
+
$CXXFLAGS << ' -std=c++17 ' unless $CXXFLAGS.include?('-std=c++')
|
|
35
43
|
|
|
36
44
|
create_makefile('mini_phone/mini_phone')
|
|
37
45
|
|
|
@@ -14,7 +14,9 @@ static VALUE rb_cPhoneNumber;
|
|
|
14
14
|
static RepeatedPtrField<NumberFormat> raw_national_format;
|
|
15
15
|
static RepeatedPtrField<NumberFormat> dasherized_national_format;
|
|
16
16
|
|
|
17
|
-
extern "C" struct PhoneNumberInfo {
|
|
17
|
+
extern "C" struct PhoneNumberInfo {
|
|
18
|
+
PhoneNumber *phone_number;
|
|
19
|
+
};
|
|
18
20
|
|
|
19
21
|
extern "C" size_t phone_number_info_size(const void *data) { return sizeof(PhoneNumberInfo); }
|
|
20
22
|
|
data/lib/mini_phone/version.rb
CHANGED
data/mini_phone.gemspec
CHANGED
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
|
14
14
|
MSG
|
|
15
15
|
spec.homepage = 'https://github.com/ianks/mini_phone'
|
|
16
16
|
spec.license = 'MIT'
|
|
17
|
-
spec.required_ruby_version = Gem::Requirement.new('>=
|
|
17
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 3.0.0')
|
|
18
18
|
|
|
19
19
|
spec.platform = Gem::Platform::RUBY
|
|
20
20
|
|
|
@@ -36,4 +36,9 @@ Gem::Specification.new do |spec|
|
|
|
36
36
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
37
37
|
spec.require_paths = ['lib']
|
|
38
38
|
spec.extensions = ['ext/mini_phone/extconf.rb']
|
|
39
|
+
|
|
40
|
+
# Security
|
|
41
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
42
|
+
spec.cert_chain = ['certs/ianks.pem']
|
|
43
|
+
spec.signing_key = File.expand_path('~/.ssh/gem-private_key.pem') if $PROGRAM_NAME.end_with?('gem')
|
|
39
44
|
end
|
data.tar.gz.sig
ADDED
|
Binary file
|
metadata
CHANGED
|
@@ -1,14 +1,36 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mini_phone
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ian Ker-Seymer
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
|
-
cert_chain:
|
|
11
|
-
|
|
10
|
+
cert_chain:
|
|
11
|
+
- |
|
|
12
|
+
-----BEGIN CERTIFICATE-----
|
|
13
|
+
MIIDfDCCAmSgAwIBAgIBATANBgkqhkiG9w0BAQsFADBCMRQwEgYDVQQDDAtpLmtl
|
|
14
|
+
cnNleW1lcjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYD
|
|
15
|
+
Y29tMB4XDTIzMDQxNDEzMzYxNVoXDTI0MDQxMzEzMzYxNVowQjEUMBIGA1UEAwwL
|
|
16
|
+
aS5rZXJzZXltZXIxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixk
|
|
17
|
+
ARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMJ2pG+er4cP
|
|
18
|
+
PasxsMIKL9/tmLL4gh80EMuF3SCS0qZoh+Oo8dkvRYxW8NXdwEIcp3cCNgE+5G+J
|
|
19
|
+
TCMOVF8S15n1Z1P7xxXiXxa/BIofKKbtatVRngm14uR/6pjdkvLXqlrWdS57bNwv
|
|
20
|
+
7LtpzYVfDHfsl/qRWaEi4jq00PNCRSWjcva8teqswjBg8KlwGtyygpezPbVSWP8Y
|
|
21
|
+
vzWZmVF7fqRBXU78Ah0+pNOhslBXDTvI3xJdN4hQ3H7rLjpD/qxKWq/8o+Qvx6cX
|
|
22
|
+
dNZ3ugH/Pr3BAsqt4JFLXin9AK7PO9GDMH5JXJrUb+hAt2VNIZqpz9VlKA6BA0jN
|
|
23
|
+
eWGea+yCZkECAwEAAaN9MHswCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
|
|
24
|
+
BBYEFOkrF6hsocaIMOjR/K3JBzyXCLJPMCAGA1UdEQQZMBeBFWkua2Vyc2V5bWVy
|
|
25
|
+
QGdtYWlsLmNvbTAgBgNVHRIEGTAXgRVpLmtlcnNleW1lckBnbWFpbC5jb20wDQYJ
|
|
26
|
+
KoZIhvcNAQELBQADggEBAMAohCl0cdVlYrJl9viGtzbEyLV/Krn0ZD/LM9d2cIRj
|
|
27
|
+
WBu7HRkP6AfYVzhZwdgUgDYw67d715kOMpLNGeWQw3QGEHFqbVzRML64jL8IxuTz
|
|
28
|
+
J8ttZVqM8f4GrHyISJnL92u6iP4WzdbVqx89EFjrrHd14OJXK+ZpdRh0YvnN/vMJ
|
|
29
|
+
t2EcDweRHkN/MEdrwbH+PbYjELnKcTIEZqcCWTk8pgssGrNyjkMhxGSsSUo9qTz0
|
|
30
|
+
DIZ6NVmpBvohJVCCCDxQQxFKLXZp1ivoxjN+m7eJSW7yzIz062pH4u8pPNQsiVSb
|
|
31
|
+
I5rgRPbDr2rAFGXKoQ0+u6CLkRxqrVsITl/OPfZhBQI=
|
|
32
|
+
-----END CERTIFICATE-----
|
|
33
|
+
date: 2023-05-24 00:00:00.000000000 Z
|
|
12
34
|
dependencies: []
|
|
13
35
|
description: Plugs directly in the the Google's native C++ [libphonenumber](https://github.com/google/libphonenumber)
|
|
14
36
|
for extemely _fast_ and _robust_ phone number parsing, validation, and formatting.
|
|
@@ -27,6 +49,7 @@ files:
|
|
|
27
49
|
- LICENSE.txt
|
|
28
50
|
- README.md
|
|
29
51
|
- Rakefile
|
|
52
|
+
- certs/ianks.pem
|
|
30
53
|
- debug/memory_plot/memory.rb
|
|
31
54
|
- debug/memory_plot/plot.sh
|
|
32
55
|
- ext/mini_phone/extconf.rb
|
|
@@ -43,7 +66,8 @@ metadata:
|
|
|
43
66
|
homepage_uri: https://github.com/ianks/mini_phone
|
|
44
67
|
source_code_uri: https://github.com/ianks/mini_phone
|
|
45
68
|
changelog_uri: https://github.com/ianks/mini_phone/blob/master/CHANGELOG.md
|
|
46
|
-
|
|
69
|
+
rubygems_mfa_required: 'true'
|
|
70
|
+
post_install_message:
|
|
47
71
|
rdoc_options: []
|
|
48
72
|
require_paths:
|
|
49
73
|
- lib
|
|
@@ -51,15 +75,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
51
75
|
requirements:
|
|
52
76
|
- - ">="
|
|
53
77
|
- !ruby/object:Gem::Version
|
|
54
|
-
version:
|
|
78
|
+
version: 3.0.0
|
|
55
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
80
|
requirements:
|
|
57
81
|
- - ">="
|
|
58
82
|
- !ruby/object:Gem::Version
|
|
59
83
|
version: '0'
|
|
60
84
|
requirements: []
|
|
61
|
-
rubygems_version: 3.
|
|
62
|
-
signing_key:
|
|
85
|
+
rubygems_version: 3.4.6
|
|
86
|
+
signing_key:
|
|
63
87
|
specification_version: 4
|
|
64
88
|
summary: Uses the Google libphonenumber C lib to parse, validate, and format phone
|
|
65
89
|
numbers
|
metadata.gz.sig
ADDED