firehouse 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/fire +6 -0
- data/config/environment.rb +10 -0
- data/db/firehouses.db +0 -0
- data/db/migrations/01_create_firehouse.rb +9 -0
- data/lib/firehouse.rb +5 -0
- data/lib/firehouse_reader.rb +20 -0
- metadata +50 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8fec4e3a8ac8feca6259b92fe25e946d5cbfb94f
|
4
|
+
data.tar.gz: e82b272d1bcdabb5a8d8896554c9ad649ca7936f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f976493ecc9f7f82aa2da30dc2576e45ddcf4ed5ce820ef9a6d84cc0996e4fde995037f726436224187827b37ae5584f4dea52629c48b2f4936d038ba19d4c1d
|
7
|
+
data.tar.gz: a73c5d0b7f43d5391f9724b7472a65bd301415cbc42b78d902af578b1210edd1077165ebd7e00a443c537a8f946a9f8516c06bb4f5b0f5918f6a70150798c80d
|
data/bin/fire
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
require_relative '../config/environment'
|
2
|
+
require 'JSON'
|
3
|
+
require 'open-uri'
|
4
|
+
|
5
|
+
ip = open( 'http://jsonip.com/ ' ){ |s| JSON::parse( s.string())['ip'] }
|
6
|
+
Launchy.open("https://www.google.com/maps/dir/#{Geocoder.coordinates(ip).to_s.gsub("[","").gsub("]","").gsub(" ","+")}/#{Firehouse.near(ip).first.address.gsub(" ", "+")}")
|
data/db/firehouses.db
ADDED
Binary file
|
data/lib/firehouse.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
class FirehouseReader
|
2
|
+
|
3
|
+
attr_reader :url
|
4
|
+
|
5
|
+
def initialize(url)
|
6
|
+
@url = url
|
7
|
+
end
|
8
|
+
|
9
|
+
def seed_db
|
10
|
+
JSON.parse(RestClient.get(url))["data"].each do |line|
|
11
|
+
next if line.last == "Borough"
|
12
|
+
f = Firehouse.create
|
13
|
+
f.address = "#{line[9]} #{line[10]}, NY"
|
14
|
+
f.save
|
15
|
+
puts "Geocoding: #{f.address}"
|
16
|
+
sleep 5
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: firehouse
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chris Guthrie
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-11 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Walking directions to nearest firehouse
|
14
|
+
email: christopher.a.guthrie@gmail.com
|
15
|
+
executables:
|
16
|
+
- fire
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- bin/fire
|
21
|
+
- config/environment.rb
|
22
|
+
- db/firehouses.db
|
23
|
+
- db/migrations/01_create_firehouse.rb
|
24
|
+
- lib/firehouse.rb
|
25
|
+
- lib/firehouse_reader.rb
|
26
|
+
homepage: http://www.github.com/caguthrie/firehouse
|
27
|
+
licenses:
|
28
|
+
- MIT
|
29
|
+
metadata: {}
|
30
|
+
post_install_message:
|
31
|
+
rdoc_options: []
|
32
|
+
require_paths:
|
33
|
+
- lib
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
requirements: []
|
45
|
+
rubyforge_project:
|
46
|
+
rubygems_version: 2.2.1
|
47
|
+
signing_key:
|
48
|
+
specification_version: 4
|
49
|
+
summary: Nearest Firehouse
|
50
|
+
test_files: []
|