sunspot_rails 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/History.txt +11 -0
  2. data/README.rdoc +13 -11
  3. data/Rakefile +1 -10
  4. data/TESTING.md +35 -0
  5. data/dev_tasks/spec.rake +22 -0
  6. data/lib/generators/sunspot_rails/install/install_generator.rb +13 -0
  7. data/lib/generators/sunspot_rails/install/templates/config/sunspot.yml +17 -0
  8. data/lib/generators/sunspot_rails.rb +9 -0
  9. data/lib/sunspot/rails/adapters.rb +6 -6
  10. data/lib/sunspot/rails/configuration.rb +53 -6
  11. data/{rails → lib/sunspot/rails}/init.rb +0 -2
  12. data/lib/sunspot/rails/railtie.rb +26 -0
  13. data/lib/sunspot/rails/request_lifecycle.rb +7 -2
  14. data/lib/sunspot/rails/searchable.rb +11 -13
  15. data/lib/sunspot/rails/server.rb +1 -1
  16. data/lib/sunspot/rails/solr_logging.rb +6 -1
  17. data/lib/sunspot/rails/spec_helper.rb +8 -1
  18. data/lib/sunspot/rails/tasks.rb +1 -1
  19. data/lib/sunspot/rails/version.rb +1 -1
  20. data/lib/sunspot_rails.rb +7 -0
  21. data/spec/configuration_spec.rb +80 -9
  22. data/spec/model_spec.rb +19 -21
  23. data/spec/request_lifecycle_spec.rb +11 -2
  24. data/spec/server_spec.rb +2 -1
  25. data/spec/spec_helper.rb +18 -23
  26. metadata +45 -48
  27. data/dev_tasks/gemspec.rake +0 -33
  28. data/spec/mock_app/app/controllers/application.rb +0 -10
  29. data/spec/mock_app/app/controllers/application_controller.rb +0 -10
  30. data/spec/mock_app/app/controllers/posts_controller.rb +0 -6
  31. data/spec/mock_app/app/models/author.rb +0 -8
  32. data/spec/mock_app/app/models/blog.rb +0 -12
  33. data/spec/mock_app/app/models/location.rb +0 -2
  34. data/spec/mock_app/app/models/photo_post.rb +0 -2
  35. data/spec/mock_app/app/models/post.rb +0 -10
  36. data/spec/mock_app/app/models/post_with_auto.rb +0 -10
  37. data/spec/mock_app/config/boot.rb +0 -110
  38. data/spec/mock_app/config/database.yml +0 -4
  39. data/spec/mock_app/config/environment.rb +0 -42
  40. data/spec/mock_app/config/environments/development.rb +0 -27
  41. data/spec/mock_app/config/environments/test.rb +0 -27
  42. data/spec/mock_app/config/initializers/new_rails_defaults.rb +0 -19
  43. data/spec/mock_app/config/initializers/session_store.rb +0 -15
  44. data/spec/mock_app/config/routes.rb +0 -43
  45. data/spec/mock_app/config/sunspot.yml +0 -19
  46. data/spec/mock_app/db/schema.rb +0 -27
  47. data/spec/mock_app/db/test.db +0 -0
@@ -1,42 +0,0 @@
1
- # Be sure to restart your server when you modify this file
2
-
3
- # Specifies gem version of Rails to use when vendor/rails is not present
4
- # RAILS_GEM_VERSION = ENV['RAILS_GEM_VERSION'] || '2.3.3' unless defined? RAILS_GEM_VERSION
5
-
6
- # Bootstrap the Rails environment, frameworks, and default configuration
7
- require File.join(File.dirname(__FILE__), 'boot')
8
-
9
- Rails::Initializer.run do |config|
10
- # Settings in config/environments/* take precedence over those specified here.
11
- # Application configuration should go into files in config/initializers
12
- # -- all .rb files in that directory are automatically loaded.
13
-
14
- # Add additional load paths for your own custom dirs
15
- # config.load_paths += %W( #{RAILS_ROOT}/extras )
16
-
17
- # Specify gems that this application depends on and have them installed with rake gems:install
18
- # config.gem "bj"
19
- # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
20
- # config.gem "sqlite3-ruby", :lib => "sqlite3"
21
- # config.gem "aws-s3", :lib => "aws/s3"
22
- config.gem "qoobaa-sqlite3-ruby", :lib => 'sqlite3', :source => "http://gems.github.com" if RUBY_VERSION > '1.9'
23
-
24
- # Only load the plugins named here, in the order given (default is alphabetical).
25
- # :all can be used as a placeholder for all plugins not explicitly named
26
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
27
-
28
- # Skip frameworks you're not going to use. To use Rails without a database,
29
- # you must remove the Active Record framework.
30
- # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
31
-
32
- # Activate observers that should always be running
33
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
34
-
35
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
36
- # Run "rake -D time" for a list of tasks for finding time zone names.
37
- config.time_zone = 'UTC'
38
-
39
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
40
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
41
- # config.i18n.default_locale = :de
42
- end
@@ -1,27 +0,0 @@
1
- # Settings specified here will take precedence over those in config/environment.rb
2
-
3
- # The test environment is used exclusively to run your application's
4
- # test suite. You never need to work with it otherwise. Remember that
5
- # your test database is "scratch space" for the test suite and is wiped
6
- # and recreated between test runs. Don't rely on the data there!
7
- config.cache_classes = true
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.action_controller.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
15
-
16
- # Disable request forgery protection in test environment
17
- config.action_controller.allow_forgery_protection = false
18
-
19
- # Tell Action Mailer not to deliver emails to the real world.
20
- # The :test delivery method accumulates sent emails in the
21
- # ActionMailer::Base.deliveries array.
22
- config.action_mailer.delivery_method = :test
23
-
24
- # Use SQL instead of Active Record's schema dumper when creating the test database.
25
- # This is necessary if your schema can't be completely dumped by the schema dumper,
26
- # like if you have constraints or database-specific column types
27
- # config.active_record.schema_format = :sql
@@ -1,27 +0,0 @@
1
- # Settings specified here will take precedence over those in config/environment.rb
2
-
3
- # The test environment is used exclusively to run your application's
4
- # test suite. You never need to work with it otherwise. Remember that
5
- # your test database is "scratch space" for the test suite and is wiped
6
- # and recreated between test runs. Don't rely on the data there!
7
- config.cache_classes = true
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.action_controller.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
15
-
16
- # Disable request forgery protection in test environment
17
- config.action_controller.allow_forgery_protection = false
18
-
19
- # Tell Action Mailer not to deliver emails to the real world.
20
- # The :test delivery method accumulates sent emails in the
21
- # ActionMailer::Base.deliveries array.
22
- config.action_mailer.delivery_method = :test
23
-
24
- # Use SQL instead of Active Record's schema dumper when creating the test database.
25
- # This is necessary if your schema can't be completely dumped by the schema dumper,
26
- # like if you have constraints or database-specific column types
27
- # config.active_record.schema_format = :sql
@@ -1,19 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # These settings change the behavior of Rails 2 apps and will be defaults
4
- # for Rails 3. You can remove this initializer when Rails 3 is released.
5
-
6
- if defined?(ActiveRecord)
7
- # Include Active Record class name as root for JSON serialized output.
8
- ActiveRecord::Base.include_root_in_json = true
9
-
10
- # Store the full class name (including module namespace) in STI type column.
11
- ActiveRecord::Base.store_full_sti_class = true
12
- end
13
-
14
- # Use ISO 8601 format for JSON serialized times and dates.
15
- ActiveSupport.use_standard_json_time_format = true
16
-
17
- # Don't escape HTML entities in JSON, leave that for the #json_escape helper.
18
- # if you're including raw json in an HTML page.
19
- ActiveSupport.escape_html_entities_in_json = false
@@ -1,15 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key for verifying cookie session data integrity.
4
- # If you change this key, all old sessions 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
- ActionController::Base.session = {
8
- :key => '_mock_app_session',
9
- :secret => 'a2ddf56c7d642f2075a5d466eff55556c20d13415aff5156740ac82848c3c586711fde0e52f4834727816d08b2d13f3da7b6c7587d789cebe6081ee1a7fec943'
10
- }
11
-
12
- # Use the database for sessions instead of the cookie-based default,
13
- # which shouldn't be used to store highly confidential information
14
- # (create the session table with "rake db:sessions:create")
15
- # ActionController::Base.session_store = :active_record_store
@@ -1,43 +0,0 @@
1
- ActionController::Routing::Routes.draw do |map|
2
- # The priority is based upon order of creation: first created -> highest priority.
3
-
4
- # Sample of regular route:
5
- # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
6
- # Keep in mind you can assign values other than :controller and :action
7
-
8
- # Sample of named route:
9
- # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
10
- # This route can be invoked with purchase_url(:id => product.id)
11
-
12
- # Sample resource route (maps HTTP verbs to controller actions automatically):
13
- # map.resources :products
14
-
15
- # Sample resource route with options:
16
- # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
17
-
18
- # Sample resource route with sub-resources:
19
- # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
20
-
21
- # Sample resource route with more complex sub-resources
22
- # map.resources :products do |products|
23
- # products.resources :comments
24
- # products.resources :sales, :collection => { :recent => :get }
25
- # end
26
-
27
- # Sample resource route within a namespace:
28
- # map.namespace :admin do |admin|
29
- # # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
30
- # admin.resources :products
31
- # end
32
-
33
- # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
34
- # map.root :controller => "welcome"
35
-
36
- # See how all your routes lay out with "rake routes"
37
-
38
- # Install the default routes as the lowest priority.
39
- # Note: These default routes make all actions in every controller accessible via GET requests. You should
40
- # consider removing the them or commenting them out if you're using named routes and resources.
41
-
42
- map.resources :posts, :only => :create
43
- end
@@ -1,19 +0,0 @@
1
- test:
2
- solr:
3
- hostname: localhost
4
- port: 8980
5
- development:
6
- solr:
7
- hostname: localhost
8
- port: 8981
9
- config_test:
10
- solr:
11
- hostname: some.host
12
- port: 1234
13
- path: /solr/idx
14
- log_level: WARNING
15
- data_path: /my_superior_path/data
16
- pid_path: /my_superior_path/pids
17
- solr_home: /my_superior_path
18
- auto_commit_after_request: false
19
- auto_commit_after_delete_request: true
@@ -1,27 +0,0 @@
1
- ActiveRecord::Schema.define(:version => 0) do
2
- create_table :posts, :force => true do |t|
3
- t.string :title
4
- t.string :type
5
- t.integer :location_id
6
- t.text :body
7
- t.references :blog
8
- t.timestamps
9
- end
10
-
11
- create_table :locations, :force => true do |t|
12
- t.float :lat
13
- t.float :lng
14
- end
15
-
16
- create_table :blogs, :force => true do |t|
17
- t.string :name
18
- t.string :subdomain
19
- t.timestamps
20
- end
21
-
22
- create_table :writers, :force => true, :primary_key => :writer_id do |t|
23
- t.string :name
24
- t.timestamps
25
- end
26
-
27
- end
File without changes