Sha256: 3cd27928f2a25e86a2b18f36b2d11f17227b53ed8da7240aed93ae88469b5e21

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

module WizardOfAwes
  def self.frameworks
    frameworks = ['rails']
    frameworks
  end

  def self.load_framework!
    show_warning if frameworks.empty?
    frameworks.each do |framework|
      begin
        require framework
      rescue NameError => e
        raise "Failed to load framework #{framework.inspect}. Have you added it to Gemfile?"
      end
    end
  end
  
   def self.show_warning
      $stderr.puts <<-EOC
  warning: no framework detected.
  would you check out if your Gemfile appropriately configured?
  ---- e.g. ----
  when Rails:
  gem 'rails'
  gem 'wizard_of_awes'

  EOC
    end
      
    def self.load_wizard_of_awes!
      require "wizard_of_awes/version"
      require 'wizard_of_awes/configuration'
      require 'wizard_of_awes/helper_auth'
      require 'wizard_of_awes/view_helpers'
    end    

    def self.hook!
      load_framework!
      load_wizard_of_awes!
      if rails?
        require 'wizard_of_awes/railtie'
        require 'wizard_of_awes/engine'
      end      
    end

    def self.load!
      hook!
    end

    private
    def self.rails?
      defined?(::Rails)
    end
end

WizardOfAwes.load!

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wizard_of_awes-0.0.2 lib/wizard_of_awes.rb
wizard_of_awes-0.0.1 lib/wizard_of_awes.rb