Permalink
Browse files

Fixed ability to run as Rails Engine or Application.

  • Loading branch information...
1 parent 6deedfc commit 52beb0b47a6bf6b8f512d2d23e1d5fbe48817a1f @ndbroadbent ndbroadbent committed Mar 6, 2012
View
@@ -114,8 +114,9 @@ def database_and_table_exists?
# Loads settings from YAML files
def load_settings_from_yaml
@@yaml_settings = {}.with_indifferent_access
+
setting_files = [
- Rails.root.join("config", "settings.default.yml"),
+ FatFreeCRM.root.join("config", "settings.default.yml"),
Rails.root.join("config", "settings.yml")
]
@@ -5,7 +5,7 @@
= link_to(tab[:url], :class => tab[:active] ? "active" : "") do
- unless request.fullpath.include?("/admin")
- img_base_path = "tab_icons/#{tab[:text].to_s.downcase.sub(/^tab_/, '')}"
- - if File.exists?(Rails.root.join("vendor/assets/images/#{img_base_path}.png"))
+ - if Rails.application.assets.find_asset("#{img_base_path}.png")
= image_tag("#{img_base_path}#{tab[:active] ? "_active" : ""}.png")
= t(tab[:text])
View
@@ -1,7 +1,4 @@
-require 'rubygems'
-require 'bundler'
+# This file is used by Rack-based servers to start the application.
-Bundler.require :default, :development
-
-Combustion.initialize!
-run Combustion::Application
+require ::File.expand_path('../config/environment', __FILE__)
+run FatFreeCRM::Application
View
@@ -1,9 +1,7 @@
require File.expand_path('../boot', __FILE__)
-# Use the Syck YAML parser
-require 'fat_free_crm/syck_yaml'
-
require 'rails/all'
+require 'fat_free_crm/syck_yaml'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
@@ -0,0 +1,37 @@
+FatFreeCRM::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 web server 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_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
+
+ # Raise exception on mass assignment protection for Active Record models
+ config.active_record.mass_assignment_sanitizer = :strict
+
+ # Log the query plan for queries taking more than this (works
+ # with SQLite, MySQL, and PostgreSQL)
+ config.active_record.auto_explain_threshold_in_seconds = 0.5
+
+ # Do not compress assets
+ config.assets.compress = false
+
+ # Expands the lines which load the assets
+ config.assets.debug = true
+end
View
@@ -36,7 +36,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency 'spork'
gem.add_development_dependency 'database_cleaner'
gem.add_development_dependency 'fuubar'
- gem.add_development_dependency 'factory_girl', '~> 2.6.0'
+ gem.add_development_dependency 'factory_girl', '~> 2.6.1'
end
View
@@ -15,6 +15,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#------------------------------------------------------------------------------
+# Use the Syck YAML parser
+require 'fat_free_crm/syck_yaml'
+
require "fat_free_crm/gem_dependencies"
require "fat_free_crm/gem_ext"
require "fat_free_crm/plugin_dependencies"
@@ -38,3 +41,12 @@
require "fat_free_crm/callback"
require "fat_free_crm/dropbox" if defined?(::Rake)
require "fat_free_crm/plugin"
+
+
+module FatFreeCRM
+ # Return the root path of either the Application or the Engine,
+ # depending on how Fat Free CRM is loaded
+ def self.root
+ (defined?(Application) ? Application : Engine).root
+ end
+end
View
@@ -1,8 +1,6 @@
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
-ENGINE_ROOT = File.expand_path('../..', __FILE__)
-ENGINE_PATH = File.expand_path('../../lib/fat_free_crm/engine', __FILE__)
-
-require 'rails/all'
-require 'rails/engine/commands'
+APP_PATH = File.expand_path('../../config/application', __FILE__)
+require File.expand_path('../../config/boot', __FILE__)
+require 'rails/commands'

0 comments on commit 52beb0b

Please sign in to comment.