gmaps4rails 0.10.2 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/README.rdoc +22 -3
  2. data/app/views/gmaps4rails/_gmaps4rails.html.erb +25 -18
  3. data/lib/generators/gmaps4rails/install_generator.rb +6 -5
  4. data/lib/gmaps4rails.rb +10 -5
  5. data/lib/gmaps4rails/acts_as_gmappable.rb +1 -2
  6. data/lib/gmaps4rails/base.rb +2 -2
  7. data/lib/gmaps4rails/extensions/array.rb +0 -1
  8. data/lib/gmaps4rails/helper/gmaps4rails_helper.rb +5 -0
  9. data/public/javascripts/gmaps4rails/bing.js +2 -0
  10. data/public/javascripts/{gmaps4rails.js → gmaps4rails/gmaps4rails.base.js} +2 -2
  11. data/public/javascripts/{gmaps4rails.bing.js → gmaps4rails/gmaps4rails.bing.js} +0 -0
  12. data/public/javascripts/{gmaps4rails.googlemaps.js → gmaps4rails/gmaps4rails.googlemaps.js} +0 -0
  13. data/public/javascripts/{gmaps4rails.mapquest.js → gmaps4rails/gmaps4rails.mapquest.js} +0 -0
  14. data/public/javascripts/{gmaps4rails.openlayers.js → gmaps4rails/gmaps4rails.openlayers.js} +0 -0
  15. data/public/javascripts/gmaps4rails/googlemaps.js +2 -0
  16. data/public/javascripts/gmaps4rails/mapquest.js +2 -0
  17. data/public/javascripts/gmaps4rails/openlayers.js +2 -0
  18. data/public/stylesheets/gmaps4rails.css +1 -1
  19. data/test/dummy/app/helpers/users_helper.rb +1 -0
  20. data/test/dummy/app/models/user.rb +11 -11
  21. data/test/dummy/db/schema.rb +5 -1
  22. data/test/dummy/spec/helpers/gmaps4rails_helper_spec.rb +13 -0
  23. data/test/dummy/spec/spec_helper.rb +1 -1
  24. data/test/dummy31/app/controllers/application_controller.rb +3 -0
  25. data/test/dummy31/app/controllers/users_controller.rb +83 -0
  26. data/test/dummy31/app/helpers/application_helper.rb +2 -0
  27. data/test/dummy31/app/helpers/users_helper.rb +2 -0
  28. data/test/dummy31/app/models/user.rb +7 -0
  29. data/test/dummy31/config/application.rb +43 -0
  30. data/test/dummy31/config/boot.rb +6 -0
  31. data/test/dummy31/config/environment.rb +5 -0
  32. data/test/dummy31/config/environments/development.rb +27 -0
  33. data/test/dummy31/config/environments/production.rb +51 -0
  34. data/test/dummy31/config/environments/test.rb +39 -0
  35. data/test/dummy31/config/initializers/backtrace_silencers.rb +7 -0
  36. data/test/dummy31/config/initializers/inflections.rb +10 -0
  37. data/test/dummy31/config/initializers/mime_types.rb +5 -0
  38. data/test/dummy31/config/initializers/secret_token.rb +7 -0
  39. data/test/dummy31/config/initializers/session_store.rb +8 -0
  40. data/test/dummy31/config/initializers/wrap_parameters.rb +12 -0
  41. data/test/dummy31/config/routes.rb +61 -0
  42. data/test/dummy31/db/migrate/20110809134019_create_users.rb +13 -0
  43. data/test/dummy31/db/schema.rb +25 -0
  44. data/test/dummy31/db/seeds.rb +7 -0
  45. metadata +57 -9
data/README.rdoc CHANGED
@@ -27,9 +27,28 @@ Any help would be appreciated to complete this work.
27
27
 
28
28
  == Requirements
29
29
  - gem 'gmaps4rails' (in your gemfile, then bundle)
30
- - <%= yield :head %> (in your header)
30
+ - <%= yield :head %> (in your header)
31
31
  - <%= yield :scripts %> (in your footer)
32
- - config.serve_static_assets = true (in your production.rb), or run 'rails generate gmaps4rails:install' to copy the JS and CSS assets to your /public folder.
32
+
33
+ To make Rails serve the assets (javascripts, stylesheets and marker images) you have several options, depending on your configuration and Rails version:
34
+ - if you are using Rails 3.1 and have asset pipeline enabled ('config.assets.enabled = true' in config/application.rb), include the appropriate manifest:
35
+
36
+ * //= require gmaps4rails/bing.js
37
+
38
+ * //= require gmaps4rails/googlemaps.js
39
+
40
+ * //= require gmaps4rails/mapquest.js
41
+
42
+ * //= require gmaps4rails/openlayers.js
43
+
44
+ You even don't need the `yield :head` if you include `require gmaps4rails` in you CSS manifest.
45
+
46
+ - if you are using Rails 3.0:
47
+ if you have Rails configured to serve static assets ('config.serve_static_assets = true'; note that it is disabled by default in production environment), they'll be served directly from gem's public/ directory.
48
+
49
+ - finally you can just copy assets to your application's public/stylesheets, public/javascripts/gmaps4rails and public/images. It's recommended to do this in production so that you can let your webserver serve them rather than go through Rails each time they are requested. There's a generator to help you with that:
50
+
51
+ rails generate gmaps4rails:install
33
52
 
34
53
  == Basic configuration
35
54
  In your model, add:
@@ -91,4 +110,4 @@ MIT license.
91
110
 
92
111
  Authors: Benjamin Roth, David Ruyer
93
112
 
94
- Contributors: Mircea Pricop, Alex Vorobiev
113
+ Contributors: Mircea Pricop, Kamil Śliwak, Alex Vorobiev
@@ -4,27 +4,34 @@ if enable_css == true %>
4
4
  <%= stylesheet_link_tag 'gmaps4rails' %>
5
5
  <% end %>
6
6
  <% end %>
7
-
8
7
  <% content_for :scripts do %>
9
8
  <% if enable_js == true %>
10
- <%= javascript_include_tag 'gmaps4rails' %>
11
-
12
- <% case options['map_options'].try(:[], 'provider') %>
13
- <% when "openlayers"%>
9
+ <% case options['map_options'].try(:[], 'provider') %>
10
+ <% when "openlayers" %>
14
11
  <script src="http://www.openlayers.org/api/OpenLayers.js"></script>
15
- <%= javascript_include_tag 'gmaps4rails.openlayers.js' %>
16
12
  <% when "mapquest" %>
17
- <script src="http://mapquestapi.com/sdk/js/v6.0.0/mqa.toolkit.js?key=<%= options['map_options'].try(:[], 'provider_key') %>"></script>
18
- <%= javascript_include_tag 'gmaps4rails.mapquest.js' %>
13
+ <script src="http://mapquestapi.com/sdk/js/v6.0.0/mqa.toolkit.js?key=#{options['map_options'].try(:[], 'provider_key')}"></script>
19
14
  <% when "bing" %>
20
15
  <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>
21
- <%= javascript_include_tag 'gmaps4rails.bing.js' %>
22
16
  <% else %>
23
- <%= javascript_include_tag 'gmaps4rails.googlemaps.js' %>
24
- <script type="text/javascript" src='http://maps.google.com/maps/api/js?sensor=false&amp;libraries=geometry'></script>
25
- <script type="text/javascript" src='http://google-maps-utility-library-v3.googlecode.com/svn/tags/infobox/1.1.5/src/infobox.js'></script>
26
- <script type="text/javascript" src='http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclusterer/1.0/src/markerclusterer_compiled.js'></script>
27
- <% end %>
17
+ <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&amp;libraries=geometry<%= g_libraries(options['map_options'].try(:[], 'libraries')) %>"></script>
18
+ <script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/tags/infobox/1.1.5/src/infobox.js"></script>
19
+ <script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclusterer/1.0/src/markerclusterer_compiled.js"></script>
20
+ <% end %>
21
+
22
+ <% if Rails::VERSION::MINOR < 1 %>
23
+ <%= javascript_include_tag 'gmaps4rails/gmaps4rails.base.js' %>
24
+ <% case options['map_options'].try(:[], 'provider') %>
25
+ <% when "openlayers" %>
26
+ <%= javascript_include_tag 'gmaps4rails/gmaps4rails.openlayers.js' %>
27
+ <% when "mapquest" %>
28
+ <%= javascript_include_tag 'gmaps4rails/gmaps4rails.mapquest.js' %>
29
+ <% when "bing" %>
30
+ <%= javascript_include_tag 'gmaps4rails/gmaps4rails.bing.js' %>
31
+ <% else %>
32
+ <%= javascript_include_tag 'gmaps4rails/gmaps4rails.googlemaps.js' %>
33
+ <% end %>
34
+ <% end %>
28
35
  <% end %>
29
36
  <script type="text/javascript" charset="utf-8">
30
37
  function gmaps4rails_init() {
@@ -44,11 +51,11 @@ window.onload = gmaps4rails_init;
44
51
  <!-- TODO: change this style dynamically -->
45
52
  </div>
46
53
  <% when "bing" %>
47
- <div id="<%= options['map_options'].try(:[],'container_id').nil? ? "map_container" : options['map_options']['container_id'] %>" >
48
- <div id="<%= options['map_options'].try(:[],'id').nil? ? "gmaps4rails_map" : options['map_options']['id'] %>" class="bing_map"></div>
54
+ <div id="<%= options['map_options'].try(:[],'container_id') || "map_container" %>" >
55
+ <div id="<%= options['map_options'].try(:[],'id') || "gmaps4rails_map" %>" class="bing_map"></div>
49
56
  </div>
50
57
  <% else %>
51
- <div id="<%= options['map_options'].try(:[],'container_id').nil? ? "map_container" : options['map_options']['container_id'] %>">
52
- <div id="<%= options['map_options'].try(:[],'id').nil? ? "gmaps4rails_map" : options['map_options']['id'] %>"></div>
58
+ <div id="<%= options['map_options'].try(:[],'container_id') || "map_container" %>">
59
+ <div id="<%= options['map_options'].try(:[],'id') || "gmaps4rails_map" %>"></div>
53
60
  </div>
54
61
  <% end %>
@@ -6,11 +6,12 @@ module Gmaps4rails
6
6
  desc 'Creates a Gmaps4rails initializer and copies the assets to the public folder.'
7
7
 
8
8
  def copy_locale
9
- copy_file '../../../public/javascripts/gmaps4rails.js', 'public/javascripts/gmaps4rails.js'
10
- copy_file '../../../public/javascripts/gmaps4rails.googlemaps.js', 'public/javascripts/gmaps4rails.googlemaps.js'
11
- copy_file '../../../public/javascripts/gmaps4rails.bing.js', 'public/javascripts/gmaps4rails.bing.js'
12
- copy_file '../../../public/javascripts/gmaps4rails.openlayers.js', 'public/javascripts/gmaps4rails.openlayers.js'
13
- copy_file '../../../public/javascripts/gmaps4rails.mapquest.js', 'public/javascripts/gmaps4rails.mapquest.js'
9
+ #I don't copy manifests, kind of useless
10
+ copy_file '../../../public/javascripts/gmaps4rails/gmaps4rails.base.js', 'public/javascripts/gmaps4rails.base.js'
11
+ copy_file '../../../public/javascripts/gmaps4rails/gmaps4rails.googlemaps.js', 'public/javascripts/gmaps4rails.googlemaps.js'
12
+ copy_file '../../../public/javascripts/gmaps4rails/gmaps4rails.bing.js', 'public/javascripts/gmaps4rails.bing.js'
13
+ copy_file '../../../public/javascripts/gmaps4rails/gmaps4rails.openlayers.js', 'public/javascripts/gmaps4rails.openlayers.js'
14
+ copy_file '../../../public/javascripts/gmaps4rails/gmaps4rails.mapquest.js', 'public/javascripts/gmaps4rails.mapquest.js'
14
15
  copy_file '../../../public/stylesheets/gmaps4rails.css', 'public/stylesheets/gmaps4rails.css'
15
16
  copy_file '../../../public/images/marker.png', 'public/images/marker.png'
16
17
  end
data/lib/gmaps4rails.rb CHANGED
@@ -8,14 +8,19 @@ if defined?(Rails) && Rails::VERSION::MAJOR == 3
8
8
  require 'gmaps4rails/helper/gmaps4rails_helper'
9
9
 
10
10
  class Engine < Rails::Engine
11
- initializer "static assets" do |app|
12
- app.middleware.use ::ActionDispatch::Static, "#{root}/public"
13
- end
14
11
  initializer "gmaps4rails view helpers" do |app|
15
12
  ActionView::Base.send :include, Gmaps4railsHelper
16
13
  end
14
+ initializer "add asset directories to pipeline" do |app|
15
+ if Rails::VERSION::MINOR >= 1
16
+ app.config.assets.paths << "#{root}/public/javascripts"
17
+ app.config.assets.paths << "#{root}/public/stylesheets"
18
+ app.config.assets.paths << "#{root}/public/images"
19
+ else
20
+ app.middleware.use ::ActionDispatch::Static, "#{root}/public"
21
+ end
22
+ end
17
23
  end
18
24
 
19
25
  end
20
- end
21
-
26
+ end
@@ -49,9 +49,8 @@ module Gmaps4rails
49
49
  unless args[:process_geocoding] == false
50
50
  validate :process_geocoding
51
51
  end
52
-
53
- #instance method containing all the options to configure the behaviour of the gem regarding the current Model
54
52
 
53
+ #instance method containing all the options to configure the behaviour of the gem regarding the current Model
55
54
  define_method "gmaps4rails_options" do
56
55
  {
57
56
  :lat_column => args[:lat] || "latitude",
@@ -14,11 +14,11 @@ module Gmaps4rails
14
14
  # Creates the json related to one Object (only tried ActiveRecord objects)
15
15
  # This json will contian the marker's attributes of the object
16
16
 
17
- def Gmaps4rails.create_json(object, &block)
17
+ def Gmaps4rails.create_json(object, &block)
18
18
  unless object.send(object.gmaps4rails_options[:lat_column]).blank? && object.send(object.gmaps4rails_options[:lng_column]).blank?
19
19
  "{#{Gmaps4rails.description(object)}#{Gmaps4rails.title(object)}#{Gmaps4rails.sidebar(object)}\"lng\": \"#{object.send(object.gmaps4rails_options[:lng_column])}\", \"lat\": \"#{object.send(object.gmaps4rails_options[:lat_column])}\"#{Gmaps4rails.picture(object)}#{Gmaps4rails.block_handling(object, &block)}},\n"
20
20
  end
21
- end
21
+ end
22
22
 
23
23
  # execute block if provided so that it's included in the json string
24
24
  def Gmaps4rails.block_handling(object, &block)
@@ -1,7 +1,6 @@
1
1
  class Array
2
2
  #Scopes on models generate Arrays
3
3
  #this method enables short call to the json creation for all elements in the array
4
-
5
4
  def to_gmaps4rails(&block)
6
5
  json = "["
7
6
  each do |object|
@@ -15,5 +15,10 @@ module Gmaps4railsHelper
15
15
  def gmaps(options, enable_css = true, enable_js = true )
16
16
  render :partial => 'gmaps4rails/gmaps4rails', :locals => { :options => options, :enable_css => enable_css, :enable_js => enable_js }
17
17
  end
18
+
19
+ def g_libraries(libraries_array)
20
+ return "" if libraries_array.nil?
21
+ "," + libraries_array.join(",")
22
+ end
18
23
 
19
24
  end
@@ -0,0 +1,2 @@
1
+ //= require ./gmaps4rails.base.js
2
+ //= require ./gmaps4rails.bing.js
@@ -460,8 +460,8 @@ var Gmaps4Rails = {
460
460
  //if autozoom is false, take user info into account
461
461
  if(!this.map_options.auto_zoom) {
462
462
  var map_center = this.boundsObject.getCenter();
463
- this.map_options.center_longitude = map_center.lat();
464
- this.map_options.center_latitude = map_center.lng();
463
+ this.map_options.center_latitude = map_center.lat();
464
+ this.map_options.center_longitude = map_center.lng();
465
465
  this.map.setCenter(map_center);
466
466
  }
467
467
  else {
@@ -0,0 +1,2 @@
1
+ //= require ./gmaps4rails.base.js
2
+ //= require ./gmaps4rails.googlemaps.js
@@ -0,0 +1,2 @@
1
+ //= require ./gmaps4rails.base.js
2
+ //= require ./gmaps4rails.mapquest.js
@@ -0,0 +1,2 @@
1
+ //= require ./gmaps4rails.base.js
2
+ //= require ./gmaps4rails.openlayers.js
@@ -1,4 +1,4 @@
1
- #map-container {
1
+ #map_container {
2
2
  padding: 6px;
3
3
  border-width: 1px;
4
4
  border-style: solid;
@@ -1,2 +1,3 @@
1
1
  module UsersHelper
2
+
2
3
  end
@@ -7,17 +7,17 @@ class User < ActiveRecord::Base
7
7
  end
8
8
 
9
9
 
10
- def gmaps4rails_marker_picture
11
- {
12
- "picture" => "http://www.blankdots.com/img/github-32x32.png",
13
- "width" => "32",
14
- "height" => "32",
15
- "shadow_picture" => "https://secure.gravatar.com/avatar/808bec1c640143bd7091888d9edfb2f2.png",
16
- "shadow_height" => 40,
17
- "shadow_width" => 50,
18
- "shadow_anchor" => [10, -30]
19
- }
20
- end
10
+ # def gmaps4rails_marker_picture
11
+ # {
12
+ # "picture" => "http://www.blankdots.com/img/github-32x32.png",
13
+ # "width" => "32",
14
+ # "height" => "32",
15
+ # "shadow_picture" => "https://secure.gravatar.com/avatar/808bec1c640143bd7091888d9edfb2f2.png",
16
+ # "shadow_height" => 40,
17
+ # "shadow_width" => 50,
18
+ # "shadow_anchor" => [10, -30]
19
+ # }
20
+ # end
21
21
 
22
22
  #
23
23
  # def gmaps4rails_title
@@ -10,7 +10,11 @@
10
10
  #
11
11
  # It's strongly recommended to check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(:version => 20110430083824) do
13
+ ActiveRecord::Schema.define(:version => 20110729164234) do
14
+
15
+ create_table "user_profiles", :force => true do |t|
16
+ t.string "name"
17
+ end
14
18
 
15
19
  create_table "users", :force => true do |t|
16
20
  t.string "name"
@@ -0,0 +1,13 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Gmaps4railsHelper do
4
+
5
+ it "should create a string containing all desired libraries" do
6
+ helper.g_libraries(["places", "foo", "bar"]).should eq(",places,foo,bar")
7
+ end
8
+
9
+ it "should render empty string if no library provided" do
10
+ helper.g_libraries(nil).should eq("")
11
+ end
12
+
13
+ end
@@ -3,7 +3,7 @@ ENV["RAILS_ENV"] ||= 'test'
3
3
  require File.expand_path("../../config/environment", __FILE__)
4
4
  require 'rspec/rails'
5
5
  require 'capybara/rspec'
6
-
6
+ require 'shoulda-matchers'
7
7
  # Requires supporting ruby files with custom matchers and macros, etc,
8
8
  # in spec/support/ and its subdirectories.
9
9
  Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,83 @@
1
+ class UsersController < ApplicationController
2
+ # GET /users
3
+ # GET /users.json
4
+ def index
5
+ @users = User.all
6
+ @json = User.all.to_gmaps4rails
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.json { render :json => @users }
10
+ end
11
+ end
12
+
13
+ # GET /users/1
14
+ # GET /users/1.json
15
+ def show
16
+ @user = User.find(params[:id])
17
+
18
+ respond_to do |format|
19
+ format.html # show.html.erb
20
+ format.json { render :json => @user }
21
+ end
22
+ end
23
+
24
+ # GET /users/new
25
+ # GET /users/new.json
26
+ def new
27
+ @user = User.new
28
+
29
+ respond_to do |format|
30
+ format.html # new.html.erb
31
+ format.json { render :json => @user }
32
+ end
33
+ end
34
+
35
+ # GET /users/1/edit
36
+ def edit
37
+ @user = User.find(params[:id])
38
+ end
39
+
40
+ # POST /users
41
+ # POST /users.json
42
+ def create
43
+ @user = User.new(params[:user])
44
+
45
+ respond_to do |format|
46
+ if @user.save
47
+ format.html { redirect_to @user, :notice => 'User was successfully created.' }
48
+ format.json { render :json => @user, :status => :created, :location => @user }
49
+ else
50
+ format.html { render :action => "new" }
51
+ format.json { render :json => @user.errors, :status => :unprocessable_entity }
52
+ end
53
+ end
54
+ end
55
+
56
+ # PUT /users/1
57
+ # PUT /users/1.json
58
+ def update
59
+ @user = User.find(params[:id])
60
+
61
+ respond_to do |format|
62
+ if @user.update_attributes(params[:user])
63
+ format.html { redirect_to @user, :notice => 'User was successfully updated.' }
64
+ format.json { head :ok }
65
+ else
66
+ format.html { render :action => "edit" }
67
+ format.json { render :json => @user.errors, :status => :unprocessable_entity }
68
+ end
69
+ end
70
+ end
71
+
72
+ # DELETE /users/1
73
+ # DELETE /users/1.json
74
+ def destroy
75
+ @user = User.find(params[:id])
76
+ @user.destroy
77
+
78
+ respond_to do |format|
79
+ format.html { redirect_to users_url }
80
+ format.json { head :ok }
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module UsersHelper
2
+ end
@@ -0,0 +1,7 @@
1
+ class User < ActiveRecord::Base
2
+ acts_as_gmappable
3
+
4
+ def gmaps4rails_address
5
+ address
6
+ end
7
+ end
@@ -0,0 +1,43 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # If you have a Gemfile, require the default gems, the ones in the
6
+ # current environment and also include :assets gems if in development
7
+ # or test environments.
8
+ Bundler.require *Rails.groups(:assets) if defined?(Bundler)
9
+
10
+ module Dummy31
11
+ class Application < Rails::Application
12
+ # Settings in config/environments/* take precedence over those specified here.
13
+ # Application configuration should go into files in config/initializers
14
+ # -- all .rb files in that directory are automatically loaded.
15
+
16
+ # Custom directories with classes and modules you want to be autoloadable.
17
+ # config.autoload_paths += %W(#{config.root}/extras)
18
+
19
+ # Only load the plugins named here, in the order given (default is alphabetical).
20
+ # :all can be used as a placeholder for all plugins not explicitly named.
21
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
22
+
23
+ # Activate observers that should always be running.
24
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
25
+
26
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
27
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
28
+ # config.time_zone = 'Central Time (US & Canada)'
29
+
30
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
31
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
32
+ # config.i18n.default_locale = :de
33
+
34
+ # Configure the default encoding used in templates for Ruby 1.9.
35
+ config.encoding = "utf-8"
36
+
37
+ # Configure sensitive parameters which will be filtered from the log file.
38
+ config.filter_parameters += [:password]
39
+
40
+ # Enable the asset pipeline
41
+ config.assets.enabled = true
42
+ end
43
+ end
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
+
6
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Dummy31::Application.initialize!
@@ -0,0 +1,27 @@
1
+ Dummy31::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 web server 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_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger
20
+ config.active_support.deprecation = :log
21
+
22
+ # Only use best-standards-support built into browsers
23
+ config.action_dispatch.best_standards_support = :builtin
24
+
25
+ # Do not compress assets
26
+ config.assets.compress = false
27
+ end
@@ -0,0 +1,51 @@
1
+ Dummy31::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+
7
+ # Full error reports are disabled and caching is turned on
8
+ config.consider_all_requests_local = false
9
+ config.action_controller.perform_caching = true
10
+
11
+ # Disable Rails's static asset server (Apache or nginx will already do this)
12
+ config.serve_static_assets = false
13
+
14
+ # Compress JavaScripts and CSS
15
+ config.assets.compress = true
16
+
17
+ # Specifies the header that your server uses for sending files
18
+ # (comment out if your front-end server doesn't support this)
19
+ config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx
20
+
21
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
22
+ # config.force_ssl = true
23
+
24
+ # See everything in the log (default is :info)
25
+ # config.log_level = :debug
26
+
27
+ # Use a different logger for distributed setups
28
+ # config.logger = SyslogLogger.new
29
+
30
+ # Use a different cache store in production
31
+ # config.cache_store = :mem_cache_store
32
+
33
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
34
+ # config.action_controller.asset_host = "http://assets.example.com"
35
+
36
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
37
+ # config.assets.precompile += %w( search.js )
38
+
39
+ # Disable delivery errors, bad email addresses will be ignored
40
+ # config.action_mailer.raise_delivery_errors = false
41
+
42
+ # Enable threaded mode
43
+ # config.threadsafe!
44
+
45
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
46
+ # the I18n.default_locale when a translation can not be found)
47
+ config.i18n.fallbacks = true
48
+
49
+ # Send deprecation notices to registered listeners
50
+ config.active_support.deprecation = :notify
51
+ end
@@ -0,0 +1,39 @@
1
+ Dummy31::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
+ # Configure static asset server for tests with Cache-Control for performance
11
+ config.serve_static_assets = true
12
+ config.static_cache_control = "public, max-age=3600"
13
+
14
+ # Log error messages when you accidentally call methods on nil
15
+ config.whiny_nils = true
16
+
17
+ # Show full error reports and disable caching
18
+ config.consider_all_requests_local = true
19
+ config.action_controller.perform_caching = false
20
+
21
+ # Raise exceptions instead of rendering exception templates
22
+ config.action_dispatch.show_exceptions = false
23
+
24
+ # Disable request forgery protection in test environment
25
+ config.action_controller.allow_forgery_protection = false
26
+
27
+ # Tell Action Mailer not to deliver emails to the real world.
28
+ # The :test delivery method accumulates sent emails in the
29
+ # ActionMailer::Base.deliveries array.
30
+ config.action_mailer.delivery_method = :test
31
+
32
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
33
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
34
+ # like if you have constraints or database-specific column types
35
+ # config.active_record.schema_format = :sql
36
+
37
+ # Print deprecation notices to the stderr
38
+ config.active_support.deprecation = :stderr
39
+ 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,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -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
+ Dummy31::Application.config.secret_token = '22e05738739a71c54cdb0e7f8fa73bb0b940bb930fd6e201d16c734db51718c44cf6c1294899c48c9ac5ac12bbae87d679f9f7eb7ec98416973c130fa77e35b7'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy31::Application.config.session_store :cookie_store, :key => '_dummy31_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
+ # Dummy31::Application.config.session_store :active_record_store
@@ -0,0 +1,12 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActionController::Base.wrap_parameters :format => [:json]
8
+
9
+ # Disable root element in JSON by default.
10
+ if defined?(ActiveRecord)
11
+ ActiveRecord::Base.include_root_in_json = false
12
+ end
@@ -0,0 +1,61 @@
1
+ Dummy31::Application.routes.draw do
2
+ resources :users
3
+
4
+ root :to => "users#index"
5
+ # The priority is based upon order of creation:
6
+ # first created -> highest priority.
7
+
8
+ # Sample of regular route:
9
+ # match 'products/:id' => 'catalog#view'
10
+ # Keep in mind you can assign values other than :controller and :action
11
+
12
+ # Sample of named route:
13
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
14
+ # This route can be invoked with purchase_url(:id => product.id)
15
+
16
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
17
+ # resources :products
18
+
19
+ # Sample resource route with options:
20
+ # resources :products do
21
+ # member do
22
+ # get 'short'
23
+ # post 'toggle'
24
+ # end
25
+ #
26
+ # collection do
27
+ # get 'sold'
28
+ # end
29
+ # end
30
+
31
+ # Sample resource route with sub-resources:
32
+ # resources :products do
33
+ # resources :comments, :sales
34
+ # resource :seller
35
+ # end
36
+
37
+ # Sample resource route with more complex sub-resources
38
+ # resources :products do
39
+ # resources :comments
40
+ # resources :sales do
41
+ # get 'recent', :on => :collection
42
+ # end
43
+ # end
44
+
45
+ # Sample resource route within a namespace:
46
+ # namespace :admin do
47
+ # # Directs /admin/products/* to Admin::ProductsController
48
+ # # (app/controllers/admin/products_controller.rb)
49
+ # resources :products
50
+ # end
51
+
52
+ # You can have the root of your site routed with "root"
53
+ # just remember to delete public/index.html.
54
+ # root :to => 'welcome#index'
55
+
56
+ # See how all your routes lay out with "rake routes"
57
+
58
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
59
+ # Note: This route will make all actions in every controller accessible via GET requests.
60
+ # match ':controller(/:action(/:id(.:format)))'
61
+ end
@@ -0,0 +1,13 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+ t.string :name
5
+ t.string :address
6
+ t.float :latitude
7
+ t.float :longitude
8
+ t.boolean :gmaps
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,25 @@
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 => 20110809134019) do
14
+
15
+ create_table "users", :force => true do |t|
16
+ t.string "name"
17
+ t.string "address"
18
+ t.float "latitude"
19
+ t.float "longitude"
20
+ t.boolean "gmaps"
21
+ t.datetime "created_at"
22
+ t.datetime "updated_at"
23
+ end
24
+
25
+ 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 => 'Emanuel', :city => cities.first)
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 10
9
- - 2
10
- version: 0.10.2
8
+ - 11
9
+ - 0
10
+ version: 0.11.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Benjamin Roth
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-07-20 00:00:00 +02:00
19
+ date: 2011-08-12 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -55,11 +55,15 @@ files:
55
55
  - lib/gmaps4rails/extensions/hash.rb
56
56
  - lib/gmaps4rails/helper/gmaps4rails_helper.rb
57
57
  - public/images/marker.png
58
- - public/javascripts/gmaps4rails.bing.js
59
- - public/javascripts/gmaps4rails.googlemaps.js
60
- - public/javascripts/gmaps4rails.js
61
- - public/javascripts/gmaps4rails.mapquest.js
62
- - public/javascripts/gmaps4rails.openlayers.js
58
+ - public/javascripts/gmaps4rails/bing.js
59
+ - public/javascripts/gmaps4rails/gmaps4rails.base.js
60
+ - public/javascripts/gmaps4rails/gmaps4rails.bing.js
61
+ - public/javascripts/gmaps4rails/gmaps4rails.googlemaps.js
62
+ - public/javascripts/gmaps4rails/gmaps4rails.mapquest.js
63
+ - public/javascripts/gmaps4rails/gmaps4rails.openlayers.js
64
+ - public/javascripts/gmaps4rails/googlemaps.js
65
+ - public/javascripts/gmaps4rails/mapquest.js
66
+ - public/javascripts/gmaps4rails/openlayers.js
63
67
  - public/stylesheets/gmaps4rails.css
64
68
  - LICENSE.txt
65
69
  - README.rdoc
@@ -86,6 +90,7 @@ files:
86
90
  - test/dummy/db/schema.rb
87
91
  - test/dummy/db/seeds.rb
88
92
  - test/dummy/spec/base/base_spec.rb
93
+ - test/dummy/spec/helpers/gmaps4rails_helper_spec.rb
89
94
  - test/dummy/spec/javascripts/support/jasmine_config.rb
90
95
  - test/dummy/spec/javascripts/support/jasmine_runner.rb
91
96
  - test/dummy/spec/models/user_spec.rb
@@ -93,6 +98,27 @@ files:
93
98
  - test/dummy/spec/spec_helper.rb
94
99
  - test/dummy/spec/support/factories.rb
95
100
  - test/dummy/spec/support/matchers.rb
101
+ - test/dummy31/app/controllers/application_controller.rb
102
+ - test/dummy31/app/controllers/users_controller.rb
103
+ - test/dummy31/app/helpers/application_helper.rb
104
+ - test/dummy31/app/helpers/users_helper.rb
105
+ - test/dummy31/app/models/user.rb
106
+ - test/dummy31/config/application.rb
107
+ - test/dummy31/config/boot.rb
108
+ - test/dummy31/config/environment.rb
109
+ - test/dummy31/config/environments/development.rb
110
+ - test/dummy31/config/environments/production.rb
111
+ - test/dummy31/config/environments/test.rb
112
+ - test/dummy31/config/initializers/backtrace_silencers.rb
113
+ - test/dummy31/config/initializers/inflections.rb
114
+ - test/dummy31/config/initializers/mime_types.rb
115
+ - test/dummy31/config/initializers/secret_token.rb
116
+ - test/dummy31/config/initializers/session_store.rb
117
+ - test/dummy31/config/initializers/wrap_parameters.rb
118
+ - test/dummy31/config/routes.rb
119
+ - test/dummy31/db/migrate/20110809134019_create_users.rb
120
+ - test/dummy31/db/schema.rb
121
+ - test/dummy31/db/seeds.rb
96
122
  has_rdoc: true
97
123
  homepage: http://github.com/apneadiving/Google-Maps-for-Rails
98
124
  licenses: []
@@ -151,6 +177,7 @@ test_files:
151
177
  - test/dummy/db/schema.rb
152
178
  - test/dummy/db/seeds.rb
153
179
  - test/dummy/spec/base/base_spec.rb
180
+ - test/dummy/spec/helpers/gmaps4rails_helper_spec.rb
154
181
  - test/dummy/spec/javascripts/support/jasmine_config.rb
155
182
  - test/dummy/spec/javascripts/support/jasmine_runner.rb
156
183
  - test/dummy/spec/models/user_spec.rb
@@ -158,3 +185,24 @@ test_files:
158
185
  - test/dummy/spec/spec_helper.rb
159
186
  - test/dummy/spec/support/factories.rb
160
187
  - test/dummy/spec/support/matchers.rb
188
+ - test/dummy31/app/controllers/application_controller.rb
189
+ - test/dummy31/app/controllers/users_controller.rb
190
+ - test/dummy31/app/helpers/application_helper.rb
191
+ - test/dummy31/app/helpers/users_helper.rb
192
+ - test/dummy31/app/models/user.rb
193
+ - test/dummy31/config/application.rb
194
+ - test/dummy31/config/boot.rb
195
+ - test/dummy31/config/environment.rb
196
+ - test/dummy31/config/environments/development.rb
197
+ - test/dummy31/config/environments/production.rb
198
+ - test/dummy31/config/environments/test.rb
199
+ - test/dummy31/config/initializers/backtrace_silencers.rb
200
+ - test/dummy31/config/initializers/inflections.rb
201
+ - test/dummy31/config/initializers/mime_types.rb
202
+ - test/dummy31/config/initializers/secret_token.rb
203
+ - test/dummy31/config/initializers/session_store.rb
204
+ - test/dummy31/config/initializers/wrap_parameters.rb
205
+ - test/dummy31/config/routes.rb
206
+ - test/dummy31/db/migrate/20110809134019_create_users.rb
207
+ - test/dummy31/db/schema.rb
208
+ - test/dummy31/db/seeds.rb