Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Reword gem loading to work with Rails 2.x & 3.x,

as well as letting the specs run properly.
Kindof tricky, hope I got it all right.
  • Loading branch information...
commit e5e6c512e05b12f6439046cd0171fd3cf57e138a 1 parent dd8d934
@jkrall authored
View
16 config/application.rb
@@ -1,16 +0,0 @@
-require File.expand_path('../boot', __FILE__)
-
-require "action_controller/railtie"
-require "action_mailer/railtie"
-require "active_resource/railtie"
-
-Bundler.require(:default, Rails.env) if defined?(Bundler)
-
-module Analytical
- class Application < Rails::Application
-
- # Configure the default encoding used in templates for Ruby 1.9.
- config.encoding = "utf-8"
-
- end
-end
View
13 config/boot.rb
@@ -1,13 +0,0 @@
-require 'rubygems'
-
-# Set up gems listed in the Gemfile.
-gemfile = File.expand_path('../../Gemfile', __FILE__)
-begin
- ENV['BUNDLE_GEMFILE'] = gemfile
- require 'bundler'
- Bundler.setup
-rescue Bundler::GemNotFound => e
- STDERR.puts e.message
- STDERR.puts "Try running `bundle install`."
- exit!
-end if File.exist?(gemfile)
View
8 config/environment.rb
@@ -1,8 +0,0 @@
-# Load the rails application
-require File.expand_path('../application', __FILE__)
-
-Analytical::Application.configure do
-end
-
-# Initialize the rails application
-Analytical::Application.initialize!
View
26 config/environments/development.rb
@@ -1,26 +0,0 @@
-Analytical::Application.configure do
- # Settings specified here will take precedence over those in config/application.rb
-
- # In the development environment your application's code is reloaded on
- # every request. This slows down response time but is perfect for development
- # since you don't have to restart the webserver when you make code changes.
- config.cache_classes = false
-
- # Log error messages when you accidentally call methods on nil.
- config.whiny_nils = true
-
- # Show full error reports and disable caching
- config.consider_all_requests_local = true
- config.action_view.debug_rjs = true
- config.action_controller.perform_caching = false
-
- # Don't care if the mailer can't send
- config.action_mailer.raise_delivery_errors = false
-
- # Print deprecation notices to the Rails logger
- config.active_support.deprecation = :log
-
- # Only use best-standards-support built into browsers
- config.action_dispatch.best_standards_support = :builtin
-end
-
View
45 config/environments/production.rb
@@ -1,45 +0,0 @@
-Analytical::Application.configure do
- # Settings specified here will take precedence over those in config/application.rb
-
- # The production environment is meant for finished, "live" apps.
- # Code is not reloaded between requests
- config.cache_classes = true
-
- # Full error reports are disabled and caching is turned on
- config.consider_all_requests_local = false
- config.action_controller.perform_caching = true
-
- # Specifies the header that your server uses for sending files
- config.action_dispatch.x_sendfile_header = "X-Sendfile"
-
- # For nginx:
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
-
- # If you have no front-end server that supports something like X-Sendfile,
- # just comment this out and Rails will serve the files
-
- # See everything in the log (default is :info)
- # config.log_level = :debug
-
- # Use a different logger for distributed setups
- # config.logger = SyslogLogger.new
-
- # Enable serving of images, stylesheets, and javascripts from an asset server
- # config.action_controller.asset_host = "http://assets.example.com"
-
- # Disable delivery errors, bad email addresses will be ignored
- # config.action_mailer.raise_delivery_errors = false
-
- # fallback to localhost if we can't find Heroku's ENV["URL"]
- config.action_mailer.default_url_options = { host: ENV["URL"] || "localhost:3000" }
-
- # Enable threaded mode
- # config.threadsafe!
-
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
- # the I18n.default_locale when a translation can not be found)
- config.i18n.fallbacks = true
-
- # Send deprecation notices to registered listeners
- config.active_support.deprecation = :notify
-end
View
38 config/environments/test.rb
@@ -1,38 +0,0 @@
-Analytical::Application.configure do
- # Settings specified here will take precedence over those in config/application.rb
-
- # The test environment is used exclusively to run your application's
- # test suite. You never need to work with it otherwise. Remember that
- # your test database is "scratch space" for the test suite and is wiped
- # and recreated between test runs. Don't rely on the data there!
- config.cache_classes = true
-
- # Log error messages when you accidentally call methods on nil.
- config.whiny_nils = true
-
- # Show full error reports and disable caching
- config.consider_all_requests_local = true
- config.action_controller.perform_caching = false
-
- # Raise exceptions instead of rendering exception templates
- config.action_dispatch.show_exceptions = false
-
- # Disable request forgery protection in test environment
- config.action_controller.allow_forgery_protection = false
-
- # Tell Action Mailer not to deliver emails to the real world.
- # The :test delivery method accumulates sent emails in the
- # ActionMailer::Base.deliveries array.
- config.action_mailer.delivery_method = :test
-
- config.action_mailer.default_url_options = { host: ENV["URL"] || "localhost:3000" }
-
- # Use SQL instead of Active Record's schema dumper when creating the test database.
- # This is necessary if your schema can't be completely dumped by the schema dumper,
- # like if you have constraints or database-specific column types
- # config.active_record.schema_format = :sql
-
- # Print deprecation notices to the stderr
- config.active_support.deprecation = :stderr
-
-end
View
3  config/routes.rb
@@ -1,3 +0,0 @@
-Analytical::Application.routes.draw do
-
-end
View
1  lib/analytical.rb
@@ -1,3 +1,4 @@
+require File.dirname(__FILE__)+'/analytical/rails/engine'
require File.dirname(__FILE__)+'/analytical/modules/base'
Dir.glob(File.dirname(__FILE__)+'/analytical/**/*.rb').each do |f|
require f
View
9 lib/analytical/rails/engine.rb
@@ -0,0 +1,9 @@
+if defined?(::Rails::Engine)
+ module Analytical
+ module Rails
+ class Engine < ::Rails::Engine
+ # auto wire
+ end
+ end
+ end
+end
View
1  rails/init.rb
@@ -0,0 +1 @@
+require 'analytical'
View
0  config/analytical.yml → spec/config/analytical.yml
File renamed without changes
View
14 spec/spec_helper.rb
@@ -2,14 +2,24 @@
ENV["RAILS_ENV"] ||= 'test'
-require "rails/application"
-require File.expand_path("../../config/environment", __FILE__)
+#require "rails/application"
+#require File.expand_path("../../config/environment", __FILE__)
+require 'active_support'
+require 'active_support/core_ext'
+require 'active_support/json'
+require 'action_view'
+require 'active_model'
+require 'action_controller'
+require 'rails'
require 'rspec/rails'
RSpec.configure do |config|
config.mock_with :rspec
config.expect_with :rspec
+ config.before do
+ Rails.stub(:root).and_return(Pathname.new(__FILE__).dirname)
+ end
end
require 'analytical'
Please sign in to comment.
Something went wrong with that request. Please try again.