Sha256: f50a417ed5be6423a2cf6278bf2994c79bc44d3243bf604c3e6109e0ef3aca62

Contents?: true

Size: 910 Bytes

Versions: 7

Compression:

Stored size: 910 Bytes

Contents

class Spork::AppFramework
  SUPPORTED_FRAMEWORKS = {
    :Rails => lambda do
      File.exist?("config/environment.rb") && File.read("config/environment.rb").include?('RAILS_GEM_VERSION')
    end
  }
  
  def self.detect_framework_name
    SUPPORTED_FRAMEWORKS.each do |key, value|
      return key if value.call
    end
    :Unknown
  end
  
  def self.detect_framework
    name = detect_framework_name
    self[name]
  end
  
  def self.[](name)
    instances[name] ||= (
      require File.join(File.dirname(__FILE__), "app_framework", name.to_s.downcase)
      const_get(name).new
    )
  end
  
  def self.instances
    @instances ||= {}
  end
  
  def self.short_name
    name.gsub('Spork::AppFramework::', '')
  end
  
  def bootstrap_required?
    entry_point.nil?
  end
  
  def entry_point
    nil
  end
  
  def preload(&block)
    yield
  end
  
  def short_name
    self.class.short_name
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
timcharper-spork-0.5.5 lib/spork/app_framework.rb
timcharper-spork-0.5.6 lib/spork/app_framework.rb
spork-0.5.2 lib/spork/app_framework.rb
spork-0.5.5 lib/spork/app_framework.rb
spork-0.5.6 lib/spork/app_framework.rb
spork-0.5.3 lib/spork/app_framework.rb
spork-0.5.4 lib/spork/app_framework.rb