zen 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. data/.gems +34 -0
  2. data/.travis.yml +7 -0
  3. data/AUTHORS +5 -0
  4. data/CHANGELOG +14 -0
  5. data/{license.txt → LICENSE} +0 -0
  6. data/MANIFEST +67 -51
  7. data/README.md +18 -25
  8. data/Rakefile +2 -3
  9. data/bin/zen +2 -2
  10. data/lib/zen.rb +93 -57
  11. data/lib/zen/asset.rb +7 -8
  12. data/lib/zen/bin/app.rb +0 -2
  13. data/lib/zen/controller/admin_controller.rb +4 -9
  14. data/lib/zen/controller/base_controller.rb +0 -25
  15. data/lib/zen/controller/main_controller.rb +5 -5
  16. data/lib/zen/controller/preview.rb +50 -0
  17. data/lib/zen/helper/common.rb +4 -68
  18. data/lib/zen/helper/message.rb +82 -0
  19. data/lib/zen/helper/theme.rb +2 -2
  20. data/lib/zen/language.rb +68 -38
  21. data/lib/zen/language/en/zen_general.yml +1 -4
  22. data/lib/zen/language/nl/zen_general.yml +28 -0
  23. data/lib/zen/language/nl/zen_models.yml +13 -0
  24. data/lib/zen/layout/admin.xhtml +1 -1
  25. data/lib/zen/layout/login.xhtml +1 -1
  26. data/lib/zen/model/settings.rb +2 -0
  27. data/lib/zen/package.rb +29 -25
  28. data/lib/zen/package/all.rb +1 -1
  29. data/lib/zen/package/categories/lib/categories/controller/categories.rb +51 -63
  30. data/lib/zen/package/categories/lib/categories/controller/category_groups.rb +45 -52
  31. data/lib/zen/package/categories/lib/categories/language/en/categories.yml +2 -2
  32. data/lib/zen/package/categories/lib/categories/language/nl/categories.yml +39 -0
  33. data/lib/zen/package/categories/lib/categories/language/nl/category_groups.yml +33 -0
  34. data/lib/zen/package/categories/lib/categories/plugin/categories.rb +2 -2
  35. data/lib/zen/package/comments/lib/comments.rb +31 -2
  36. data/lib/zen/package/comments/lib/comments/controller/comments.rb +42 -57
  37. data/lib/zen/package/comments/lib/comments/controller/comments_form.rb +36 -51
  38. data/lib/zen/package/comments/lib/comments/language/en/comments.yml +7 -3
  39. data/lib/zen/package/comments/lib/comments/language/nl/comments.yml +48 -0
  40. data/lib/zen/package/comments/lib/comments/model/comment.rb +45 -4
  41. data/lib/zen/package/comments/lib/comments/plugin/anti_spam.rb +152 -0
  42. data/lib/zen/package/comments/lib/comments/plugin/comments.rb +5 -6
  43. data/lib/zen/package/comments/lib/comments/view/admin/comments/index.xhtml +2 -2
  44. data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_groups.rb +43 -52
  45. data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_fields.rb +68 -67
  46. data/lib/zen/package/custom_fields/lib/custom_fields/language/en/custom_fields.yml +1 -1
  47. data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_field_groups.yml +32 -0
  48. data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_fields.yml +52 -0
  49. data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field.rb +3 -3
  50. data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_group.rb +4 -7
  51. data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_value.rb +3 -3
  52. data/lib/zen/package/menus/lib/menus/controller/menu_items.rb +37 -44
  53. data/lib/zen/package/menus/lib/menus/controller/menus.rb +33 -43
  54. data/lib/zen/package/menus/lib/menus/helper/menu_item.rb +5 -10
  55. data/lib/zen/package/menus/lib/menus/language/nl/menu_items.yml +41 -0
  56. data/lib/zen/package/menus/lib/menus/language/nl/menus.yml +39 -0
  57. data/lib/zen/package/menus/lib/menus/model/menu.rb +3 -3
  58. data/lib/zen/package/menus/lib/menus/model/menu_item.rb +3 -3
  59. data/lib/zen/package/menus/lib/menus/plugin/menus.rb +5 -6
  60. data/lib/zen/package/menus/migrations/1297184342_create_schema.rb +1 -1
  61. data/lib/zen/package/sections/lib/sections.rb +20 -0
  62. data/lib/zen/package/sections/lib/sections/controller/section_entries.rb +85 -79
  63. data/lib/zen/package/sections/lib/sections/controller/sections.rb +58 -66
  64. data/lib/zen/package/sections/lib/sections/language/en/sections.yml +0 -1
  65. data/lib/zen/package/sections/lib/sections/language/nl/section_entries.yml +43 -0
  66. data/lib/zen/package/sections/lib/sections/language/nl/sections.yml +47 -0
  67. data/lib/zen/package/sections/lib/sections/model/section.rb +11 -15
  68. data/lib/zen/package/sections/lib/sections/model/section_entry.rb +9 -5
  69. data/lib/zen/package/sections/lib/sections/plugin/section_entries.rb +7 -8
  70. data/lib/zen/package/sections/lib/sections/plugin/sections.rb +3 -4
  71. data/lib/zen/package/sections/lib/sections/view/admin/section-entries/form.xhtml +0 -4
  72. data/lib/zen/package/sections/lib/sections/view/admin/section-entries/index.xhtml +8 -2
  73. data/lib/zen/package/sections/migrations/1306772479_remove_unique_slug.rb +28 -0
  74. data/lib/zen/package/settings/lib/settings.rb +21 -34
  75. data/lib/zen/package/settings/lib/settings/controller/settings.rb +29 -22
  76. data/lib/zen/package/settings/lib/settings/language/en/settings.yml +7 -5
  77. data/lib/zen/package/settings/lib/settings/language/nl/settings.yml +39 -0
  78. data/lib/zen/package/settings/lib/settings/model/setting.rb +3 -5
  79. data/lib/zen/package/settings/lib/settings/plugin/group_base.rb +3 -4
  80. data/lib/zen/package/settings/lib/settings/plugin/setting_base.rb +3 -5
  81. data/lib/zen/package/settings/lib/settings/plugin/settings.rb +11 -4
  82. data/lib/zen/package/settings/lib/settings/view/admin/settings/index.xhtml +5 -5
  83. data/lib/zen/package/settings/migrations/1299538742_add_language_key.rb +8 -8
  84. data/lib/zen/package/settings/migrations/1303196915_settings_plugin.rb +2 -5
  85. data/lib/zen/package/users/lib/users/controller/access_rules.rb +54 -61
  86. data/lib/zen/package/users/lib/users/controller/user_groups.rb +49 -57
  87. data/lib/zen/package/users/lib/users/controller/users.rb +58 -73
  88. data/lib/zen/package/users/lib/users/language/en/users.yml +6 -0
  89. data/lib/zen/package/users/lib/users/language/nl/access_rules.yml +37 -0
  90. data/lib/zen/package/users/lib/users/language/nl/user_groups.yml +31 -0
  91. data/lib/zen/package/users/lib/users/language/nl/users.yml +56 -0
  92. data/lib/zen/package/users/lib/users/model/user.rb +16 -1
  93. data/lib/zen/package/users/lib/users/view/admin/users/form.xhtml +27 -2
  94. data/lib/zen/package/users/lib/users/view/admin/users/index.xhtml +15 -3
  95. data/lib/zen/package/users/migrations/1304939855_user_settings.rb +15 -0
  96. data/lib/zen/plugin.rb +7 -9
  97. data/lib/zen/public/admin/css/{buttons.css → zen/buttons.css} +11 -7
  98. data/lib/zen/public/admin/css/{datepicker.css → zen/datepicker.css} +0 -0
  99. data/lib/zen/public/admin/css/{editor.css → zen/editor.css} +10 -5
  100. data/lib/zen/public/admin/css/{forms.css → zen/forms.css} +1 -1
  101. data/lib/zen/public/admin/css/{general.css → zen/general.css} +7 -7
  102. data/lib/zen/public/admin/css/{grid.css → zen/grid.css} +0 -0
  103. data/lib/zen/public/admin/css/{layout.css → zen/layout.css} +4 -5
  104. data/lib/zen/public/admin/css/zen/messages.css +61 -0
  105. data/lib/zen/public/admin/css/{notifications.css → zen/notifications.css} +4 -4
  106. data/lib/zen/public/admin/css/{reset.css → zen/reset.css} +0 -0
  107. data/lib/zen/public/admin/css/{tables.css → zen/tables.css} +3 -3
  108. data/lib/zen/public/admin/css/{tabs.css → zen/tabs.css} +5 -5
  109. data/lib/zen/public/admin/css/zen/window.css +79 -0
  110. data/lib/zen/public/admin/images/{icons → zen/icons}/accept.png +0 -0
  111. data/lib/zen/public/admin/images/{icons → zen/icons}/add.png +0 -0
  112. data/lib/zen/public/admin/images/{icons → zen/icons}/back.png +0 -0
  113. data/lib/zen/public/admin/images/{icons → zen/icons}/bold.png +0 -0
  114. data/lib/zen/public/admin/images/zen/icons/close.png +0 -0
  115. data/lib/zen/public/admin/images/{icons → zen/icons}/delete.png +0 -0
  116. data/lib/zen/public/admin/images/{icons → zen/icons}/edit.png +0 -0
  117. data/lib/zen/public/admin/images/{icons → zen/icons}/error.png +0 -0
  118. data/lib/zen/public/admin/images/{icons → zen/icons}/help.png +0 -0
  119. data/lib/zen/public/admin/images/{icons → zen/icons}/info.png +0 -0
  120. data/lib/zen/public/admin/images/{icons → zen/icons}/italic.png +0 -0
  121. data/lib/zen/public/admin/images/{icons → zen/icons}/large/error.png +0 -0
  122. data/lib/zen/public/admin/images/{icons → zen/icons}/large/notice.png +0 -0
  123. data/lib/zen/public/admin/images/{icons → zen/icons}/large/success.png +0 -0
  124. data/lib/zen/public/admin/images/{icons → zen/icons}/link.png +0 -0
  125. data/lib/zen/public/admin/images/{icons → zen/icons}/logout.png +0 -0
  126. data/lib/zen/public/admin/images/{icons → zen/icons}/ol.png +0 -0
  127. data/lib/zen/public/admin/images/{icons → zen/icons}/pdf.png +0 -0
  128. data/lib/zen/public/admin/images/zen/icons/preview.png +0 -0
  129. data/lib/zen/public/admin/images/{icons → zen/icons}/ul.png +0 -0
  130. data/lib/zen/public/admin/images/{icons → zen/icons}/user.png +0 -0
  131. data/lib/zen/public/admin/images/{icons → zen/icons}/view.png +0 -0
  132. data/lib/zen/public/admin/js/zen/core.js +73 -0
  133. data/lib/zen/public/admin/js/zen/editor.js +527 -0
  134. data/lib/zen/public/admin/js/zen/editor/markdown.js +84 -0
  135. data/lib/zen/public/admin/js/zen/editor/textile.js +84 -0
  136. data/lib/zen/public/admin/js/zen/init.js +12 -66
  137. data/lib/zen/public/admin/js/zen/tabs.js +5 -0
  138. data/lib/zen/public/admin/js/zen/window.js +206 -0
  139. data/lib/zen/task/build.rake +23 -6
  140. data/lib/zen/task/clean.rake +6 -7
  141. data/lib/zen/task/db.rake +7 -9
  142. data/lib/zen/task/package.rake +6 -6
  143. data/lib/zen/task/test.rake +6 -0
  144. data/lib/zen/task/theme.rake +3 -3
  145. data/lib/zen/theme.rb +3 -4
  146. data/lib/zen/validation.rb +7 -9
  147. data/lib/zen/version.rb +3 -4
  148. data/lib/zen/view/bottom.xhtml +0 -5
  149. data/lib/zen/view/main.xhtml +2 -0
  150. data/proto/app/app.rb +6 -4
  151. data/proto/app/config/config.rb +1 -7
  152. data/proto/app/config/database.rb +47 -43
  153. data/proto/app/config/middlewares.rb +0 -40
  154. data/proto/app/start.rb +1 -6
  155. data/proto/app/{vendor → theme}/.gitkeep +0 -0
  156. data/proto/migration.rb +3 -3
  157. data/proto/package/lib/package.rb +0 -1
  158. data/proto/package/lib/package/controller/controllers.rb +7 -40
  159. data/proto/package/lib/package/model/model.rb +3 -3
  160. metadata +106 -79
  161. data/CHANGELOG.md +0 -27
  162. data/ROADMAP.md +0 -53
  163. data/lib/zen/database.rb +0 -112
  164. data/lib/zen/logger.rb +0 -56
  165. data/lib/zen/public/admin/css/modals.css +0 -63
  166. data/lib/zen/public/admin/images/icons/close.png +0 -0
  167. data/lib/zen/public/admin/js/vendor/yepnope.js +0 -1
  168. data/lib/zen/public/admin/js/zen/editor/base.js +0 -262
  169. data/lib/zen/public/admin/js/zen/editor/drivers/html.js +0 -89
  170. data/lib/zen/public/admin/js/zen/editor/drivers/markdown.js +0 -87
  171. data/lib/zen/public/admin/js/zen/editor/drivers/textile.js +0 -87
  172. data/lib/zen/public/admin/js/zen/modal.js +0 -146
  173. data/lib/zen/public/admin/js/zen/notification.js +0 -211
  174. data/proto/app/config/requires.rb +0 -10
  175. data/proto/app/vendor/theme/.gitkeep +0 -0
  176. data/proto/package/lib/package/view/admin/package/edit.xhtml +0 -0
  177. data/proto/package/lib/package/view/admin/package/form.xhtml +0 -0
  178. data/proto/package/lib/package/view/admin/package/new.xhtml +0 -0
@@ -10,9 +10,7 @@ namespace :build do
10
10
  task :doc do
11
11
  zen_path = File.expand_path('../../../../', __FILE__)
12
12
  command = "yard doc #{zen_path}/lib -m markdown -M rdiscount -o #{zen_path}/doc "
13
- command += "-r #{zen_path}/README.md --private --protected "
14
- command += "--files #{zen_path}/license.txt,#{zen_path}/CHANGELOG.md,"
15
- command += "#{zen_path}/ROADMAP.md"
13
+ command += "-r #{zen_path}/README.md --private --protected"
16
14
 
17
15
  sh(command)
18
16
  end
@@ -30,8 +28,8 @@ namespace :build do
30
28
  desc 'Builds the MANIFEST file'
31
29
  task :manifest do
32
30
  zen_path = File.expand_path('../../../../', __FILE__)
33
- ignore_exts = ['.gem', '.gemspec']
34
- ignore_files = ['.DS_Store', '.gitignore']
31
+ ignore_exts = ['.gem', '.gemspec', '.swp']
32
+ ignore_files = ['.DS_Store', '.gitignore', '.rvmrc']
35
33
  ignore_dirs = ['.git', '.yardoc', 'spec', 'pkg', 'doc']
36
34
  files = ''
37
35
 
@@ -40,7 +38,8 @@ namespace :build do
40
38
  f.gsub!(/^\//, '')
41
39
 
42
40
  # Ignore directories
43
- if !File.directory?(f) and !ignore_exts.include?(File.extname(f)) and !ignore_files.include?(File.basename(f))
41
+ if !File.directory?(f) and !ignore_exts.include?(File.extname(f)) \
42
+ and !ignore_files.include?(File.basename(f))
44
43
  files += "#{f}\n"
45
44
  else
46
45
  Find.prune if ignore_dirs.include?(f)
@@ -57,4 +56,22 @@ namespace :build do
57
56
  end
58
57
  end
59
58
 
59
+ # Shamelessly stolen from Ramaze
60
+ desc 'Builds a list of all the people that have contributed to Zen'
61
+ task :authors do
62
+ authors = Hash.new(0)
63
+
64
+ `git shortlog -nse`.scan(/(\d+)\s(.+)\s<(.*)>$/) do |count, name, email|
65
+ authors[[name, email]] += count.to_i
66
+ end
67
+
68
+ File.open('AUTHORS', 'w+') do |io|
69
+ io.puts "Following persons have contributed to Zen."
70
+ io.puts '(Sorted by number of submitted patches, then alphabetically)'
71
+ io.puts ''
72
+ authors.sort_by{|(n,e),c| [-c, n.downcase] }.each do |(name, email), count|
73
+ io.puts("%6d %s <%s>" % [count, name, email])
74
+ end
75
+ end
76
+ end
60
77
  end
@@ -7,13 +7,13 @@ require 'fileutils'
7
7
  # @since 0.2.5
8
8
  #
9
9
  namespace :clean do
10
+ desc 'Removes all the gems located in pkg/'
11
+ task :gem do
12
+ glob_pattern = File.expand_path('../../../../pkg/*.gem', __FILE__)
10
13
 
11
- desc 'Removes all log files'
12
- task :log do
13
- zen_path = File.expand_path('../../../../', __FILE__)
14
-
15
- log_files = Dir.glob("#{zen_path}/spec/log/**/*.log")
16
- log_files.each { |file| File.unlink(file) }
14
+ Dir.glob(glob_pattern).each do |gem|
15
+ File.unlink(gem)
16
+ end
17
17
  end
18
18
 
19
19
  desc 'Removes all YARD files'
@@ -23,5 +23,4 @@ namespace :clean do
23
23
  FileUtils.rm_rf("#{zen_path}/doc")
24
24
  FileUtils.rm_rf("#{zen_path}/.yardoc")
25
25
  end
26
-
27
26
  end
@@ -1,5 +1,3 @@
1
- Sequel.extension(:migration)
2
-
3
1
  ##
4
2
  # Task group for database related tasks such as migrating and removing the database.
5
3
  #
@@ -30,9 +28,9 @@ namespace :db do
30
28
  table = 'migrations_package_' + pkg.name.to_s
31
29
 
32
30
  # Migration time
33
- Zen::Database.handle.transaction do
34
- Sequel::Migrator.run(Zen::Database.handle, dir, :table => table)
35
- puts "Successfully migrated \"#{pkg.name}\""
31
+ Zen.database.transaction do
32
+ Sequel::Migrator.run(Zen.database, dir, :table => table)
33
+ Ramaze::Log.info("Successfully migrated \"#{pkg.name}\"")
36
34
  end
37
35
  end
38
36
  end
@@ -61,11 +59,11 @@ namespace :db do
61
59
  table = 'migrations_package_' + pkg.name.to_s
62
60
 
63
61
  # Migration time
64
- Zen::Database.handle.transaction do
65
- Sequel::Migrator.run(Zen::Database.handle, dir, :table => table, :target => 0)
66
- Zen::Database.handle.drop_table(table)
62
+ Zen.database.transaction do
63
+ Sequel::Migrator.run(Zen.database, dir, :table => table, :target => 0)
64
+ Zen.database.drop_table(table)
67
65
 
68
- puts "Successfully uninstalled \"#{pkg.name}\""
66
+ Ramaze::Log.info("Successfully uninstalled \"#{pkg.name}\"")
69
67
  end
70
68
  end
71
69
  end
@@ -34,11 +34,11 @@ MSG
34
34
  end
35
35
 
36
36
  # Validate the package name
37
- if !Zen::Packages::Registered[args[:name].to_sym]
37
+ if !Zen::Package::Registered[args[:name].to_sym]
38
38
  abort "The package name \"#{args[:name]}\" is invalid."
39
39
  end
40
40
 
41
- package = Zen::Packages::Registered[args[:name].to_sym]
41
+ package = Zen::Package::Registered[args[:name].to_sym]
42
42
 
43
43
  # Get the migrations directory
44
44
  if package.respond_to?(:migration_dir) and !package.migration_dir.nil?
@@ -54,12 +54,12 @@ MSG
54
54
 
55
55
  table = 'migrations_package_' + package.name.to_s
56
56
 
57
- puts "Migrating package..."
57
+ Ramaze::Log.info('Migrating package...')
58
58
 
59
59
  # Run all migrations
60
- Zen::Database.handle.transaction do
61
- Sequel.migrator.run(
62
- Zen::Database.handle, dir, :table => table, :target => version
60
+ Zen.database.transaction do
61
+ Sequel::Migrator.run(
62
+ Zen.database, dir, :table => table, :target => version
63
63
  )
64
64
  end
65
65
  end
@@ -0,0 +1,6 @@
1
+ desc 'Runs all the RSpec specifications'
2
+ task :test do
3
+ spec_dir = __DIR__('../../../spec')
4
+ sh("cd #{spec_dir}; rake db:delete; rm resources/database.db; rake db:migrate; \
5
+ rake db:test_user; rspec zen/all.rb")
6
+ end
@@ -56,11 +56,11 @@ MSG
56
56
  end
57
57
 
58
58
  # Time to migrate the theme
59
- puts 'Migrating...'
59
+ Ramaze::Log.info('Migrating package...')
60
60
 
61
- Zen::Database.handle.transaction do
61
+ Zen.database.transaction do
62
62
  Sequel::Migrator.run(
63
- Zen::Database.handle, dir, :table => table, :target => version
63
+ Zen.database, dir, :table => table, :target => version
64
64
  )
65
65
  end
66
66
  end
@@ -64,7 +64,7 @@ module Zen
64
64
  if !Ramaze.options.publics.include?(theme.public_dir)
65
65
  # Generate a relative path from ROOT to the theme
66
66
  to = Pathname.new(theme.public_dir)
67
- from = Pathname.new(Zen.options.root)
67
+ from = Pathname.new(Zen.root)
68
68
  dir = to.relative_path_from(from.realpath).to_s
69
69
 
70
70
  Ramaze.options.publics.push(dir)
@@ -97,6 +97,5 @@ module Zen
97
97
 
98
98
  return Registered[name]
99
99
  end
100
-
101
- end
102
- end
100
+ end # Theme
101
+ end # Zen
@@ -8,9 +8,9 @@ module Zen
8
8
  #
9
9
  # ## Usage
10
10
  #
11
- # Using the module is pretty simple. Include it, specify the validation rules in a
11
+ # Using the module is pretty simple. Include it, specify the validation rules in a
12
12
  # method and call it. All official modules and classes use a method called "validate"
13
- # but you're free to name it whatever you want. A basic example looks like the
13
+ # but you're free to name it whatever you want. A basic example looks like the
14
14
  # following:
15
15
  #
16
16
  # class Something
@@ -27,7 +27,6 @@ module Zen
27
27
  # @since 0.2.5
28
28
  #
29
29
  module Validation
30
-
31
30
  ##
32
31
  # Checks if the specified attributes exist and aren't set to nil.
33
32
  #
@@ -74,7 +73,7 @@ module Zen
74
73
 
75
74
  if !value.respond_to?(:length)
76
75
  raise(
77
- ValidationError,
76
+ ValidationError,
78
77
  "The length of \"#{attribute}\" can't be checked as the method \"length\" " +
79
78
  "doesn't exist."
80
79
  )
@@ -107,7 +106,7 @@ module Zen
107
106
  # containing all the attributes and their regular expressions.
108
107
  # @param [Regexp] regexp The regular expression to use when validating a single
109
108
  # attribute.
110
- # @raise [ValidationError] Raised when one of the attributes doesn't matches the
109
+ # @raise [ValidationError] Raised when one of the attributes doesn't matches the
111
110
  # regular expression.
112
111
  #
113
112
  def validates_format(attribute, regexp = nil)
@@ -139,11 +138,10 @@ module Zen
139
138
  #
140
139
  def validates_filepath(attribute)
141
140
  path = send(attribute)
142
-
141
+
143
142
  if !File.exist?(path)
144
143
  raise(ValidationError, "The path #{path} in \"#{attribute}\" doesn't exist.")
145
144
  end
146
145
  end
147
-
148
- end
149
- end
146
+ end # Validation
147
+ end # Zen
@@ -1,12 +1,11 @@
1
1
  #:nodoc:
2
2
  module Zen
3
3
  ##
4
- # Defines the current version of Zen as a string. This constant
5
- # is used to set the Gem version when generating a new Rubygems
6
- # package.
4
+ # Defines the current version of Zen as a string. This constant is used to set the Gem
5
+ # version when generating a new Rubygems package.
7
6
  #
8
7
  # @author Yorick Peterse
9
8
  # @since 0.1
10
9
  #
11
- Version = '0.2.5'
10
+ Version = '0.2.6'
12
11
  end
@@ -1,6 +1 @@
1
- <script>
2
- Zen = {};
3
- Zen.Flash = #{flash.combined.to_json};
4
- </script>
5
-
6
1
  #{Zen::Asset.build(:javascript)}
@@ -1,3 +1,5 @@
1
+ #{display_messages}
2
+
1
3
  <!--
2
4
  Main area of the admin panel. The content stretches across the entire screen and there
3
5
  are no silly sidebars.
@@ -1,4 +1,3 @@
1
- # Load the Zen gem
2
1
  require 'zen'
3
2
 
4
3
  # Load the configuration files
@@ -11,10 +10,13 @@ require __DIR__('config/middlewares')
11
10
  require __DIR__('config/database')
12
11
 
13
12
  # Make sure that Ramaze knows where you are
14
- Ramaze.options.roots.push(Zen.options.root)
13
+ Ramaze.options.roots.push(Zen.root)
15
14
 
16
15
  # Load the database
17
16
  Zen.init
18
17
 
19
- # Require all the custom gems/modules we need
20
- require __DIR__('config/requires')
18
+ # Load all the packages
19
+ require 'zen/package/all'
20
+
21
+ # Almost done!
22
+ Zen.post_init
@@ -1,12 +1,6 @@
1
1
  # Specify the root directory. This is required since there are multiple directories
2
2
  # to load resources from. This directory will be used for the database logger, modes, etc.
3
- Zen.options.root = __DIR__('../')
4
-
5
- # UTF-8 bitches.
6
- Zen.options.encoding = 'utf8'
7
-
8
- # Sets the language to use in the event of the database settings not being set correctly.
9
- Zen.options.language = 'en'
3
+ Zen.root = __DIR__('../')
10
4
 
11
5
  # Set the application's mode. Available modes are "dev" and "live"
12
6
  Ramaze.options.mode = :dev
@@ -1,54 +1,58 @@
1
1
  ##
2
2
  # Database group to use for developing the website.
3
3
  #
4
- # The following options can be set:
4
+ # IMPORTANT: it's recommended to create a separate database user for your Zen application
5
+ # and prevent it from being able to access other databases. Zen is new and may allow
6
+ # hackers to exploit the system.
5
7
  #
6
- # * adapter: the SQL adapter used by Sequel to connect to the database. Examples of these
7
- # are mysql2, postgres, sqlite, etc.
8
- # * host: the hostname of the database server.
9
- # * username: the name of the user used for connecting to the database
10
- # * password: the password of the user used for connecting to the database.
8
+ # The following items can be set:
9
+ #
10
+ # * adapter: the adapter to use. When using MySQL it's best to use the mysql2 gem as it's
11
+ # a lot faster than the mysql gem.
12
+ # * host: the hostname where the database is located.
13
+ # * username: the username to use for connecting to the database.
14
+ # * password: the password to use for connecting to the database.
11
15
  # * database: the name of the database to use.
16
+ # * test: whether or not the connection should be verified.
17
+ # * encoding: the encoding type to use.
18
+ # * logger: the logger used for logging queries and such.
12
19
  #
13
- # IMPORTANT: it's recommended to create a database user for your Zen application and
14
- # prevent it from being able to access other databases. Zen is new and may allow hackers
15
- # to exploit the system. Using an isolated user would prevent hackers from destroying
16
- # all databases.
20
+ # Fore more information see the Sequel documentation:
21
+ # http://sequel.rubyforge.org/rdoc/files/doc/opening_databases_rdoc.html
17
22
  #
18
- Zen::Database.mode :dev do |db|
19
- # Example: mysql2
20
- db.adapter = ''
21
-
22
- # Example: localhost
23
- db.host = ''
23
+ # Sets the connection for the development mode
24
+ if Ramaze.options.mode === :dev
25
+ Zen.database = Sequel.connect(
26
+ :adapter => '',
27
+ :host => 'localhost',
28
+ :username => '',
29
+ :password => '',
30
+ :database => '',
31
+ :test => true,
32
+ :encoding => 'utf8',
33
+ :logger => Ramaze::Logger::RotatingInformer.new(
34
+ __DIR__("../log/database/dev"), '%d-%m-%Y.log'
35
+ )
36
+ )
24
37
 
25
- # Example: zen-app
26
- db.username = ''
27
-
28
- # Example: 23x190jj38123x
29
- db.password = ''
30
-
31
- # Example: blog
32
- db.database = ''
38
+ # Does the same but for the live mode
39
+ elsif Ramaze.options.mode === :live
40
+ Zen.database = Sequel.connect(
41
+ :adapter => 'mysql2',
42
+ :host => '',
43
+ :username => '',
44
+ :password => '',
45
+ :database => '',
46
+ :test => true,
47
+ :encoding => 'utf8',
48
+ :logger => Ramaze::Logger::RotatingInformer.new(
49
+ __DIR__("../log/database/live"), '%d-%m-%Y.log'
50
+ )
51
+ )
33
52
  end
34
53
 
35
- ##
36
- # Database group to use for your production server.
37
- # This group accepts the same settings as the block above.
38
- #
39
- Zen::Database.mode :live do |db|
40
- # Example: mysql2
41
- db.adapter = ''
42
-
43
- # Example: localhost
44
- db.host = ''
45
-
46
- # Example: zen-app
47
- db.username = ''
48
-
49
- # Example: 23x190jj38123x
50
- db.password = ''
51
-
52
- # Example: blog
53
- db.database = ''
54
+ # IMPORTANT, when running MySQL the engine should be set to InnoDB in order for foreign
55
+ # keys to work properly.
56
+ if Zen.database.adapter_scheme.to_s.include?('mysql')
57
+ Sequel::MySQL.default_engine = 'InnoDB'
54
58
  end
@@ -1,4 +1,3 @@
1
- ##
2
1
  # All Rack middlewares should go in a block like the one below. Different combinations
3
2
  # can be used for different versions by setting the first argument of the middleware!
4
3
  # method to a symbol containing the name of the environment (e.g. :live).
@@ -7,82 +6,43 @@
7
6
  # detect errors, reloading the code and so on.
8
7
  #
9
8
  Ramaze.middleware! :dev do |m|
10
- ##
11
9
  # Rack::Lint is used to validate all code according to the Rack specification.
12
10
  # It's not recommended to use this middleware in a production environment as it will
13
11
  # slow your application down a bit.
14
- #
15
12
  m.use Rack::Lint
16
13
 
17
- ##
18
- # Rack::CommonLogger is used to log requests in an Apache like format. Zen ships with
19
- # a small extension of Ramaze::Log::RotatingInformer that automatically creates the
20
- # required directories for each mode and group (database, server, etc) but any Rack
21
- # compatible logger will do.
22
- #
23
- m.use Rack::CommonLogger, Zen::Logger.new("#{Zen.options.root}/log/server")
24
-
25
- ##
26
14
  # Shows an error page whenever an exception was raised. It's not recommended to use
27
15
  # this middleware on a production server as it may reveal sensitive details to the
28
16
  # visitor.
29
- #
30
17
  m.use Rack::ShowExceptions
31
18
 
32
- ##
33
19
  # Pretty much the same as Rack::ShowExceptions.
34
- #
35
20
  m.use Rack::ShowStatus
36
21
 
37
- ##
38
22
  # Routes exceptions to different actions, can be useful for catching 404's and such.
39
- #
40
23
  # m.use Rack::RouteExceptions
41
24
 
42
- ##
43
25
  # Middleware that enables conditional GET using If-None-Match and If-Modified-Since.
44
26
  # Currently Zen doesn't respond to conditional GET requests so it's fairly useless
45
27
  # out of the box, it can be useful for custom extensions and such.
46
- #
47
28
  # m.use Rack::ConditionalGet
48
29
 
49
- ##
50
30
  # Automatically sets the ETag header on all string bodies. Etags can be useful for
51
31
  # checking if a certain page has been modified or not.
52
32
  #
53
33
  # IMPORTANT: Prior to Rack 1.2.2 Rack::ETag required the second argument of use() to
54
34
  # be set to 'public'. Newer versions no longer require this.
55
- #
56
35
  m.use Rack::ETag
57
36
 
58
- ##
59
37
  # Allows HEAD requests. HEAD requests are identical to GET requests but shouldn't
60
38
  # return the body.
61
- #
62
39
  m.use Rack::Head
63
40
 
64
- ##
65
41
  # Automatically reloads your application whenever it detects changes. Note that this
66
42
  # middleware isn't always as accurate so there may be times when you have to manually
67
43
  # restart your server.
68
- #
69
44
  m.use Ramaze::Reloader
70
45
 
71
- ##
72
46
  # Runs Ramaze based on all mappings and such.
73
- #
74
- m.run Ramaze::AppMap
75
- end
76
-
77
- ##
78
- # Middlewares to use for a production environment.
79
- #
80
- Ramaze.middleware! :live do |m|
81
- m.use Rack::CommonLogger, Zen::Logger.new("#{Zen.options.root}/log/server")
82
- m.use Rack::RouteExceptions
83
- m.use Rack::ShowStatus
84
- m.use Rack::ConditionalGet
85
- m.use Rack::ETag
86
- m.use Rack::Head
87
47
  m.run Ramaze::AppMap
88
48
  end