orochi 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +1 -0
- data/VERSION +1 -1
- data/lib/orochi.rb +16 -1
- data/lib/orochi/acts_as_routeable.rb +20 -23
- data/orochi.gemspec +28 -5
- data/spec/{gem → acts_as_routeable}/acts_as_routeable_spec.rb +1 -2
- data/spec/helpers/core.rb +27 -1
- data/spec/helpers/debug.log +1 -0
- data/spec/rake/migration_spec.rb +3 -1
- data/spec/spec_helper.rb +0 -4
- data/spec/staging/gem_test/app/controllers/application_controller.rb +3 -0
- data/spec/staging/gem_test/app/helpers/application_helper.rb +2 -0
- data/spec/staging/gem_test/app/models/leg.rb +3 -0
- data/spec/staging/gem_test/app/models/route.rb +11 -0
- data/spec/staging/gem_test/app/models/router.rb +3 -0
- data/spec/staging/gem_test/app/models/step.rb +2 -0
- data/spec/staging/gem_test/config/application.rb +42 -0
- data/spec/staging/gem_test/config/boot.rb +13 -0
- data/spec/staging/gem_test/config/environment.rb +5 -0
- data/spec/staging/gem_test/config/environments/development.rb +26 -0
- data/spec/staging/gem_test/config/environments/production.rb +49 -0
- data/spec/staging/gem_test/config/environments/test.rb +35 -0
- data/spec/staging/gem_test/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/staging/gem_test/config/initializers/inflections.rb +10 -0
- data/spec/staging/gem_test/config/initializers/mime_types.rb +5 -0
- data/spec/staging/gem_test/config/initializers/secret_token.rb +7 -0
- data/spec/staging/gem_test/config/initializers/session_store.rb +8 -0
- data/spec/staging/gem_test/config/routes.rb +58 -0
- data/spec/staging/gem_test/db/migrate/20110117235527_orochi_migration.rb +33 -0
- data/spec/staging/gem_test/db/schema.rb +41 -0
- data/spec/staging/gem_test/db/seeds.rb +7 -0
- data/spec/staging/gem_test/test/performance/browsing_test.rb +9 -0
- data/spec/staging/gem_test/test/test_helper.rb +13 -0
- metadata +52 -6
data/README.textile
CHANGED
@@ -48,3 +48,4 @@ p. Now you can do some of the following:
|
|
48
48
|
pre. your_model_instance.polyline # Polyline representation for Google Maps
|
49
49
|
your_model_instance.directions # List of directions
|
50
50
|
your_model_instance.reverse # A creates a router with the reversed address + routes
|
51
|
+
your_model_instance.includes?(point_of_interest) # Returns if point of interest is within your route
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.7
|
data/lib/orochi.rb
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
# TODO make this more "Pragmatic Programmer"
|
2
|
+
require 'net/https'
|
3
|
+
require 'open-uri'
|
4
|
+
require 'json'
|
5
|
+
|
2
6
|
if defined?(Rails)
|
3
7
|
require "active_model"
|
4
8
|
require "active_record"
|
@@ -13,7 +17,18 @@ end
|
|
13
17
|
module Orochi
|
14
18
|
class GoogleClient
|
15
19
|
def self.request(options = {})
|
16
|
-
|
20
|
+
request_str = "http://maps.googleapis.com/maps/api/directions/json?"
|
21
|
+
|
22
|
+
# TODO make settings for default request
|
23
|
+
request_str += "sensor=false&"
|
24
|
+
request_str += "alternatives=true&"
|
25
|
+
|
26
|
+
options.each do |k, v|
|
27
|
+
request_str += "&#{k}=#{CGI::escape(v)}"
|
28
|
+
end
|
29
|
+
|
30
|
+
response = open(request_str)
|
31
|
+
return JSON.parse(response.read)
|
17
32
|
end
|
18
33
|
end
|
19
34
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'net/https'
|
2
|
-
require 'open-uri'
|
3
1
|
require 'json'
|
4
2
|
require 'googlemaps_polyline/version'
|
5
3
|
require 'googlemaps_polyline/core'
|
@@ -21,27 +19,13 @@ module Orochi
|
|
21
19
|
end
|
22
20
|
|
23
21
|
module InstanceMethods
|
24
|
-
def request_routes
|
25
|
-
|
26
|
-
|
27
|
-
alternatives = true
|
28
|
-
# TODO accept hash of options, build request string
|
29
|
-
alt = "alternatives=#{(alternatives)? true : false}&"
|
30
|
-
request_str += alt
|
31
|
-
|
32
|
-
start = self.router.start
|
33
|
-
request_str += "origin=#{CGI::escape(start)}&"
|
34
|
-
|
35
|
-
stop = self.router.stop
|
36
|
-
request_str += "destination=#{CGI::escape(stop)}"
|
37
|
-
|
38
|
-
response = open(request_str)
|
39
|
-
return JSON.parse(response.read)
|
22
|
+
def request_routes(options)
|
23
|
+
Orochi::GoogleClient.request(options)
|
40
24
|
end
|
41
25
|
|
42
26
|
|
43
27
|
def route!
|
44
|
-
json = self.request_routes
|
28
|
+
json = self.request_routes({:origin => self.router.start, :destination => self.router.stop})
|
45
29
|
json_routes = json["routes"]
|
46
30
|
json_routes.each do |route|
|
47
31
|
r = self.router.routes.create!
|
@@ -56,10 +40,8 @@ module Orochi
|
|
56
40
|
leg_levels = leg_step["polyline"]["levels"]
|
57
41
|
polyline_data = GoogleMapsPolyline.decode_polyline(leg_points, leg_levels)
|
58
42
|
|
59
|
-
|
60
|
-
|
61
|
-
polyline_data.collect do |point|
|
62
|
-
polyline.push([point[0], point[1]])
|
43
|
+
polyline = polyline_data.inject([]) do |acc, point|
|
44
|
+
acc << ([point[0], point[1]])
|
63
45
|
end
|
64
46
|
|
65
47
|
s.polyline_json = polyline.inspect
|
@@ -75,12 +57,17 @@ module Orochi
|
|
75
57
|
end
|
76
58
|
|
77
59
|
def set_endpoints!(start, stop)
|
60
|
+
# TODO find_or_create_by
|
61
|
+
if self.router.nil?
|
62
|
+
self.router = Router.create!
|
63
|
+
end
|
78
64
|
self.router.start = start
|
79
65
|
self.router.stop = stop
|
80
66
|
self.router.save!
|
81
67
|
end
|
82
68
|
|
83
69
|
def polyline
|
70
|
+
# TODO abstract into helper
|
84
71
|
polyline = []
|
85
72
|
routes.first.each_step do |step|
|
86
73
|
polyline.push(step.polyline_json.to_a)
|
@@ -89,6 +76,7 @@ module Orochi
|
|
89
76
|
end
|
90
77
|
|
91
78
|
def directions
|
79
|
+
# TODO abstract into helper
|
92
80
|
directions = []
|
93
81
|
routes.first.each_step do |step|
|
94
82
|
directions.push(step.directions_json.to_s)
|
@@ -106,6 +94,15 @@ module Orochi
|
|
106
94
|
reversed_router
|
107
95
|
end
|
108
96
|
|
97
|
+
# PRE point needs to be a tuple [lat, lng] (for now)
|
98
|
+
# TODO point of inclusion
|
99
|
+
def includes?(point)
|
100
|
+
self.polyline.any? do |step_json|
|
101
|
+
polyline_array = eval step_json
|
102
|
+
polyline_array.include?(point)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
109
106
|
end
|
110
107
|
end
|
111
108
|
end
|
data/orochi.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{orochi}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["kellydunn"]
|
@@ -37,10 +37,10 @@ Gem::Specification.new do |s|
|
|
37
37
|
"lib/orochi/acts_as_routeable.rb",
|
38
38
|
"lib/orochi/railtie.rb",
|
39
39
|
"lib/rails_templates/default_template.rb",
|
40
|
-
"orochi-0.0.6.gem",
|
41
40
|
"orochi.gemspec",
|
42
|
-
"spec/
|
41
|
+
"spec/acts_as_routeable/acts_as_routeable_spec.rb",
|
43
42
|
"spec/helpers/core.rb",
|
43
|
+
"spec/helpers/debug.log",
|
44
44
|
"spec/rake/migration_spec.rb",
|
45
45
|
"spec/rake/rake_spec.rb",
|
46
46
|
"spec/spec_helper.rb"
|
@@ -51,11 +51,34 @@ Gem::Specification.new do |s|
|
|
51
51
|
s.rubygems_version = %q{1.3.7}
|
52
52
|
s.summary = %q{An easy way to ActiveRecord-ize directions and route data}
|
53
53
|
s.test_files = [
|
54
|
-
"spec/
|
54
|
+
"spec/acts_as_routeable/acts_as_routeable_spec.rb",
|
55
55
|
"spec/helpers/core.rb",
|
56
56
|
"spec/rake/migration_spec.rb",
|
57
57
|
"spec/rake/rake_spec.rb",
|
58
|
-
"spec/spec_helper.rb"
|
58
|
+
"spec/spec_helper.rb",
|
59
|
+
"spec/staging/gem_test/app/controllers/application_controller.rb",
|
60
|
+
"spec/staging/gem_test/app/helpers/application_helper.rb",
|
61
|
+
"spec/staging/gem_test/app/models/leg.rb",
|
62
|
+
"spec/staging/gem_test/app/models/route.rb",
|
63
|
+
"spec/staging/gem_test/app/models/router.rb",
|
64
|
+
"spec/staging/gem_test/app/models/step.rb",
|
65
|
+
"spec/staging/gem_test/config/application.rb",
|
66
|
+
"spec/staging/gem_test/config/boot.rb",
|
67
|
+
"spec/staging/gem_test/config/environment.rb",
|
68
|
+
"spec/staging/gem_test/config/environments/development.rb",
|
69
|
+
"spec/staging/gem_test/config/environments/production.rb",
|
70
|
+
"spec/staging/gem_test/config/environments/test.rb",
|
71
|
+
"spec/staging/gem_test/config/initializers/backtrace_silencers.rb",
|
72
|
+
"spec/staging/gem_test/config/initializers/inflections.rb",
|
73
|
+
"spec/staging/gem_test/config/initializers/mime_types.rb",
|
74
|
+
"spec/staging/gem_test/config/initializers/secret_token.rb",
|
75
|
+
"spec/staging/gem_test/config/initializers/session_store.rb",
|
76
|
+
"spec/staging/gem_test/config/routes.rb",
|
77
|
+
"spec/staging/gem_test/db/migrate/20110117235527_orochi_migration.rb",
|
78
|
+
"spec/staging/gem_test/db/schema.rb",
|
79
|
+
"spec/staging/gem_test/db/seeds.rb",
|
80
|
+
"spec/staging/gem_test/test/performance/browsing_test.rb",
|
81
|
+
"spec/staging/gem_test/test/test_helper.rb"
|
59
82
|
]
|
60
83
|
|
61
84
|
if s.respond_to? :specification_version then
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "A model acting as routeable" do
|
4
|
-
|
4
|
+
include CoreHelper
|
5
5
|
|
6
6
|
context "setting endpoints" do
|
7
7
|
it "should be able to set its stopping and starting endpoints"
|
@@ -14,5 +14,4 @@ describe "A model acting as routeable" do
|
|
14
14
|
it "should be able to grab a polyline after being routed"
|
15
15
|
end
|
16
16
|
|
17
|
-
destroy_rails_app
|
18
17
|
end
|
data/spec/helpers/core.rb
CHANGED
@@ -2,9 +2,12 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
module CoreHelper
|
4
4
|
def create_rails_app
|
5
|
-
Dir.chdir("
|
5
|
+
Dir.chdir(File.join(File.dirname(__FILE__), "../staging"))
|
6
6
|
system("rails new gem_test -d mysql -m ../../lib/rails_templates/default_template.rb >> /dev/null")
|
7
7
|
puts "== Created rails application ====="
|
8
|
+
system("pwd")
|
9
|
+
require "gem_test/config/environment.rb"
|
10
|
+
mock_rails_env
|
8
11
|
end
|
9
12
|
|
10
13
|
def destroy_rails_app
|
@@ -16,5 +19,28 @@ module CoreHelper
|
|
16
19
|
puts "Was not able to delete rails application"
|
17
20
|
end
|
18
21
|
end
|
22
|
+
|
23
|
+
def mock_rails_env
|
24
|
+
database_yml = File.join(File.dirname(__FILE__), '../staging/gem_test/config/database.yml')
|
25
|
+
system("echo #{database_yml}")
|
26
|
+
if File.exists?(database_yml)
|
27
|
+
active_record_configuration = YAML.load_file(database_yml)["mysql"]
|
28
|
+
|
29
|
+
ActiveRecord::Base.establish_connection(active_record_configuration)
|
30
|
+
ActiveRecord::Base.logger = Logger.new(File.join(File.dirname(__FILE__), "debug.log"))
|
31
|
+
|
32
|
+
ActiveRecord::Base.silence do
|
33
|
+
ActiveRecord::Migration.verbose = false
|
34
|
+
|
35
|
+
load(File.dirname(__FILE__) + '/../staging/gem_test/db/schema.rb')
|
36
|
+
system("pwd")
|
37
|
+
Dir.new(File.join(File.dirname(__FILE__), "/../../lib/generators/orochi/templates/models")).each do |file|
|
38
|
+
load(file) if !File.directory?(file)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
else
|
42
|
+
system("echo ':('")
|
43
|
+
end
|
44
|
+
end
|
19
45
|
end
|
20
46
|
|
@@ -0,0 +1 @@
|
|
1
|
+
# Logfile created on Mon Jan 17 15:51:43 -0800 2011 by logger.rb/22285
|
data/spec/rake/migration_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,12 +1,8 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
1
|
require 'rspec'
|
4
2
|
require 'orochi'
|
5
3
|
|
6
4
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
7
5
|
Dir["#{File.dirname(__FILE__)}/helpers/**/*.rb"].each {|f| require f}
|
8
6
|
|
9
|
-
File.join(File.dirname(__FILE__))
|
10
|
-
|
11
7
|
RSpec.configure do |config|
|
12
8
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
# If you have a Gemfile, require the gems listed there, including any gems
|
6
|
+
# you've limited to :test, :development, or :production.
|
7
|
+
Bundler.require(:default, Rails.env) if defined?(Bundler)
|
8
|
+
|
9
|
+
module GemTest
|
10
|
+
class Application < Rails::Application
|
11
|
+
# Settings in config/environments/* take precedence over those specified here.
|
12
|
+
# Application configuration should go into files in config/initializers
|
13
|
+
# -- all .rb files in that directory are automatically loaded.
|
14
|
+
|
15
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
16
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
17
|
+
|
18
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
19
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
20
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
21
|
+
|
22
|
+
# Activate observers that should always be running.
|
23
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
24
|
+
|
25
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
26
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
27
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
28
|
+
|
29
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
30
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
31
|
+
# config.i18n.default_locale = :de
|
32
|
+
|
33
|
+
# JavaScript files you want as :defaults (application.js is always included).
|
34
|
+
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
35
|
+
|
36
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
37
|
+
config.encoding = "utf-8"
|
38
|
+
|
39
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
40
|
+
config.filter_parameters += [:password]
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
# Set up gems listed in the Gemfile.
|
4
|
+
gemfile = File.expand_path('../../Gemfile', __FILE__)
|
5
|
+
begin
|
6
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
7
|
+
require 'bundler'
|
8
|
+
Bundler.setup
|
9
|
+
rescue Bundler::GemNotFound => e
|
10
|
+
STDERR.puts e.message
|
11
|
+
STDERR.puts "Try running `bundle install`."
|
12
|
+
exit!
|
13
|
+
end if File.exist?(gemfile)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
GemTest::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the webserver when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_view.debug_rjs = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Don't care if the mailer can't send
|
18
|
+
config.action_mailer.raise_delivery_errors = false
|
19
|
+
|
20
|
+
# Print deprecation notices to the Rails logger
|
21
|
+
config.active_support.deprecation = :log
|
22
|
+
|
23
|
+
# Only use best-standards-support built into browsers
|
24
|
+
config.action_dispatch.best_standards_support = :builtin
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
GemTest::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The production environment is meant for finished, "live" apps.
|
5
|
+
# Code is not reloaded between requests
|
6
|
+
config.cache_classes = true
|
7
|
+
|
8
|
+
# Full error reports are disabled and caching is turned on
|
9
|
+
config.consider_all_requests_local = false
|
10
|
+
config.action_controller.perform_caching = true
|
11
|
+
|
12
|
+
# Specifies the header that your server uses for sending files
|
13
|
+
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
14
|
+
|
15
|
+
# For nginx:
|
16
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
17
|
+
|
18
|
+
# If you have no front-end server that supports something like X-Sendfile,
|
19
|
+
# just comment this out and Rails will serve the files
|
20
|
+
|
21
|
+
# See everything in the log (default is :info)
|
22
|
+
# config.log_level = :debug
|
23
|
+
|
24
|
+
# Use a different logger for distributed setups
|
25
|
+
# config.logger = SyslogLogger.new
|
26
|
+
|
27
|
+
# Use a different cache store in production
|
28
|
+
# config.cache_store = :mem_cache_store
|
29
|
+
|
30
|
+
# Disable Rails's static asset server
|
31
|
+
# In production, Apache or nginx will already do this
|
32
|
+
config.serve_static_assets = false
|
33
|
+
|
34
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
35
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
36
|
+
|
37
|
+
# Disable delivery errors, bad email addresses will be ignored
|
38
|
+
# config.action_mailer.raise_delivery_errors = false
|
39
|
+
|
40
|
+
# Enable threaded mode
|
41
|
+
# config.threadsafe!
|
42
|
+
|
43
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
44
|
+
# the I18n.default_locale when a translation can not be found)
|
45
|
+
config.i18n.fallbacks = true
|
46
|
+
|
47
|
+
# Send deprecation notices to registered listeners
|
48
|
+
config.active_support.deprecation = :notify
|
49
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
GemTest::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Log error messages when you accidentally call methods on nil.
|
11
|
+
config.whiny_nils = true
|
12
|
+
|
13
|
+
# Show full error reports and disable caching
|
14
|
+
config.consider_all_requests_local = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Raise exceptions instead of rendering exception templates
|
18
|
+
config.action_dispatch.show_exceptions = false
|
19
|
+
|
20
|
+
# Disable request forgery protection in test environment
|
21
|
+
config.action_controller.allow_forgery_protection = false
|
22
|
+
|
23
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
24
|
+
# The :test delivery method accumulates sent emails in the
|
25
|
+
# ActionMailer::Base.deliveries array.
|
26
|
+
config.action_mailer.delivery_method = :test
|
27
|
+
|
28
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
29
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
30
|
+
# like if you have constraints or database-specific column types
|
31
|
+
# config.active_record.schema_format = :sql
|
32
|
+
|
33
|
+
# Print deprecation notices to the stderr
|
34
|
+
config.active_support.deprecation = :stderr
|
35
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
GemTest::Application.config.secret_token = '2a656402aa1bd7aa26f17c6a5b72ed9476b8dc06a3045c7b5a5dd18d8349ad56d2077660c572220af92450c8752a21a0c094e4d37e1f934acb11d2f09f35f083'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
GemTest::Application.config.session_store :cookie_store, :key => '_gem_test_session'
|
4
|
+
|
5
|
+
# Use the database for sessions instead of the cookie-based default,
|
6
|
+
# which shouldn't be used to store highly confidential information
|
7
|
+
# (create the session table with "rails generate session_migration")
|
8
|
+
# GemTest::Application.config.session_store :active_record_store
|
@@ -0,0 +1,58 @@
|
|
1
|
+
GemTest::Application.routes.draw do
|
2
|
+
# The priority is based upon order of creation:
|
3
|
+
# first created -> highest priority.
|
4
|
+
|
5
|
+
# Sample of regular route:
|
6
|
+
# match 'products/:id' => 'catalog#view'
|
7
|
+
# Keep in mind you can assign values other than :controller and :action
|
8
|
+
|
9
|
+
# Sample of named route:
|
10
|
+
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
11
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
12
|
+
|
13
|
+
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
14
|
+
# resources :products
|
15
|
+
|
16
|
+
# Sample resource route with options:
|
17
|
+
# resources :products do
|
18
|
+
# member do
|
19
|
+
# get 'short'
|
20
|
+
# post 'toggle'
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# collection do
|
24
|
+
# get 'sold'
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
|
28
|
+
# Sample resource route with sub-resources:
|
29
|
+
# resources :products do
|
30
|
+
# resources :comments, :sales
|
31
|
+
# resource :seller
|
32
|
+
# end
|
33
|
+
|
34
|
+
# Sample resource route with more complex sub-resources
|
35
|
+
# resources :products do
|
36
|
+
# resources :comments
|
37
|
+
# resources :sales do
|
38
|
+
# get 'recent', :on => :collection
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
|
42
|
+
# Sample resource route within a namespace:
|
43
|
+
# namespace :admin do
|
44
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
45
|
+
# # (app/controllers/admin/products_controller.rb)
|
46
|
+
# resources :products
|
47
|
+
# end
|
48
|
+
|
49
|
+
# You can have the root of your site routed with "root"
|
50
|
+
# just remember to delete public/index.html.
|
51
|
+
# root :to => "welcome#index"
|
52
|
+
|
53
|
+
# See how all your routes lay out with "rake routes"
|
54
|
+
|
55
|
+
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
56
|
+
# Note: This route will make all actions in every controller accessible via GET requests.
|
57
|
+
# match ':controller(/:action(/:id(.:format)))'
|
58
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class OrochiMigration < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :routers do |t|
|
4
|
+
t.string :start
|
5
|
+
t.string :stop
|
6
|
+
t.timestamps
|
7
|
+
end
|
8
|
+
|
9
|
+
create_table :routes do |t|
|
10
|
+
t.integer :router_id, :references => :routers
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
|
14
|
+
create_table :legs do |t|
|
15
|
+
t.integer :route_id, :references => :routes
|
16
|
+
t.timestamps
|
17
|
+
end
|
18
|
+
|
19
|
+
create_table :steps do |t|
|
20
|
+
t.integer :leg_id, :references => :legs
|
21
|
+
t.text :polyline_json
|
22
|
+
t.text :directions_json
|
23
|
+
t.timestamps
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.down
|
28
|
+
drop_table :routers
|
29
|
+
drop_table :routes
|
30
|
+
drop_table :legs
|
31
|
+
drop_table :steps
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
2
|
+
# of editing this file, please use the migrations feature of Active Record to
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
+
#
|
5
|
+
# Note that this schema.rb definition is the authoritative source for your
|
6
|
+
# database schema. If you need to create the application database on another
|
7
|
+
# system, you should be using db:schema:load, not running all the migrations
|
8
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
9
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
10
|
+
#
|
11
|
+
# It's strongly recommended to check this file into your version control system.
|
12
|
+
|
13
|
+
ActiveRecord::Schema.define(:version => 20110114193812) do
|
14
|
+
|
15
|
+
create_table "legs", :force => true do |t|
|
16
|
+
t.integer "route_id"
|
17
|
+
t.datetime "created_at"
|
18
|
+
t.datetime "updated_at"
|
19
|
+
end
|
20
|
+
|
21
|
+
create_table "routers", :force => true do |t|
|
22
|
+
t.string "start"
|
23
|
+
t.string "stop"
|
24
|
+
t.datetime "created_at"
|
25
|
+
t.datetime "updated_at"
|
26
|
+
end
|
27
|
+
|
28
|
+
create_table "routes", :force => true do |t|
|
29
|
+
t.datetime "created_at"
|
30
|
+
t.datetime "updated_at"
|
31
|
+
end
|
32
|
+
|
33
|
+
create_table "steps", :force => true do |t|
|
34
|
+
t.integer "leg_id"
|
35
|
+
t.text "polyline_json"
|
36
|
+
t.text "directions_json"
|
37
|
+
t.datetime "created_at"
|
38
|
+
t.datetime "updated_at"
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
7
|
+
# Mayor.create(:name => 'Daley', :city => cities.first)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
|
+
require File.expand_path('../../config/environment', __FILE__)
|
3
|
+
require 'rails/test_help'
|
4
|
+
|
5
|
+
class ActiveSupport::TestCase
|
6
|
+
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
7
|
+
#
|
8
|
+
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
9
|
+
# -- they do not yet inherit this setting
|
10
|
+
fixtures :all
|
11
|
+
|
12
|
+
# Add more helper methods to be used by all tests here...
|
13
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orochi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- kellydunn
|
@@ -166,13 +166,36 @@ files:
|
|
166
166
|
- lib/orochi/acts_as_routeable.rb
|
167
167
|
- lib/orochi/railtie.rb
|
168
168
|
- lib/rails_templates/default_template.rb
|
169
|
-
- orochi-0.0.6.gem
|
170
169
|
- orochi.gemspec
|
171
|
-
- spec/
|
170
|
+
- spec/acts_as_routeable/acts_as_routeable_spec.rb
|
172
171
|
- spec/helpers/core.rb
|
172
|
+
- spec/helpers/debug.log
|
173
173
|
- spec/rake/migration_spec.rb
|
174
174
|
- spec/rake/rake_spec.rb
|
175
175
|
- spec/spec_helper.rb
|
176
|
+
- spec/staging/gem_test/app/controllers/application_controller.rb
|
177
|
+
- spec/staging/gem_test/app/helpers/application_helper.rb
|
178
|
+
- spec/staging/gem_test/app/models/leg.rb
|
179
|
+
- spec/staging/gem_test/app/models/route.rb
|
180
|
+
- spec/staging/gem_test/app/models/router.rb
|
181
|
+
- spec/staging/gem_test/app/models/step.rb
|
182
|
+
- spec/staging/gem_test/config/application.rb
|
183
|
+
- spec/staging/gem_test/config/boot.rb
|
184
|
+
- spec/staging/gem_test/config/environment.rb
|
185
|
+
- spec/staging/gem_test/config/environments/development.rb
|
186
|
+
- spec/staging/gem_test/config/environments/production.rb
|
187
|
+
- spec/staging/gem_test/config/environments/test.rb
|
188
|
+
- spec/staging/gem_test/config/initializers/backtrace_silencers.rb
|
189
|
+
- spec/staging/gem_test/config/initializers/inflections.rb
|
190
|
+
- spec/staging/gem_test/config/initializers/mime_types.rb
|
191
|
+
- spec/staging/gem_test/config/initializers/secret_token.rb
|
192
|
+
- spec/staging/gem_test/config/initializers/session_store.rb
|
193
|
+
- spec/staging/gem_test/config/routes.rb
|
194
|
+
- spec/staging/gem_test/db/migrate/20110117235527_orochi_migration.rb
|
195
|
+
- spec/staging/gem_test/db/schema.rb
|
196
|
+
- spec/staging/gem_test/db/seeds.rb
|
197
|
+
- spec/staging/gem_test/test/performance/browsing_test.rb
|
198
|
+
- spec/staging/gem_test/test/test_helper.rb
|
176
199
|
has_rdoc: true
|
177
200
|
homepage: http://github.com/kellydunn/orochi
|
178
201
|
licenses:
|
@@ -208,8 +231,31 @@ signing_key:
|
|
208
231
|
specification_version: 3
|
209
232
|
summary: An easy way to ActiveRecord-ize directions and route data
|
210
233
|
test_files:
|
211
|
-
- spec/
|
234
|
+
- spec/acts_as_routeable/acts_as_routeable_spec.rb
|
212
235
|
- spec/helpers/core.rb
|
213
236
|
- spec/rake/migration_spec.rb
|
214
237
|
- spec/rake/rake_spec.rb
|
215
238
|
- spec/spec_helper.rb
|
239
|
+
- spec/staging/gem_test/app/controllers/application_controller.rb
|
240
|
+
- spec/staging/gem_test/app/helpers/application_helper.rb
|
241
|
+
- spec/staging/gem_test/app/models/leg.rb
|
242
|
+
- spec/staging/gem_test/app/models/route.rb
|
243
|
+
- spec/staging/gem_test/app/models/router.rb
|
244
|
+
- spec/staging/gem_test/app/models/step.rb
|
245
|
+
- spec/staging/gem_test/config/application.rb
|
246
|
+
- spec/staging/gem_test/config/boot.rb
|
247
|
+
- spec/staging/gem_test/config/environment.rb
|
248
|
+
- spec/staging/gem_test/config/environments/development.rb
|
249
|
+
- spec/staging/gem_test/config/environments/production.rb
|
250
|
+
- spec/staging/gem_test/config/environments/test.rb
|
251
|
+
- spec/staging/gem_test/config/initializers/backtrace_silencers.rb
|
252
|
+
- spec/staging/gem_test/config/initializers/inflections.rb
|
253
|
+
- spec/staging/gem_test/config/initializers/mime_types.rb
|
254
|
+
- spec/staging/gem_test/config/initializers/secret_token.rb
|
255
|
+
- spec/staging/gem_test/config/initializers/session_store.rb
|
256
|
+
- spec/staging/gem_test/config/routes.rb
|
257
|
+
- spec/staging/gem_test/db/migrate/20110117235527_orochi_migration.rb
|
258
|
+
- spec/staging/gem_test/db/schema.rb
|
259
|
+
- spec/staging/gem_test/db/seeds.rb
|
260
|
+
- spec/staging/gem_test/test/performance/browsing_test.rb
|
261
|
+
- spec/staging/gem_test/test/test_helper.rb
|