lolita 3.4.2 → 3.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +36 -36
  3. data/Gemfile +29 -29
  4. data/README.md +147 -147
  5. data/Rakefile +6 -6
  6. data/app/assets/javascripts/lolita/application.js +6 -6
  7. data/app/assets/javascripts/lolita/tab.js +100 -100
  8. data/app/assets/stylesheets/lolita/PIE-custom.htc +87 -87
  9. data/app/assets/stylesheets/lolita/PIE.htc +81 -81
  10. data/app/assets/stylesheets/lolita/application.css +6 -6
  11. data/app/assets/stylesheets/lolita/default.css.erb +169 -169
  12. data/app/assets/stylesheets/lolita/jquery-ui-1.8.16.lolita.css.erb +567 -567
  13. data/app/assets/stylesheets/lolita/style.css.erb +553 -553
  14. data/app/helpers/components/lolita/configuration/list_component.rb +10 -10
  15. data/app/helpers/components/lolita/configuration_component.rb +20 -20
  16. data/app/views/components/lolita/configuration/column/_first.html.haml +1 -1
  17. data/app/views/components/lolita/configuration/column/header/_first.html.haml +1 -1
  18. data/app/views/components/lolita/configuration/column/header/_sort.html.haml +6 -6
  19. data/app/views/components/lolita/configuration/columns/header/_display.html.haml +5 -5
  20. data/app/views/components/lolita/configuration/field/array/checkbox/_display.html.haml +7 -7
  21. data/app/views/components/lolita/configuration/field/string/text/_display.html.haml +7 -7
  22. data/app/views/components/lolita/configuration/search/_display.html.haml +2 -2
  23. data/app/views/components/lolita/configuration/tab/_display.html.haml +3 -3
  24. data/app/views/components/lolita/configuration/tabs/_form.html.haml +6 -6
  25. data/app/views/kaminari/lolita/_first_page.html.erb +11 -11
  26. data/app/views/kaminari/lolita/_gap.html.erb +8 -8
  27. data/app/views/kaminari/lolita/_last_page.html.erb +11 -11
  28. data/app/views/kaminari/lolita/_next_page.html.erb +11 -11
  29. data/app/views/kaminari/lolita/_page.html.erb +12 -12
  30. data/app/views/kaminari/lolita/_paginator.html.erb +23 -23
  31. data/app/views/kaminari/lolita/_prev_page.html.erb +11 -11
  32. data/app/views/lolita/info/index.html.erb +232 -232
  33. data/author +1 -1
  34. data/config/routes.rb +6 -6
  35. data/lib/generators/lolita/install_generator.rb +19 -19
  36. data/lib/generators/lolita/uninstall_generator.rb +70 -70
  37. data/lib/generators/templates/lolita.rb +13 -13
  38. data/lib/lolita.rb +140 -140
  39. data/lib/lolita/adapter/abstract_adapter.rb +15 -15
  40. data/lib/lolita/adapter/active_record.rb +227 -227
  41. data/lib/lolita/adapter/common_helper.rb +221 -221
  42. data/lib/lolita/adapter/field_helper.rb +18 -18
  43. data/lib/lolita/adapter/mongoid.rb +241 -241
  44. data/lib/lolita/components/base.rb +11 -11
  45. data/lib/lolita/configuration.rb +60 -60
  46. data/lib/lolita/configuration/column.rb +181 -181
  47. data/lib/lolita/configuration/field/big_decimal.rb +12 -12
  48. data/lib/lolita/configuration/field/boolean.rb +12 -12
  49. data/lib/lolita/configuration/field/date.rb +12 -12
  50. data/lib/lolita/configuration/field/hidden.rb +12 -12
  51. data/lib/lolita/configuration/field/integer.rb +11 -11
  52. data/lib/lolita/configuration/field/string.rb +16 -16
  53. data/lib/lolita/configuration/field/time.rb +13 -13
  54. data/lib/lolita/configuration/field_set.rb +25 -25
  55. data/lib/lolita/configuration/filter.rb +116 -116
  56. data/lib/lolita/configuration/list.rb +200 -200
  57. data/lib/lolita/configuration/search.rb +104 -104
  58. data/lib/lolita/controllers/component_helpers.rb +156 -156
  59. data/lib/lolita/controllers/internal_helpers.rb +71 -71
  60. data/lib/lolita/controllers/url_helpers.rb +7 -7
  61. data/lib/lolita/dbi/base.rb +56 -56
  62. data/lib/lolita/hooks/named_hook.rb +125 -125
  63. data/lib/lolita/lazy_loader.rb +54 -54
  64. data/lib/lolita/navigation/tree.rb +132 -132
  65. data/lib/lolita/rails/engine.rb +23 -23
  66. data/lib/lolita/rails/routes.rb +129 -129
  67. data/lib/lolita/ruby_ext/accessors.rb +26 -26
  68. data/lib/lolita/search/simple.rb +75 -75
  69. data/lib/lolita/support/formatter.rb +62 -62
  70. data/lib/lolita/support/formatter/rails.rb +56 -56
  71. data/lib/lolita/system_configuration/base.rb +178 -178
  72. data/lib/lolita/test/matchers.rb +77 -77
  73. data/lib/lolita/version.rb +30 -30
  74. data/lib/tasks/tinymce-assets.rake +6 -6
  75. data/lolita.gemspec +34 -34
  76. data/spec/adapter/common_helper_spec.rb +95 -95
  77. data/spec/adapter_helper.rb +42 -42
  78. data/spec/builder_spec.rb +120 -120
  79. data/spec/configuration/base_spec.rb +22 -22
  80. data/spec/configuration/field_spec.rb +118 -118
  81. data/spec/configuration/filter_spec.rb +131 -131
  82. data/spec/configuration/tab_spec.rb +187 -187
  83. data/spec/configuration/tabs_spec.rb +120 -120
  84. data/spec/generators/lolita/install_generator_spec.rb +54 -54
  85. data/spec/generators/lolita/uninstall_generator_spec.rb +48 -48
  86. data/spec/orm/mongoid.rb +12 -12
  87. data/spec/rails_app/app/controllers/application_controller.rb +3 -3
  88. data/spec/rails_app/app/helpers/application_helper.rb +3 -3
  89. data/spec/rails_app/app/mongoid/address.rb +7 -7
  90. data/spec/rails_app/app/mongoid/category.rb +18 -18
  91. data/spec/rails_app/app/mongoid/comment.rb +5 -5
  92. data/spec/rails_app/app/mongoid/post.rb +30 -30
  93. data/spec/rails_app/app/mongoid/preference.rb +5 -5
  94. data/spec/rails_app/app/mongoid/profile.rb +13 -13
  95. data/spec/rails_app/app/mongoid/tag.rb +3 -3
  96. data/spec/rails_app/app/views/components/lolita/configuration/list/_body_cell.html.erb +1 -1
  97. data/spec/rails_app/config/application.rb +33 -33
  98. data/spec/rails_app/config/boot.rb +7 -7
  99. data/spec/rails_app/config/environment.rb +5 -5
  100. data/spec/rails_app/config/environments/development.rb +23 -23
  101. data/spec/rails_app/config/environments/production.rb +37 -37
  102. data/spec/rails_app/config/environments/test.rb +37 -37
  103. data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -7
  104. data/spec/rails_app/config/initializers/inflections.rb +2 -2
  105. data/spec/rails_app/config/initializers/secret_token.rb +1 -1
  106. data/spec/rails_app/config/routes.rb +2 -2
  107. data/spec/rails_app/lib/lolita/configuration/field/my_custom_collection.rb +13 -13
  108. data/spec/rails_app/public/javascripts/jquery-1.5.1.min.js +15 -15
  109. data/spec/rails_app/public/javascripts/lolita/main.js +6 -6
  110. data/spec/rails_app/public/javascripts/modernizr-1.7.min.js +1 -1
  111. data/spec/rails_app/public/javascripts/rails.js +137 -137
  112. data/spec/rails_app/public/javascripts/tinymce/langs/en.js +221 -221
  113. data/spec/rails_app/public/javascripts/tinymce/license.txt +504 -504
  114. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/about.htm +52 -52
  115. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/anchor.htm +26 -26
  116. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/charmap.htm +51 -51
  117. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/color_picker.htm +74 -74
  118. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/editor_template_src.js +1328 -1328
  119. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/image.htm +80 -80
  120. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/about.js +73 -73
  121. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/anchor.js +42 -42
  122. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/charmap.js +354 -354
  123. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/color_picker.js +329 -329
  124. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/image.js +247 -247
  125. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/link.js +153 -153
  126. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/source_editor.js +56 -56
  127. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/langs/en.js +68 -68
  128. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/langs/en_dlg.js +53 -53
  129. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/link.htm +57 -57
  130. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/shortcuts.htm +47 -47
  131. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/skins/cirkuit/content.css +66 -66
  132. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/skins/cirkuit/dialog.css +117 -117
  133. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/skins/cirkuit/ui.css +988 -988
  134. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/source_editor.htm +25 -25
  135. data/spec/rails_app/public/javascripts/tinymce/tiny_mce_popup.js +4 -4
  136. data/spec/rails_app/public/stylesheets/lolita/default.css +169 -169
  137. data/spec/rails_app/public/stylesheets/lolita/style.css +214 -214
  138. data/spec/spec_helper.rb +51 -51
  139. data/vendor/assets/javascripts/application_vendor_lolita.js +4 -4
  140. data/vendor/assets/javascripts/jquery-numeric.js +279 -279
  141. data/vendor/assets/javascripts/modernizr_1_7_min.js +1 -1
  142. data/vendor/assets/javascripts/tinymce/themes/advanced/skins/cirkuit/content.css +66 -66
  143. data/vendor/assets/javascripts/tinymce/themes/advanced/skins/cirkuit/dialog.css +117 -117
  144. data/vendor/assets/javascripts/tinymce/themes/advanced/skins/cirkuit/ui.css +988 -988
  145. data/vendor/assets/stylesheets/jquery-ui-1.8.16.custom.css +567 -567
  146. metadata +4 -3
data/author CHANGED
@@ -1 +1 @@
1
- This software is developed by IT House (Latvia) and Artūrs Meisters
1
+ This software is developed by IT House (Latvia) and Artūrs Meisters
@@ -1,6 +1,6 @@
1
- Rails.application.routes.draw do
2
- match '/lolita' => "lolita/info#index"
3
- match '/lolita/info/properties' => "lolita/info#properties"
4
- match "/lolita/array_field/:name/:field_class/:class/:id" => "lolita/field_data#array_polymorphic", :as => "array_field_data_collector"
5
- match "/lolita/autocomplete_field/:field_class/:field_name" => "lolita/field_data#autocomplete_field", :as => "autocomplete_field"
6
- end
1
+ Rails.application.routes.draw do
2
+ match '/lolita' => "lolita/info#index"
3
+ match '/lolita/info/properties' => "lolita/info#properties"
4
+ match "/lolita/array_field/:name/:field_class/:class/:id" => "lolita/field_data#array_polymorphic", :as => "array_field_data_collector"
5
+ match "/lolita/autocomplete_field/:field_class/:field_name" => "lolita/field_data#autocomplete_field", :as => "autocomplete_field"
6
+ end
@@ -1,19 +1,19 @@
1
- module Lolita
2
- module Generators
3
- class InstallGenerator < Rails::Generators::Base
4
- source_root File.expand_path("../../templates", __FILE__)
5
- desc "Create lolita initializer."
6
-
7
- def copy_initializer
8
- template "lolita.rb", "config/initializers/lolita.rb" unless File.exist?(Rails.root + "config/initializers/lolita.rb")
9
- end
10
-
11
- def install_modules
12
- Lolita.modules.each do |module_name|
13
- invoke "lolita:#{module_name.to_s.underscore.gsub("/","_").gsub(/^lolita_/,"")}:install" rescue nil
14
- end
15
- end
16
-
17
- end
18
- end
19
- end
1
+ module Lolita
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("../../templates", __FILE__)
5
+ desc "Create lolita initializer."
6
+
7
+ def copy_initializer
8
+ template "lolita.rb", "config/initializers/lolita.rb" unless File.exist?(Rails.root + "config/initializers/lolita.rb")
9
+ end
10
+
11
+ def install_modules
12
+ Lolita.modules.each do |module_name|
13
+ invoke "lolita:#{module_name.to_s.underscore.gsub("/","_").gsub(/^lolita_/,"")}:install" rescue nil
14
+ end
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -1,71 +1,71 @@
1
- module Lolita
2
- module Generators
3
- class UninstallGenerator < Rails::Generators::Base
4
- ROUTE_NAME = "lolita_for"
5
- INCLUDE_MODULE = "Lolita::Configuration"
6
- MODEL_METHOD = "lolita"
7
-
8
- desc "Uninstall Lolita and remove all dependencies"
9
-
10
- # Remove lolita initializer file
11
- def remove_initializer
12
- remove_file "config/initializers/lolita.rb"
13
- end
14
-
15
- # Remove all not-commented lines that begins with lolita_for
16
- def clear_routes
17
- gsub_file Rails.root.join("config","routes.rb"), /^\s*#{ROUTE_NAME}.*/ do |match|
18
- match.clear
19
- match
20
- end
21
- end
22
-
23
- # Remove configuration include line and lolita block or single lolita method call.
24
- # Block will be removed correctly if it starts with _do_ and ends with _end_.
25
- def clear_models
26
- Dir[Rails.root.join("app","models","*.rb")].each do |file_name|
27
- matched = false
28
- gsub_file file_name, /^\s*include\s+#{INCLUDE_MODULE}.*/ do |match|
29
- matched = true
30
- match.clear
31
- match
32
- end
33
- if matched
34
- new_lines = []
35
- File.open(file_name,"r") do |file|
36
- do_count = nil
37
- file.each_line do |line|
38
- if do_count.nil?
39
- if line.match(/^(\s*)lolita\s+(do)?/)
40
- if $2 == "do"
41
- do_count = 1
42
- else
43
- do_count = 0
44
- end
45
- else
46
- new_lines << line
47
- end
48
- elsif do_count > 0
49
- if line.match(/(^|\s+)do(\s+|$)/)
50
- do_count +=1
51
- elsif line.match(/(^|\s+)end(\s+|$)/)
52
- do_count -=1
53
- end
54
- else
55
- new_lines << line
56
- end
57
- end
58
- end
59
- File.open(file_name,"w") do |file|
60
- new_lines.each do |line|
61
- file.puts(line)
62
- end
63
- end
64
-
65
- end
66
- end
67
- end
68
-
69
- end
70
- end
1
+ module Lolita
2
+ module Generators
3
+ class UninstallGenerator < Rails::Generators::Base
4
+ ROUTE_NAME = "lolita_for"
5
+ INCLUDE_MODULE = "Lolita::Configuration"
6
+ MODEL_METHOD = "lolita"
7
+
8
+ desc "Uninstall Lolita and remove all dependencies"
9
+
10
+ # Remove lolita initializer file
11
+ def remove_initializer
12
+ remove_file "config/initializers/lolita.rb"
13
+ end
14
+
15
+ # Remove all not-commented lines that begins with lolita_for
16
+ def clear_routes
17
+ gsub_file Rails.root.join("config","routes.rb"), /^\s*#{ROUTE_NAME}.*/ do |match|
18
+ match.clear
19
+ match
20
+ end
21
+ end
22
+
23
+ # Remove configuration include line and lolita block or single lolita method call.
24
+ # Block will be removed correctly if it starts with _do_ and ends with _end_.
25
+ def clear_models
26
+ Dir[Rails.root.join("app","models","*.rb")].each do |file_name|
27
+ matched = false
28
+ gsub_file file_name, /^\s*include\s+#{INCLUDE_MODULE}.*/ do |match|
29
+ matched = true
30
+ match.clear
31
+ match
32
+ end
33
+ if matched
34
+ new_lines = []
35
+ File.open(file_name,"r") do |file|
36
+ do_count = nil
37
+ file.each_line do |line|
38
+ if do_count.nil?
39
+ if line.match(/^(\s*)lolita\s+(do)?/)
40
+ if $2 == "do"
41
+ do_count = 1
42
+ else
43
+ do_count = 0
44
+ end
45
+ else
46
+ new_lines << line
47
+ end
48
+ elsif do_count > 0
49
+ if line.match(/(^|\s+)do(\s+|$)/)
50
+ do_count +=1
51
+ elsif line.match(/(^|\s+)end(\s+|$)/)
52
+ do_count -=1
53
+ end
54
+ else
55
+ new_lines << line
56
+ end
57
+ end
58
+ end
59
+ File.open(file_name,"w") do |file|
60
+ new_lines.each do |line|
61
+ file.puts(line)
62
+ end
63
+ end
64
+
65
+ end
66
+ end
67
+ end
68
+
69
+ end
70
+ end
71
71
  end
@@ -1,14 +1,14 @@
1
- Lolita.setup do |config|
2
- #= More info about setup - https://github.com/ithouse/lolita/wiki/Lolita-setup
3
- #= More info about authentication - https://github.com/ithouse/lolita/wiki/Authorization-and-authentication
4
- <% if defined?(Devise) && Devise.respond_to?(:mappings) && default_user_class = Devise.mappings.keys.first %>
5
- config.user_classes << <%= default_user_class.to_s.camelize %>
6
- config.authentication=:authenticate_<%= default_user_class %>!
7
- <% else %>
8
- #= Sample config for Admin user managing Lolita
9
- # config.user_classes << Admin
10
- # config.authentication = :authenticate_admin!
11
- <% end %>
12
- ## add this if you manage your authorization with CanCan
13
- # config.authorization = "CanCan"
1
+ Lolita.setup do |config|
2
+ #= More info about setup - https://github.com/ithouse/lolita/wiki/Lolita-setup
3
+ #= More info about authentication - https://github.com/ithouse/lolita/wiki/Authorization-and-authentication
4
+ <% if defined?(Devise) && Devise.respond_to?(:mappings) && default_user_class = Devise.mappings.keys.first %>
5
+ config.user_classes << <%= default_user_class.to_s.camelize %>
6
+ config.authentication=:authenticate_<%= default_user_class %>!
7
+ <% else %>
8
+ #= Sample config for Admin user managing Lolita
9
+ # config.user_classes << Admin
10
+ # config.authentication = :authenticate_admin!
11
+ <% end %>
12
+ ## add this if you manage your authorization with CanCan
13
+ # config.authorization = "CanCan"
14
14
  end
@@ -1,141 +1,141 @@
1
- require 'lolita/version'
2
-
3
- module Lolita
4
-
5
- CONFIGURATIONS = {}
6
- DEFAULT_CONFIGURATION_NAME = :default
7
-
8
- def self.configuration name = nil
9
- name ||= DEFAULT_CONFIGURATION_NAME
10
- CONFIGURATIONS[name] ||= Lolita::SystemConfiguration::Base.new(name)
11
- CONFIGURATIONS[name]
12
- end
13
-
14
- def self.setup
15
- self.run(:before_setup)
16
- yield configuration
17
- self.run(:after_setup)
18
- end
19
-
20
- def self.root
21
- @@root||=File.expand_path("#{__FILE__}/../..")
22
- end
23
-
24
- def self.app_root
25
- @@app_root||=File.join(File.expand_path("#{__FILE__}/../.."),"app")
26
- end
27
-
28
- def self.method_missing method_name, *args, &block
29
- self.class_eval <<-LOLITA_SETUP,__FILE__,__LINE__+1
30
- class << self
31
- def #{method_name}(*args,&block)
32
- configuration.send(:#{method_name},*args,&block)
33
- end
34
- end
35
- LOLITA_SETUP
36
- configuration.send(method_name,*args,&block)
37
- end
38
-
39
- def self.load!
40
- load_frameworks!
41
- load_dependencies!
42
- load_base!
43
-
44
- self.send(:include, Lolita::Hooks)
45
- self.send(:add_hook, :before_setup, :after_setup, :after_routes_loaded,:before_routes_loaded)
46
-
47
-
48
- if rails?
49
- load_rails!
50
- end
51
- load_modules!
52
- end
53
-
54
- def self.load_frameworks!
55
- frameworks.each do |framework|
56
- begin
57
- require framework
58
- puts "=> Loading Lolita #{version} with #{framework}"
59
- rescue Execption => e
60
- raise "Can't load #{framework}. Check you Gemfile."
61
- end
62
- end
63
- end
64
-
65
- def self.frameworks
66
- frameworks = []
67
- if rails?
68
- frameworks << "rails"
69
- end
70
- frameworks
71
- end
72
-
73
- def self.load_dependencies!
74
- require 'abstract'
75
- require 'observer'
76
- require 'ostruct'
77
- require "base64"
78
- require 'active_support'
79
- require 'active_support/core_ext/numeric/time'
80
- require 'active_support/core_ext/date_time/conversions'
81
- require 'active_support/concern'
82
- require 'active_support/callbacks'
83
- require 'active_support/dependencies'
84
- require 'active_support/inflector'
85
- end
86
-
87
- def self.load_base!
88
- Dir["#{File.dirname(__FILE__)}/lolita/ruby_ext/**/*.*"].each do |path|
89
- require path
90
- end
91
- require 'lolita/errors'
92
- require 'lolita/utils'
93
- require 'lolita/hooks'
94
- require 'lolita/mapping'
95
- require 'lolita/hooks/named_hook'
96
- require 'lolita/system_configuration/base'
97
- require 'lolita/system_configuration/application'
98
- require 'lolita/extensions/extensions'
99
- end
100
-
101
- def self.load_modules!
102
- require 'lolita/base'
103
- require 'lolita/orm'
104
- require 'lolita/configuration'
105
- require 'lolita/helpers'
106
- require 'lolita/processors/request_processor'
107
- require 'lolita/navigation/tree'
108
- require 'lolita/navigation/branch'
109
-
110
- require 'lolita/test/matchers'
111
- require 'lolita/support/formatter'
112
- require 'lolita/support/formatter/rails'
113
-
114
- require 'lolita/search/simple'
115
- require 'lolita/components/base'
116
- require 'lolita/components/configuration/column_component'
117
- end
118
-
119
- def self.load_rails!
120
- require 'kaminari'
121
- require 'jquery-rails'
122
- require 'tinymce-rails'
123
- require 'tinymce-rails-config-manager'
124
- require 'lolita/rails/railtie'
125
- require 'lolita/rails/engine'
126
- end
127
-
128
- def self.version
129
- Lolita::Version::STRING
130
- end
131
-
132
- def self.rails?
133
- !!defined?(::Rails)
134
- end
135
-
136
- def self.rails3?
137
- !!defined?(::Rails) && ::Rails::VERSION::MAJOR == 3
138
- end
139
- end
140
-
1
+ require 'lolita/version'
2
+
3
+ module Lolita
4
+
5
+ CONFIGURATIONS = {}
6
+ DEFAULT_CONFIGURATION_NAME = :default
7
+
8
+ def self.configuration name = nil
9
+ name ||= DEFAULT_CONFIGURATION_NAME
10
+ CONFIGURATIONS[name] ||= Lolita::SystemConfiguration::Base.new(name)
11
+ CONFIGURATIONS[name]
12
+ end
13
+
14
+ def self.setup
15
+ self.run(:before_setup)
16
+ yield configuration
17
+ self.run(:after_setup)
18
+ end
19
+
20
+ def self.root
21
+ @@root||=File.expand_path("#{__FILE__}/../..")
22
+ end
23
+
24
+ def self.app_root
25
+ @@app_root||=File.join(File.expand_path("#{__FILE__}/../.."),"app")
26
+ end
27
+
28
+ def self.method_missing method_name, *args, &block
29
+ self.class_eval <<-LOLITA_SETUP,__FILE__,__LINE__+1
30
+ class << self
31
+ def #{method_name}(*args,&block)
32
+ configuration.send(:#{method_name},*args,&block)
33
+ end
34
+ end
35
+ LOLITA_SETUP
36
+ configuration.send(method_name,*args,&block)
37
+ end
38
+
39
+ def self.load!
40
+ load_frameworks!
41
+ load_dependencies!
42
+ load_base!
43
+
44
+ self.send(:include, Lolita::Hooks)
45
+ self.send(:add_hook, :before_setup, :after_setup, :after_routes_loaded,:before_routes_loaded)
46
+
47
+
48
+ if rails?
49
+ load_rails!
50
+ end
51
+ load_modules!
52
+ end
53
+
54
+ def self.load_frameworks!
55
+ frameworks.each do |framework|
56
+ begin
57
+ require framework
58
+ puts "=> Loading Lolita #{version} with #{framework}"
59
+ rescue Execption => e
60
+ raise "Can't load #{framework}. Check you Gemfile."
61
+ end
62
+ end
63
+ end
64
+
65
+ def self.frameworks
66
+ frameworks = []
67
+ if rails?
68
+ frameworks << "rails"
69
+ end
70
+ frameworks
71
+ end
72
+
73
+ def self.load_dependencies!
74
+ require 'abstract'
75
+ require 'observer'
76
+ require 'ostruct'
77
+ require "base64"
78
+ require 'active_support'
79
+ require 'active_support/core_ext/numeric/time'
80
+ require 'active_support/core_ext/date_time/conversions'
81
+ require 'active_support/concern'
82
+ require 'active_support/callbacks'
83
+ require 'active_support/dependencies'
84
+ require 'active_support/inflector'
85
+ end
86
+
87
+ def self.load_base!
88
+ Dir["#{File.dirname(__FILE__)}/lolita/ruby_ext/**/*.*"].each do |path|
89
+ require path
90
+ end
91
+ require 'lolita/errors'
92
+ require 'lolita/utils'
93
+ require 'lolita/hooks'
94
+ require 'lolita/mapping'
95
+ require 'lolita/hooks/named_hook'
96
+ require 'lolita/system_configuration/base'
97
+ require 'lolita/system_configuration/application'
98
+ require 'lolita/extensions/extensions'
99
+ end
100
+
101
+ def self.load_modules!
102
+ require 'lolita/base'
103
+ require 'lolita/orm'
104
+ require 'lolita/configuration'
105
+ require 'lolita/helpers'
106
+ require 'lolita/processors/request_processor'
107
+ require 'lolita/navigation/tree'
108
+ require 'lolita/navigation/branch'
109
+
110
+ require 'lolita/test/matchers'
111
+ require 'lolita/support/formatter'
112
+ require 'lolita/support/formatter/rails'
113
+
114
+ require 'lolita/search/simple'
115
+ require 'lolita/components/base'
116
+ require 'lolita/components/configuration/column_component'
117
+ end
118
+
119
+ def self.load_rails!
120
+ require 'kaminari'
121
+ require 'jquery-rails'
122
+ require 'tinymce-rails'
123
+ require 'tinymce-rails-config-manager'
124
+ require 'lolita/rails/railtie'
125
+ require 'lolita/rails/engine'
126
+ end
127
+
128
+ def self.version
129
+ Lolita::Version::STRING
130
+ end
131
+
132
+ def self.rails?
133
+ !!defined?(::Rails)
134
+ end
135
+
136
+ def self.rails3?
137
+ !!defined?(::Rails) && ::Rails::VERSION::MAJOR == 3
138
+ end
139
+ end
140
+
141
141
  Lolita.load!