From 2cba14afec699054139fefc956cea3954aa00823 Mon Sep 17 00:00:00 2001 From: did Date: Wed, 6 Apr 2011 01:29:11 +0200 Subject: [PATCH] do not run the locomotive core initializer if engine --- Gemfile | 3 +- Gemfile.lock | 60 ++++++++++++++++--------------- config/initializers/locomotive.rb | 22 ++++++------ lib/locomotive.rb | 4 +++ lib/locomotive/hosting/heroku.rb | 4 --- 5 files changed, 48 insertions(+), 45 deletions(-) diff --git a/Gemfile b/Gemfile index 74fa4990..7c8c2397 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ gem 'warden' gem 'devise', '= 1.1.3' gem 'mongoid', '2.0.0.rc.7' -gem 'bson_ext', '~> 1.2.1' +gem 'bson_ext', '~> 1.3.0' gem 'locomotive_mongoid_acts_as_tree', '0.1.5.5', :require => 'mongoid_acts_as_tree' gem 'will_paginate' @@ -32,6 +32,7 @@ gem 'delayed_job', '2.1.4' gem 'delayed_job_mongoid', '1.0.2' gem 'rubyzip' gem 'locomotive_jammit-s3', :require => 'jammit-s3' +gem 'SystemTimer', :platforms => :ruby_18 # The rest of the dependencies are for use when in the locomotive dev environment diff --git a/Gemfile.lock b/Gemfile.lock index 4d0c0259..d5140c6e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -26,41 +26,42 @@ GEM open4 Platform (0.4.0) RedCloth (4.2.7) + SystemTimer (1.2.3) ZenTest (4.5.0) abstract (1.0.0) - actionmailer (3.0.5) - actionpack (= 3.0.5) + actionmailer (3.0.6) + actionpack (= 3.0.6) mail (~> 2.2.15) - actionpack (3.0.5) - activemodel (= 3.0.5) - activesupport (= 3.0.5) + actionpack (3.0.6) + activemodel (= 3.0.6) + activesupport (= 3.0.6) builder (~> 2.1.2) erubis (~> 2.6.6) - i18n (~> 0.4) + i18n (~> 0.5.0) rack (~> 1.2.1) - rack-mount (~> 0.6.13) + rack-mount (~> 0.6.14) rack-test (~> 0.5.7) tzinfo (~> 0.3.23) - activemodel (3.0.5) - activesupport (= 3.0.5) + activemodel (3.0.6) + activesupport (= 3.0.6) builder (~> 2.1.2) - i18n (~> 0.4) - activerecord (3.0.5) - activemodel (= 3.0.5) - activesupport (= 3.0.5) + i18n (~> 0.5.0) + activerecord (3.0.6) + activemodel (= 3.0.6) + activesupport (= 3.0.6) arel (~> 2.0.2) tzinfo (~> 0.3.23) - activeresource (3.0.5) - activemodel (= 3.0.5) - activesupport (= 3.0.5) - activesupport (3.0.5) + activeresource (3.0.6) + activemodel (= 3.0.6) + activesupport (= 3.0.6) + activesupport (3.0.6) archive-tar-minitar (0.5.2) arel (2.0.9) autotest (4.4.6) ZenTest (>= 4.4.1) bcrypt-ruby (2.1.4) bson (1.3.0) - bson_ext (1.2.4) + bson_ext (1.3.0) builder (2.1.2) bushido (0.0.12) highline (>= 1.6.1) @@ -195,17 +196,17 @@ GEM rack (>= 1.0.0) rack-test (0.5.7) rack (>= 1.0) - rails (3.0.5) - actionmailer (= 3.0.5) - actionpack (= 3.0.5) - activerecord (= 3.0.5) - activeresource (= 3.0.5) - activesupport (= 3.0.5) + rails (3.0.6) + actionmailer (= 3.0.6) + actionpack (= 3.0.6) + activerecord (= 3.0.6) + activeresource (= 3.0.6) + activesupport (= 3.0.6) bundler (~> 1.0) - railties (= 3.0.5) - railties (3.0.5) - actionpack (= 3.0.5) - activesupport (= 3.0.5) + railties (= 3.0.6) + railties (3.0.6) + actionpack (= 3.0.6) + activesupport (= 3.0.6) rake (>= 0.8.7) thor (~> 0.14.4) rake (0.8.7) @@ -271,10 +272,11 @@ PLATFORMS DEPENDENCIES RedCloth (= 4.2.7) + SystemTimer ZenTest actionmailer_with_request! autotest - bson_ext (~> 1.2.1) + bson_ext (~> 1.3.0) bushido capybara cucumber (= 0.8.5) diff --git a/config/initializers/locomotive.rb b/config/initializers/locomotive.rb index bcc41fbe..aedb821b 100644 --- a/config/initializers/locomotive.rb +++ b/config/initializers/locomotive.rb @@ -7,16 +7,16 @@ Locomotive.configure do |config| # your own domain name (ex: locomotivehosting.com). # # Ex: - config.multi_sites do |multi_sites| - # each new website you add will have a default entry based on a subdomain - # and the multi_site_domain value (ex: website_1.locomotivehosting.com). - multi_sites.domain = 'example.com' #'myhostingplatform.com' - - # define the reserved subdomains - # Ex: - multi_sites.reserved_subdomains = %w(www admin email blog webmail mail support help site sites) - end - # config.multi_sites = false + # config.multi_sites do |multi_sites| + # # each new website you add will have a default entry based on a subdomain + # # and the multi_site_domain value (ex: website_1.locomotivehosting.com). + # multi_sites.domain = 'example.com' #'myhostingplatform.com' + # + # # define the reserved subdomains + # # Ex: + # multi_sites.reserved_subdomains = %w(www admin email blog webmail mail support help site sites) + # end + config.multi_sites = false # configure the hosting target for the production environment. Locomotive can be installed in: # - your own server @@ -60,4 +60,4 @@ Locomotive.configure do |config| # config.mailer_sender = 'support' # # => 'support@heroku.com' (Heroku), 'support@bushi.do' (Bushido), 'support@example.com' (Dev) or 'support@' (Multi-sites) config.mailer_sender = 'support' -end +end unless Locomotive.engine? diff --git a/lib/locomotive.rb b/lib/locomotive.rb index c66572fc..54c5a1de 100644 --- a/lib/locomotive.rb +++ b/lib/locomotive.rb @@ -35,6 +35,10 @@ module Locomotive end end + def self.engine? + self.const_defined?('Engine') + end + def self.configure self.config ||= Configuration.new diff --git a/lib/locomotive/hosting/heroku.rb b/lib/locomotive/hosting/heroku.rb index 1f58c34e..5b6366e9 100644 --- a/lib/locomotive/hosting/heroku.rb +++ b/lib/locomotive/hosting/heroku.rb @@ -35,8 +35,6 @@ module Locomotive self.enhance_site_model_with_heroku - puts "HEROKU NAME = #{self.config.heroku[:name]} / #{ENV['APP_NAME'].inspect} / #{ENV.inspect}" - # "cache" domains for better performance self.heroku_domains = self.heroku_connection.list_domains(self.config.heroku[:name]).collect { |h| h[:domain] } end @@ -45,8 +43,6 @@ module Locomotive login = self.config.heroku[:login] || ENV['HEROKU_LOGIN'] password = self.config.heroku[:password] || ENV['HEROKU_PASSWORD'] - puts "LOGIN = #{login} / PASSWORD = #{password}" - self.heroku_connection = ::Heroku::Client.new(login, password) end