phil_locator 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -2
- data/VERSION +1 -1
- data/app/models/phil_locator/barangay.rb +1 -1
- data/app/models/phil_locator/city.rb +1 -1
- data/app/models/phil_locator/province.rb +1 -1
- data/app/models/phil_locator/region.rb +1 -1
- data/lib/phil_locator/configuration.rb +9 -0
- data/lib/phil_locator/version.rb +0 -1
- data/lib/phil_locator.rb +25 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d12c866185b3ac196dd2c202802764a178c7663d15fe084e9e993269579a0fc
|
4
|
+
data.tar.gz: d41b0da954548f50efb380e1059ed3fc02a134a4fdf4fdec2ca0b9f8e5dba713
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 936dd12ab5f7cd65acee6c9b45f7c08184d6e6d6a906ef0b0cdfa7c98bea147d8dc2ee51457a4b016b036936a3d451aed24ee763422c7fe4162937f6b1739307
|
7
|
+
data.tar.gz: 8b9db0d51dee215b70bade15c1e09df50502342cbcf4bd72b6233f99fd14f164666aac01dc1a97a0264ec15b132c9641962fe93189c9b5b81bf6ccf9a56e9aa3
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Phil Locator
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/phil_locator.svg)](https://badge.fury.io/rb/phil_locator)
|
4
|
+
|
3
5
|
## Build Status
|
4
6
|
[![Maintainability](https://api.codeclimate.com/v1/badges/9cc2694e0d4b21080edc/maintainability)](https://codeclimate.com/github/tenshiAMD/phil_locator/maintainability)
|
5
7
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/9cc2694e0d4b21080edc/test_coverage)](https://codeclimate.com/github/tenshiAMD/phil_locator/test_coverage)
|
@@ -11,12 +13,12 @@ Provides registry records for `regions`, `cities`, `provinces`, and `barangays`
|
|
11
13
|
|
12
14
|
In Gemfile:
|
13
15
|
```
|
14
|
-
gem "phil_locator", "~> 1.
|
16
|
+
gem "phil_locator", "~> 1.2.0"
|
15
17
|
```
|
16
18
|
|
17
19
|
Or, from the command line:
|
18
20
|
```
|
19
|
-
gem install phil_locator -v "~> 1.
|
21
|
+
gem install phil_locator -v "~> 1.2.0"
|
20
22
|
```
|
21
23
|
|
22
24
|
## Usage
|
@@ -35,6 +37,17 @@ PhilLocator::City.all
|
|
35
37
|
PhilLocator::Barangay.all
|
36
38
|
```
|
37
39
|
|
40
|
+
## Configuration
|
41
|
+
|
42
|
+
Create an initializer `phil_locator.rb` to configure the options, here's a sample provided below
|
43
|
+
|
44
|
+
```
|
45
|
+
PhilLocator.configure do |config|
|
46
|
+
# This overrides the default data directory
|
47
|
+
config.data_root_path = Rails.root.join("data").to_s
|
48
|
+
end
|
49
|
+
```
|
50
|
+
|
38
51
|
## Copyright
|
39
52
|
|
40
53
|
Copyright (c) 2019 Angel Aviel Domaoan, released under the [MIT license](/LICENSE).
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
@@ -2,7 +2,7 @@ module PhilLocator
|
|
2
2
|
class Barangay < ActiveYaml::Base
|
3
3
|
include ActiveHash::Associations
|
4
4
|
|
5
|
-
set_root_path
|
5
|
+
set_root_path self.module_parent.data_root_path
|
6
6
|
set_filename "barangays"
|
7
7
|
|
8
8
|
belongs_to :city, class_name: "PhilLocator::City", foreign_key: :city_code, primary_key: :code
|
@@ -2,7 +2,7 @@ module PhilLocator
|
|
2
2
|
class City < ActiveYaml::Base
|
3
3
|
include ActiveHash::Associations
|
4
4
|
|
5
|
-
set_root_path
|
5
|
+
set_root_path self.module_parent.data_root_path
|
6
6
|
set_filename "cities"
|
7
7
|
|
8
8
|
belongs_to :province, class_name: "PhilLocator::Province", foreign_key: :province_code, primary_key: :code
|
@@ -2,7 +2,7 @@ module PhilLocator
|
|
2
2
|
class Province < ActiveYaml::Base
|
3
3
|
include ActiveHash::Associations
|
4
4
|
|
5
|
-
set_root_path
|
5
|
+
set_root_path self.module_parent.data_root_path
|
6
6
|
set_filename "provinces"
|
7
7
|
|
8
8
|
belongs_to :region, class_name: "PhilLocator::Region", foreign_key: :region_code, primary_key: :code
|
@@ -2,7 +2,7 @@ module PhilLocator
|
|
2
2
|
class Region < ActiveYaml::Base
|
3
3
|
include ActiveHash::Associations
|
4
4
|
|
5
|
-
set_root_path
|
5
|
+
set_root_path self.module_parent.data_root_path
|
6
6
|
set_filename "regions"
|
7
7
|
|
8
8
|
has_many :provinces, class_name: "PhilLocator::Province", foreign_key: :region_code, primary_key: :code
|
data/lib/phil_locator/version.rb
CHANGED
data/lib/phil_locator.rb
CHANGED
@@ -1,9 +1,34 @@
|
|
1
1
|
require "active_hash"
|
2
2
|
|
3
|
+
require "phil_locator/configuration"
|
3
4
|
require "phil_locator/version"
|
4
5
|
|
5
6
|
module PhilLocator
|
6
7
|
extend ActiveSupport::Autoload
|
8
|
+
|
9
|
+
mattr_writer :configuration
|
10
|
+
|
11
|
+
def self.configuration
|
12
|
+
@configuration ||= PhilLocator::Configuration.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.configure
|
16
|
+
yield configuration if block_given?
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.data_root_path
|
20
|
+
raise "`#{name}.data_root_path` MUST be a String object." unless configuration.data_root_path.is_a?(String)
|
21
|
+
|
22
|
+
configuration.data_root_path
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.gem_full_path
|
26
|
+
Gem.loaded_specs[gem_name].full_gem_path
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.gem_name
|
30
|
+
name.underscore
|
31
|
+
end
|
7
32
|
end
|
8
33
|
|
9
34
|
require "phil_locator/engine"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phil_locator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Angel Aviel Domaoan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_hash
|
@@ -47,6 +47,7 @@ files:
|
|
47
47
|
- data/provinces.yml
|
48
48
|
- data/regions.yml
|
49
49
|
- lib/phil_locator.rb
|
50
|
+
- lib/phil_locator/configuration.rb
|
50
51
|
- lib/phil_locator/engine.rb
|
51
52
|
- lib/phil_locator/gem_version.rb
|
52
53
|
- lib/phil_locator/version.rb
|
@@ -56,7 +57,7 @@ licenses:
|
|
56
57
|
- MIT
|
57
58
|
metadata:
|
58
59
|
bug_tracker_uri: https://github.com/tenshiAMD/phil_locator/issues
|
59
|
-
source_code_uri: https://github.com/tenshiAMD/phil_locator/tree/v1.
|
60
|
+
source_code_uri: https://github.com/tenshiAMD/phil_locator/tree/v1.2.0
|
60
61
|
post_install_message:
|
61
62
|
rdoc_options: []
|
62
63
|
require_paths:
|