Module: WizardOfAwes

Defined in:
lib/wizard_of_awes.rb,
lib/wizard_of_awes/engine.rb,
lib/wizard_of_awes/railtie.rb,
lib/wizard_of_awes/version.rb,
lib/wizard_of_awes/view_helpers.rb,
lib/wizard_of_awes/configuration.rb,
lib/generators/wizard_of_awes/install/install_generator.rb

Defined Under Namespace

Modules: HelperAuth, ViewHelpers Classes: Configuration, Engine, InstallGenerator, Railtie

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.configObject



8
9
10
# File 'lib/wizard_of_awes/configuration.rb', line 8

def self.config
  @config
end

.configure {|@config ||= WizardOfAwes::Configuration.new| ... } ⇒ Object

Yields:



4
5
6
# File 'lib/wizard_of_awes/configuration.rb', line 4

def self.configure(&block)
  yield @config ||= WizardOfAwes::Configuration.new
end

.frameworksObject



2
3
4
5
# File 'lib/wizard_of_awes.rb', line 2

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

.hook!Object



37
38
39
40
41
42
43
44
# File 'lib/wizard_of_awes.rb', line 37

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

.load!Object



46
47
48
# File 'lib/wizard_of_awes.rb', line 46

def self.load!
  hook!
end

.load_framework!Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/wizard_of_awes.rb', line 7

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

.load_wizard_of_awes!Object



30
31
32
33
34
35
# File 'lib/wizard_of_awes.rb', line 30

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

.show_warningObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/wizard_of_awes.rb', line 18

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