pinas 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/.rspec +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +34 -0
- data/Rakefile +7 -0
- data/lib/generators/pinas/install_generator.rb +19 -0
- data/lib/generators/templates/README +1 -0
- data/lib/generators/templates/migration.rb +23 -0
- data/lib/pinas/data/locations.sql +45131 -0
- data/lib/pinas/location.rb +157 -0
- data/lib/pinas/railtie.rb +9 -0
- data/lib/pinas/version.rb +3 -0
- data/lib/pinas.rb +7 -0
- data/lib/tasks/pinas_tasks.rake +10 -0
- data/pinas.gemspec +32 -0
- data/spec/pinas_spec.rb +6 -0
- data/spec/spec_helper.rb +0 -0
- metadata +168 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bc3a803bb594b9b74a8838ed1f69bcf2d951b9bc
|
4
|
+
data.tar.gz: 10cd31a139fa2806dbb4c3dcbf1cebde4653e949
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 273d0038f43811d09659c93ffc50eb65768ecdd41c0c471c27e960214a76afca12cc6fbd941916f37fac84f520b97efae752578ee7a7abd1a12d32c2e7e9b26f
|
7
|
+
data.tar.gz: 9b576e0300da6ffb948d452349dc4d48ab32f7fc786bf1e8ef4019e66d4daa1a9ef97c9c4fb731737ceae2367bba7a4f96d58b905cc8620701688cbc417efee1
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Allan Andal
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# Pinas
|
2
|
+
|
3
|
+
This gem provides model for Philippines location
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'pinas'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install pinas
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
$ rails g pinas:install
|
22
|
+
|
23
|
+
$ rake db:migrate
|
24
|
+
|
25
|
+
$ rake pinas:load_data
|
26
|
+
|
27
|
+
|
28
|
+
## Contributing
|
29
|
+
|
30
|
+
1. Fork it ( https://github.com/pangkalizer/pinas/fork )
|
31
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
32
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
33
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
34
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rails/generators/active_record'
|
2
|
+
|
3
|
+
module Pinas
|
4
|
+
class InstallGenerator < Rails::Generators::Base
|
5
|
+
include Rails::Generators::Migration
|
6
|
+
source_root File.expand_path('../../templates', __FILE__)
|
7
|
+
desc "Install Pinas"
|
8
|
+
|
9
|
+
def install
|
10
|
+
migration_template 'migration.rb', 'db/migrate/create_pinas_tables.rb'
|
11
|
+
readme 'README'
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.next_migration_number(dirname)
|
15
|
+
ActiveRecord::Generators::Base.next_migration_number(dirname)
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
HEY
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class CreatePinasTables < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table(:locations) do |t|
|
4
|
+
t.references :parent
|
5
|
+
t.integer :lft
|
6
|
+
t.integer :rgt
|
7
|
+
t.string :location_type
|
8
|
+
t.string :code
|
9
|
+
t.string :name
|
10
|
+
t.boolean :city, :default => false, :null => false
|
11
|
+
t.string :income_class
|
12
|
+
t.string :urban_rural
|
13
|
+
t.string :district
|
14
|
+
t.string :postcode
|
15
|
+
t.string :longitude
|
16
|
+
t.string :latitude
|
17
|
+
t.timestamps null: false
|
18
|
+
end
|
19
|
+
add_index :locations, :parent_id
|
20
|
+
add_index :locations, :postcode
|
21
|
+
add_index :locations, [:name, :location_type, :postcode]
|
22
|
+
end
|
23
|
+
end
|