gmaps4rails 1.5.8 → 2.0.0.pre

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.
Files changed (146) hide show
  1. data/.gitignore +12 -0
  2. data/.travis.yml +9 -0
  3. data/Gemfile +7 -0
  4. data/Gemfile.lock +149 -0
  5. data/Guardfile.old +24 -0
  6. data/MIT-LICENSE +20 -0
  7. data/README.rdoc +129 -0
  8. data/Rakefile +4 -0
  9. data/app/views/gmaps4rails/_gmaps4rails.html.erb +20 -0
  10. data/gmaps4rails.gemspec +38 -0
  11. data/lib/generators/gmaps4rails/install_generator.rb +43 -0
  12. data/lib/generators/templates/README +2 -0
  13. data/lib/gmaps4rails.rb +26 -0
  14. data/lib/gmaps4rails/acts_as_gmappable.rb +54 -0
  15. data/lib/gmaps4rails/api_wrappers/base_net_methods.rb +40 -0
  16. data/lib/gmaps4rails/api_wrappers/direction.rb +87 -0
  17. data/lib/gmaps4rails/api_wrappers/geocoder.rb +54 -0
  18. data/lib/gmaps4rails/api_wrappers/places.rb +74 -0
  19. data/lib/gmaps4rails/base.rb +126 -0
  20. data/lib/gmaps4rails/extensions/enumerable.rb +14 -0
  21. data/lib/gmaps4rails/extensions/hash.rb +9 -0
  22. data/lib/gmaps4rails/helper/gmaps4rails_helper.rb +33 -0
  23. data/lib/gmaps4rails/js_builder.rb +154 -0
  24. data/lib/gmaps4rails/json_builder.rb +140 -0
  25. data/lib/gmaps4rails/model_handler.rb +101 -0
  26. data/lib/gmaps4rails/version.rb +3 -0
  27. data/lib/gmaps4rails/view_helper.rb +172 -0
  28. data/lib/tasks/jasmine.rake +8 -0
  29. data/public/javascripts/gmaps4rails/all.js +2144 -0
  30. data/public/javascripts/gmaps4rails/base.js +792 -0
  31. data/public/javascripts/gmaps4rails/google.js +556 -0
  32. data/public/javascripts/gmaps4rails/openlayers.js +377 -0
  33. data/public/stylesheets/gmaps4rails.css +24 -0
  34. data/spec/dummy/.gitignore +3 -0
  35. data/spec/dummy/.rspec +1 -0
  36. data/spec/dummy/README.rdoc +261 -0
  37. data/spec/dummy/Rakefile +7 -0
  38. data/spec/dummy/app/assets/javascripts/application.js +18 -0
  39. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  40. data/spec/dummy/app/assets/stylesheets/gmaps4rails.css +24 -0
  41. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  42. data/spec/dummy/app/controllers/users_controller.rb +105 -0
  43. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  44. data/spec/dummy/app/mailers/.gitkeep +0 -0
  45. data/spec/dummy/app/models/.gitkeep +0 -0
  46. data/spec/dummy/app/models/place.rb +16 -0
  47. data/spec/dummy/app/models/user.rb +12 -0
  48. data/spec/dummy/app/views/layouts/application.html.erb +17 -0
  49. data/spec/dummy/app/views/users/_form.html.erb +37 -0
  50. data/spec/dummy/app/views/users/edit.html.erb +6 -0
  51. data/spec/dummy/app/views/users/index.html.erb +268 -0
  52. data/spec/dummy/app/views/users/new.html.erb +5 -0
  53. data/spec/dummy/app/views/users/show.html.erb +30 -0
  54. data/spec/dummy/config.ru +4 -0
  55. data/spec/dummy/config/application.rb +62 -0
  56. data/spec/dummy/config/boot.rb +10 -0
  57. data/spec/dummy/config/database.yml +25 -0
  58. data/spec/dummy/config/environment.rb +5 -0
  59. data/spec/dummy/config/environments/development.rb +37 -0
  60. data/spec/dummy/config/environments/production.rb +67 -0
  61. data/spec/dummy/config/environments/test.rb +37 -0
  62. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  63. data/spec/dummy/config/initializers/gmaps4rails.rb +1 -0
  64. data/spec/dummy/config/initializers/inflections.rb +15 -0
  65. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  66. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  67. data/spec/dummy/config/initializers/session_store.rb +8 -0
  68. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  69. data/spec/dummy/config/locales/en.yml +5 -0
  70. data/spec/dummy/config/routes.rb +60 -0
  71. data/spec/dummy/db/migrate/20120408170155_create_users.rb +16 -0
  72. data/spec/dummy/db/schema.rb +29 -0
  73. data/spec/dummy/lib/assets/.gitkeep +0 -0
  74. data/spec/dummy/log/.gitkeep +0 -0
  75. data/spec/dummy/public/404.html +26 -0
  76. data/spec/dummy/public/422.html +26 -0
  77. data/spec/dummy/public/500.html +25 -0
  78. data/spec/dummy/public/favicon.ico +0 -0
  79. data/spec/dummy/public/javascripts/Player.js +22 -0
  80. data/spec/dummy/public/javascripts/Song.js +7 -0
  81. data/spec/dummy/public/logo.png +0 -0
  82. data/spec/dummy/script/rails +6 -0
  83. data/spec/factories/place_factory.rb +16 -0
  84. data/spec/factories/user_factory.rb +23 -0
  85. data/spec/fixtures/google_direction_valid.json +65 -0
  86. data/spec/fixtures/google_geocoding_toulon_france.json +58 -0
  87. data/spec/fixtures/google_places_valid.json +45 -0
  88. data/spec/fixtures/google_wrong_geocoding.json +4 -0
  89. data/spec/launchers/all_but_requests.rb +0 -0
  90. data/spec/launchers/all_specs.rb +0 -0
  91. data/spec/launchers/requests.rb +0 -0
  92. data/spec/lib/base_spec.rb +59 -0
  93. data/spec/lib/direction_spec.rb +53 -0
  94. data/spec/lib/geocoder_spec.rb +46 -0
  95. data/spec/lib/js_builder_spec.rb +134 -0
  96. data/spec/lib/json_builder_spec.rb +232 -0
  97. data/spec/lib/places_spec.rb +25 -0
  98. data/spec/models/place_spec.rb +39 -0
  99. data/spec/models/user_spec.rb +187 -0
  100. data/spec/spec_helper.rb +38 -0
  101. data/spec/support/geocoding.rb +40 -0
  102. data/spec/support/matchers.rb +73 -0
  103. data/todo +0 -0
  104. data/vendor/assets/javascripts/gmaps4rails/all.js +1 -0
  105. data/vendor/assets/javascripts/gmaps4rails/base.coffee +1 -0
  106. data/vendor/assets/javascripts/gmaps4rails/base/common.coffee +43 -0
  107. data/vendor/assets/javascripts/gmaps4rails/base/configuration.coffee +7 -0
  108. data/vendor/assets/javascripts/gmaps4rails/base/gmaps.coffee +13 -0
  109. data/vendor/assets/javascripts/gmaps4rails/base/interfaces/basic_interface.coffee +15 -0
  110. data/vendor/assets/javascripts/gmaps4rails/base/interfaces/controller_interface.coffee +15 -0
  111. data/vendor/assets/javascripts/gmaps4rails/base/interfaces/map_interface.coffee +27 -0
  112. data/vendor/assets/javascripts/gmaps4rails/base/interfaces/marker_interface.coffee +15 -0
  113. data/vendor/assets/javascripts/gmaps4rails/base/main.coffee +124 -0
  114. data/vendor/assets/javascripts/gmaps4rails/base/main_controller_extensions/circle_controller.coffee +29 -0
  115. data/vendor/assets/javascripts/gmaps4rails/base/main_controller_extensions/kml_controller.coffee +5 -0
  116. data/vendor/assets/javascripts/gmaps4rails/base/main_controller_extensions/marker_controller.coffee +76 -0
  117. data/vendor/assets/javascripts/gmaps4rails/base/main_controller_extensions/polygon_controller.coffee +29 -0
  118. data/vendor/assets/javascripts/gmaps4rails/base/main_controller_extensions/polyline_controller.coffee +29 -0
  119. data/vendor/assets/javascripts/gmaps4rails/base/objects/circle.coffee +12 -0
  120. data/vendor/assets/javascripts/gmaps4rails/base/objects/kml.coffee +8 -0
  121. data/vendor/assets/javascripts/gmaps4rails/base/objects/map.coffee +62 -0
  122. data/vendor/assets/javascripts/gmaps4rails/base/objects/marker.coffee +24 -0
  123. data/vendor/assets/javascripts/gmaps4rails/base/objects/polygon.coffee +11 -0
  124. data/vendor/assets/javascripts/gmaps4rails/base/objects/polyline.coffee +11 -0
  125. data/vendor/assets/javascripts/gmaps4rails/bing.coffee +1 -0
  126. data/vendor/assets/javascripts/gmaps4rails/bing/main.coffee +29 -0
  127. data/vendor/assets/javascripts/gmaps4rails/bing/objects/map.coffee +63 -0
  128. data/vendor/assets/javascripts/gmaps4rails/bing/objects/marker.coffee +78 -0
  129. data/vendor/assets/javascripts/gmaps4rails/bing/shared.coffee +20 -0
  130. data/vendor/assets/javascripts/gmaps4rails/google.coffee +1 -0
  131. data/vendor/assets/javascripts/gmaps4rails/google/main.coffee +47 -0
  132. data/vendor/assets/javascripts/gmaps4rails/google/objects/circle.coffee +38 -0
  133. data/vendor/assets/javascripts/gmaps4rails/google/objects/kml.coffee +16 -0
  134. data/vendor/assets/javascripts/gmaps4rails/google/objects/map.coffee +71 -0
  135. data/vendor/assets/javascripts/gmaps4rails/google/objects/marker.coffee +114 -0
  136. data/vendor/assets/javascripts/gmaps4rails/google/objects/polygon.coffee +38 -0
  137. data/vendor/assets/javascripts/gmaps4rails/google/objects/polyline.coffee +49 -0
  138. data/vendor/assets/javascripts/gmaps4rails/google/shared.coffee +27 -0
  139. data/vendor/assets/javascripts/gmaps4rails/openlayers.coffee +1 -0
  140. data/vendor/assets/javascripts/gmaps4rails/openlayers/main.coffee +138 -0
  141. data/vendor/assets/javascripts/gmaps4rails/openlayers/objects/map.coffee +49 -0
  142. data/vendor/assets/javascripts/gmaps4rails/openlayers/objects/marker.coffee +68 -0
  143. data/vendor/assets/javascripts/gmaps4rails/openlayers/objects/polyline.coffee +39 -0
  144. data/vendor/assets/javascripts/gmaps4rails/openlayers/shared.coffee +19 -0
  145. metadata +378 -14
  146. checksums.yaml +0 -7
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ *~
2
+ *.cache
3
+ *.log
4
+ *.pid
5
+ .*.sw?
6
+ .DS_Store
7
+ test/dummy/tmp/**/*
8
+ test/dummy/log/**/*
9
+ test/dummy/.rvmrc
10
+ pkg
11
+ .idea
12
+ .redcar
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.2
5
+ - 1.9.3
6
+
7
+ before_script: 'cd spec/dummy/; rake db:migrate RAILS_ENV=test; cd ../..'
8
+ script: 'rspec spec'
9
+ # after_script: 'bundle exec guard-jasmine -u http://localhost:8888/'
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Declare your gem's dependencies in gmaps4rails.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
6
+
7
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,149 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gmaps4rails (2.0.0.pre)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ actionmailer (3.2.3)
10
+ actionpack (= 3.2.3)
11
+ mail (~> 2.4.4)
12
+ actionpack (3.2.3)
13
+ activemodel (= 3.2.3)
14
+ activesupport (= 3.2.3)
15
+ builder (~> 3.0.0)
16
+ erubis (~> 2.7.0)
17
+ journey (~> 1.0.1)
18
+ rack (~> 1.4.0)
19
+ rack-cache (~> 1.2)
20
+ rack-test (~> 0.6.1)
21
+ sprockets (~> 2.1.2)
22
+ activemodel (3.2.3)
23
+ activesupport (= 3.2.3)
24
+ builder (~> 3.0.0)
25
+ activerecord (3.2.3)
26
+ activemodel (= 3.2.3)
27
+ activesupport (= 3.2.3)
28
+ arel (~> 3.0.2)
29
+ tzinfo (~> 0.3.29)
30
+ activeresource (3.2.3)
31
+ activemodel (= 3.2.3)
32
+ activesupport (= 3.2.3)
33
+ activesupport (3.2.3)
34
+ i18n (~> 0.6)
35
+ multi_json (~> 1.0)
36
+ addressable (2.2.8)
37
+ arel (3.0.2)
38
+ builder (3.0.0)
39
+ coderay (1.0.6)
40
+ coffee-script (2.2.0)
41
+ coffee-script-source
42
+ execjs
43
+ coffee-script-source (1.3.3)
44
+ crack (0.3.1)
45
+ database_cleaner (0.7.2)
46
+ diff-lcs (1.1.3)
47
+ erubis (2.7.0)
48
+ execjs (1.4.0)
49
+ multi_json (~> 1.0)
50
+ factory_girl (2.6.1)
51
+ activesupport (>= 2.3.9)
52
+ factory_girl_rails (1.7.0)
53
+ factory_girl (~> 2.6.0)
54
+ railties (>= 3.0.0)
55
+ hike (1.2.1)
56
+ i18n (0.6.0)
57
+ journey (1.0.3)
58
+ jquery-rails (2.0.2)
59
+ railties (>= 3.2.0, < 5.0)
60
+ thor (~> 0.14)
61
+ json (1.6.6)
62
+ mail (2.4.4)
63
+ i18n (>= 0.4.0)
64
+ mime-types (~> 1.16)
65
+ treetop (~> 1.4.8)
66
+ method_source (0.7.1)
67
+ mime-types (1.18)
68
+ mongoid (3.0.6)
69
+ activemodel (~> 3.1)
70
+ moped (~> 1.1)
71
+ origin (~> 1.0)
72
+ tzinfo (~> 0.3.22)
73
+ moped (1.2.5)
74
+ multi_json (1.2.0)
75
+ origin (1.0.9)
76
+ polyglot (0.3.3)
77
+ pry (0.9.8.4)
78
+ coderay (~> 1.0.5)
79
+ method_source (~> 0.7.1)
80
+ slop (>= 2.4.4, < 3)
81
+ rack (1.4.1)
82
+ rack-cache (1.2)
83
+ rack (>= 0.4)
84
+ rack-ssl (1.3.2)
85
+ rack
86
+ rack-test (0.6.1)
87
+ rack (>= 1.0)
88
+ rails (3.2.3)
89
+ actionmailer (= 3.2.3)
90
+ actionpack (= 3.2.3)
91
+ activerecord (= 3.2.3)
92
+ activeresource (= 3.2.3)
93
+ activesupport (= 3.2.3)
94
+ bundler (~> 1.0)
95
+ railties (= 3.2.3)
96
+ railties (3.2.3)
97
+ actionpack (= 3.2.3)
98
+ activesupport (= 3.2.3)
99
+ rack-ssl (~> 1.3.2)
100
+ rake (>= 0.8.7)
101
+ rdoc (~> 3.4)
102
+ thor (~> 0.14.6)
103
+ rake (0.9.2.2)
104
+ rdoc (3.12)
105
+ json (~> 1.4)
106
+ rspec (2.8.0)
107
+ rspec-core (~> 2.8.0)
108
+ rspec-expectations (~> 2.8.0)
109
+ rspec-mocks (~> 2.8.0)
110
+ rspec-core (2.8.0)
111
+ rspec-expectations (2.8.0)
112
+ diff-lcs (~> 1.1.2)
113
+ rspec-mocks (2.8.0)
114
+ rspec-rails (2.8.1)
115
+ actionpack (>= 3.0)
116
+ activesupport (>= 3.0)
117
+ railties (>= 3.0)
118
+ rspec (~> 2.8.0)
119
+ slop (2.4.4)
120
+ sprockets (2.1.2)
121
+ hike (~> 1.2)
122
+ rack (~> 1.0)
123
+ tilt (~> 1.1, != 1.3.0)
124
+ sqlite3 (1.3.5)
125
+ thor (0.14.6)
126
+ tilt (1.3.3)
127
+ treetop (1.4.10)
128
+ polyglot
129
+ polyglot (>= 0.3.1)
130
+ tzinfo (0.3.32)
131
+ webmock (1.8.7)
132
+ addressable (>= 2.2.7)
133
+ crack (>= 0.1.7)
134
+
135
+ PLATFORMS
136
+ ruby
137
+
138
+ DEPENDENCIES
139
+ coffee-script
140
+ database_cleaner
141
+ factory_girl_rails
142
+ gmaps4rails!
143
+ jquery-rails
144
+ mongoid (~> 3)
145
+ pry
146
+ rails (~> 3.2.1)
147
+ rspec-rails
148
+ sqlite3
149
+ webmock
data/Guardfile.old ADDED
@@ -0,0 +1,24 @@
1
+ # guard 'spork', :rspec_env => { 'RAILS_ENV' => 'test' } do
2
+ # watch('config/application.rb')
3
+ # watch('config/environment.rb')
4
+ # watch(%r{^config/environments/.+\.rb$})
5
+ # watch(%r{^config/initializers/.+\.rb$})
6
+ # watch('Gemfile')
7
+ # watch('Gemfile.lock')
8
+ # watch('spec/spec_helper.rb') { :rspec }
9
+ # end
10
+
11
+ # guard 'rspec', :cli => "-c -f d", :all_on_start => false, :all_after_pass => false do
12
+ # watch(%r{^spec/.+_spec\.rb$})
13
+ # watch('spec/launchers/all_specs.rb') { "spec" }
14
+ # watch('spec/launchers/all_but_requests.rb') { ["spec/base", "spec/helpers", "spec/models", "spec/views", "spec/javascripts"] }
15
+ # watch('spec/launchers/requests.rb') { "spec/requests" }
16
+ # end
17
+
18
+ # guard 'jasmine', :jasmine_url => 'http://localhost:8888/', :all_on_start => false, :all_after_pass => false do
19
+ # watch(%r{spec/javascripts/spec\.(js\.coffee|js|coffee)$}) { "spec/javascripts" }
20
+ # watch(%r{^spec/javascripts/.+_spec\.(js\.coffee|js|coffee)$}) { "spec/javascripts" }
21
+ # watch(%r{^spec/javascripts/.+_spec\.js$}) { "spec/javascripts" }
22
+ # end
23
+
24
+ # guard 'coffeescript', :input => 'app/assets/javascripts/gmaps4rails', :output => 'public/javascripts/gmaps4rails'
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 Benjamin Roth
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.rdoc ADDED
@@ -0,0 +1,129 @@
1
+ == Google Maps for Rails (gmaps4rails) {<img src="https://secure.travis-ci.org/apneadiving/Google-Maps-for-Rails.png?branch=master" alt="Build Status" />}[http://travis-ci.org/apneadiving/Google-Maps-for-Rails] {<img src="https://codeclimate.com/badge.png" />}[https://codeclimate.com/github/apneadiving/Google-Maps-for-Rails]
2
+
3
+ Gmaps4rails is developed to simply create a Google Map:
4
+
5
+ - directly from your model,
6
+
7
+ - from your own json
8
+
9
+ It's based on Ruby on Rails 3 Engines and uses Google Maps API V3.
10
+
11
+ == When Gmaps4rails finally means Global Maps for Rails
12
+
13
+ I've added support for other map providers: openlayers, mapquest & bing.
14
+
15
+ See: https://github.com/apneadiving/Google-Maps-for-Rails/wiki/Map-Apis
16
+
17
+ Any help would be appreciated to complete this work.
18
+
19
+ == Requirements
20
+
21
+ 1) Gemfile
22
+
23
+ gem 'gmaps4rails'
24
+
25
+ 2) Copy the assets to your app (and be sure to copy the fresh assets when you upgrade the gem):
26
+
27
+ rails generate gmaps4rails:install
28
+
29
+ This will copy all the coffeescript files if you're running Rails >= 3.1 or all the js files for Rails 3.0.x.
30
+
31
+ Only `base` + `your_provider` are necessary.
32
+
33
+ 3) Javascript
34
+
35
+ <%= yield :scripts %> (in your footer)
36
+
37
+ This container will include the js files from map providers, the custom js to display the map, the gem's js code.
38
+
39
+ 4) CSS
40
+
41
+ `gmaps4rails.css` will be copied to your app after you run the Rails generator.
42
+ Be sure to require this file in your view for your first steps.
43
+
44
+ For Rails 3.0.x or without assets pipeline:
45
+
46
+ <%= stylesheet_link_tag 'gmaps4rails' %>
47
+
48
+ For Rails >= 3.1 with assets pipeline, same principle: add the required file to your manifest.
49
+
50
+
51
+ == Basic configuration
52
+ In your model, add:
53
+
54
+ acts_as_gmappable
55
+
56
+ def gmaps4rails_address
57
+ #describe how to retrieve the address from your model, if you use directly a db column, you can dry your code, see wiki
58
+ "#{self.street}, #{self.city}, #{self.country}"
59
+ end
60
+
61
+ Create a migration and add the following fields to your table (here users):
62
+
63
+ add_column :users, :latitude, :float #you can change the name, see wiki
64
+ add_column :users, :longitude, :float #you can change the name, see wiki
65
+ add_column :users, :gmaps, :boolean #not mandatory, see wiki
66
+
67
+ == Basic configuration: Non-relational DB
68
+
69
+ Mongoid example:
70
+
71
+ acts_as_gmappable :position => :location
72
+
73
+ field :location, :type => Array
74
+
75
+ == How to?
76
+ === QuickStart!
77
+ In your controller:
78
+
79
+ @json = User.all.to_gmaps4rails
80
+
81
+ In your view:
82
+
83
+ <%= gmaps4rails(@json) %>
84
+
85
+ Done!
86
+
87
+ == Options
88
+
89
+ * Markers with Info window, Custom Picture, RichMarkers (make your own markers with custom html)
90
+
91
+ * Circles, Polylines, Polygons
92
+
93
+ * Geocode directly your address and retrieve coordinates.
94
+
95
+ * Auto-adjust the map to your markers
96
+
97
+ * Refresh your map on the fly with Javascript (and Ajax)
98
+
99
+ * KML support
100
+
101
+ * Easy multimap
102
+
103
+ * {More details in the Wiki}[https://github.com/apneadiving/Google-Maps-for-Rails/wiki]
104
+
105
+ == Todo?
106
+
107
+ Feel free to contact us, you have your say.
108
+
109
+ == Want to help?
110
+
111
+ This is how you can launch the spec suite (js + ruby):
112
+
113
+ * Clone the gem repository
114
+
115
+ * Go to the gem's folder
116
+
117
+ * run `bundle`
118
+
119
+ * run `cd spec/dummy; rake db:migrate RAILS_ENV=test; cd ../..`
120
+
121
+ * run `bundle exec rspec spec`
122
+
123
+
124
+ == Copyright
125
+ MIT license.
126
+
127
+ Authors: Benjamin Roth, David Ruyer
128
+
129
+ {Contributors}[https://github.com/apneadiving/Google-Maps-for-Rails/graphs/contributors]
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ # import 'lib/tasks/jasmine.rake'
@@ -0,0 +1,20 @@
1
+ <% content_for :scripts do %>
2
+ <%= javascript_include_tag *js_dependencies %>
3
+
4
+ <script type="text/javascript">
5
+ <%=raw options.to_gmaps4rails %>
6
+ </script>
7
+ <% end %>
8
+
9
+ <% case dom.map_provider %>
10
+ <% when "mapquest" %>
11
+ <div id="<%= dom.map_id %>" style="width:750px; height:475px;">
12
+ <!-- TODO: change this style dynamically -->
13
+ </div>
14
+ <% when "bing" %>
15
+ <div id="<%= dom.map_id %>" class="<%= dom.map_class %>"></div>
16
+ <% else %>
17
+ <div class="<%= dom.container_class %>">
18
+ <div id="<%= dom.map_id %>" class="<%= dom.map_class %>"></div>
19
+ </div>
20
+ <% end %>
@@ -0,0 +1,38 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ # Maintain your gem's version:
4
+ require "gmaps4rails/version"
5
+
6
+ # Describe your gem and declare its dependencies:
7
+ Gem::Specification.new do |s|
8
+ s.name = "gmaps4rails"
9
+ s.version = Gmaps4rails::VERSION
10
+ s.authors = [%q{Benjamin Roth}, %q{David Ruyer}]
11
+ s.email = [%q{apnea.diving.deep@gmail.com}, %q{david.ruyer@gmail.com}]
12
+ s.homepage = %q{http://github.com/apneadiving/Google-Maps-for-Rails}
13
+ s.summary = %q{Maps made easy for Rails 3}
14
+ s.description = %q{Enables easy display of items (taken from a Rails 3 model) on a Google Maps (JS API V3), OpenLayers, Mapquest and Bing.}
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- spec/*`.split("\n")
17
+
18
+ s.add_development_dependency "rails", "~> 3.2.1"
19
+ s.add_development_dependency "sqlite3"
20
+ s.add_development_dependency "mongoid", "~> 3" if RUBY_VERSION == "1.9.3"
21
+ s.add_development_dependency 'jquery-rails'
22
+ s.add_development_dependency "rspec-rails"
23
+ s.add_development_dependency 'database_cleaner'
24
+ #s.add_development_dependency "capybara"
25
+ #s.add_development_dependency 'launchy'
26
+
27
+ # s.add_development_dependency "jasmine"
28
+
29
+ # s.add_development_dependency "guard", "~> 1.0.1"
30
+ s.add_development_dependency 'coffee-script'
31
+ # s.add_development_dependency 'guard-jasmine'
32
+ # s.add_development_dependency "guard-rspec"
33
+
34
+ s.add_development_dependency "factory_girl_rails"
35
+ s.add_development_dependency "webmock"
36
+
37
+ s.add_development_dependency 'pry'
38
+ end
@@ -0,0 +1,43 @@
1
+ module Gmaps4rails
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ source_root File.expand_path('../../templates', __FILE__)
5
+
6
+ desc 'Creates a Gmaps4rails initializer and copies the assets to the public folder.'
7
+
8
+ def copy_locale
9
+ if Gmaps4rails.pipeline_enabled?
10
+ directory assets_source_path, assets_destination_path
11
+ copy_file "../../../public/stylesheets/gmaps4rails.css", "vendor/assets/stylesheets/gmaps4rails.css"
12
+ else
13
+ %w( base google openlayers all ).each do |filename|
14
+ copy_file js_source_path(filename), js_destination_path(filename)
15
+ end
16
+ copy_file "../../../public/stylesheets/gmaps4rails.css", "public/stylesheets/gmaps4rails.css"
17
+ end
18
+ end
19
+
20
+ def show_readme
21
+ readme 'README' if behavior == :invoke
22
+ end
23
+
24
+ private
25
+
26
+ def assets_source_path
27
+ '../../../vendor/assets/javascripts/gmaps4rails/'
28
+ end
29
+
30
+ def assets_destination_path
31
+ 'vendor/assets/javascripts/gmaps4rails'
32
+ end
33
+
34
+ def js_source_path(filename)
35
+ "../../../public/javascripts/gmaps4rails/#{filename}.js"
36
+ end
37
+
38
+ def js_destination_path(filename)
39
+ "public/javascripts/gmaps4rails/#{filename}.js"
40
+ end
41
+ end
42
+ end
43
+ end