mini_phone 0.1.3 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ecd792546c1404a41c162138a718cd788795d891aac24c97ee87b3df382f431e
4
- data.tar.gz: c77a185fce6abd249a5d0cabf92d718869ac3a99b0eb7c8596f64595582c00a6
3
+ metadata.gz: 7aeb4f877c1a92925416a7642c331cc9229233bdc070b877cb1b8801241dd6f8
4
+ data.tar.gz: 7262c82936a62c6d6e32123f23b2189a4eddc870cb708eb06784658785080e68
5
5
  SHA512:
6
- metadata.gz: 99a20b5158402162ee9f2d10732c1d4ec07e18b2395d823ee2e5573059dfbc04c7815102eded133e38958b4b8573290287e9acccba9436be763bc7eb9763dd8f
7
- data.tar.gz: 54e2043235f832e46a48bd94a9fb01c9e4ac30fc1e34835d9889fb3702bef96282adf5db5f6cce5d62b40ca095d6d4553a8c550465c1a244d882bea9767ae63a
6
+ metadata.gz: e6bf08052c013aa7bbd6a49ebbe47ab8ee356c32866e7b0a2048751ca16c407e9efc65593a400b5fe2440bbc9c5ea424f1489561d05e0e107064d068b1f02a8a
7
+ data.tar.gz: 121ef682de85616bf54075dd70246669b2228234795856fe12cc323a58fe7d89685a660084f3c7c5246e5a83bfdd55a4f17b4be08b44a12ae1ce5de21f3a7e21
@@ -8,7 +8,7 @@ jobs:
8
8
  strategy:
9
9
  fail-fast: false
10
10
  matrix:
11
- ruby: ["2.5", "2.6", "2.7"]
11
+ ruby: ["2.5", "2.6", "2.7", "3.0"]
12
12
  os: [ubuntu-latest, macos-latest]
13
13
  experimental: [false]
14
14
  # include:
@@ -12,7 +12,12 @@ AllCops:
12
12
  TargetRubyVersion: 2.5
13
13
  NewCops: enable
14
14
  SuggestExtensions: false
15
+ Exclude:
16
+ - pkg/**/*
17
+ - tmp/**/*
15
18
 
16
19
  Metrics/BlockLength:
17
20
  Exclude:
18
21
  - spec/**/*
22
+ - Rakefile
23
+ - Gemfile
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
@@ -32,31 +32,42 @@ task :deploy do
32
32
  sh 'code -w ./lib/mini_phone/version.rb'
33
33
  version = `ruby -r ./lib/mini_phone/version.rb -e 'print MiniPhone::VERSION'`.strip
34
34
  sh "git commit -am 'Bump to v#{version} :confetti_ball:'"
35
- sh 'bundle exec rake release'
35
+ sh 'gem_push=no bundle exec rake release'
36
36
  end
37
37
 
38
38
  namespace :publish do
39
39
  def push_to_github_registry(gem)
40
40
  puts "Pushing #{gem} to GitHub Package Registry"
41
41
  sh "gem push #{gem} --host https://rubygems.pkg.github.com/ianks --key github"
42
+ true
43
+ rescue StandardError
44
+ warn 'Could not publish to Github Package Registry'
45
+ false
42
46
  end
43
47
 
44
48
  def push_to_rubygems(gem)
45
- puts "Pushing #{gem} to Rubygems"
49
+ puts "Pushing #{gem} to rubygems"
46
50
  sh "gem push #{gem}"
51
+ true
52
+ rescue StandardError
53
+ warn 'Could not publish to rubygems'
54
+ false
47
55
  end
48
56
 
49
57
  task native: %i[native gem] do
50
58
  g = "./pkg/mini_phone-#{MiniPhone::VERSION}-#{Gem::Platform.new(RUBY_PLATFORM)}.gem"
51
59
 
52
- push_to_github_registry(g)
53
60
  push_to_rubygems(g)
54
61
  end
55
62
 
56
63
  task non_native: [:gem] do
57
64
  g = "./pkg/mini_phone-#{MiniPhone::VERSION}.gem"
58
65
 
59
- push_to_github_registry(g)
60
- push_to_rubygems(g)
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 }
61
72
  end
62
73
  end
@@ -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.3'
4
+ VERSION = '1.0.0'
5
5
  end
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.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Ker-Seymer
8
- autorequire:
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.
@@ -47,7 +47,7 @@ metadata:
47
47
  homepage_uri: https://github.com/ianks/mini_phone
48
48
  source_code_uri: https://github.com/ianks/mini_phone
49
49
  changelog_uri: https://github.com/ianks/mini_phone/blob/master/CHANGELOG.md
50
- post_install_message:
50
+ post_install_message:
51
51
  rdoc_options: []
52
52
  require_paths:
53
53
  - lib
@@ -62,8 +62,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0'
64
64
  requirements: []
65
- rubygems_version: 3.1.2
66
- signing_key:
65
+ rubygems_version: 3.1.4
66
+ signing_key:
67
67
  specification_version: 4
68
68
  summary: Uses the Google libphonenumber C lib to parse, validate, and format phone
69
69
  numbers