orochi 0.0.0

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.
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ gem 'geokit'
7
+ gem 'geokit-rails'
8
+ gem 'nayutaya-googlemaps-polyline'
9
+ gem 'json'
10
+
11
+ # Add dependencies to develop your gem here.
12
+ # Include everything needed to run rake, tests, features, etc.
13
+ group :development do
14
+ gem "rspec", "~> 2.3.0"
15
+ gem "bundler", "~> 1.0.0"
16
+ gem "jeweler", "~> 1.5.2"
17
+ gem "rcov", ">= 0"
18
+ end
@@ -0,0 +1,37 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.2)
5
+ geokit (1.5.0)
6
+ geokit-rails (1.1.4)
7
+ geokit (>= 1.5.0)
8
+ git (1.2.5)
9
+ jeweler (1.5.2)
10
+ bundler (~> 1.0.0)
11
+ git (>= 1.2.5)
12
+ rake
13
+ json (1.4.6)
14
+ nayutaya-googlemaps-polyline (0.0.1)
15
+ rake (0.8.7)
16
+ rcov (0.9.9)
17
+ rspec (2.3.0)
18
+ rspec-core (~> 2.3.0)
19
+ rspec-expectations (~> 2.3.0)
20
+ rspec-mocks (~> 2.3.0)
21
+ rspec-core (2.3.1)
22
+ rspec-expectations (2.3.0)
23
+ diff-lcs (~> 1.1.2)
24
+ rspec-mocks (2.3.0)
25
+
26
+ PLATFORMS
27
+ ruby
28
+
29
+ DEPENDENCIES
30
+ bundler (~> 1.0.0)
31
+ geokit
32
+ geokit-rails
33
+ jeweler (~> 1.5.2)
34
+ json
35
+ nayutaya-googlemaps-polyline
36
+ rcov
37
+ rspec (~> 2.3.0)
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 kellydunn
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,256 @@
1
+ == Welcome to Rails
2
+
3
+ Rails is a web-application framework that includes everything needed to create
4
+ database-backed web applications according to the Model-View-Control pattern.
5
+
6
+ This pattern splits the view (also called the presentation) into "dumb"
7
+ templates that are primarily responsible for inserting pre-built data in between
8
+ HTML tags. The model contains the "smart" domain objects (such as Account,
9
+ Product, Person, Post) that holds all the business logic and knows how to
10
+ persist themselves to a database. The controller handles the incoming requests
11
+ (such as Save New Account, Update Product, Show Post) by manipulating the model
12
+ and directing data to the view.
13
+
14
+ In Rails, the model is handled by what's called an object-relational mapping
15
+ layer entitled Active Record. This layer allows you to present the data from
16
+ database rows as objects and embellish these data objects with business logic
17
+ methods. You can read more about Active Record in
18
+ link:files/vendor/rails/activerecord/README.html.
19
+
20
+ The controller and view are handled by the Action Pack, which handles both
21
+ layers by its two parts: Action View and Action Controller. These two layers
22
+ are bundled in a single package due to their heavy interdependence. This is
23
+ unlike the relationship between the Active Record and Action Pack that is much
24
+ more separate. Each of these packages can be used independently outside of
25
+ Rails. You can read more about Action Pack in
26
+ link:files/vendor/rails/actionpack/README.html.
27
+
28
+
29
+ == Getting Started
30
+
31
+ 1. At the command prompt, create a new Rails application:
32
+ <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
33
+
34
+ 2. Change directory to <tt>myapp</tt> and start the web server:
35
+ <tt>cd myapp; rails server</tt> (run with --help for options)
36
+
37
+ 3. Go to http://localhost:3000/ and you'll see:
38
+ "Welcome aboard: You're riding Ruby on Rails!"
39
+
40
+ 4. Follow the guidelines to start developing your application. You can find
41
+ the following resources handy:
42
+
43
+ * The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
44
+ * Ruby on Rails Tutorial Book: http://www.railstutorial.org/
45
+
46
+
47
+ == Debugging Rails
48
+
49
+ Sometimes your application goes wrong. Fortunately there are a lot of tools that
50
+ will help you debug it and get it back on the rails.
51
+
52
+ First area to check is the application log files. Have "tail -f" commands
53
+ running on the server.log and development.log. Rails will automatically display
54
+ debugging and runtime information to these files. Debugging info will also be
55
+ shown in the browser on requests from 127.0.0.1.
56
+
57
+ You can also log your own messages directly into the log file from your code
58
+ using the Ruby logger class from inside your controllers. Example:
59
+
60
+ class WeblogController < ActionController::Base
61
+ def destroy
62
+ @weblog = Weblog.find(params[:id])
63
+ @weblog.destroy
64
+ logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
65
+ end
66
+ end
67
+
68
+ The result will be a message in your log file along the lines of:
69
+
70
+ Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
71
+
72
+ More information on how to use the logger is at http://www.ruby-doc.org/core/
73
+
74
+ Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
75
+ several books available online as well:
76
+
77
+ * Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
78
+ * Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
79
+
80
+ These two books will bring you up to speed on the Ruby language and also on
81
+ programming in general.
82
+
83
+
84
+ == Debugger
85
+
86
+ Debugger support is available through the debugger command when you start your
87
+ Mongrel or WEBrick server with --debugger. This means that you can break out of
88
+ execution at any point in the code, investigate and change the model, and then,
89
+ resume execution! You need to install ruby-debug to run the server in debugging
90
+ mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
91
+
92
+ class WeblogController < ActionController::Base
93
+ def index
94
+ @posts = Post.find(:all)
95
+ debugger
96
+ end
97
+ end
98
+
99
+ So the controller will accept the action, run the first line, then present you
100
+ with a IRB prompt in the server window. Here you can do things like:
101
+
102
+ >> @posts.inspect
103
+ => "[#<Post:0x14a6be8
104
+ @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
105
+ #<Post:0x14a6620
106
+ @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
107
+ >> @posts.first.title = "hello from a debugger"
108
+ => "hello from a debugger"
109
+
110
+ ...and even better, you can examine how your runtime objects actually work:
111
+
112
+ >> f = @posts.first
113
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
114
+ >> f.
115
+ Display all 152 possibilities? (y or n)
116
+
117
+ Finally, when you're ready to resume execution, you can enter "cont".
118
+
119
+
120
+ == Console
121
+
122
+ The console is a Ruby shell, which allows you to interact with your
123
+ application's domain model. Here you'll have all parts of the application
124
+ configured, just like it is when the application is running. You can inspect
125
+ domain models, change values, and save to the database. Starting the script
126
+ without arguments will launch it in the development environment.
127
+
128
+ To start the console, run <tt>rails console</tt> from the application
129
+ directory.
130
+
131
+ Options:
132
+
133
+ * Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
134
+ made to the database.
135
+ * Passing an environment name as an argument will load the corresponding
136
+ environment. Example: <tt>rails console production</tt>.
137
+
138
+ To reload your controllers and models after launching the console run
139
+ <tt>reload!</tt>
140
+
141
+ More information about irb can be found at:
142
+ link:http://www.rubycentral.com/pickaxe/irb.html
143
+
144
+
145
+ == dbconsole
146
+
147
+ You can go to the command line of your database directly through <tt>rails
148
+ dbconsole</tt>. You would be connected to the database with the credentials
149
+ defined in database.yml. Starting the script without arguments will connect you
150
+ to the development database. Passing an argument will connect you to a different
151
+ database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
152
+ PostgreSQL and SQLite 3.
153
+
154
+ == Description of Contents
155
+
156
+ The default directory structure of a generated Ruby on Rails application:
157
+
158
+ |-- app
159
+ | |-- controllers
160
+ | |-- helpers
161
+ | |-- mailers
162
+ | |-- models
163
+ | `-- views
164
+ | `-- layouts
165
+ |-- config
166
+ | |-- environments
167
+ | |-- initializers
168
+ | `-- locales
169
+ |-- db
170
+ |-- doc
171
+ |-- lib
172
+ | `-- tasks
173
+ |-- log
174
+ |-- public
175
+ | |-- images
176
+ | |-- javascripts
177
+ | `-- stylesheets
178
+ |-- script
179
+ |-- test
180
+ | |-- fixtures
181
+ | |-- functional
182
+ | |-- integration
183
+ | |-- performance
184
+ | `-- unit
185
+ |-- tmp
186
+ | |-- cache
187
+ | |-- pids
188
+ | |-- sessions
189
+ | `-- sockets
190
+ `-- vendor
191
+ `-- plugins
192
+
193
+ app
194
+ Holds all the code that's specific to this particular application.
195
+
196
+ app/controllers
197
+ Holds controllers that should be named like weblogs_controller.rb for
198
+ automated URL mapping. All controllers should descend from
199
+ ApplicationController which itself descends from ActionController::Base.
200
+
201
+ app/models
202
+ Holds models that should be named like post.rb. Models descend from
203
+ ActiveRecord::Base by default.
204
+
205
+ app/views
206
+ Holds the template files for the view that should be named like
207
+ weblogs/index.html.erb for the WeblogsController#index action. All views use
208
+ eRuby syntax by default.
209
+
210
+ app/views/layouts
211
+ Holds the template files for layouts to be used with views. This models the
212
+ common header/footer method of wrapping views. In your views, define a layout
213
+ using the <tt>layout :default</tt> and create a file named default.html.erb.
214
+ Inside default.html.erb, call <% yield %> to render the view using this
215
+ layout.
216
+
217
+ app/helpers
218
+ Holds view helpers that should be named like weblogs_helper.rb. These are
219
+ generated for you automatically when using generators for controllers.
220
+ Helpers can be used to wrap functionality for your views into methods.
221
+
222
+ config
223
+ Configuration files for the Rails environment, the routing map, the database,
224
+ and other dependencies.
225
+
226
+ db
227
+ Contains the database schema in schema.rb. db/migrate contains all the
228
+ sequence of Migrations for your schema.
229
+
230
+ doc
231
+ This directory is where your application documentation will be stored when
232
+ generated using <tt>rake doc:app</tt>
233
+
234
+ lib
235
+ Application specific libraries. Basically, any kind of custom code that
236
+ doesn't belong under controllers, models, or helpers. This directory is in
237
+ the load path.
238
+
239
+ public
240
+ The directory available for the web server. Contains subdirectories for
241
+ images, stylesheets, and javascripts. Also contains the dispatchers and the
242
+ default HTML files. This should be set as the DOCUMENT_ROOT of your web
243
+ server.
244
+
245
+ script
246
+ Helper scripts for automation and generation.
247
+
248
+ test
249
+ Unit and functional tests along with fixtures. When using the rails generate
250
+ command, template test files will be generated for you and placed in this
251
+ directory.
252
+
253
+ vendor
254
+ External libraries that the application depends on. Also includes the plugins
255
+ subdirectory. If the app has frozen rails, those gems also go here, under
256
+ vendor/rails/. This directory is in the load path.
@@ -0,0 +1,29 @@
1
+ h1. orochi
2
+
3
+ h2. setup
4
+
5
+ pre. sudo gem install orochi
6
+ rake orochi:awaken
7
+
8
+ h2. usage
9
+
10
+ pre. class YourModel < ActiveRecord::Base
11
+ acts_as_routeable
12
+ end
13
+
14
+ pre. rails generate migration add_router_id_to_your_model
15
+
16
+ pre. class AddRouterIdToYourModel < ActiveRecord::Migration
17
+ self.up
18
+ add_column :your_models, :router_id, :integer, :references => :routers
19
+ end
20
+ self.down
21
+ remove_column :your_models, :router_id
22
+ end
23
+ end
24
+
25
+ h2. ghetto usage
26
+
27
+ pre. your_model_instance.router.start = "a_start_address"
28
+ your_model_instance.router.stop = "a_stop_address"
29
+ your_model_instance.route!
@@ -0,0 +1,50 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'rake'
11
+
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
+ gem.name = "orochi"
16
+ gem.homepage = "http://github.com/kellydunn/orochi"
17
+ gem.license = "MIT"
18
+ gem.summary = %Q{An easy way to ActiveRecord-ize directions and route data}
19
+ gem.description = %Q{A ruby gem that helps ActiveRecord-ize directions and route data}
20
+ gem.email = "defaultstring@gmail.com"
21
+ gem.authors = ["kellydunn"]
22
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
23
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
24
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
25
+ # gem.add_development_dependency 'rspec', '> 1.2.3'
26
+ end
27
+ Jeweler::RubygemsDotOrgTasks.new
28
+
29
+ require 'rspec/core'
30
+ require 'rspec/core/rake_task'
31
+ RSpec::Core::RakeTask.new(:spec) do |spec|
32
+ spec.pattern = FileList['spec/**/*_spec.rb']
33
+ end
34
+
35
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
36
+ spec.pattern = 'spec/**/*_spec.rb'
37
+ spec.rcov = true
38
+ end
39
+
40
+ task :default => :spec
41
+
42
+ require 'rake/rdoctask'
43
+ Rake::RDocTask.new do |rdoc|
44
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
45
+
46
+ rdoc.rdoc_dir = 'rdoc'
47
+ rdoc.title = "orochi #{version}"
48
+ rdoc.rdoc_files.include('README*')
49
+ rdoc.rdoc_files.include('lib/**/*.rb')
50
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.0
@@ -0,0 +1,29 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/migration'
3
+
4
+ # TODO seperating this content seems to
5
+ # render all generators un-find-able :\
6
+ class OrochiGenerator < Rails::Generators::Base
7
+ source_root(File.join(File.dirname(__FILE__)))
8
+
9
+ # Migrations
10
+ include Rails::Generators::Migration
11
+
12
+ def self.next_migration_number(path)
13
+ Time.now.utc.strftime("%Y%m%d%H%M%S")
14
+ end
15
+
16
+ def create_migration_file
17
+ migration_template File.join(File.dirname(__FILE__), 'templates/migrations/migration.rb'), 'db/migrate/orochi_migration'
18
+ end
19
+
20
+ #Models
21
+ def create_models
22
+ dir_path = File.join(File.dirname(__FILE__), 'templates/models')
23
+ Dir.new(dir_path).each do |file|
24
+ if !File.directory?(file)
25
+ template "#{dir_path}/#{File.basename(file)}", "app/models/#{File.basename(file)}"
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,33 @@
1
+ class OdinMigration < 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,3 @@
1
+ class Leg < ActiveRecord::Base
2
+ has_many :steps
3
+ end
@@ -0,0 +1,3 @@
1
+ class Route < ActiveRecord::Base
2
+ has_many :legs
3
+ end
@@ -0,0 +1,3 @@
1
+ class Router < ActiveRecord::Base
2
+ has_many :routes
3
+ end
@@ -0,0 +1,2 @@
1
+ class Step < ActiveRecord::Base
2
+ end
@@ -0,0 +1,10 @@
1
+ require "active_model"
2
+ require "active_record"
3
+
4
+ require "orochi/acts_as_routeable"
5
+
6
+ require "orochi/railtie.rb" if defined?(Rails)
7
+
8
+ if defined?(ActiveRecord::Base)
9
+ Orochi::ActsAsRouteable.include ActiveRecord::Base
10
+ end
@@ -0,0 +1,73 @@
1
+ require 'net/https'
2
+ require 'open-uri'
3
+ require 'json'
4
+ require 'googlemaps_polyline/version'
5
+ require 'googlemaps_polyline/core'
6
+
7
+ module Orochi
8
+ module ActsAsRouteable
9
+ def self.include(base)
10
+ base.extend ClassMethods
11
+ end
12
+
13
+ module ClassMethods
14
+ def acts_as_routeable(options = {})
15
+ metaclass = (class << self; self; end)
16
+
17
+ belongs_to :router
18
+
19
+ send :include, Orochi::ActsAsRouteable::InstanceMethods
20
+ end
21
+ end
22
+
23
+ module InstanceMethods
24
+ def request_routes
25
+ request_str = "http://maps.googleapis.com/maps/api/directions/json?sensor=false&alternatives=true&"
26
+
27
+ start = self.router.start
28
+ request_str += "origin=#{CGI::escape(start)}&"
29
+
30
+ stop = self.router.stop
31
+ request_str += "destination=#{CGI::escape(stop)}"
32
+
33
+ response = open(request_str)
34
+ return JSON.parse(response.read)
35
+ end
36
+
37
+
38
+ def route!
39
+ json = self.request_routes
40
+ json_routes = json["routes"]
41
+ json_routes.each do |route|
42
+ r = self.router.routes.create!
43
+
44
+ route["legs"].each do |route_leg|
45
+ l = r.legs.create!
46
+
47
+ route_leg["steps"].each do |leg_step|
48
+ s = l.steps.create!
49
+
50
+ leg_points = leg_step["polyline"]["points"]
51
+ leg_levels = leg_step["polyline"]["levels"]
52
+ polyline_data = GoogleMapsPolyline.decode_polyline(leg_points, leg_levels)
53
+
54
+ # TODO use inject
55
+ polyline = []
56
+ polyline_data.collect do |point|
57
+ polyline.push([point[0], point[1]])
58
+ end
59
+
60
+ s.polyline_json = polyline
61
+ s.directions_json = leg_step["html_instructions"]
62
+ s.save!
63
+ end
64
+ end
65
+ end
66
+ end
67
+
68
+ def routes
69
+ self.router.routes
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,24 @@
1
+ require 'orochi'
2
+ require 'rails'
3
+
4
+ module Orochi
5
+ class Railtie < Rails::Railtie
6
+
7
+ generators do
8
+ require File.join(File.dirname(__FILE__), "../generators/orochi/orochi_generator")
9
+ end
10
+
11
+ rake_tasks do
12
+ namespace :orochi do
13
+
14
+ desc "generates and runs all necessary migrations for orochi"
15
+ task :awaken => :environment do
16
+ puts "===OROCHI AWAKENS==="
17
+ system("rails g orochi")
18
+ system("rake db:migrate")
19
+ puts "===ARISE, OROCHI!==="
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,4 @@
1
+ run "echo \"gem 'orochi'\" >> Gemfile"
2
+ run "rake db:create:all >> /dev/null"
3
+ run "rake db:migrate >> /dev/null"
4
+ run "rake orochi:awaken >> /dev/null"
@@ -0,0 +1,94 @@
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{orochi}
8
+ s.version = "0.0.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["kellydunn"]
12
+ s.date = %q{2011-01-15}
13
+ s.description = %q{A ruby gem that helps ActiveRecord-ize directions and route data}
14
+ s.email = %q{defaultstring@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README",
18
+ "README.textile"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ ".rspec",
23
+ "Gemfile",
24
+ "Gemfile.lock",
25
+ "LICENSE.txt",
26
+ "README",
27
+ "README.textile",
28
+ "Rakefile",
29
+ "VERSION",
30
+ "lib/generators/orochi/orochi_generator.rb",
31
+ "lib/generators/orochi/templates/migrations/migration.rb",
32
+ "lib/generators/orochi/templates/models/leg.rb",
33
+ "lib/generators/orochi/templates/models/route.rb",
34
+ "lib/generators/orochi/templates/models/router.rb",
35
+ "lib/generators/orochi/templates/models/step.rb",
36
+ "lib/orochi.rb",
37
+ "lib/orochi/acts_as_routeable.rb",
38
+ "lib/orochi/railtie.rb",
39
+ "lib/rails_templates/default_template.rb",
40
+ "orochi.gemspec",
41
+ "spec/helpers/core.rb",
42
+ "spec/odin_spec.rb",
43
+ "spec/rake/migration_spec.rb",
44
+ "spec/rake/rake_spec.rb",
45
+ "spec/spec_helper.rb"
46
+ ]
47
+ s.homepage = %q{http://github.com/kellydunn/orochi}
48
+ s.licenses = ["MIT"]
49
+ s.require_paths = ["lib"]
50
+ s.rubygems_version = %q{1.3.7}
51
+ s.summary = %q{An easy way to ActiveRecord-ize directions and route data}
52
+ s.test_files = [
53
+ "spec/helpers/core.rb",
54
+ "spec/odin_spec.rb",
55
+ "spec/rake/migration_spec.rb",
56
+ "spec/rake/rake_spec.rb",
57
+ "spec/spec_helper.rb"
58
+ ]
59
+
60
+ if s.respond_to? :specification_version then
61
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
62
+ s.specification_version = 3
63
+
64
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
65
+ s.add_runtime_dependency(%q<geokit>, [">= 0"])
66
+ s.add_runtime_dependency(%q<geokit-rails>, [">= 0"])
67
+ s.add_runtime_dependency(%q<nayutaya-googlemaps-polyline>, [">= 0"])
68
+ s.add_runtime_dependency(%q<json>, [">= 0"])
69
+ s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
70
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
71
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
72
+ s.add_development_dependency(%q<rcov>, [">= 0"])
73
+ else
74
+ s.add_dependency(%q<geokit>, [">= 0"])
75
+ s.add_dependency(%q<geokit-rails>, [">= 0"])
76
+ s.add_dependency(%q<nayutaya-googlemaps-polyline>, [">= 0"])
77
+ s.add_dependency(%q<json>, [">= 0"])
78
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
79
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
80
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
81
+ s.add_dependency(%q<rcov>, [">= 0"])
82
+ end
83
+ else
84
+ s.add_dependency(%q<geokit>, [">= 0"])
85
+ s.add_dependency(%q<geokit-rails>, [">= 0"])
86
+ s.add_dependency(%q<nayutaya-googlemaps-polyline>, [">= 0"])
87
+ s.add_dependency(%q<json>, [">= 0"])
88
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
89
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
90
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
91
+ s.add_dependency(%q<rcov>, [">= 0"])
92
+ end
93
+ end
94
+
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+
3
+ module CoreHelper
4
+ def create_rails_app
5
+ Dir.chdir("spec/staging")
6
+ system("rails new gem_test -d mysql -m ../../lib/rails_templates/default_template.rb >> /dev/null")
7
+ puts "== Created rails application ====="
8
+ end
9
+
10
+ def destroy_rails_app
11
+ begin
12
+ system("rm -rf gem_test")
13
+ puts "== Destroyed rails application ==="
14
+ Dir.chdir("../../")
15
+ rescue
16
+ puts "Was not able to delete rails application"
17
+ end
18
+ end
19
+ end
20
+
@@ -0,0 +1,4 @@
1
+ 'spec_helper'
2
+
3
+ describe "Odin" do
4
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Migration rake" do
4
+ include CoreHelper
5
+
6
+ before :each do
7
+ create_rails_app
8
+ end
9
+
10
+ after :each do
11
+ destroy_rails_app
12
+ end
13
+
14
+ it "should create all necessary migrations" do
15
+ success = Dir.new("gem_test/db/migrate/").all? do |file|
16
+ File.basename(file).match("orochi_migration")
17
+ end
18
+ success.should_not be_nil
19
+ end
20
+
21
+ it "should automatically apply the necessary migrations"
22
+ end
@@ -0,0 +1,5 @@
1
+ require "spec_helper"
2
+
3
+ describe "Gem rake tasks" do
4
+ include CoreHelper
5
+ end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'orochi'
5
+
6
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
7
+ Dir["#{File.dirname(__FILE__)}/helpers/**/*.rb"].each {|f| require f}
8
+
9
+ File.join(File.dirname(__FILE__))
10
+
11
+ RSpec.configure do |config|
12
+ end
metadata ADDED
@@ -0,0 +1,214 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: orochi
3
+ version: !ruby/object:Gem::Version
4
+ hash: 31
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 0
10
+ version: 0.0.0
11
+ platform: ruby
12
+ authors:
13
+ - kellydunn
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-01-15 00:00:00 -08:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ prerelease: false
23
+ name: geokit
24
+ type: :runtime
25
+ version_requirements: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 3
31
+ segments:
32
+ - 0
33
+ version: "0"
34
+ requirement: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ prerelease: false
37
+ name: geokit-rails
38
+ type: :runtime
39
+ version_requirements: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
47
+ version: "0"
48
+ requirement: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ prerelease: false
51
+ name: nayutaya-googlemaps-polyline
52
+ type: :runtime
53
+ version_requirements: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ requirement: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ prerelease: false
65
+ name: json
66
+ type: :runtime
67
+ version_requirements: &id004 !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 3
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ requirement: *id004
77
+ - !ruby/object:Gem::Dependency
78
+ prerelease: false
79
+ name: rspec
80
+ type: :development
81
+ version_requirements: &id005 !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ~>
85
+ - !ruby/object:Gem::Version
86
+ hash: 3
87
+ segments:
88
+ - 2
89
+ - 3
90
+ - 0
91
+ version: 2.3.0
92
+ requirement: *id005
93
+ - !ruby/object:Gem::Dependency
94
+ prerelease: false
95
+ name: bundler
96
+ type: :development
97
+ version_requirements: &id006 !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ~>
101
+ - !ruby/object:Gem::Version
102
+ hash: 23
103
+ segments:
104
+ - 1
105
+ - 0
106
+ - 0
107
+ version: 1.0.0
108
+ requirement: *id006
109
+ - !ruby/object:Gem::Dependency
110
+ prerelease: false
111
+ name: jeweler
112
+ type: :development
113
+ version_requirements: &id007 !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ~>
117
+ - !ruby/object:Gem::Version
118
+ hash: 7
119
+ segments:
120
+ - 1
121
+ - 5
122
+ - 2
123
+ version: 1.5.2
124
+ requirement: *id007
125
+ - !ruby/object:Gem::Dependency
126
+ prerelease: false
127
+ name: rcov
128
+ type: :development
129
+ version_requirements: &id008 !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ hash: 3
135
+ segments:
136
+ - 0
137
+ version: "0"
138
+ requirement: *id008
139
+ description: A ruby gem that helps ActiveRecord-ize directions and route data
140
+ email: defaultstring@gmail.com
141
+ executables: []
142
+
143
+ extensions: []
144
+
145
+ extra_rdoc_files:
146
+ - LICENSE.txt
147
+ - README
148
+ - README.textile
149
+ files:
150
+ - .document
151
+ - .rspec
152
+ - Gemfile
153
+ - Gemfile.lock
154
+ - LICENSE.txt
155
+ - README
156
+ - README.textile
157
+ - Rakefile
158
+ - VERSION
159
+ - lib/generators/orochi/orochi_generator.rb
160
+ - lib/generators/orochi/templates/migrations/migration.rb
161
+ - lib/generators/orochi/templates/models/leg.rb
162
+ - lib/generators/orochi/templates/models/route.rb
163
+ - lib/generators/orochi/templates/models/router.rb
164
+ - lib/generators/orochi/templates/models/step.rb
165
+ - lib/orochi.rb
166
+ - lib/orochi/acts_as_routeable.rb
167
+ - lib/orochi/railtie.rb
168
+ - lib/rails_templates/default_template.rb
169
+ - orochi.gemspec
170
+ - spec/helpers/core.rb
171
+ - spec/odin_spec.rb
172
+ - spec/rake/migration_spec.rb
173
+ - spec/rake/rake_spec.rb
174
+ - spec/spec_helper.rb
175
+ has_rdoc: true
176
+ homepage: http://github.com/kellydunn/orochi
177
+ licenses:
178
+ - MIT
179
+ post_install_message:
180
+ rdoc_options: []
181
+
182
+ require_paths:
183
+ - lib
184
+ required_ruby_version: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ hash: 3
190
+ segments:
191
+ - 0
192
+ version: "0"
193
+ required_rubygems_version: !ruby/object:Gem::Requirement
194
+ none: false
195
+ requirements:
196
+ - - ">="
197
+ - !ruby/object:Gem::Version
198
+ hash: 3
199
+ segments:
200
+ - 0
201
+ version: "0"
202
+ requirements: []
203
+
204
+ rubyforge_project:
205
+ rubygems_version: 1.3.7
206
+ signing_key:
207
+ specification_version: 3
208
+ summary: An easy way to ActiveRecord-ize directions and route data
209
+ test_files:
210
+ - spec/helpers/core.rb
211
+ - spec/odin_spec.rb
212
+ - spec/rake/migration_spec.rb
213
+ - spec/rake/rake_spec.rb
214
+ - spec/spec_helper.rb