mini_phone 0.1.6 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1bba68164238d85ff35c9e3adb5f691451b6ed10adbd6b221300dde45031c947
4
- data.tar.gz: 2fe1c17ed5516cc584f53810896265a7f013c0bc3e3fcc4ff05c7c5705bc5302
3
+ metadata.gz: 54303715ea62a3242c279007d693c6e50727f63a584bd180ec64b385fd5c5368
4
+ data.tar.gz: 9fee829e59cdbc304eea3a2e88a86c8e53264e38ab6cde0aaf31261a6dd5d03c
5
5
  SHA512:
6
- metadata.gz: f9f73f44e94e49fbc2f95ba75f250ec6c7b8a5f7a7405d2740c9172cbcb354316168284a74fe5e48adcdcd80950f049c9a6efe092501f2d0219e4902fe95311c
7
- data.tar.gz: 8a10b0e29939dd79d1d4e66953acdde1212bbf4ec4ce2ee46770aae39a7b45d209ed604b69014b2a6cf92dd31ac7d194b250e99d05ec0296666a8c56548bac46
6
+ metadata.gz: 43829b6078b48ac2a5ed3e69662a9c0cd8b3bc42d2b744d9836b080eaa604a8a33486f445ead9506c3663714853b914203811af781ca71a3804c0ca0a358b9b1
7
+ data.tar.gz: 759f0d9dd79035372a50bc19b049f05d897df905cce531eaf5b71b738cf611d3179e8256c9b072b4c59a05573496d3c721946b7b4d266fe7dab7991169a33719
data/Gemfile CHANGED
@@ -5,11 +5,12 @@ source 'https://rubygems.org'
5
5
  # Specify your gem's dependencies in mini_phone.gemspec
6
6
  gemspec
7
7
 
8
- gem 'rake', '~> 12.0'
8
+ gem 'rake', require: false
9
+ # https://github.com/rake-compiler/rake-compiler/pull/166
9
10
  gem 'rake-compiler', github: 'larskanis/rake-compiler', branch: 'fix-native-version'
10
- gem 'rspec', '~> 3.0'
11
+ gem 'rspec', '~> 3.0', require: false
11
12
  gem 'rspec-github', require: false
12
- gem 'rubocop'
13
+ gem 'rubocop', require: false
13
14
 
14
15
  group :bench do
15
16
  gem 'benchmark-ips'
data/Rakefile CHANGED
@@ -63,11 +63,7 @@ namespace :publish do
63
63
  task non_native: [:gem] do
64
64
  g = "./pkg/mini_phone-#{MiniPhone::VERSION}.gem"
65
65
 
66
- results = []
67
-
68
- results << push_to_rubygems(g)
69
- results << push_to_github_registry(g)
70
-
71
- abort if results.all? { |r| r == true }
66
+ push_to_rubygems(g)
67
+ push_to_github_registry(g)
72
68
  end
73
69
  end
@@ -4,47 +4,6 @@
4
4
 
5
5
  require 'mkmf'
6
6
 
7
- LIBDIR = RbConfig::CONFIG['libdir']
8
-
9
- INCLUDEDIR = RbConfig::CONFIG['includedir']
10
-
11
- header_dirs = [
12
- # First search /opt/local for macports
13
- '/opt/local/include',
14
-
15
- # Then search /usr/local for people that installed from source
16
- '/usr/local/include',
17
-
18
- # Check the ruby install locations
19
- INCLUDEDIR,
20
-
21
- # Finally fall back to /usr
22
- '/usr/include'
23
- ]
24
-
25
- lib_dirs = [
26
- # First search /opt/local for macports
27
- '/opt/local/lib',
28
-
29
- # Then search /usr/local for people that installed from source
30
- '/usr/local/lib',
31
-
32
- # Check the ruby install locations
33
- LIBDIR,
34
-
35
- # Finally fall back to /usr
36
- '/usr/lib'
37
- ]
38
-
39
- # Detect homebrew installs
40
- if find_executable('brew')
41
- brew_prefix = `brew --prefix`.strip
42
- header_dirs.unshift "#{brew_prefix}/include"
43
- lib_dirs.unshift "#{brew_prefix}/lib"
44
- end
45
-
46
- dir_config('mini_phone', header_dirs, lib_dirs)
47
-
48
7
  unless have_library('phonenumber')
49
8
  abort <<~MSG
50
9
 
@@ -70,7 +29,9 @@ unless have_library('phonenumber')
70
29
  MSG
71
30
  end
72
31
 
73
- $CXXFLAGS += ' -std=c++11 '
32
+ dir_config('mini_phone')
33
+
34
+ $CXXFLAGS += ' -std=c++11 -ofast '
74
35
 
75
36
  create_makefile('mini_phone/mini_phone')
76
37
 
@@ -30,7 +30,7 @@ static inline VALUE is_phone_number_valid(VALUE self, VALUE str, VALUE cc) {
30
30
  }
31
31
 
32
32
  extern "C" VALUE rb_is_phone_number_valid(VALUE self, VALUE str) {
33
- VALUE def_cc = rb_iv_get(rb_mMiniPhone, "@default_country_code");
33
+ VALUE def_cc = rb_iv_get(rb_mMiniPhone, "@default_country");
34
34
 
35
35
  return is_phone_number_valid(self, str, def_cc);
36
36
  }
@@ -51,7 +51,7 @@ extern "C" VALUE rb_is_phone_number_possible(VALUE self, VALUE str) {
51
51
  PhoneNumber parsed_number;
52
52
  PhoneNumberUtil *phone_util = PhoneNumberUtil::GetInstance();
53
53
 
54
- VALUE def_cc = rb_iv_get(rb_mMiniPhone, "@default_country_code");
54
+ VALUE def_cc = rb_iv_get(rb_mMiniPhone, "@default_country");
55
55
  std::string phone_number(RSTRING_PTR(str), RSTRING_LEN(str));
56
56
  std::string country_code(RSTRING_PTR(def_cc), RSTRING_LEN(def_cc));
57
57
 
@@ -68,11 +68,11 @@ extern "C" VALUE rb_is_phone_number_impossible(VALUE self, VALUE str) {
68
68
  return rb_is_phone_number_possible(self, str) == Qtrue ? Qfalse : Qtrue;
69
69
  }
70
70
 
71
- extern "C" VALUE rb_set_default_country_code(VALUE self, VALUE str_code) {
72
- return rb_iv_set(self, "@default_country_code", str_code);
71
+ extern "C" VALUE rb_set_default_country(VALUE self, VALUE str_code) {
72
+ return rb_iv_set(self, "@default_country", str_code);
73
73
  }
74
74
 
75
- extern "C" VALUE rb_get_default_country_code(VALUE self) { return rb_iv_get(self, "@default_country_code"); }
75
+ extern "C" VALUE rb_get_default_country(VALUE self) { return rb_iv_get(self, "@default_country"); }
76
76
 
77
77
  extern "C" void rb_phone_number_dealloc(PhoneNumberInfo *phone_number_info) { delete phone_number_info; }
78
78
 
@@ -108,7 +108,7 @@ extern "C" VALUE rb_phone_number_initialize(int argc, VALUE *argv, VALUE self) {
108
108
  rb_scan_args(argc, argv, "11", &str, &def_cc);
109
109
 
110
110
  if (NIL_P(def_cc)) {
111
- def_cc = rb_iv_get(rb_mMiniPhone, "@default_country_code");
111
+ def_cc = rb_iv_get(rb_mMiniPhone, "@default_country");
112
112
  }
113
113
 
114
114
  rb_iv_set(self, "@input", str);
@@ -339,7 +339,7 @@ extern "C" void Init_mini_phone(void) {
339
339
  rb_mMiniPhone = rb_define_module("MiniPhone");
340
340
 
341
341
  // Unknown
342
- rb_iv_set(rb_mMiniPhone, "@default_country_code", rb_str_new("ZZ", 2));
342
+ rb_iv_set(rb_mMiniPhone, "@default_country", rb_str_new("ZZ", 2));
343
343
 
344
344
  rb_define_module_function(rb_mMiniPhone, "valid?", reinterpret_cast<VALUE (*)(...)>(rb_is_phone_number_valid), 1);
345
345
  rb_define_module_function(rb_mMiniPhone, "valid_for_country?",
@@ -351,9 +351,9 @@ extern "C" void Init_mini_phone(void) {
351
351
  rb_define_module_function(rb_mMiniPhone, "impossible?", reinterpret_cast<VALUE (*)(...)>(rb_is_phone_number_invalid),
352
352
  1);
353
353
  rb_define_module_function(rb_mMiniPhone,
354
- "default_country_code=", reinterpret_cast<VALUE (*)(...)>(rb_set_default_country_code), 1);
355
- rb_define_module_function(rb_mMiniPhone, "default_country_code",
356
- reinterpret_cast<VALUE (*)(...)>(rb_get_default_country_code), 0);
354
+ "default_country=", reinterpret_cast<VALUE (*)(...)>(rb_set_default_country), 1);
355
+ rb_define_module_function(rb_mMiniPhone, "default_country",
356
+ reinterpret_cast<VALUE (*)(...)>(rb_get_default_country), 0);
357
357
  rb_define_module_function(rb_mMiniPhone, "parse", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_parse), -1);
358
358
 
359
359
  rb_cPhoneNumber = rb_define_class_under(rb_mMiniPhone, "PhoneNumber", rb_cObject);
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MiniPhone
4
- VERSION = '0.1.6'
4
+ VERSION = '1.0.2'
5
5
  end
@@ -27,7 +27,10 @@ Gem::Specification.new do |spec|
27
27
  # Specify which files should be added to the gem when it is released.
28
28
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
29
29
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
30
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(bin|spec|bench)/}) }
30
+ `git ls-files -z`
31
+ .split("\x0")
32
+ .reject { |f| f.match(%r{^(bin|spec|bench)/}) }
33
+ .reject { |f| f.start_with?('.') }
31
34
  end
32
35
  spec.bindir = 'exe'
33
36
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_phone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Ker-Seymer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-05 00:00:00.000000000 Z
11
+ date: 2021-01-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Plugs directly in the the Google's native C++ [libphonenumber](https://github.com/google/libphonenumber)
14
14
  for extemely _fast_ and _robust_ phone number parsing, validation, and formatting.
@@ -20,13 +20,6 @@ extensions:
20
20
  - ext/mini_phone/extconf.rb
21
21
  extra_rdoc_files: []
22
22
  files:
23
- - ".clang-format"
24
- - ".github/workflows/ci.yml"
25
- - ".github/workflows/release.yml"
26
- - ".gitignore"
27
- - ".rspec"
28
- - ".rubocop.yml"
29
- - ".travis.yml"
30
23
  - CHANGELOG.md
31
24
  - CODE_OF_CONDUCT.md
32
25
  - Gemfile
@@ -1,3 +0,0 @@
1
- ---
2
- BasedOnStyle: LLVM
3
- ColumnLimit: 120
@@ -1,51 +0,0 @@
1
- ---
2
- name: CI
3
-
4
- on: push
5
-
6
- jobs:
7
- build:
8
- strategy:
9
- fail-fast: false
10
- matrix:
11
- ruby: ["2.5", "2.6", "2.7"]
12
- os: [ubuntu-latest, macos-latest]
13
- experimental: [false]
14
- # include:
15
- # - ruby: "truffleruby"
16
- # os: ubuntu-latest
17
- # experimental: true
18
- # - ruby: "truffleruby"
19
- # os: macos-latest
20
- # experimental: true
21
- name: ${{ matrix.ruby }} on ${{ matrix.os }}
22
- runs-on: ${{ matrix.os }}
23
- continue-on-error: ${{ matrix.experimental }}
24
- env:
25
- CI_EXPERIMENTAL: ${{ matrix.experimental }}
26
- steps:
27
- - uses: actions/checkout@v2
28
-
29
- - uses: ruby/setup-ruby@v1
30
- with:
31
- ruby-version: ${{ matrix.ruby }}
32
-
33
- - name: Install dependencies (system)
34
- if: ${{ matrix.os == 'ubuntu-latest' }}
35
- run: sudo apt-get -yqq install libphonenumber-dev
36
-
37
- - name: Install dependencies (system)
38
- if: ${{ matrix.os == 'macos-latest' }}
39
- run: brew install --build-from-source libphonenumber && brew link libphonenumber
40
-
41
- - name: Install dependencies (ruby)
42
- run: gem install bundler && bundle install --jobs 4 --retry 3
43
-
44
- - name: Compile
45
- run: bundle exec rake compile
46
-
47
- - name: RSpec
48
- run: bundle exec rspec --format RSpec::Github::Formatter --format documentation
49
-
50
- - name: Rubocop
51
- run: bundle exec rubocop --format github
@@ -1,55 +0,0 @@
1
- ---
2
- name: Release
3
-
4
- on:
5
- push:
6
- tags:
7
- - "v*"
8
-
9
- jobs:
10
- build:
11
- strategy:
12
- fail-fast: false
13
- matrix:
14
- ruby: ["2.7"]
15
- os: [ubuntu-latest, macos-latest]
16
- name: ${{ matrix.os }}
17
- runs-on: ${{ matrix.os }}
18
- steps:
19
- - uses: actions/checkout@v2
20
-
21
- - uses: ruby/setup-ruby@v1
22
- with:
23
- ruby-version: ${{ matrix.ruby }}
24
-
25
- - name: Install dependencies (system)
26
- if: ${{ matrix.os == 'ubuntu-latest' }}
27
- run: sudo apt-get -yqq install libphonenumber-dev
28
-
29
- - name: Install dependencies (system)
30
- if: ${{ matrix.os == 'macos-latest' }}
31
- run: brew install --build-from-source libphonenumber && brew link libphonenumber
32
-
33
- - name: Install dependencies (ruby)
34
- run: gem install bundler && bundle install --jobs 4 --retry 3
35
-
36
- - name: Login
37
- run: |
38
- mkdir -p ~/.gem
39
-
40
- cat << EOF > ~/.gem/credentials
41
- ---
42
- :github: ${GITHUB_AUTH_TOKEN}
43
- :rubygems_api_key: ${RUBYGEMS_AUTH_TOKEN}
44
- EOF
45
-
46
- chmod 0600 ~/.gem/credentials
47
- env:
48
- GITHUB_AUTH_TOKEN: "Bearer ${{secrets.GITHUB_TOKEN}}"
49
- RUBYGEMS_AUTH_TOKEN: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
50
- OWNER: ${{ github.repository_owner }}
51
-
52
- - name: 🛳 Ship it
53
- run: |
54
- bundle exec rake publish:native
55
- bundle exec rake publish:non_native || true
data/.gitignore DELETED
@@ -1,19 +0,0 @@
1
- .bundle/
2
- .yardoc
3
- _yardoc/
4
- coverage/
5
- doc/
6
- pkg/
7
- spec/reports/
8
- tmp/
9
- *.bundle
10
- *.so
11
- *.o
12
- *.a
13
- mkmf.log
14
-
15
- # rspec failure tracking
16
- .rspec_status
17
- Gemfile.lock
18
- vendor/cache/
19
- *.gem
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
@@ -1,18 +0,0 @@
1
- # The behavior of RuboCop can be controlled via the .rubocop.yml
2
- # configuration file. It makes it possible to enable/disable
3
- # certain cops (checks) and to alter their behavior if they accept
4
- # any parameters. The file can be placed either in your home
5
- # directory or in some project directory.
6
- #
7
- # RuboCop will start looking for the configuration file in the directory
8
- # where the inspected file is and continue its way up to the root directory.
9
- #
10
- # See https://docs.rubocop.org/rubocop/configuration
11
- AllCops:
12
- TargetRubyVersion: 2.5
13
- NewCops: enable
14
- SuggestExtensions: false
15
-
16
- Metrics/BlockLength:
17
- Exclude:
18
- - spec/**/*
@@ -1,6 +0,0 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.7.1
6
- before_install: gem install bundler -v 2.1.4