diff --git a/app/models/setting.rb b/app/models/setting.rb index 0cab33d2f9..a43ce4cc47 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -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") ] diff --git a/app/views/layouts/_tabbed.html.haml b/app/views/layouts/_tabbed.html.haml index b7f7453053..cee902e9f1 100644 --- a/app/views/layouts/_tabbed.html.haml +++ b/app/views/layouts/_tabbed.html.haml @@ -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]) diff --git a/config.ru b/config.ru index d2881ce4c3..d71c08dff8 100644 --- a/config.ru +++ b/config.ru @@ -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 diff --git a/config/application.rb b/config/application.rb index 94cefebda0..b65a195829 100644 --- a/config/application.rb +++ b/config/application.rb @@ -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 diff --git a/config/environments/development.rb b/config/environments/development.rb new file mode 100644 index 0000000000..b852017a03 --- /dev/null +++ b/config/environments/development.rb @@ -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 diff --git a/fat_free_crm.gemspec b/fat_free_crm.gemspec index 37f50fe486..9fbb427116 100644 --- a/fat_free_crm.gemspec +++ b/fat_free_crm.gemspec @@ -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 diff --git a/lib/fat_free_crm.rb b/lib/fat_free_crm.rb index 8134a1e891..b06ceb28e9 100644 --- a/lib/fat_free_crm.rb +++ b/lib/fat_free_crm.rb @@ -15,6 +15,9 @@ # along with this program. If not, see . #------------------------------------------------------------------------------ +# 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 \ No newline at end of file diff --git a/script/rails b/script/rails index 7ab83d44c9..f8da2cffd4 100755 --- a/script/rails +++ b/script/rails @@ -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'