calagator 0.0.1.pre1 → 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. checksums.yaml +4 -4
  2. data/{LICENSE.txt → MIT-LICENSE.txt} +0 -0
  3. data/README.md +4 -18
  4. data/Rakefile +6 -0
  5. data/app/assets/javascripts/calagator.js +1 -0
  6. data/app/assets/stylesheets/calagator/changes.scss +45 -0
  7. data/app/assets/stylesheets/calagator/errors.css +8 -0
  8. data/app/assets/stylesheets/calagator/forms.scss +148 -2
  9. data/app/assets/stylesheets/calagator/index.scss +21 -0
  10. data/app/assets/stylesheets/calagator/layout.scss +731 -0
  11. data/app/assets/stylesheets/calagator/mobile.scss +196 -0
  12. data/app/assets/stylesheets/calagator/{reset.css → reset.scss} +0 -0
  13. data/app/assets/stylesheets/calagator/typography.scss +225 -0
  14. data/app/assets/stylesheets/calagator/{common.scss → utils.scss} +0 -0
  15. data/app/assets/stylesheets/calagator/variables.scss +21 -0
  16. data/app/controllers/calagator/admin_controller.rb +1 -1
  17. data/app/controllers/calagator/application_controller.rb +3 -3
  18. data/app/controllers/calagator/events_controller.rb +3 -3
  19. data/app/controllers/calagator/site_controller.rb +1 -1
  20. data/app/controllers/calagator/sources_controller.rb +3 -3
  21. data/app/controllers/calagator/venues_controller.rb +4 -4
  22. data/app/controllers/calagator/versions_controller.rb +2 -2
  23. data/app/helpers/calagator/application_helper.rb +0 -3
  24. data/app/helpers/calagator/mapping_helper.rb +9 -8
  25. data/app/models/calagator/event.rb +2 -3
  26. data/app/models/calagator/event/ical_renderer.rb +4 -2
  27. data/app/models/calagator/event/saver.rb +2 -2
  28. data/app/models/calagator/event/search_engine/sql.rb +2 -1
  29. data/app/models/calagator/source.rb +0 -26
  30. data/app/models/calagator/source/importer.rb +1 -1
  31. data/app/models/calagator/source/parser/meetup.rb +2 -2
  32. data/app/models/calagator/venue.rb +0 -2
  33. data/app/models/calagator/venue/geocoder.rb +1 -1
  34. data/app/models/calagator/venue/search_engine/sql.rb +1 -1
  35. data/app/views/calagator/events/_subnav.html.erb +2 -2
  36. data/app/views/calagator/events/show.html.erb +2 -2
  37. data/app/views/calagator/site/_description.html.erb +6 -3
  38. data/app/views/calagator/site/_sidebar_menu.html.erb +13 -0
  39. data/app/views/calagator/site/index.html.erb +1 -0
  40. data/app/views/calagator/sources/index.html.erb +1 -1
  41. data/app/views/calagator/sources/show.html.erb +1 -1
  42. data/app/views/calagator/venues/_subnav.html.erb +1 -1
  43. data/app/views/calagator/venues/show.html.erb +1 -1
  44. data/app/views/layouts/calagator/_after_footer.html.erb +2 -0
  45. data/app/views/layouts/calagator/_content.html.erb +6 -0
  46. data/app/views/layouts/calagator/_footer.html.erb +8 -0
  47. data/app/views/layouts/calagator/_global_search.html.erb +11 -0
  48. data/app/views/layouts/calagator/_header.html.erb +20 -0
  49. data/app/views/layouts/calagator/application.html.erb +9 -64
  50. data/config/routes.rb +16 -16
  51. data/config/spring.rb +1 -0
  52. data/db/development +0 -0
  53. data/db/development.sqlite3 +0 -0
  54. data/db/migrate/20150407014752_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +14 -0
  55. data/db/migrate/20150407014754_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +9 -0
  56. data/db/schema.rb +2 -8
  57. data/db/seeds.rb +64 -8
  58. data/lib/calagator.rb +42 -2
  59. data/lib/calagator/duplicate_checking/duplicate_finder.rb +1 -1
  60. data/lib/calagator/duplicate_checking/duplicate_squasher.rb +1 -1
  61. data/lib/calagator/engine.rb +12 -22
  62. data/lib/calagator/tag_model_extensions.rb +1 -1
  63. data/lib/calagator/version.rb +1 -1
  64. data/lib/generators/calagator/install_generator.rb +17 -12
  65. data/lib/generators/calagator/templates/config/initializers/01_calagator.rb +89 -0
  66. data/lib/generators/calagator/templates/config/initializers/02_geokit.rb +106 -0
  67. data/lib/tasks/sunspot_reindex_calagator.rake +16 -3
  68. data/lib/tasks/update_counter_caches.rake +3 -3
  69. data/spec/controllers/calagator/events_controller_spec.rb +3 -3
  70. data/spec/controllers/calagator/sources_controller_spec.rb +3 -3
  71. data/spec/controllers/calagator/venues_controller_spec.rb +5 -5
  72. data/spec/dummy/Gemfile +35 -27
  73. data/spec/dummy/README.rdoc +15 -248
  74. data/spec/dummy/Rakefile +1 -2
  75. data/spec/dummy/app/assets/javascripts/application.js +5 -4
  76. data/spec/dummy/app/assets/stylesheets/application.css +6 -4
  77. data/spec/dummy/app/controllers/application_controller.rb +3 -1
  78. data/spec/dummy/app/views/layouts/application.html.erb +2 -2
  79. data/spec/dummy/bin/bundle +3 -0
  80. data/spec/dummy/bin/rails +4 -0
  81. data/spec/dummy/bin/rake +4 -0
  82. data/spec/dummy/bin/setup +29 -0
  83. data/spec/dummy/config.ru +2 -2
  84. data/spec/dummy/config/application.rb +5 -41
  85. data/spec/dummy/config/boot.rb +1 -4
  86. data/spec/dummy/config/database.yml +8 -8
  87. data/spec/dummy/config/environment.rb +3 -3
  88. data/spec/dummy/config/environments/development.rb +22 -18
  89. data/spec/dummy/config/environments/production.rb +46 -34
  90. data/spec/dummy/config/environments/test.rb +19 -14
  91. data/spec/dummy/config/initializers/01_calagator.rb +89 -0
  92. data/spec/dummy/config/initializers/02_geokit.rb +106 -0
  93. data/spec/dummy/config/initializers/assets.rb +11 -0
  94. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  95. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  96. data/spec/dummy/config/initializers/inflections.rb +6 -5
  97. data/spec/dummy/config/initializers/mime_types.rb +0 -1
  98. data/spec/dummy/config/initializers/session_store.rb +1 -6
  99. data/spec/dummy/config/initializers/wrap_parameters.rb +6 -6
  100. data/spec/dummy/config/locales/en.yml +20 -2
  101. data/spec/dummy/config/routes.rb +23 -25
  102. data/spec/dummy/config/secrets.yml +16 -77
  103. data/spec/dummy/config/sunspot.yml +23 -0
  104. data/spec/dummy/db/development.sqlite3 +0 -0
  105. data/spec/dummy/db/schema.rb +31 -30
  106. data/spec/dummy/db/seeds.rb +1 -0
  107. data/spec/dummy/log/development.log +257 -235
  108. data/spec/dummy/public/404.html +54 -13
  109. data/spec/dummy/public/422.html +54 -13
  110. data/spec/dummy/public/500.html +53 -12
  111. data/spec/dummy/public/robots.txt +2 -2
  112. data/spec/dummy/test/test_helper.rb +2 -5
  113. data/spec/factories.rb +0 -54
  114. data/spec/features/admin_auth_spec.rb +2 -2
  115. data/spec/features/admin_lock_event_spec.rb +1 -1
  116. data/spec/features/import_events_from_feed_spec.rb +1 -1
  117. data/spec/helpers/calagator/google_event_export_helper_spec.rb +8 -11
  118. data/spec/helpers/calagator/sources_helper_spec.rb +1 -2
  119. data/spec/helpers/calagator/tags_helper_spec.rb +1 -2
  120. data/spec/models/calagator/event_spec.rb +7 -7
  121. data/spec/models/calagator/source/parser_meetup_spec.rb +3 -3
  122. data/spec/models/calagator/source_spec.rb +0 -29
  123. data/spec/models/calagator/venue_spec.rb +8 -11
  124. data/spec/spec_helper.rb +3 -1
  125. data/spec/support/admin_authentication.rb +2 -0
  126. data/spec/support/assert_dom_equal.rb +26 -0
  127. data/spec/support/paper_trail.rb +7 -0
  128. data/spec/support/rspec-activemodel-mocks_patch.rb +9 -0
  129. metadata +200 -280
  130. data/app/assets/stylesheets/calagator.scss +0 -8
  131. data/app/assets/stylesheets/calagator/datepicker.scss +0 -177
  132. data/app/assets/stylesheets/calagator/theme.css +0 -0
  133. data/app/models/event/search_engine/base.rb +0 -0
  134. data/config/deploy/local.rb +0 -37
  135. data/config/deploy/lucca.rb +0 -33
  136. data/config/initializers/geokit.rb +0 -74
  137. data/config/initializers/search_engine.rb +0 -4
  138. data/config/initializers/set_default_url_host.rb +0 -5
  139. data/db/test.sqlite3 +0 -0
  140. data/lib/generators/calagator/templates/config/calagator.rb +0 -26
  141. data/lib/generators/calagator/templates/config/secrets.yml.sample +0 -83
  142. data/lib/secrets_reader.rb +0 -76
  143. data/spec/dummy/Gemfile.lock +0 -195
  144. data/spec/dummy/app/assets/images/rails.png +0 -0
  145. data/spec/dummy/config/initializers/calagator.rb +0 -26
  146. data/spec/dummy/config/initializers/secret_token.rb +0 -7
  147. data/spec/dummy/db/migrate/20150309023304_create_events.calagator.rb +0 -18
  148. data/spec/dummy/db/migrate/20150309023305_create_venues.calagator.rb +0 -18
  149. data/spec/dummy/db/migrate/20150309023306_create_sources.calagator.rb +0 -17
  150. data/spec/dummy/db/migrate/20150309023307_add_detailed_fields_to_venue.calagator.rb +0 -20
  151. data/spec/dummy/db/migrate/20150309023308_add_end_time_to_events.calagator.rb +0 -10
  152. data/spec/dummy/db/migrate/20150309023309_add_source_id_to_events.calagator.rb +0 -10
  153. data/spec/dummy/db/migrate/20150309023310_add_source_id_to_venues.calagator.rb +0 -11
  154. data/spec/dummy/db/migrate/20150309023311_add_duplicate_of_column_to_venues.calagator.rb +0 -10
  155. data/spec/dummy/db/migrate/20150309023312_add_duplicate_of_column_to_events.calagator.rb +0 -10
  156. data/spec/dummy/db/migrate/20150309023313_change_lat_long_type.calagator.rb +0 -13
  157. data/spec/dummy/db/migrate/20150309023314_add_source_reimport.calagator.rb +0 -10
  158. data/spec/dummy/db/migrate/20150309023315_change_end_time_to_duration.calagator.rb +0 -12
  159. data/spec/dummy/db/migrate/20150309023316_remove_format_type_from_source.calagator.rb +0 -10
  160. data/spec/dummy/db/migrate/20150309023317_create_updates.calagator.rb +0 -16
  161. data/spec/dummy/db/migrate/20150309023318_remove_next_update_from_source.calagator.rb +0 -10
  162. data/spec/dummy/db/migrate/20150309023319_change_duration_to_end_time.calagator.rb +0 -12
  163. data/spec/dummy/db/migrate/20150309023320_create_tags_and_taggings.calagator.rb +0 -29
  164. data/spec/dummy/db/migrate/20150309023321_create_versioned_events.calagator.rb +0 -26
  165. data/spec/dummy/db/migrate/20150309023322_create_versioned_venues.calagator.rb +0 -33
  166. data/spec/dummy/db/migrate/20150309023323_add_rrule_to_events.calagator.rb +0 -16
  167. data/spec/dummy/db/migrate/20150309023324_create_versions.calagator.rb +0 -19
  168. data/spec/dummy/db/migrate/20150309023325_add_closed_flag_to_venues.calagator.rb +0 -10
  169. data/spec/dummy/db/migrate/20150309023326_add_wifi_flag_to_venues.calagator.rb +0 -10
  170. data/spec/dummy/db/migrate/20150309023327_add_access_notes_to_venues.calagator.rb +0 -10
  171. data/spec/dummy/db/migrate/20150309023328_add_events_count_to_venues.calagator.rb +0 -9
  172. data/spec/dummy/db/migrate/20150309023329_add_venue_details_to_events.calagator.rb +0 -10
  173. data/spec/dummy/db/migrate/20150309023330_acts_as_taggable_on_migration.calagator.rb +0 -51
  174. data/spec/dummy/db/migrate/20150309023331_cleanup.calagator.rb +0 -15
  175. data/spec/dummy/db/migrate/20150309023332_specify_venues_latitude_and_longitude_precision.calagator.rb +0 -12
  176. data/spec/dummy/db/migrate/20150309023333_remove_updates.calagator.rb +0 -14
  177. data/spec/dummy/db/migrate/20150309023334_add_locked_status_to_events.calagator.rb +0 -6
  178. data/spec/dummy/db/test.sqlite3 +0 -0
  179. data/spec/dummy/doc/README_FOR_APP +0 -2
  180. data/spec/dummy/script/rails +0 -6
  181. data/spec/dummy/test/performance/browsing_test.rb +0 -12
  182. data/spec/lib/secrets_reader_spec.rb +0 -65
@@ -2,29 +2,19 @@ module Calagator
2
2
  class Engine < ::Rails::Engine
3
3
  isolate_namespace Calagator
4
4
 
5
- config.before_initialize do
6
- # Read secrets
7
- require 'secrets_reader'
8
- ::SECRETS = SecretsReader.read
9
- end
10
- end
11
-
12
- # settings with defaults
13
- class << self
14
- mattr_accessor :title, :tagline, :url, :venues_map_options, :blacklist_patterns
15
-
16
- self.title = 'Calagator'
17
- self.tagline = 'A Tech Calendar'
18
- self.url = 'http://my-calagator.org/'
19
- self.venues_map_options = {}
20
- self.blacklist_patterns = [
21
- /\b(online|overseas).+(drugstore|pharmacy)\b/,
22
- /\bcialis\b/,
23
- ]
5
+ config.assets.precompile += %w(
6
+ markers-soft.png
7
+ markers-shadow.png
8
+ markers-soft@2x.png
9
+ markers-shadow@2x.png
10
+ leaflet.js
11
+ leaflet_google_layer.js
12
+ mustache.js
13
+ leaflet
14
+ )
24
15
 
25
- # map the attrs from initializer
26
- def setup(&block)
27
- yield self
16
+ config.after_initialize do
17
+ Calagator.configure_search_engine
28
18
  end
29
19
  end
30
20
  end
@@ -4,7 +4,7 @@ module Calagator
4
4
  module TagModelExtensions
5
5
  def self.included(base)
6
6
  base.class_eval do
7
- scope :machine_tags, where("name LIKE '%:%=%'")
7
+ scope :machine_tags, -> { where("name LIKE '%:%=%'") }
8
8
  end
9
9
  end
10
10
 
@@ -1,3 +1,3 @@
1
1
  module Calagator
2
- VERSION = "0.0.1.pre1"
2
+ VERSION = "1.0.0.rc1"
3
3
  end
@@ -2,30 +2,31 @@ module Calagator
2
2
  class InstallGenerator < Rails::Generators::Base
3
3
  source_root File.expand_path('../templates', __FILE__)
4
4
 
5
+ class_option :dummy, type: :boolean, default: false
6
+
5
7
  def install
6
8
  add_route
7
- add_secrets
8
- add_initializer
9
+ add_initializers
9
10
  add_javascripts
10
11
  add_stylesheets
11
- rake 'calagator:install:migrations'
12
- rake 'db:migrate'
13
- rake 'db:test:prepare'
12
+ add_seeds
14
13
  run 'rm -f public/index.html'
14
+ unless options[:dummy]
15
+ rake 'calagator:install:migrations'
16
+ rake 'db:migrate'
17
+ rake 'db:test:prepare'
18
+ end
15
19
  end
16
20
 
17
21
  private
18
22
 
19
23
  def add_route
20
- inject_into_file 'config/routes.rb', "\s\smount Calagator::Engine => '/'\n", after: "Application.routes.draw do\n"
21
- end
22
-
23
- def add_secrets
24
- copy_file File.expand_path(File.join(__FILE__, '../templates/config/secrets.yml.sample')), 'config/secrets.yml'
24
+ inject_into_file 'config/routes.rb', "\s\smount Calagator::Engine => '/'\n", after: "routes.draw do\n"
25
25
  end
26
26
 
27
- def add_initializer
28
- copy_file File.expand_path(File.join(__FILE__, '../templates/config/calagator.rb')), 'config/initializers/calagator.rb'
27
+ def add_initializers
28
+ initializer '01_calagator.rb', File.read(File.expand_path('../templates/config/initializers/01_calagator.rb', __FILE__))
29
+ initializer '02_geokit.rb', File.read(File.expand_path('../templates/config/initializers/02_geokit.rb', __FILE__))
29
30
  end
30
31
 
31
32
  def add_javascripts
@@ -35,5 +36,9 @@ module Calagator
35
36
  def add_stylesheets
36
37
  append_file 'app/assets/stylesheets/application.css', '//= require calagator'
37
38
  end
39
+
40
+ def add_seeds
41
+ append_file 'db/seeds.rb', 'Calagator::Engine.load_seed'
42
+ end
38
43
  end
39
44
  end
@@ -0,0 +1,89 @@
1
+ Calagator.setup do |config|
2
+ # Site name
3
+ # config.title = 'Calagator'
4
+
5
+ # Site tagline
6
+ # config.tagline = 'A Tech Calendar'
7
+
8
+ # Site URL with trailing slash
9
+ # config.url = 'http://my-calagator.org/'
10
+
11
+ # Email address of administrator that will get exception notifications
12
+ # and requests for assistance from users:
13
+ # config.administrator_email = 'your@email.addr'
14
+
15
+ # Admin username and password to use when accessing /admin pages
16
+ # config.admin_username = 'admin'
17
+ # config.admin_password = 'kitties!'
18
+
19
+ # API key for Meetup.com, get your own from: http://www.meetup.com/meetup_api/key/
20
+ # config.meetup_api_key = '<your meetup API key>'
21
+
22
+ # Search engine to use for searching events.
23
+ # Values: :sql, :sunspot. Defaults to :sql.
24
+ # config.search_engine = :sql
25
+
26
+ # Set the iCalendar SEQUENCE, which should be increased each time an event
27
+ # is updated. If an admin needs to forcefully increment the SEQUENCE for all
28
+ # events, they can set this icalendar_sequence_offset value to something
29
+ # greater than 0.
30
+ # config.icalendar_sequence_offset = 0
31
+
32
+ # Configure a mapping provider
33
+ # Stamen's terrain tiles will be used by default.
34
+ # Map marker color
35
+ # Values: red, darkred, orange, green, darkgreen, blue, purple, darkpuple, cadetblue
36
+ # config.mapping_marker_color = 'green'
37
+
38
+ # A Google Maps API key is required to use Google's geocoding service
39
+ # as well as to display maps using their API.
40
+ # Get one at: https://developers.google.com/maps/documentation/javascript/tutorial#api_key
41
+ # config.mapping_google_maps_api_key = '<your google maps v3 API key>'
42
+
43
+ # The tile provider to use when rendering maps with Leaflet.
44
+ # One of: leaflet, stamen, mapbox, google
45
+ # config.mapping_provider = 'stamen'
46
+
47
+ # The tiles to use for the map, see the docs for individual Leaflet plugins.
48
+ # config.mapping_tiles = 'terrain'
49
+
50
+ # Other mapping examples:
51
+ #
52
+ # Stamen
53
+ # (available tiles: terrain, toner, watercolor)
54
+ # config.mapping_provider = 'stamen'
55
+ # config.mapping_tiles = 'watercolor'
56
+ #
57
+ # MapBox Streets (use a map from your own account)
58
+ # config.mapping_provider = 'mapbox'
59
+ # config.mapping_tiles = 'examples.map-9ijuk24y'
60
+ #
61
+ # Google Maps
62
+ # config.mapping_provider = 'google'
63
+ # config.mapping_tiles = 'ROADMAP'
64
+ #
65
+ # OpenStreetMap
66
+ # config.mapping_provider = 'leaflet'
67
+ # config.mapping_tiles = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
68
+ #
69
+ # Esri
70
+ # (available tiles: Gray, Streets, Oceans, Topographic)
71
+ # config.mapping_provider = 'esri'
72
+ # config.mapping_tiles = 'Gray'
73
+
74
+ # Map to display on /venues page:
75
+ # config.venues_map_options = {
76
+ # # Zoom magnification level:
77
+ # zoom: 12,
78
+ # # Center of the map, in latitude and longitude.
79
+ # # If no center is specified, the map will zoom to fit all markers.
80
+ # center: [45.518493, -122.660737]
81
+ # }
82
+
83
+ # Patterns for detecting spam events and venues
84
+ # config.blacklist_patterns = [
85
+ # /\b(online|overseas).+(drugstore|pharmacy)\b/,
86
+ # /\bcialis\b/,
87
+ # ]
88
+
89
+ end
@@ -0,0 +1,106 @@
1
+ require 'geokit'
2
+
3
+ # This is the order in which the geocoders are called in a failover scenario
4
+ # If you only want to use a single geocoder, put a single symbol in the array.
5
+ #
6
+ # Be aware that there are Terms of Use restrictions on how you can use the
7
+ # various geocoders. Make sure you read up on relevant Terms of Use for each
8
+ # geocoder you are going to use.
9
+
10
+ Geokit::Geocoders::provider_order = [:google]
11
+
12
+ # These defaults are used in Geokit::Mappable.distance_to and in acts_as_mappable
13
+ Geokit::default_units = :miles
14
+ Geokit::default_formula = :sphere
15
+
16
+ # This is your Google Maps geocoder keys (all optional).
17
+ # See http://www.google.com/apis/maps/signup.html
18
+ # and http://www.google.com/apis/maps/documentation/#Geocoding_Examples
19
+ #
20
+ # Geokit::Geocoders::GoogleGeocoder.client_id = ''
21
+ # Geokit::Geocoders::GoogleGeocoder.cryptographic_key = ''
22
+ # Geokit::Geocoders::GoogleGeocoder.channel = ''
23
+
24
+ # You can also use the free API key instead of signed requests
25
+ # See https://developers.google.com/maps/documentation/geocoding/#api_key
26
+ # Geokit::Geocoders::GoogleGeocoder.api_key = ''
27
+ #
28
+ # CALAGATOR:
29
+ # We populate this with the API key set for Google Maps in 01_calagator.rb by default
30
+ Geokit::Geocoders::GoogleGeocoder.api_key = Calagator.mapping_google_maps_api_key
31
+
32
+ # You can also set multiple API KEYS for different domains that may be directed to this same application.
33
+ # The domain from which the current user is being directed will automatically be updated for Geokit via
34
+ # the GeocoderControl class, which gets it's begin filter mixed into the ActionController.
35
+ # You define these keys with a Hash as follows:
36
+ #
37
+ # Geokit::Geocoders::google = { 'rubyonrails.org' => 'RUBY_ON_RAILS_API_KEY', 'ruby-docs.org' => 'RUBY_DOCS_API_KEY' }
38
+
39
+ # This is your yahoo application key for the Yahoo Geocoder.
40
+ # See http://developer.yahoo.com/faq/index.html#appid
41
+ # and http://developer.yahoo.com/maps/rest/V1/geocode.html
42
+ #
43
+ # Geokit::Geocoders::YahooGeocoder.key = 'REPLACE_WITH_YOUR_YAHOO_KEY'
44
+ # Geokit::Geocoders::YahooGeocoder.secret = 'REPLACE_WITH_YOUR_YAHOO_SECRET'
45
+
46
+ # This is your username and password for geocoder.us.
47
+ # To use the free service, the value can be set to nil or false. For
48
+ # usage tied to an account, the value should be set to username:password.
49
+ # See http://geocoder.us
50
+ # and http://geocoder.us/user/signup
51
+ #
52
+ # Geokit::Geocoders::UsGeocoder.key = 'username:password'
53
+
54
+ # This is your authorization key for geocoder.ca.
55
+ # To use the free service, the value can be set to nil or false. For
56
+ # usage tied to an account, set the value to the key obtained from
57
+ # Geocoder.ca.
58
+ # See http://geocoder.ca
59
+ # and http://geocoder.ca/?register=1
60
+ #
61
+ # Geokit::Geocoders::CaGeocoder.key = 'KEY'
62
+
63
+ # This is your username key for geonames.
64
+ # To use this service either free or premium, you must register a key.
65
+ # See http://www.geonames.org
66
+ #
67
+ # Geokit::Geocoders::GeonamesGeocoder.key = 'KEY'
68
+
69
+ # Most other geocoders need either no setup or a key
70
+ # Geokit::Geocoders::BingGeocoder.key = ''
71
+ # Geokit::Geocoders::MapQuestGeocoder.key = ''
72
+ # Geokit::Geocoders::YandexGeocoder.key = ''
73
+ # Geokit::Geocoders::MapboxGeocoder.key = 'ACCESS_TOKEN'
74
+ # Geokit::Geocoders::OpencageGeocoder.key = 'some_api_key'
75
+
76
+ # Geonames has a free service and a premium service, each using a different URL
77
+ # GeonamesGeocoder.premium = true will use http://ws.geonames.net (premium)
78
+ # GeonamesGeocoder.premium = false will use http://api.geonames.org (free)
79
+ # Geokit::Geocoders::GeonamesGeocoder.premium = false
80
+
81
+ # The IP provider order. Valid symbols are :ip,:geo_plugin.
82
+ # As before, make sure you read up on relevant Terms of Use for each.
83
+ # Geokit::Geocoders::ip_provider_order = [:external,:geo_plugin,:ip]
84
+
85
+ # Disable HTTPS globally. This option can also be set on individual
86
+ # geocoder classes.
87
+ # Geokit::Geocoders::secure = false
88
+
89
+ # Control verification of the server certificate for geocoders using HTTPS
90
+ # Geokit::Geocoders::ssl_verify_mode = OpenSSL::SSL::VERIFY_(PEER/NONE)
91
+ #
92
+ # Setting this to VERIFY_NONE may be needed on systems that don't have
93
+ # a complete or up to date root certificate store. Only applies to
94
+ # the Net::HTTP adapter.
95
+
96
+ # This is the timeout value in seconds to be used for calls to the geocoder web
97
+ # services. For no timeout at all, comment out the setting. The timeout unit
98
+ # is in seconds.
99
+ Geokit::Geocoders::request_timeout = 3
100
+
101
+ # This setting can be used if web service calls must be routed through a proxy.
102
+ # These setting can be nil if not needed, otherwise, a valid URI must be
103
+ # filled in at a minimum. If the proxy requires authentication, the username
104
+ # and password can be provided as well.
105
+ #
106
+ # Geokit::Geocoders::proxy = 'https://user:password@host:port'
@@ -1,6 +1,19 @@
1
1
  desc "Reindex Calagator models with Sunspot"
2
- task "sunspot:reindex:calagator" => :environment do
3
- Rake.application.invoke_task('sunspot:solr:reindex[500,Event]')
4
- Rake.application.invoke_task('sunspot:solr:reindex[500,Venue]')
2
+ task "sunspot:reindex:calagator" do
3
+ # Silence warnings about already-initialized constants caused by
4
+ # sunspot-rails' aggressive eager loading of all engine files.
5
+ original_verbosity = $VERBOSE
6
+ $VERBOSE = nil
7
+
8
+ puts "Reindexing Venues…"
9
+ Rake.application['sunspot:solr:reindex'].invoke(500, "Calagator::Venue")
10
+
11
+ Rake.application['sunspot:solr:reindex'].reenable
12
+ Rake.application['sunspot:reindex'].reenable
13
+
14
+ puts "Reindexing Events…"
15
+ Rake.application['sunspot:solr:reindex'].invoke(500, "Calagator::Event")
16
+
17
+ $VERBOSE = original_verbosity
5
18
  end
6
19
 
@@ -1,13 +1,13 @@
1
1
  desc "Update counter caches"
2
2
  task :update_counter_caches => :environment do
3
3
  # Update the Venue#events_count
4
- total = Venue.count
5
- Venue.all.each do |venue|
4
+ total = Calagator::Venue.count
5
+ Calagator::Venue.all.each do |venue|
6
6
  cached = venue.events_count
7
7
  actual = venue.events.count
8
8
  if actual != cached
9
9
  puts "Updating Venue ##{venue.id} from #{cached} cached to #{actual} actual -- #{venue.title}"
10
- Venue.connection.update("UPDATE venues SET events_count = #{actual} WHERE id = #{venue.id}")
10
+ Calagator::Venue.connection.update("UPDATE venues SET events_count = #{actual} WHERE id = #{venue.id}")
11
11
  end
12
12
  end
13
13
  end
@@ -62,7 +62,7 @@ describe EventsController, :type => :controller do
62
62
  it "should accept a JSONP callback" do
63
63
  post :index, :format => "json", :callback => "some_function"
64
64
 
65
- expect(response.body.split("\n").join).to match /^\s*some_function\(.*\);?\s*$/
65
+ expect(response.body.split("\n").join).to match /some_function\(.*\)\Z/
66
66
  end
67
67
 
68
68
  describe "without events" do
@@ -586,7 +586,7 @@ describe EventsController, :type => :controller do
586
586
 
587
587
  context "with admin auth for duplicates" do
588
588
  before do
589
- credentials = ActionController::HttpAuthentication::Basic.encode_credentials SECRETS.admin_username, SECRETS.admin_password
589
+ credentials = ActionController::HttpAuthentication::Basic.encode_credentials Calagator.admin_username, Calagator.admin_password
590
590
  request.env['HTTP_AUTHORIZATION'] = credentials
591
591
  end
592
592
 
@@ -717,7 +717,7 @@ describe EventsController, :type => :controller do
717
717
  it "should accept a JSONP callback" do
718
718
  post :search, :query => "myquery", :format => "json", :callback => "some_function"
719
719
 
720
- expect(response.body).to match /^\s*some_function\(.*\);?\s*$/
720
+ expect(response.body).to match /some_function\(.*\)$/
721
721
  end
722
722
 
723
723
  it "should include venue details" do
@@ -27,7 +27,7 @@ describe SourcesController, :type => :controller do
27
27
  allow(@source).to receive(:to_events).and_return([@event])
28
28
 
29
29
  allow(Source).to receive(:new).and_return(@source)
30
- allow(Source).to receive(:find_or_create_by_url).and_return(@source)
30
+ allow(Source).to receive(:find_or_create_by).with(url: "http://my.url/").and_return(@source)
31
31
  end
32
32
 
33
33
  it "should provide a way to create new sources" do
@@ -69,7 +69,7 @@ describe SourcesController, :type => :controller do
69
69
  describe "is given problematic sources" do
70
70
  before do
71
71
  @source = stub_model(Source)
72
- expect(Source).to receive(:find_or_create_from).and_return(@source)
72
+ expect(Source).to receive(:find_or_create_by).with(url: "http://invalid.host").and_return(@source)
73
73
  end
74
74
 
75
75
  def assert_import_raises(exception)
@@ -79,7 +79,7 @@ describe SourcesController, :type => :controller do
79
79
 
80
80
  it "should fail when host responds with no events" do
81
81
  expect(@source).to receive(:create_events!).and_return([])
82
- post :import, :source => {:url => "http://empty.host"}
82
+ post :import, :source => {:url => "http://invalid.host"}
83
83
  expect(flash[:failure]).to match /Unable to find any upcoming events to import from this source/
84
84
  end
85
85
 
@@ -29,7 +29,7 @@ describe VenuesController, :type => :controller do
29
29
 
30
30
  context "with admin auth for duplicates" do
31
31
  before do
32
- credentials = ActionController::HttpAuthentication::Basic.encode_credentials SECRETS.admin_username, SECRETS.admin_password
32
+ credentials = ActionController::HttpAuthentication::Basic.encode_credentials Calagator.admin_username, Calagator.admin_password
33
33
  request.env['HTTP_AUTHORIZATION'] = credentials
34
34
  end
35
35
 
@@ -132,9 +132,9 @@ describe VenuesController, :type => :controller do
132
132
  end
133
133
 
134
134
  it "should accept a JSONP callback" do
135
- get :index, :format => "json", :callback => "some_function"
135
+ xhr :get, :index, :format => "json", :callback => "some_function"
136
136
 
137
- expect(response.body.split("\n").join).to match /^\s*some_function\(.*\);?\s*$/
137
+ expect(response.body.split("\n").join).to match /some_function\(.*\)$/
138
138
  end
139
139
  end
140
140
 
@@ -164,9 +164,9 @@ describe VenuesController, :type => :controller do
164
164
  end
165
165
 
166
166
  it "should accept a JSONP callback" do
167
- get :show, :id => @venue.to_param, :format => "json", :callback => "some_function"
167
+ xhr :get, :show, :id => @venue.to_param, :format => "json", :callback => "some_function"
168
168
 
169
- expect(response.body.split("\n").join).to match /^\s*some_function\(.*\);?\s*$/
169
+ expect(response.body.split("\n").join).to match /some_function\(.*\)$/
170
170
  end
171
171
  end
172
172
  end
@@ -1,39 +1,47 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rails', '3.2.19'
4
-
5
- # Bundle edge Rails instead:
6
- # gem 'rails', :git => 'git://github.com/rails/rails.git'
7
3
 
4
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
5
+ gem 'rails', '4.2.1'
6
+ # Use sqlite3 as the database for Active Record
8
7
  gem 'sqlite3'
8
+ # Use SCSS for stylesheets
9
+ gem 'sass-rails', '~> 5.0'
10
+ # Use Uglifier as compressor for JavaScript assets
11
+ gem 'uglifier', '>= 1.3.0'
12
+ # Use CoffeeScript for .coffee assets and views
13
+ gem 'coffee-rails', '~> 4.1.0'
14
+ # See https://github.com/rails/execjs#readme for more supported runtimes
15
+ # gem 'therubyracer', platforms: :ruby
16
+
17
+ # Use jquery as the JavaScript library
18
+ gem 'jquery-rails'
19
+ # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
20
+ gem 'turbolinks'
21
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
22
+ gem 'jbuilder', '~> 2.0'
23
+ # bundle exec rake doc:rails generates the API under doc/api.
24
+ gem 'sdoc', '~> 0.4.0', group: :doc
9
25
 
26
+ # Use ActiveModel has_secure_password
27
+ # gem 'bcrypt', '~> 3.1.7'
10
28
 
11
- # Gems used only for assets and not required
12
- # in production environments by default.
13
- group :assets do
14
- gem 'sass-rails', '~> 3.2.3'
15
- gem 'coffee-rails', '~> 3.2.1'
16
-
17
- # See https://github.com/sstephenson/execjs#readme for more supported runtimes
18
- # gem 'therubyracer', :platforms => :ruby
19
-
20
- gem 'uglifier', '>= 1.0.3'
21
- end
29
+ # Use Unicorn as the app server
30
+ # gem 'unicorn'
22
31
 
23
- gem 'jquery-rails'
32
+ # Use Capistrano for deployment
33
+ # gem 'capistrano-rails', group: :development
24
34
 
25
- # To use ActiveModel has_secure_password
26
- # gem 'bcrypt-ruby', '~> 3.0.0'
35
+ group :development, :test do
36
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
37
+ gem 'byebug'
27
38
 
28
- # To use Jbuilder templates for JSON
29
- # gem 'jbuilder'
39
+ # Access an IRB console on exception pages or by using <%= console %> in views
40
+ gem 'web-console', '~> 2.0'
30
41
 
31
- # Use unicorn as the app server
32
- # gem 'unicorn'
42
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
43
+ gem 'spring'
44
+ end
33
45
 
34
- # Deploy with Capistrano
35
- # gem 'capistrano'
36
46
 
37
- # To use debugger
38
- # gem 'debugger'
39
- gem 'calagator', path: '/Users/reidab/code/calagator'
47
+ gem 'calagator', path: '../..'