phonelib 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +9 -3
  3. data/data/extended_data.dat +0 -0
  4. data/data/libphonenumber/README.md +1 -1
  5. data/data/libphonenumber/cpp/src/phonenumbers/lite_metadata.cc +6313 -6305
  6. data/data/libphonenumber/cpp/src/phonenumbers/metadata.cc +5989 -5980
  7. data/data/libphonenumber/cpp/src/phonenumbers/short_metadata.cc +2063 -1977
  8. data/data/libphonenumber/java/build.xml +30 -0
  9. data/data/libphonenumber/java/carrier/pom.xml +4 -4
  10. data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/227_en +0 -0
  11. data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/231_en +0 -0
  12. data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/252_en +0 -0
  13. data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/254_en +0 -0
  14. data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/255_en +0 -0
  15. data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/40_en +0 -0
  16. data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/509_en +0 -0
  17. data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/91_en +0 -0
  18. data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/95_en +0 -0
  19. data/data/libphonenumber/java/demo/pom.xml +5 -5
  20. data/data/libphonenumber/java/geocoder/pom.xml +4 -4
  21. data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1854_en +0 -0
  22. data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/264_en +0 -0
  23. data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/config +0 -0
  24. data/data/libphonenumber/java/internal/prefixmapper/pom.xml +3 -3
  25. data/data/libphonenumber/java/libphonenumber/pom.xml +16 -2
  26. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/ShortNumbersRegionCodeSet.java +8 -2
  27. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/SingleFileMetadataSourceImpl.java +98 -0
  28. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IN +0 -0
  29. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KE +0 -0
  30. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LR +0 -0
  31. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MM +0 -0
  32. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MR +0 -0
  33. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NA +0 -0
  34. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NE +0 -0
  35. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PT +0 -0
  36. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RO +0 -0
  37. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SO +0 -0
  38. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TZ +0 -0
  39. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_US +0 -0
  40. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_CD +0 -0
  41. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_CF +0 -0
  42. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_CG +0 -0
  43. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_ER +0 -0
  44. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_KP +0 -0
  45. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_NE +0 -0
  46. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_NO +0 -0
  47. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_PT +0 -0
  48. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_SO +0 -0
  49. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/SingleFilePhoneNumberMetadataProto +0 -0
  50. data/data/libphonenumber/java/libphonenumber/test/com/google/i18n/phonenumbers/data/SingleFilePhoneNumberMetadataProtoForTesting +0 -0
  51. data/data/libphonenumber/java/pom.xml +1 -1
  52. data/data/libphonenumber/java/release_notes.txt +12 -0
  53. data/data/libphonenumber/javascript/README.md +86 -0
  54. data/data/libphonenumber/javascript/i18n/phonenumbers/demo-compiled.js +73 -73
  55. data/data/libphonenumber/javascript/i18n/phonenumbers/metadata.js +29 -29
  56. data/data/libphonenumber/javascript/i18n/phonenumbers/metadatalite.js +29 -29
  57. data/data/libphonenumber/resources/PhoneNumberMetadata.xml +86 -66
  58. data/data/libphonenumber/resources/ShortNumberMetadata.xml +276 -24
  59. data/data/libphonenumber/resources/carrier/en/227.txt +1 -0
  60. data/data/libphonenumber/resources/carrier/en/231.txt +3 -0
  61. data/data/libphonenumber/resources/carrier/en/252.txt +3 -0
  62. data/data/libphonenumber/resources/carrier/en/254.txt +3 -0
  63. data/data/libphonenumber/resources/carrier/en/255.txt +6 -0
  64. data/data/libphonenumber/resources/carrier/en/40.txt +1 -0
  65. data/data/libphonenumber/resources/carrier/en/509.txt +5 -5
  66. data/data/libphonenumber/resources/carrier/en/880.txt +1 -1
  67. data/data/libphonenumber/resources/carrier/en/91.txt +37 -4
  68. data/data/libphonenumber/resources/carrier/en/95.txt +29 -0
  69. data/data/libphonenumber/resources/geocoding/en/1.txt +1 -0
  70. data/data/libphonenumber/resources/geocoding/en/264.txt +1 -0
  71. data/data/libphonenumber/tools/java/cpp-build/target/cpp-build-1.0-SNAPSHOT-jar-with-dependencies.jar +0 -0
  72. data/data/libphonenumber/tools/java/java-build/src/com/google/i18n/phonenumbers/BuildMetadataProtoFromXml.java +32 -14
  73. data/data/libphonenumber/tools/java/java-build/target/java-build-1.0-SNAPSHOT-jar-with-dependencies.jar +0 -0
  74. data/data/phone_data.dat +0 -0
  75. data/lib/phonelib/core.rb +15 -0
  76. data/lib/phonelib/data_importer.rb +12 -0
  77. data/lib/phonelib/phone_analyzer.rb +6 -109
  78. data/lib/phonelib/phone_analyzer_helper.rb +128 -0
  79. data/lib/phonelib/version.rb +1 -1
  80. data/lib/phonelib.rb +1 -0
  81. metadata +28 -3
  82. data/data/libphonenumber/javascript/README +0 -101
@@ -0,0 +1,128 @@
1
+ module Phonelib
2
+ module PhoneAnalyzerHelper
3
+ private
4
+
5
+ # caches regular expression, reusing it for later lookups
6
+ def cr(regexp)
7
+ Phonelib.phone_regexp_cache[regexp] ||= Regexp.new(regexp)
8
+ end
9
+
10
+ # checks if country can have numbers with double country prefixes
11
+ #
12
+ # ==== Attributes
13
+ #
14
+ # * +data+ - country data used for parsing
15
+ # * +phone+ - phone number being parsed
16
+ # * +parsed+ - parsed regex match for phone
17
+ def allows_double_prefix(data, phone, parsed)
18
+ data[Core::DOUBLE_COUNTRY_PREFIX_FLAG] &&
19
+ phone =~ cr("^#{data[Core::COUNTRY_CODE]}") &&
20
+ parsed && (parsed[:valid].nil? || parsed[:valid].empty?)
21
+ end
22
+
23
+ # Get country that was provided or default country in needable format
24
+ #
25
+ # ==== Attributes
26
+ #
27
+ # * +country+ - country passed for parsing
28
+ def country_or_default_country(country)
29
+ country = country || Phonelib.default_country
30
+ country && country.to_s.upcase
31
+ end
32
+
33
+ # constructs full regex for phone validation for provided phone data
34
+ # (international prefix, country code, national prefix, valid number)
35
+ #
36
+ # ==== Attributes
37
+ #
38
+ # * +data+ - country data hash
39
+ # * +country_optional+ - whether to put country code as optional group
40
+ def full_regex_for_data(data, type, country_optional = true)
41
+ regex = []
42
+ regex << "(#{data[Core::INTERNATIONAL_PREFIX]})?"
43
+ regex << if country_optional
44
+ "(#{data[Core::COUNTRY_CODE]})?"
45
+ else
46
+ data[Core::COUNTRY_CODE]
47
+ end
48
+ regex << "(#{data[Core::NATIONAL_PREFIX_FOR_PARSING] || data[Core::NATIONAL_PREFIX]})?"
49
+ regex << "(#{data[Core::TYPES][Core::GENERAL][type]})"
50
+
51
+ cr("^#{regex.join}$")
52
+ end
53
+
54
+ # Check if phone match country data
55
+ #
56
+ # ==== Attributes
57
+ #
58
+ # * +phone+ - phone number for parsing
59
+ # * +data+ - country data
60
+ def phone_match_data?(phone, data, possible = false)
61
+ country_code = "#{data[Core::COUNTRY_CODE]}"
62
+ inter_prefix = "(#{data[Core::INTERNATIONAL_PREFIX]})?"
63
+ return unless phone.match cr("^#{inter_prefix}#{country_code}")
64
+
65
+ type = possible ? Core::POSSIBLE_PATTERN : Core::VALID_PATTERN
66
+ phone.match full_regex_for_data(data, type, false)
67
+ end
68
+
69
+ # checks if types has both :mobile and :fixed_line and replaces it with
70
+ # :fixed_or_mobile in case both present
71
+ def sanitize_fixed_mobile(types)
72
+ fixed_mobile = [Core::FIXED_LINE, Core::MOBILE]
73
+ [:possible, :valid].each do |key|
74
+ if (fixed_mobile - types[key]).empty?
75
+ types[key] = types[key] - fixed_mobile + [Core::FIXED_OR_MOBILE]
76
+ end
77
+ end
78
+ types
79
+ end
80
+
81
+ # returns array of phone types for check for current country data
82
+ #
83
+ # ==== Attributes
84
+ #
85
+ # * +data+ - country data hash
86
+ def types_for_check(data)
87
+ exclude_list = PhoneAnalyzer::NOT_FOR_CHECK
88
+ exclude_list += Phonelib::Core::SHORT_CODES unless Phonelib.parse_special
89
+ Core::TYPES_DESC.keys - exclude_list + fixed_and_mobile_keys(data)
90
+ end
91
+
92
+ # Checks if fixed line pattern and mobile pattern are the same and returns
93
+ # appropriate keys
94
+ #
95
+ # ==== Attributes
96
+ #
97
+ # * +data+ - country data
98
+ def fixed_and_mobile_keys(data)
99
+ if data[Core::FIXED_LINE] == data[Core::MOBILE]
100
+ [Core::FIXED_OR_MOBILE]
101
+ else
102
+ [Core::FIXED_LINE, Core::MOBILE]
103
+ end
104
+ end
105
+
106
+ # Checks if passed number matches valid and possible patterns
107
+ #
108
+ # ==== Attributes
109
+ #
110
+ # * +number+ - phone number for validation
111
+ # * +possible_pattern+ - possible pattern for validation
112
+ # * +national_pattern+ - valid pattern for validation
113
+ def number_valid_and_possible?(number, possible_pattern, national_pattern)
114
+ possible_match = number.match(cr("^(?:#{possible_pattern})$"))
115
+ possible = possible_match && possible_match.to_s.length == number.length
116
+
117
+ return [possible, possible] if possible_pattern == national_pattern
118
+ valid = false
119
+ if possible
120
+ # doing national pattern match only in case possible matches
121
+ national_match = number.match(cr("^(?:#{national_pattern})$"))
122
+ valid = national_match && national_match.to_s.length == number.length
123
+ end
124
+
125
+ [valid && possible, possible]
126
+ end
127
+ end
128
+ end
@@ -1,5 +1,5 @@
1
1
  # :nodoc:
2
2
  module Phonelib
3
3
  # :nodoc:
4
- VERSION = '0.5.0'
4
+ VERSION = '0.5.1'
5
5
  end
data/lib/phonelib.rb CHANGED
@@ -4,6 +4,7 @@ module Phonelib
4
4
  autoload :Core, 'phonelib/core'
5
5
  autoload :Phone, 'phonelib/phone'
6
6
  autoload :PhoneAnalyzer, 'phonelib/phone_analyzer'
7
+ autoload :PhoneAnalyzerHelper, 'phonelib/phone_analyzer_helper'
7
8
  autoload :PhoneExtendedData, 'phonelib/phone_extended_data'
8
9
 
9
10
  extend Module.new {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phonelib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vadim Senderovich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-04 00:00:00.000000000 Z
11
+ date: 2015-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 2.14.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: codeclimate-test-reporter
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: |2
70
84
  Google libphonenumber library was taken as a basis for
71
85
  this gem. Gem uses its data file for validations and number formatting.
@@ -684,6 +698,7 @@ files:
684
698
  - data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1848_en
685
699
  - data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1850_en
686
700
  - data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1851_en
701
+ - data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1854_en
687
702
  - data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1856_en
688
703
  - data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1857_en
689
704
  - data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1858_en
@@ -962,6 +977,7 @@ files:
962
977
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/ShortNumberInfo.java
963
978
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/ShortNumberUtil.java
964
979
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/ShortNumbersRegionCodeSet.java
980
+ - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/SingleFileMetadataSourceImpl.java
965
981
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_255
966
982
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_27
967
983
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_30
@@ -1298,6 +1314,8 @@ files:
1298
1314
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_CA
1299
1315
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_CC
1300
1316
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_CD
1317
+ - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_CF
1318
+ - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_CG
1301
1319
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_CH
1302
1320
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_CI
1303
1321
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_CK
@@ -1322,6 +1340,7 @@ files:
1322
1340
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_EE
1323
1341
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_EG
1324
1342
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_EH
1343
+ - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_ER
1325
1344
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_ES
1326
1345
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_ET
1327
1346
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_FI
@@ -1371,6 +1390,7 @@ files:
1371
1390
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_KI
1372
1391
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_KM
1373
1392
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_KN
1393
+ - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_KP
1374
1394
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_KR
1375
1395
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_KW
1376
1396
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_KY
@@ -1411,6 +1431,7 @@ files:
1411
1431
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_MZ
1412
1432
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_NA
1413
1433
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_NC
1434
+ - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_NE
1414
1435
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_NF
1415
1436
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_NG
1416
1437
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_NI
@@ -1452,6 +1473,7 @@ files:
1452
1473
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_SL
1453
1474
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_SM
1454
1475
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_SN
1476
+ - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_SO
1455
1477
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_SR
1456
1478
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_ST
1457
1479
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_SV
@@ -1491,6 +1513,7 @@ files:
1491
1513
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_ZA
1492
1514
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_ZM
1493
1515
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_ZW
1516
+ - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/SingleFilePhoneNumberMetadataProto
1494
1517
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/internal/MatcherApi.java
1495
1518
  - data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/internal/RegexBasedMatcher.java
1496
1519
  - data/libphonenumber/java/libphonenumber/test/com/google/i18n/phonenumbers/AsYouTypeFormatterTest.java
@@ -1538,6 +1561,7 @@ files:
1538
1561
  - data/libphonenumber/java/libphonenumber/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_SG
1539
1562
  - data/libphonenumber/java/libphonenumber/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_US
1540
1563
  - data/libphonenumber/java/libphonenumber/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_YT
1564
+ - data/libphonenumber/java/libphonenumber/test/com/google/i18n/phonenumbers/data/SingleFilePhoneNumberMetadataProtoForTesting
1541
1565
  - data/libphonenumber/java/pom.xml
1542
1566
  - data/libphonenumber/java/release_notes.txt
1543
1567
  - data/libphonenumber/javadoc/allclasses-frame.html
@@ -1565,7 +1589,7 @@ files:
1565
1589
  - data/libphonenumber/javadoc/resources/inherit.gif
1566
1590
  - data/libphonenumber/javadoc/serialized-form.html
1567
1591
  - data/libphonenumber/javadoc/stylesheet.css
1568
- - data/libphonenumber/javascript/README
1592
+ - data/libphonenumber/javascript/README.md
1569
1593
  - data/libphonenumber/javascript/build.xml
1570
1594
  - data/libphonenumber/javascript/i18n/phonenumbers/asyoutypeformatter.js
1571
1595
  - data/libphonenumber/javascript/i18n/phonenumbers/asyoutypeformatter_test.html
@@ -1990,6 +2014,7 @@ files:
1990
2014
  - lib/phonelib/data_importer_helper.rb
1991
2015
  - lib/phonelib/phone.rb
1992
2016
  - lib/phonelib/phone_analyzer.rb
2017
+ - lib/phonelib/phone_analyzer_helper.rb
1993
2018
  - lib/phonelib/phone_extended_data.rb
1994
2019
  - lib/phonelib/version.rb
1995
2020
  - lib/tasks/phonelib_tasks.rake
@@ -1,101 +0,0 @@
1
- Info:
2
- =====
3
- Google's JavaScript library for parsing, formatting, and validating
4
- international phone numbers.
5
-
6
-
7
- How to setup:
8
- =============
9
- 1. Checkout closure-library, closure-compiler, closure-linter and python-gflags
10
- next to libphonenumber:
11
-
12
- e.g.
13
- git clone https://github.com/googlei18n/libphonenumber/
14
- git clone https://github.com/google/closure-library/
15
- git clone https://github.com/google/closure-compiler.git
16
- svn checkout http://closure-linter.googlecode.com/svn/trunk/ ~/src/closure-linter
17
- svn checkout http://python-gflags.googlecode.com/svn/trunk/ ~/src/python-gflags
18
-
19
- (If you don't checkout the dependencies next to libphonenumber:
20
- a. change the path of the <script src=""> in the html pages to point to wherever
21
- base.js is located
22
- b. update javascript/build.xml with the correct paths)
23
-
24
- 2. Run the unit tests to make sure everything is working. Open the following
25
- pages with your web browser:
26
- javascript/i18n/phonenumbers/phonenumberutil_test.html
27
- javascript/i18n/phonenumbers/asyoutypeformatter_test.html
28
-
29
- 3. Run the demo: javascript/i18n/phonenumbers/demo.html
30
-
31
-
32
- How to compile:
33
- ===============
34
- 1. Build Closure's compiler.jar:
35
-
36
- e.g.
37
- ant -f ~/src/closure-compiler/build.xml
38
-
39
- 2. Compile the demo.js and all its dependencies to one file: demo-compiled.js:
40
-
41
- ant -f javascript/build.xml compile-demo
42
-
43
- 3. Run the compiled demo: javascript/i18n/phonenumbers/demo-compiled.html
44
-
45
-
46
- How to use:
47
- ===========
48
- To use and compile the library in your own project, use the
49
- javascript/i18n/phonenumbers/demo.js as an example. You will need to
50
- goog.exportSymbol all the methods you use in your html so that the compiler
51
- won't rename them. You can then invoke the compiler similarly to how the
52
- compile-demo ant target in javascript/build.xml invokes it.
53
-
54
-
55
- How to update:
56
- ==============
57
- The JavaScript library is ported from the Java implementation (revision 536).
58
- When the Java project gets updated follow these steps to update the JavaScript
59
- project:
60
-
61
- 1. If the protocol buffers (phonemetadata.proto and phonenumber.proto)
62
- have changed:
63
- a. Manually update the .pb.js files with the changes of the .proto files.
64
- b. Manually update the toJsArray() Java methods in
65
- tools/java/java-build/src/com/google/i18n/phonenumbers/BuildMetadataJsonFromXml.java
66
- c. Build tools/java/java-build/target/java-build-1.0-SNAPSHOT-jar-with-dependencies.jar
67
- by running:
68
- mvn -f tools/java/java-build/pom.xml package
69
-
70
- 2. If the phone number metadata in the XML format has changed
71
- (resources/PhoneNumberMetadata.xml)
72
- run the following commands to regenerate metadata.js and
73
- metadatafortesting.js:
74
-
75
- ant -f java/build.xml build-js-metadata
76
-
77
- 3. Manually port any changes of the Java code to the JavaScript code:
78
- PhoneNumberUtil.java => phonenumberutil.js
79
- AsYouTypeFormatter.java => asyoutypeformatter.js
80
- PhoneNumberUtilTest.java => phonenumberutil_test.js
81
- AsYouTypeFormatterTest.java => asyoutypeformatter_test.js
82
-
83
- 4. Run the Closure Compiler to get your changes syntax and type checked.
84
- This will also generate demo-compiled.js used by demo-compiler.html
85
- (TODO: Use target "compile" rather than "compile-demo" once
86
- visibility issues for getExtractedNationalPrefix_ have been resolved):
87
-
88
- ant -f javascript/build.xml compile-demo
89
-
90
- 5. Run the Closure Linter to lint the JavaScript files:
91
-
92
- ant -f javascript/build.xml lint
93
-
94
-
95
- TODO:
96
- =====
97
- Port functionality to extract phone-numbers from text (findNumbers).
98
- Port offline phone number geocoder.
99
- Enable PhoneNumberUtil to handle all digits, rather than a subset
100
- (JavaScript has no equivalent to the Java Character.digit).
101
- Port ShortNumberInfo.