to_town 0.0.4
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.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +25 -0
- data/Gemfile.lock +73 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +106 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/bin/to_town +6 -0
- data/lib/to_town.rb +12 -0
- data/lib/to_town/cli.rb +42 -0
- data/lib/to_town/converter/us.rb +37 -0
- data/lib/to_town/data_migration.rb +14 -0
- data/lib/to_town/db_connection.rb +14 -0
- data/lib/to_town/generators/mongodb.rb +19 -0
- data/lib/to_town/generators/templates/mongoid_example.yml +10 -0
- data/lib/to_town/point.rb +21 -0
- data/raw_data/Gaz_places_national.txt +29515 -0
- data/spec/spec_helper.rb +23 -0
- data/spec/to_town_spec.rb +18 -0
- data/spec/us_spec.rb +14 -0
- data/to_town.gemspec +84 -0
- metadata +168 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
|
4
|
+
RACK_ENV = 'test'
|
5
|
+
|
6
|
+
require "bundler"
|
7
|
+
Bundler.require(:default, :test)
|
8
|
+
|
9
|
+
require 'simplecov'
|
10
|
+
require 'to_town/db_connection'
|
11
|
+
|
12
|
+
# Requires supporting files with custom matchers and macros, etc,
|
13
|
+
# in ./support/ and its subdirectories.
|
14
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
15
|
+
|
16
|
+
SimpleCov.start
|
17
|
+
|
18
|
+
RSpec.configure do |config|
|
19
|
+
# config.mock_with :rspec
|
20
|
+
config.before :each do
|
21
|
+
Mongoid.master.collections.select {|c| c.name !~ /system/ }.each(&:drop)
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'to_town'
|
3
|
+
require 'to_town/point'
|
4
|
+
|
5
|
+
describe "ToTown" do
|
6
|
+
|
7
|
+
it "should have a check class method" do
|
8
|
+
ToTown.should respond_to :check
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should return a list of points" do
|
12
|
+
ToTown::Point.create(:name => "name1", :latlng => [50,51] )
|
13
|
+
points = ToTown.check(50,50)
|
14
|
+
points.length.should == 1
|
15
|
+
points.first.name.should == "name1"
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
data/spec/us_spec.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'to_town/converter/us'
|
3
|
+
require 'to_town/data_migration'
|
4
|
+
|
5
|
+
describe "Us" do
|
6
|
+
|
7
|
+
it "should create a migration record" do
|
8
|
+
ToTown::DataMigration.all.length.should == 0
|
9
|
+
ToTown::Converter::Us.run(dry = 1)
|
10
|
+
ToTown::DataMigration.all.length.should == 1
|
11
|
+
ToTown::DataMigration.first.filename.should == "Gaz_places_national.txt"
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
data/to_town.gemspec
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{to_town}
|
8
|
+
s.version = "0.0.4"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["zhengjia"]
|
12
|
+
s.date = %q{2011-06-19}
|
13
|
+
s.default_executable = %q{to_town}
|
14
|
+
s.description = %q{Find nearby towns of a geographic latitude and longitude}
|
15
|
+
s.email = %q{jiazheng@live.com}
|
16
|
+
s.executables = ["to_town"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE.txt",
|
19
|
+
"README.rdoc"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
".rspec",
|
24
|
+
"Gemfile",
|
25
|
+
"Gemfile.lock",
|
26
|
+
"LICENSE.txt",
|
27
|
+
"README.rdoc",
|
28
|
+
"Rakefile",
|
29
|
+
"VERSION",
|
30
|
+
"bin/to_town",
|
31
|
+
"lib/to_town.rb",
|
32
|
+
"lib/to_town/cli.rb",
|
33
|
+
"lib/to_town/converter/us.rb",
|
34
|
+
"lib/to_town/data_migration.rb",
|
35
|
+
"lib/to_town/db_connection.rb",
|
36
|
+
"lib/to_town/generators/mongodb.rb",
|
37
|
+
"lib/to_town/generators/templates/mongoid_example.yml",
|
38
|
+
"lib/to_town/point.rb",
|
39
|
+
"raw_data/Gaz_places_national.txt",
|
40
|
+
"spec/spec_helper.rb",
|
41
|
+
"spec/to_town_spec.rb",
|
42
|
+
"spec/us_spec.rb",
|
43
|
+
"to_town.gemspec"
|
44
|
+
]
|
45
|
+
s.homepage = %q{http://github.com/zhengjia/to_town}
|
46
|
+
s.licenses = ["MIT"]
|
47
|
+
s.require_paths = ["lib"]
|
48
|
+
s.rubygems_version = %q{1.6.2}
|
49
|
+
s.summary = %q{Find nearby towns of a geographic latitude and longitude}
|
50
|
+
|
51
|
+
if s.respond_to? :specification_version then
|
52
|
+
s.specification_version = 3
|
53
|
+
|
54
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
55
|
+
s.add_runtime_dependency(%q<bundler>, [">= 0"])
|
56
|
+
s.add_runtime_dependency(%q<mongoid>, ["~> 2.0.0"])
|
57
|
+
s.add_runtime_dependency(%q<thor>, [">= 0"])
|
58
|
+
s.add_runtime_dependency(%q<bson_ext>, [">= 0"])
|
59
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.2"])
|
60
|
+
s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
|
61
|
+
s.add_development_dependency(%q<awesome_print>, [">= 0"])
|
62
|
+
s.add_development_dependency(%q<fabrication>, [">= 0"])
|
63
|
+
else
|
64
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
65
|
+
s.add_dependency(%q<mongoid>, ["~> 2.0.0"])
|
66
|
+
s.add_dependency(%q<thor>, [">= 0"])
|
67
|
+
s.add_dependency(%q<bson_ext>, [">= 0"])
|
68
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
|
69
|
+
s.add_dependency(%q<ruby-debug19>, [">= 0"])
|
70
|
+
s.add_dependency(%q<awesome_print>, [">= 0"])
|
71
|
+
s.add_dependency(%q<fabrication>, [">= 0"])
|
72
|
+
end
|
73
|
+
else
|
74
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
75
|
+
s.add_dependency(%q<mongoid>, ["~> 2.0.0"])
|
76
|
+
s.add_dependency(%q<thor>, [">= 0"])
|
77
|
+
s.add_dependency(%q<bson_ext>, [">= 0"])
|
78
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
|
79
|
+
s.add_dependency(%q<ruby-debug19>, [">= 0"])
|
80
|
+
s.add_dependency(%q<awesome_print>, [">= 0"])
|
81
|
+
s.add_dependency(%q<fabrication>, [">= 0"])
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
metadata
ADDED
@@ -0,0 +1,168 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: to_town
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.4
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- zhengjia
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-06-19 00:00:00 -05:00
|
14
|
+
default_executable: to_town
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: bundler
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mongoid
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ~>
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 2.0.0
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: thor
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0"
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: bson_ext
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
57
|
+
type: :runtime
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: jeweler
|
62
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ~>
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 1.6.2
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: *id005
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: ruby-debug19
|
73
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: "0"
|
79
|
+
type: :development
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: *id006
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: awesome_print
|
84
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: "0"
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: *id007
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: fabrication
|
95
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: "0"
|
101
|
+
type: :development
|
102
|
+
prerelease: false
|
103
|
+
version_requirements: *id008
|
104
|
+
description: Find nearby towns of a geographic latitude and longitude
|
105
|
+
email: jiazheng@live.com
|
106
|
+
executables:
|
107
|
+
- to_town
|
108
|
+
extensions: []
|
109
|
+
|
110
|
+
extra_rdoc_files:
|
111
|
+
- LICENSE.txt
|
112
|
+
- README.rdoc
|
113
|
+
files:
|
114
|
+
- .document
|
115
|
+
- .rspec
|
116
|
+
- Gemfile
|
117
|
+
- Gemfile.lock
|
118
|
+
- LICENSE.txt
|
119
|
+
- README.rdoc
|
120
|
+
- Rakefile
|
121
|
+
- VERSION
|
122
|
+
- bin/to_town
|
123
|
+
- lib/to_town.rb
|
124
|
+
- lib/to_town/cli.rb
|
125
|
+
- lib/to_town/converter/us.rb
|
126
|
+
- lib/to_town/data_migration.rb
|
127
|
+
- lib/to_town/db_connection.rb
|
128
|
+
- lib/to_town/generators/mongodb.rb
|
129
|
+
- lib/to_town/generators/templates/mongoid_example.yml
|
130
|
+
- lib/to_town/point.rb
|
131
|
+
- raw_data/Gaz_places_national.txt
|
132
|
+
- spec/spec_helper.rb
|
133
|
+
- spec/to_town_spec.rb
|
134
|
+
- spec/us_spec.rb
|
135
|
+
- to_town.gemspec
|
136
|
+
has_rdoc: true
|
137
|
+
homepage: http://github.com/zhengjia/to_town
|
138
|
+
licenses:
|
139
|
+
- MIT
|
140
|
+
post_install_message:
|
141
|
+
rdoc_options: []
|
142
|
+
|
143
|
+
require_paths:
|
144
|
+
- lib
|
145
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
146
|
+
none: false
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
hash: 2337848755328771632
|
151
|
+
segments:
|
152
|
+
- 0
|
153
|
+
version: "0"
|
154
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
+
none: false
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: "0"
|
160
|
+
requirements: []
|
161
|
+
|
162
|
+
rubyforge_project:
|
163
|
+
rubygems_version: 1.6.2
|
164
|
+
signing_key:
|
165
|
+
specification_version: 3
|
166
|
+
summary: Find nearby towns of a geographic latitude and longitude
|
167
|
+
test_files: []
|
168
|
+
|