Module: Lolita

Defined in:
lib/lolita.rb,
lib/lolita/hooks.rb,
lib/lolita/utils.rb,
lib/lolita/errors.rb,
lib/lolita/builder.rb,
lib/lolita/helpers.rb,
lib/lolita/mapping.rb,
lib/lolita/version.rb,
lib/lolita/dbi/base.rb,
lib/lolita/register.rb,
lib/lolita/lazy_loader.rb,
lib/lolita/rails/engine.rb,
lib/lolita/configuration.rb,
lib/lolita/search/simple.rb,
lib/lolita/test/matchers.rb,
lib/lolita/observed_array.rb,
lib/lolita/adapter/mongoid.rb,
lib/lolita/components/base.rb,
lib/lolita/navigation/tree.rb,
lib/lolita/hooks/named_hook.rb,
lib/lolita/configuration/tab.rb,
lib/lolita/navigation/branch.rb,
lib/lolita/support/formatter.rb,
lib/lolita/configuration/base.rb,
lib/lolita/configuration/core.rb,
lib/lolita/configuration/list.rb,
lib/lolita/configuration/tabs.rb,
lib/lolita/configuration/field.rb,
lib/lolita/adapter/field_helper.rb,
lib/lolita/configuration/action.rb,
lib/lolita/configuration/column.rb,
lib/lolita/configuration/fields.rb,
lib/lolita/configuration/filter.rb,
lib/lolita/configuration/search.rb,
lib/lolita/controller_additions.rb,
lib/lolita/adapter/active_record.rb,
lib/lolita/adapter/common_helper.rb,
lib/lolita/configuration/columns.rb,
lib/lolita/extensions/extensions.rb,
lib/lolita/configuration/field_set.rb,
lib/lolita/controllers/url_helpers.rb,
lib/lolita/support/formatter/rails.rb,
lib/lolita/adapter/abstract_adapter.rb,
lib/lolita/configuration/field/date.rb,
lib/lolita/configuration/field/enum.rb,
lib/lolita/configuration/field/hash.rb,
lib/lolita/configuration/field/time.rb,
lib/lolita/configuration/factory/tab.rb,
lib/lolita/configuration/field/array.rb,
lib/lolita/configuration/field/float.rb,
lib/lolita/configuration/field/range.rb,
lib/lolita/configuration/nested_form.rb,
lib/lolita/configuration/nested_list.rb,
lib/lolita/configuration/tab/content.rb,
lib/lolita/configuration/tab/default.rb,
lib/lolita/controllers/rails_helpers.rb,
lib/lolita/system_configuration/base.rb,
lib/lolita/configuration/field/hidden.rb,
lib/lolita/configuration/field/string.rb,
lib/lolita/configuration/field/symbol.rb,
lib/lolita/ruby_ext/lolita_model_name.rb,
lib/lolita/configuration/factory/field.rb,
lib/lolita/configuration/field/boolean.rb,
lib/lolita/configuration/field/integer.rb,
lib/generators/lolita/install_generator.rb,
lib/lolita/controllers/internal_helpers.rb,
lib/lolita/processors/request_processor.rb,
lib/lolita/configuration/field/date_time.rb,
lib/lolita/controllers/component_helpers.rb,
lib/generators/lolita/uninstall_generator.rb,
lib/lolita/extensions/authorization/proxy.rb,
lib/lolita/configuration/field/big_decimal.rb,
lib/lolita/extensions/authentication/proxy.rb,
lib/lolita/system_configuration/application.rb,
lib/lolita/controllers/authentication_helpers.rb,
lib/lolita/components/configuration/list_component.rb,
lib/lolita/extensions/authorization/cancan_adapter.rb,
lib/lolita/extensions/authorization/pundit_adapter.rb,
lib/lolita/extensions/authentication/devise_adapter.rb,
lib/lolita/extensions/authorization/default_adapter.rb,
lib/lolita/components/configuration/column_component.rb,
lib/lolita/extensions/authentication/default_adapter.rb

Defined Under Namespace

Modules: Adapter, Builder, Components, Configuration, ControllerAdditions, Controllers, DBI, Extensions, Generators, Helpers, Hooks, Navigation, ObservedArray, Processors, Search, Support, SystemConfiguration, Test, Utils, Version Classes: AssociationError, ConfigurationClassNotFound, Engine, FieldDataController, FieldNameError, FieldTypeError, HookNotFound, InfoController, LazyLoader, Mapping, ModelName, ModuleNotFound, NoAuthenticationDefinedError, NoAuthorizationDefinedError, NoFieldsGivenError, NotFound, NotInitialized, NotORMClassError, ParentNotAListError, RecordNotFound, ReferenceError, Register, RestController, SameTabTypeError, UnknownDBPError

Constant Summary collapse

CONFIGURATIONS =
{}
DEFAULT_CONFIGURATION_NAME =
:default

Class Method Summary collapse

Class Method Details

.app_rootObject



24
25
26
# File 'lib/lolita.rb', line 24

def self.app_root
  @@app_root||=File.join(File.expand_path("#{__FILE__}/../.."),"app")
end

.configuration(name = nil) ⇒ Object



8
9
10
11
12
# File 'lib/lolita.rb', line 8

def self.configuration name = nil
  name ||= DEFAULT_CONFIGURATION_NAME
  CONFIGURATIONS[name] ||= Lolita::SystemConfiguration::Base.new(name)
  CONFIGURATIONS[name]
end

.frameworksObject



65
66
67
68
69
70
71
# File 'lib/lolita.rb', line 65

def self.frameworks
  frameworks = []
  if rails?
    frameworks << "rails"
  end
  frameworks
end

.load!Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/lolita.rb', line 39

def self.load!
  load_frameworks!
  load_dependencies!
  load_base!

  self.send(:include, Lolita::Hooks)
  self.send(:add_hook, :before_setup, :after_setup, :after_routes_loaded,:before_routes_loaded)


  if rails?
    load_rails!
  end
  load_modules!
end

.load_base!Object



87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/lolita.rb', line 87

def self.load_base!
  Dir["#{File.dirname(__FILE__)}/lolita/ruby_ext/**/*.*"].each do |path|
    require path
  end
  require "lolita/errors"
  require "lolita/utils"
  require "lolita/hooks"
  require "lolita/mapping"
  require "lolita/hooks/named_hook"
  require "lolita/system_configuration/base"
  require "lolita/system_configuration/application"
  require "lolita/extensions/extensions"
end

.load_dependencies!Object



73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/lolita.rb', line 73

def self.load_dependencies!
  require "abstract"
  require "observer"
  require "ostruct"
  require "base64"
  require "active_support"
  require "active_support/core_ext/numeric/time"
  require "active_support/core_ext/date_time/conversions"
  require "active_support/concern"
  require "active_support/callbacks"
  require "active_support/dependencies"
  require "active_support/inflector"
end

.load_frameworks!Object



54
55
56
57
58
59
60
61
62
63
# File 'lib/lolita.rb', line 54

def self.load_frameworks!
  frameworks.each do |framework|
    begin
      require framework
      puts "=> Loading Lolita #{version} with #{framework}"
    rescue Execption => e
      raise "Can't load #{framework}. Check you Gemfile."
    end
  end
end

.load_modules!Object



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/lolita.rb', line 101

def self.load_modules!
  require "lolita/base"
  require "lolita/orm"
  require "lolita/configuration"
  require "lolita/helpers"
  require "lolita/processors/request_processor"
  require "lolita/navigation/tree"
  require "lolita/navigation/branch"

  require "lolita/test/matchers"
  require "lolita/support/formatter"
  require "lolita/support/formatter/rails"

  require "lolita/search/simple"
  require "lolita/components/base"
  require "lolita/components/configuration/column_component"
end

.load_rails!Object



119
120
121
122
123
124
125
126
127
# File 'lib/lolita.rb', line 119

def self.load_rails!
  require "kaminari"
  require "jquery-rails"
  require "jquery-ui-rails"
  require "tinymce-rails"
  require "tinymce-rails-langs"
  require "lolita/rails/railtie"
  require "lolita/rails/engine"
end

.method_missing(method_name, *args, &block) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/lolita.rb', line 28

def self.method_missing method_name, *args, &block
  self.class_eval <<-LOLITA_SETUP,__FILE__,__LINE__+1
    class << self
      def #{method_name}(*args,&block)
        configuration.send(:#{method_name},*args,&block)
      end
    end
  LOLITA_SETUP
  configuration.send(method_name,*args,&block)
end

.rails3?Boolean

Returns:

  • (Boolean)


137
138
139
# File 'lib/lolita.rb', line 137

def self.rails3?
  !!defined?(::Rails) && ::Rails::VERSION::MAJOR == 3
end

.rails?Boolean

Returns:

  • (Boolean)


133
134
135
# File 'lib/lolita.rb', line 133

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

.rootObject



20
21
22
# File 'lib/lolita.rb', line 20

def self.root
  @@root||=File.expand_path("#{__FILE__}/../..")
end

.setup {|configuration| ... } ⇒ Object

Yields:



14
15
16
17
18
# File 'lib/lolita.rb', line 14

def self.setup
  self.run(:before_setup)
  yield configuration
  self.run(:after_setup)
end

.versionObject



129
130
131
# File 'lib/lolita.rb', line 129

def self.version
  Lolita::Version::STRING
end