zen 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +15 -0
- data/.mailmap +2 -0
- data/.rvmrc +2 -0
- data/.travis.yml +8 -3
- data/AUTHORS +1 -2
- data/CHANGELOG.md +48 -17
- data/README.md +44 -39
- data/Rakefile +4 -0
- data/bin/zen +5 -30
- data/lib/zen.rb +13 -19
- data/lib/zen/asset.rb +99 -64
- data/lib/zen/bin/create.rb +94 -0
- data/lib/zen/bin/runner.rb +118 -0
- data/lib/zen/controller/admin_controller.rb +52 -36
- data/lib/zen/controller/base_controller.rb +5 -5
- data/lib/zen/controller/frontend_controller.rb +7 -7
- data/lib/zen/controller/main_controller.rb +12 -10
- data/lib/zen/controller/preview.rb +15 -11
- data/lib/zen/helper/acl.rb +73 -53
- data/lib/zen/helper/blue_form_vendor.rb +689 -0
- data/lib/zen/helper/breadcrumb.rb +23 -19
- data/lib/zen/helper/message.rb +3 -3
- data/lib/zen/helper/theme.rb +18 -13
- data/lib/zen/language.rb +62 -58
- data/lib/zen/language/en/zen_general.yml +2 -4
- data/lib/zen/language/nl/zen_general.yml +2 -4
- data/lib/zen/layout/admin.xhtml +3 -12
- data/lib/zen/layout/login.xhtml +1 -6
- data/lib/zen/model/methods.rb +6 -6
- data/lib/zen/model/settings.rb +5 -4
- data/lib/zen/package.rb +47 -38
- data/lib/zen/package/all.rb +3 -5
- data/lib/zen/package/base.rb +7 -7
- data/lib/zen/package/categories/lib/categories.rb +8 -3
- data/lib/zen/package/categories/lib/categories/controller/categories.rb +81 -55
- data/lib/zen/package/categories/lib/categories/controller/category_groups.rb +45 -44
- data/lib/zen/package/categories/lib/categories/helper/category.rb +88 -0
- data/lib/zen/package/categories/lib/categories/language/en/categories.yml +5 -4
- data/lib/zen/package/categories/lib/categories/language/en/category_groups.yml +5 -4
- data/lib/zen/package/categories/lib/categories/language/nl/categories.yml +5 -4
- data/lib/zen/package/categories/lib/categories/language/nl/category_groups.yml +5 -4
- data/lib/zen/package/categories/lib/categories/model/category.rb +15 -13
- data/lib/zen/package/categories/lib/categories/model/category_group.rb +3 -3
- data/lib/zen/package/categories/lib/categories/plugin/categories.rb +36 -25
- data/lib/zen/package/categories/lib/categories/view/admin/categories/form.xhtml +49 -56
- data/lib/zen/package/categories/lib/categories/view/admin/categories/index.xhtml +48 -35
- data/lib/zen/package/categories/lib/categories/view/admin/category-groups/form.xhtml +36 -29
- data/lib/zen/package/categories/lib/categories/view/admin/category-groups/index.xhtml +42 -37
- data/lib/zen/package/comments/lib/comments.rb +4 -1
- data/lib/zen/package/comments/lib/comments/controller/comments.rb +39 -32
- data/lib/zen/package/comments/lib/comments/controller/comments_form.rb +45 -26
- data/lib/zen/package/comments/lib/comments/helper/comment.rb +35 -0
- data/lib/zen/package/comments/lib/comments/language/en/comments.yml +9 -7
- data/lib/zen/package/comments/lib/comments/language/nl/comments.yml +10 -8
- data/lib/zen/package/comments/lib/comments/model/comment.rb +31 -17
- data/lib/zen/package/comments/lib/comments/model/comment_status.rb +15 -0
- data/lib/zen/package/comments/lib/comments/plugin/anti_spam.rb +27 -18
- data/lib/zen/package/comments/lib/comments/plugin/comments.rb +25 -20
- data/lib/zen/package/comments/lib/comments/view/admin/comments/form.xhtml +61 -54
- data/lib/zen/package/comments/lib/comments/view/admin/comments/index.xhtml +38 -23
- data/lib/zen/package/comments/migrations/1308774099_comment_status.rb +60 -0
- data/lib/zen/package/custom_fields/lib/custom_fields.rb +33 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/blue_form_parameters.rb +209 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_groups.rb +50 -47
- data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_types.rb +215 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_fields.rb +111 -73
- data/lib/zen/package/custom_fields/lib/custom_fields/helper/custom_field.rb +79 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/language/en/custom_field_groups.yml +20 -19
- data/lib/zen/package/custom_fields/lib/custom_fields/language/en/custom_field_types.yml +40 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/language/en/custom_fields.yml +34 -32
- data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_field_groups.yml +5 -4
- data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_field_types.yml +40 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_fields.yml +18 -16
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field.rb +31 -11
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_method.rb +15 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_type.rb +50 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_value.rb +28 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/form.xhtml +33 -28
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/index.xhtml +48 -46
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-types/form.xhtml +61 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-types/index.xhtml +93 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/form.xhtml +105 -99
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/index.xhtml +43 -39
- data/lib/zen/package/custom_fields/migrations/1295255665_create_schema.rb +47 -16
- data/lib/zen/package/custom_fields/migrations/1310659580_custom_field_types.rb +148 -0
- data/lib/zen/package/custom_fields/migrations/1311694920_rename_css_class.rb +11 -0
- data/lib/zen/package/menus/lib/menus/controller/menu_items.rb +40 -35
- data/lib/zen/package/menus/lib/menus/controller/menus.rb +47 -43
- data/lib/zen/package/menus/lib/menus/helper/{menu_item.rb → menu.rb} +42 -15
- data/lib/zen/package/menus/lib/menus/language/en/menu_items.yml +5 -5
- data/lib/zen/package/menus/lib/menus/language/en/menus.yml +9 -8
- data/lib/zen/package/menus/lib/menus/language/nl/menu_items.yml +8 -8
- data/lib/zen/package/menus/lib/menus/language/nl/menus.yml +11 -10
- data/lib/zen/package/menus/lib/menus/model/menu.rb +5 -5
- data/lib/zen/package/menus/lib/menus/model/menu_item.rb +6 -5
- data/lib/zen/package/menus/lib/menus/plugin/menus.rb +41 -43
- data/lib/zen/package/menus/lib/menus/view/admin/menu-items/form.xhtml +59 -63
- data/lib/zen/package/menus/lib/menus/view/admin/menu-items/index.xhtml +35 -30
- data/lib/zen/package/menus/lib/menus/view/admin/menus/form.xhtml +46 -37
- data/lib/zen/package/menus/lib/menus/view/admin/menus/index.xhtml +37 -37
- data/lib/zen/package/menus/migrations/1297184342_create_schema.rb +5 -5
- data/lib/zen/package/menus/migrations/1308671733_rename_order_column.rb +11 -0
- data/lib/zen/package/menus/migrations/1311695030_rename_css_class.rb +17 -0
- data/lib/zen/package/sections/lib/sections.rb +18 -11
- data/lib/zen/package/sections/lib/sections/controller/section_entries.rb +115 -109
- data/lib/zen/package/sections/lib/sections/controller/sections.rb +72 -50
- data/lib/zen/package/sections/lib/sections/helper/section.rb +53 -0
- data/lib/zen/package/sections/lib/sections/language/en/section_entries.yml +5 -4
- data/lib/zen/package/sections/lib/sections/language/en/sections.yml +5 -4
- data/lib/zen/package/sections/lib/sections/language/nl/section_entries.yml +5 -4
- data/lib/zen/package/sections/lib/sections/language/nl/sections.yml +5 -4
- data/lib/zen/package/sections/lib/sections/model/section.rb +17 -9
- data/lib/zen/package/sections/lib/sections/model/section_entry.rb +192 -13
- data/lib/zen/package/sections/lib/sections/model/section_entry_status.rb +13 -0
- data/lib/zen/package/sections/lib/sections/plugin/section_entries.rb +60 -39
- data/lib/zen/package/sections/lib/sections/plugin/sections.rb +14 -11
- data/lib/zen/package/sections/lib/sections/view/admin/form.xhtml +100 -97
- data/lib/zen/package/sections/lib/sections/view/admin/index.xhtml +41 -39
- data/lib/zen/package/sections/lib/sections/view/admin/section-entries/form.xhtml +95 -215
- data/lib/zen/package/sections/lib/sections/view/admin/section-entries/index.xhtml +48 -40
- data/lib/zen/package/sections/migrations/1308672298_use_id_for_default_section.rb +40 -0
- data/lib/zen/package/sections/migrations/1308813320_section_entry_statuses.rb +58 -0
- data/lib/zen/package/settings/lib/settings/controller/settings.rb +5 -8
- data/lib/zen/package/settings/lib/settings/model/setting.rb +2 -37
- data/lib/zen/package/settings/lib/settings/plugin/setting_base.rb +18 -1
- data/lib/zen/package/settings/lib/settings/plugin/settings.rb +13 -7
- data/lib/zen/package/settings/lib/settings/view/admin/settings/index.xhtml +2 -1
- data/lib/zen/package/users/lib/users.rb +3 -1
- data/lib/zen/package/users/lib/users/controller/access_rules.rb +77 -60
- data/lib/zen/package/users/lib/users/controller/user_groups.rb +41 -36
- data/lib/zen/package/users/lib/users/controller/users.rb +48 -42
- data/lib/zen/package/users/lib/users/helper/users.rb +72 -0
- data/lib/zen/package/users/lib/users/language/en/access_rules.yml +6 -5
- data/lib/zen/package/users/lib/users/language/en/user_groups.yml +5 -4
- data/lib/zen/package/users/lib/users/language/en/users.yml +1 -0
- data/lib/zen/package/users/lib/users/language/nl/access_rules.yml +5 -4
- data/lib/zen/package/users/lib/users/language/nl/user_groups.yml +5 -4
- data/lib/zen/package/users/lib/users/language/nl/users.yml +1 -0
- data/lib/zen/package/users/lib/users/model/access_rule.rb +5 -1
- data/lib/zen/package/users/lib/users/model/user.rb +17 -10
- data/lib/zen/package/users/lib/users/public/admin/js/users/access_rules.js +10 -37
- data/lib/zen/package/users/lib/users/public/admin/js/users/lib/access_rules.js +49 -0
- data/lib/zen/package/users/lib/users/view/admin/access-rules/form.xhtml +105 -96
- data/lib/zen/package/users/lib/users/view/admin/access-rules/index.xhtml +48 -41
- data/lib/zen/package/users/lib/users/view/admin/user-groups/form.xhtml +42 -32
- data/lib/zen/package/users/lib/users/view/admin/user-groups/index.xhtml +43 -38
- data/lib/zen/package/users/lib/users/view/admin/users/form.xhtml +76 -67
- data/lib/zen/package/users/lib/users/view/admin/users/index.xhtml +43 -41
- data/lib/zen/package/users/lib/users/view/admin/users/login.xhtml +12 -9
- data/lib/zen/package/users/migrations/1295281013_create_schema.rb +2 -2
- data/lib/zen/plugin.rb +56 -50
- data/lib/zen/plugin/markup/lib/markup/markup.rb +33 -21
- data/lib/zen/public/admin/css/zen/buttons.css +11 -7
- data/lib/zen/public/admin/css/zen/datepicker.css +6 -6
- data/lib/zen/public/admin/css/zen/forms.css +2 -1
- data/lib/zen/public/admin/css/zen/general.css +15 -10
- data/lib/zen/public/admin/css/zen/layout.css +51 -20
- data/lib/zen/public/admin/css/zen/tables.css +39 -11
- data/lib/zen/public/admin/css/zen/tabs.css +6 -4
- data/lib/zen/public/admin/css/zen/window.css +11 -11
- data/lib/zen/public/{favicon.ico → admin/favicon.ico} +0 -0
- data/lib/zen/public/admin/images/zen/icons/asc.png +0 -0
- data/lib/zen/public/admin/images/zen/icons/desc.png +0 -0
- data/lib/zen/public/admin/js/vendor/datepicker.js +0 -11
- data/lib/zen/public/admin/js/{mootools → vendor/mootools}/core.js +0 -1
- data/lib/zen/public/admin/js/{mootools → vendor/mootools}/more.js +100 -29
- data/lib/zen/public/admin/js/zen/index.js +48 -0
- data/lib/zen/public/admin/js/zen/lib/asset.js +111 -0
- data/lib/zen/public/admin/js/zen/{editor.js → lib/editor.js} +107 -127
- data/lib/zen/public/admin/js/zen/{editor → lib/editor}/markdown.js +7 -9
- data/lib/zen/public/admin/js/zen/{editor → lib/editor}/textile.js +7 -9
- data/lib/zen/public/admin/js/zen/lib/html_table.js +143 -0
- data/lib/zen/public/admin/js/zen/{tabs.js → lib/tabs.js} +40 -37
- data/lib/zen/public/admin/js/zen/{window.js → lib/window.js} +24 -20
- data/lib/zen/spec/bacon/color_output.rb +39 -0
- data/lib/zen/spec/helper.rb +152 -0
- data/lib/zen/spec/simplecov.rb +22 -0
- data/lib/zen/task/build.rake +20 -43
- data/lib/zen/task/clean.rake +2 -6
- data/lib/zen/task/db.rake +8 -12
- data/lib/zen/task/package.rake +4 -10
- data/lib/zen/task/plugin.rake +3 -9
- data/lib/zen/task/proto.rake +0 -62
- data/lib/zen/task/test.rake +6 -3
- data/lib/zen/task/theme.rake +4 -11
- data/lib/zen/theme.rb +22 -24
- data/lib/zen/validation.rb +34 -27
- data/lib/zen/version.rb +2 -8
- data/lib/zen/view/head.xhtml +7 -0
- data/lib/zen/view/main.xhtml +7 -22
- data/{proto/package/migrations → pkg}/.gitkeep +0 -0
- data/proto/app/app.rb +1 -0
- data/proto/app/config/config.rb +5 -4
- data/proto/app/config/database.rb +19 -41
- data/proto/app/config/middlewares.rb +32 -29
- data/proto/{package/lib/package/view/admin/package/index.xhtml → app/log/database/dev/.gitkeep} +0 -0
- data/proto/app/log/database/live/.gitkeep +0 -0
- data/spec/Rakefile +26 -0
- data/spec/fixtures/zen/asset.rb +18 -0
- data/spec/fixtures/zen/helper/acl.rb +39 -0
- data/spec/fixtures/zen/helper/message.rb +19 -0
- data/spec/fixtures/zen/language/en/spec.yml +10 -0
- data/spec/fixtures/zen/language/nl/spec.yml +7 -0
- data/spec/fixtures/zen/package.rb +17 -0
- data/spec/fixtures/zen/package/comments/controller/comments_form.rb +27 -0
- data/spec/fixtures/zen/package/settings/plugin/settings.rb +20 -0
- data/spec/fixtures/zen/plugin.rb +7 -0
- data/spec/fixtures/zen/theme/404.xhtml +1 -0
- data/spec/fixtures/zen/theme/default-section/index.xhtml +1 -0
- data/spec/fixtures/zen/theme/helper/404.xhtml +1 -0
- data/spec/fixtures/zen/theme/helper/partial.xhtml +1 -0
- data/spec/fixtures/zen/theme/helper/wrong_partial.xhtml +1 -0
- data/spec/fixtures/zen/theme/partials/partial.xhtml +1 -0
- data/spec/fixtures/zen/theme/theme.rb +11 -0
- data/spec/fixtures/zen/validation.rb +22 -0
- data/spec/helper.rb +41 -0
- data/spec/zen/all.rb +5 -0
- data/spec/zen/asset.rb +97 -0
- data/spec/zen/bin/create.rb +89 -0
- data/spec/zen/bin/runner.rb +47 -0
- data/spec/zen/controller/admin_controller.rb +26 -0
- data/spec/zen/controller/main_controller.rb +81 -0
- data/spec/zen/controller/preview.rb +33 -0
- data/spec/zen/helper/acl.rb +149 -0
- data/spec/zen/helper/breadcrumb.rb +38 -0
- data/spec/zen/helper/message.rb +31 -0
- data/spec/zen/helper/theme.rb +58 -0
- data/spec/zen/language.rb +55 -0
- data/spec/zen/package.rb +23 -0
- data/spec/zen/package/categories/controller/categories.rb +123 -0
- data/spec/zen/package/categories/controller/category_groups.rb +108 -0
- data/spec/zen/package/categories/helper/category.rb +75 -0
- data/spec/zen/package/categories/plugin/categories.rb +92 -0
- data/spec/zen/package/comments/controller/comments.rb +134 -0
- data/spec/zen/package/comments/controller/comments_form.rb +343 -0
- data/spec/zen/package/comments/helper/comment.rb +47 -0
- data/spec/zen/package/comments/plugin/anti_spam.rb +59 -0
- data/spec/zen/package/comments/plugin/comments.rb +107 -0
- data/spec/zen/package/custom_fields/blue_form_parameters.rb +183 -0
- data/spec/zen/package/custom_fields/controller/custom_field_groups.rb +120 -0
- data/spec/zen/package/custom_fields/controller/custom_field_types.rb +169 -0
- data/spec/zen/package/custom_fields/controller/custom_fields.rb +158 -0
- data/spec/zen/package/custom_fields/helper/custom_field.rb +86 -0
- data/spec/zen/package/menus/controller/menu_items.rb +110 -0
- data/spec/zen/package/menus/controller/menus.rb +110 -0
- data/spec/zen/package/menus/helper/menu.rb +75 -0
- data/spec/zen/package/menus/plugin/menus.rb +120 -0
- data/spec/zen/package/sections/controller/section_entries.rb +201 -0
- data/spec/zen/package/sections/controller/sections.rb +116 -0
- data/spec/zen/package/sections/helper/section.rb +74 -0
- data/spec/zen/package/sections/plugin/section_entries.rb +161 -0
- data/spec/zen/package/sections/plugin/sections.rb +75 -0
- data/spec/zen/package/settings/controller/settings.rb +36 -0
- data/spec/zen/package/settings/plugin/settings.rb +33 -0
- data/spec/zen/package/users/controller/access_rules.rb +90 -0
- data/spec/zen/package/users/controller/user_groups.rb +101 -0
- data/spec/zen/package/users/controller/users.rb +130 -0
- data/spec/zen/package/users/helper/users.rb +97 -0
- data/spec/zen/plugin.rb +64 -0
- data/spec/zen/plugin/helper.rb +11 -0
- data/spec/zen/plugin/markup.rb +44 -0
- data/spec/zen/theme.rb +41 -0
- data/spec/zen/validation.rb +63 -0
- data/zen.gemspec +36 -0
- metadata +159 -113
- data/MANIFEST +0 -266
- data/lib/zen/bin/app.rb +0 -40
- data/lib/zen/ext/string.rb +0 -185
- data/lib/zen/helper/common.rb +0 -106
- data/lib/zen/package/categories/lib/categories/view/admin/categories/edit.xhtml +0 -7
- data/lib/zen/package/categories/lib/categories/view/admin/categories/new.xhtml +0 -7
- data/lib/zen/package/categories/lib/categories/view/admin/category-groups/edit.xhtml +0 -7
- data/lib/zen/package/categories/lib/categories/view/admin/category-groups/new.xhtml +0 -7
- data/lib/zen/package/comments/lib/comments/view/admin/comments/edit.xhtml +0 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/edit.xhtml +0 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/new.xhtml +0 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/edit.xhtml +0 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/new.xhtml +0 -7
- data/lib/zen/package/menus/lib/menus/view/admin/menu-items/edit.xhtml +0 -7
- data/lib/zen/package/menus/lib/menus/view/admin/menu-items/new.xhtml +0 -7
- data/lib/zen/package/menus/lib/menus/view/admin/menus/edit.xhtml +0 -7
- data/lib/zen/package/menus/lib/menus/view/admin/menus/new.xhtml +0 -7
- data/lib/zen/package/sections/lib/sections/view/admin/edit.xhtml +0 -7
- data/lib/zen/package/sections/lib/sections/view/admin/new.xhtml +0 -7
- data/lib/zen/package/sections/lib/sections/view/admin/section-entries/edit.xhtml +0 -7
- data/lib/zen/package/sections/lib/sections/view/admin/section-entries/new.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/access-rules/edit.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/access-rules/new.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/user-groups/edit.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/user-groups/new.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/users/edit.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/users/new.xhtml +0 -7
- data/lib/zen/plugin/controller.rb +0 -59
- data/lib/zen/public/admin/css/zen/notifications.css +0 -84
- data/lib/zen/public/admin/images/zen/icons/large/error.png +0 -0
- data/lib/zen/public/admin/images/zen/icons/large/notice.png +0 -0
- data/lib/zen/public/admin/images/zen/icons/large/success.png +0 -0
- data/lib/zen/public/admin/js/zen/core.js +0 -73
- data/lib/zen/public/admin/js/zen/init.js +0 -80
- data/proto/package/lib/package.rb +0 -21
- data/proto/package/lib/package/controller/controllers.rb +0 -50
- data/proto/package/lib/package/language/en/languages.yml +0 -4
- data/proto/package/lib/package/model/model.rb +0 -12
data/lib/zen/task/test.rake
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
desc 'Runs all the
|
1
|
+
desc 'Runs all the Bacon specifications'
|
2
2
|
task :test do
|
3
3
|
spec_dir = __DIR__('../../../spec')
|
4
|
-
|
5
|
-
|
4
|
+
db_path = File.join(spec_dir, 'database.db')
|
5
|
+
|
6
|
+
File.unlink(db_path) if File.exist?(db_path)
|
7
|
+
|
8
|
+
sh("cd #{spec_dir}; rake db:migrate; rake db:test_user; ruby zen/all.rb")
|
6
9
|
end
|
data/lib/zen/task/theme.rake
CHANGED
@@ -1,21 +1,14 @@
|
|
1
|
-
##
|
2
1
|
# Task group for managing themes.
|
3
|
-
#
|
4
|
-
# @author Yorick Peterse
|
5
|
-
# @since 0.2.5
|
6
|
-
#
|
7
2
|
namespace :theme do
|
8
3
|
|
9
4
|
desc 'Lists all installed themes'
|
10
5
|
task :list do
|
11
6
|
Zen::Theme::Registered.each do |name, pkg|
|
12
7
|
message = <<-MSG
|
13
|
-
|
14
|
-
|
15
|
-
Author: #{pkg.author}
|
16
|
-
Template directory: #{pkg.template_dir}
|
17
|
-
|
8
|
+
#{name}
|
9
|
+
--------------------
|
18
10
|
#{pkg.about}
|
11
|
+
|
19
12
|
MSG
|
20
13
|
|
21
14
|
puts message
|
@@ -43,7 +36,7 @@ MSG
|
|
43
36
|
|
44
37
|
theme = Zen::Theme::Registered[name]
|
45
38
|
table = 'migrations_theme_' + theme.name.to_s
|
46
|
-
|
39
|
+
|
47
40
|
# Fetch the migrations directory
|
48
41
|
if theme.respond_to?(:migration_dir) and !theme.migration_dir.nil?
|
49
42
|
dir = theme.migration_dir
|
data/lib/zen/theme.rb
CHANGED
@@ -5,23 +5,27 @@ require 'pathname'
|
|
5
5
|
#:nodoc:
|
6
6
|
module Zen
|
7
7
|
##
|
8
|
-
# Themes in many ways are similar to plugins and packages but with a few
|
9
|
-
# Unlike packages themes aren't able to update the entire Ramaze
|
10
|
-
# them from loading controllers and other classes unless
|
11
|
-
# paths manually. However, themes can set the
|
8
|
+
# Themes in many ways are similar to plugins and packages but with a few
|
9
|
+
# differences. Unlike packages themes aren't able to update the entire Ramaze
|
10
|
+
# root, this prevents them from loading controllers and other classes unless
|
11
|
+
# the developer updates these paths manually. However, themes can set the
|
12
|
+
# following paths:
|
12
13
|
#
|
13
|
-
# * template_dir: the directory where all Liquid templates are located,
|
14
|
+
# * template_dir: the directory where all Liquid templates are located,
|
15
|
+
# always required.
|
14
16
|
# * partial_dir: the directory where all Liquid partials are located.
|
15
|
-
# * public_dir: the public directory containing assets such as CSS and
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
17
|
+
# * public_dir: the public directory containing assets such as CSS and
|
18
|
+
# Javascript files.
|
19
|
+
# * migration_dir: themes can use migrations to automatically add the required
|
20
|
+
# fields to the database, this setting should point to the directory where
|
21
|
+
# all migrations are located.
|
19
22
|
#
|
20
23
|
# ## Adding Themes
|
21
24
|
#
|
22
|
-
# Just like plugins and packages a theme can be added by calling
|
23
|
-
# passing a block to it. Once a theme has been loaded it
|
24
|
-
# user sets it as the active theme in the
|
25
|
+
# Just like plugins and packages a theme can be added by calling
|
26
|
+
# Zen::Theme#add and passing a block to it. Once a theme has been loaded it
|
27
|
+
# will *not* be used until the user sets it as the active theme in the
|
28
|
+
# settings module.
|
25
29
|
#
|
26
30
|
# Example:
|
27
31
|
#
|
@@ -35,8 +39,8 @@ module Zen
|
|
35
39
|
#
|
36
40
|
module Theme
|
37
41
|
##
|
38
|
-
# Hash containing all registered themes. The keys are the names of the
|
39
|
-
# the values instances of Zen::Theme::Base.
|
42
|
+
# Hash containing all registered themes. The keys are the names of the
|
43
|
+
# themes and the values instances of Zen::Theme::Base.
|
40
44
|
#
|
41
45
|
# @author Yorick Peterse
|
42
46
|
# @since 0.2.5
|
@@ -44,8 +48,8 @@ module Zen
|
|
44
48
|
Registered = {}
|
45
49
|
|
46
50
|
##
|
47
|
-
# Adds a new theme to Zen. Note that the theme won't be used unless it has
|
48
|
-
# as the active theme in the settings package.
|
51
|
+
# Adds a new theme to Zen. Note that the theme won't be used unless it has
|
52
|
+
# been set as the active theme in the settings package.
|
49
53
|
#
|
50
54
|
# @author Yorick Peterse
|
51
55
|
# @since 0.2.4
|
@@ -83,15 +87,9 @@ module Zen
|
|
83
87
|
# @return [Zen::Theme::Base]
|
84
88
|
#
|
85
89
|
def self.[](name)
|
86
|
-
if name.class != Symbol
|
87
|
-
name = name.to_sym
|
88
|
-
end
|
89
|
-
|
90
|
-
if Registered.nil?
|
91
|
-
raise(Zen::ThemeError, "No themes have been added yet.")
|
92
|
-
end
|
90
|
+
name = name.to_sym if name.class != Symbol
|
93
91
|
|
94
|
-
if !Registered
|
92
|
+
if !Registered.key?(name)
|
95
93
|
raise(Zen::ThemeError, "The theme #{name} doesn't exist.")
|
96
94
|
end
|
97
95
|
|
data/lib/zen/validation.rb
CHANGED
@@ -3,15 +3,15 @@ require __DIR__('error/validation_error')
|
|
3
3
|
#:nodoc:
|
4
4
|
module Zen
|
5
5
|
##
|
6
|
-
# The Validation module is a very basic validation framework that's used by
|
7
|
-
# internal modules/classes such as Zen::Plugin and Zen::Package.
|
6
|
+
# The Validation module is a very basic validation framework that's used by
|
7
|
+
# various internal modules/classes such as Zen::Plugin and Zen::Package.
|
8
8
|
#
|
9
9
|
# ## Usage
|
10
10
|
#
|
11
|
-
# Using the module is pretty simple. Include it, specify the validation rules
|
12
|
-
# method and call it. All official modules and classes use a method
|
13
|
-
# but you're free to name it whatever you want. A basic
|
14
|
-
# following:
|
11
|
+
# Using the module is pretty simple. Include it, specify the validation rules
|
12
|
+
# in a method and call it. All official modules and classes use a method
|
13
|
+
# called "validate" but you're free to name it whatever you want. A basic
|
14
|
+
# example looks like the following:
|
15
15
|
#
|
16
16
|
# class Something
|
17
17
|
# include Zen::Validation
|
@@ -35,9 +35,10 @@ module Zen
|
|
35
35
|
#
|
36
36
|
# @author Yorick Peterse
|
37
37
|
# @since 0.2.5
|
38
|
-
# @param [Array/Symbol/String] attributes Either a single or multiple
|
39
|
-
# validate.
|
40
|
-
# @raise [ValidationError] Raised whenever a attribute is missing or is
|
38
|
+
# @param [Array/Symbol/String] attributes Either a single or multiple
|
39
|
+
# attributes to validate.
|
40
|
+
# @raise [ValidationError] Raised whenever a attribute is missing or is
|
41
|
+
# set to nil.
|
41
42
|
#
|
42
43
|
def validates_presence(attributes)
|
43
44
|
if attributes.class != Array
|
@@ -52,8 +53,8 @@ module Zen
|
|
52
53
|
end
|
53
54
|
|
54
55
|
##
|
55
|
-
# Checks if the length of a string matches the given length. You can specify
|
56
|
-
# length, a maximum one as well as both.
|
56
|
+
# Checks if the length of a string matches the given length. You can specify
|
57
|
+
# a minimum length, a maximum one as well as both.
|
57
58
|
#
|
58
59
|
# @example
|
59
60
|
# validates_length(:foobar, :min => 5, :max => 10)
|
@@ -61,12 +62,12 @@ module Zen
|
|
61
62
|
# @author Yorick Peterse
|
62
63
|
# @since 0.2.5
|
63
64
|
# @param [String/Symbol] attribute The attribute to validate.
|
64
|
-
# @param [Hash] options Hash containing the options to use for determining
|
65
|
-
# the attribute's value should be.
|
65
|
+
# @param [Hash] options Hash containing the options to use for determining
|
66
|
+
# how long the attribute's value should be.
|
66
67
|
# @option options [Fixnum] :min The minimum length of the attribute's value.
|
67
68
|
# @option options [Fixnum] :max The maximum length of the value.
|
68
|
-
# @raise [ValidationError] Raised then the value of the attribute isn't
|
69
|
-
# enough.
|
69
|
+
# @raise [ValidationError] Raised then the value of the attribute isn't
|
70
|
+
# long or short enough.
|
70
71
|
#
|
71
72
|
def validates_length(attribute, options)
|
72
73
|
value = send(attribute)
|
@@ -74,8 +75,8 @@ module Zen
|
|
74
75
|
if !value.respond_to?(:length)
|
75
76
|
raise(
|
76
77
|
ValidationError,
|
77
|
-
"The length of \"#{attribute}\" can't be checked as the method
|
78
|
-
|
78
|
+
"The length of \"#{attribute}\" can't be checked as the method " + \
|
79
|
+
"\"length\" doesn't exist."
|
79
80
|
)
|
80
81
|
end
|
81
82
|
|
@@ -93,8 +94,8 @@ module Zen
|
|
93
94
|
|
94
95
|
##
|
95
96
|
# Checks if the given attributes match the specified regular expressions.
|
96
|
-
# When a hash is specified the keys should be the names of the attributes to
|
97
|
-
# and the values the regular expressions to use.
|
97
|
+
# When a hash is specified the keys should be the names of the attributes to
|
98
|
+
# validate and the values the regular expressions to use.
|
98
99
|
#
|
99
100
|
# @example
|
100
101
|
# validates_format(:name, /[\w\-]+/)
|
@@ -102,12 +103,12 @@ module Zen
|
|
102
103
|
#
|
103
104
|
# @author Yorick Peterse
|
104
105
|
# @since 0.2.5
|
105
|
-
# @param [Hash/Symbol] attribute The name of the attribute to validate or
|
106
|
-
# containing all the attributes and their regular expressions.
|
107
|
-
# @param [Regexp] regexp The regular expression to use when validating a
|
108
|
-
# attribute.
|
109
|
-
# @raise [ValidationError] Raised when one of the attributes doesn't matches
|
110
|
-
# regular expression.
|
106
|
+
# @param [Hash/Symbol] attribute The name of the attribute to validate or
|
107
|
+
# a hash containing all the attributes and their regular expressions.
|
108
|
+
# @param [Regexp] regexp The regular expression to use when validating a
|
109
|
+
# single attribute.
|
110
|
+
# @raise [ValidationError] Raised when one of the attributes doesn't matches
|
111
|
+
# the regular expression.
|
111
112
|
#
|
112
113
|
def validates_format(attribute, regexp = nil)
|
113
114
|
if attribute.class != Hash
|
@@ -120,7 +121,10 @@ module Zen
|
|
120
121
|
match = val =~ regexp
|
121
122
|
|
122
123
|
if !match
|
123
|
-
raise(
|
124
|
+
raise(
|
125
|
+
ValidationError,
|
126
|
+
"The attribute \"#{attr}\" doesn't match #{regexp}"
|
127
|
+
)
|
124
128
|
end
|
125
129
|
end
|
126
130
|
end
|
@@ -140,7 +144,10 @@ module Zen
|
|
140
144
|
path = send(attribute)
|
141
145
|
|
142
146
|
if !File.exist?(path)
|
143
|
-
raise(
|
147
|
+
raise(
|
148
|
+
ValidationError,
|
149
|
+
"The path #{path} in \"#{attribute}\" doesn't exist."
|
150
|
+
)
|
144
151
|
end
|
145
152
|
end
|
146
153
|
end # Validation
|
data/lib/zen/version.rb
CHANGED
@@ -1,11 +1,5 @@
|
|
1
1
|
#:nodoc:
|
2
2
|
module Zen
|
3
|
-
|
4
|
-
|
5
|
-
# version when generating a new Rubygems package.
|
6
|
-
#
|
7
|
-
# @author Yorick Peterse
|
8
|
-
# @since 0.1
|
9
|
-
#
|
10
|
-
Version = '0.2.7'
|
3
|
+
# :nodoc:
|
4
|
+
Version = '0.2.8'
|
11
5
|
end
|
data/lib/zen/view/main.xhtml
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
#{display_messages}
|
2
2
|
|
3
|
-
<!--
|
4
|
-
Main area of the admin panel. The content stretches across the entire screen and there
|
5
|
-
are no silly sidebars.
|
6
|
-
-->
|
7
3
|
<div id="container" class="container">
|
8
4
|
<div id="content" class="grid_12">
|
9
5
|
#{@content}
|
@@ -12,23 +8,12 @@ are no silly sidebars.
|
|
12
8
|
|
13
9
|
<footer id="main_footer" class="container">
|
14
10
|
<div class="grid_12">
|
15
|
-
<p
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
<li>
|
23
|
-
<a href="http://zen-cms.com/userguide">
|
24
|
-
#{lang('zen_general.labels.zen_docs')}
|
25
|
-
</a>
|
26
|
-
</li>
|
27
|
-
<li>
|
28
|
-
<a href="https://github.com/zen-cms/">
|
29
|
-
#{lang('zen_general.labels.zen_github')}
|
30
|
-
</a>
|
31
|
-
</li>
|
32
|
-
</ul>
|
11
|
+
<p>
|
12
|
+
#{lang('zen_general.labels.powered_by')}
|
13
|
+
|
14
|
+
<a href="http://zen-cms.com/">
|
15
|
+
Zen #{Zen::Version}
|
16
|
+
</a>
|
17
|
+
</p>
|
33
18
|
</div>
|
34
19
|
</footer>
|
File without changes
|
data/proto/app/app.rb
CHANGED
data/proto/app/config/config.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
# Specify the root directory. This is required since there are multiple
|
2
|
-
# to load resources from. This directory will be used for the
|
1
|
+
# Specify the root directory. This is required since there are multiple
|
2
|
+
# directories to load resources from. This directory will be used for the
|
3
|
+
# database logger, modes, etc.
|
3
4
|
Zen.root = __DIR__('../')
|
4
5
|
|
5
6
|
# Set the application's mode. Available modes are "dev" and "live"
|
@@ -8,8 +9,8 @@ Ramaze.options.mode = :dev
|
|
8
9
|
# The session identifier to use for cookies.
|
9
10
|
Ramaze.options.session.key = 'zen.sid'
|
10
11
|
|
11
|
-
# Cache settings. These are turned off for the development server to make it
|
12
|
-
# to debug potential errors.
|
12
|
+
# Cache settings. These are turned off for the development server to make it
|
13
|
+
# easier to debug potential errors.
|
13
14
|
Ramaze::View.options.cache = false
|
14
15
|
Ramaze::View.options.read_cache = false
|
15
16
|
|
@@ -1,14 +1,11 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
#
|
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.
|
1
|
+
# It's recommended to create a separate database user for your Zen application
|
2
|
+
# and prevent it from being able to access other databases. Zen is new and may
|
3
|
+
# allow hackers to exploit the system.
|
7
4
|
#
|
8
5
|
# The following items can be set:
|
9
6
|
#
|
10
|
-
# * adapter: the adapter to use. When using MySQL it's best to use the mysql2
|
11
|
-
# a lot faster than the mysql gem.
|
7
|
+
# * adapter: the adapter to use. When using MySQL it's best to use the mysql2
|
8
|
+
# gem as it's a lot faster than the mysql gem.
|
12
9
|
# * host: the hostname where the database is located.
|
13
10
|
# * username: the username to use for connecting to the database.
|
14
11
|
# * password: the password to use for connecting to the database.
|
@@ -17,42 +14,23 @@
|
|
17
14
|
# * encoding: the encoding type to use.
|
18
15
|
# * logger: the logger used for logging queries and such.
|
19
16
|
#
|
20
|
-
# Fore more information see the Sequel documentation:
|
17
|
+
# Fore more information see the Sequel documentation:
|
21
18
|
# http://sequel.rubyforge.org/rdoc/files/doc/opening_databases_rdoc.html
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
:encoding => 'utf8',
|
33
|
-
:logger => Ramaze::Logger::RotatingInformer.new(
|
34
|
-
__DIR__("../log/database/dev"), '%d-%m-%Y.log'
|
35
|
-
)
|
19
|
+
Zen.database = Sequel.connect(
|
20
|
+
:adapter => '',
|
21
|
+
:host => 'localhost',
|
22
|
+
:username => '',
|
23
|
+
:password => '',
|
24
|
+
:database => '',
|
25
|
+
:test => true,
|
26
|
+
:encoding => 'utf8',
|
27
|
+
:logger => Ramaze::Logger::RotatingInformer.new(
|
28
|
+
__DIR__("../log/database/dev"), '%d-%m-%Y.log'
|
36
29
|
)
|
30
|
+
)
|
37
31
|
|
38
|
-
#
|
39
|
-
|
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
|
-
)
|
52
|
-
end
|
53
|
-
|
54
|
-
# IMPORTANT, when running MySQL the engine should be set to InnoDB in order for foreign
|
55
|
-
# keys to work properly.
|
32
|
+
# IMPORTANT, when running MySQL the engine should be set to InnoDB in order for
|
33
|
+
# foreign keys to work properly.
|
56
34
|
if Zen.database.adapter_scheme.to_s.include?('mysql')
|
57
35
|
Sequel::MySQL.default_engine = 'InnoDB'
|
58
36
|
end
|
@@ -1,48 +1,51 @@
|
|
1
|
-
# All Rack middlewares should go in a block like the one below. Different
|
2
|
-
# can be used for different versions by setting the first argument
|
3
|
-
# method to a symbol containing the name of the environment
|
1
|
+
# All Rack middlewares should go in a block like the one below. Different
|
2
|
+
# combinations can be used for different versions by setting the first argument
|
3
|
+
# of the middleware! method to a symbol containing the name of the environment
|
4
|
+
# (e.g. :live).
|
4
5
|
#
|
5
|
-
# For development purposes we'll be loading various middlewares to make it
|
6
|
-
# detect errors, reloading the code and so on.
|
6
|
+
# For development purposes we'll be loading various middlewares to make it
|
7
|
+
# easier to detect errors, reloading the code and so on.
|
7
8
|
#
|
8
9
|
Ramaze.middleware! :dev do |m|
|
9
10
|
# Rack::Lint is used to validate all code according to the Rack specification.
|
10
|
-
# It's not recommended to use this middleware in a production environment as
|
11
|
-
# slow your application down a bit.
|
11
|
+
# It's not recommended to use this middleware in a production environment as
|
12
|
+
# it will slow your application down a bit.
|
12
13
|
m.use Rack::Lint
|
13
14
|
|
14
|
-
# Shows an error page whenever an exception was raised. It's not recommended
|
15
|
-
# this middleware on a production server as it may reveal sensitive
|
16
|
-
# visitor.
|
15
|
+
# Shows an error page whenever an exception was raised. It's not recommended
|
16
|
+
# to use this middleware on a production server as it may reveal sensitive
|
17
|
+
# details to the visitor.
|
17
18
|
m.use Rack::ShowExceptions
|
18
19
|
|
19
20
|
# Pretty much the same as Rack::ShowExceptions.
|
20
21
|
m.use Rack::ShowStatus
|
21
|
-
|
22
|
-
# Routes exceptions to different actions, can be useful for catching 404's and
|
22
|
+
|
23
|
+
# Routes exceptions to different actions, can be useful for catching 404's and
|
24
|
+
# such.
|
23
25
|
# m.use Rack::RouteExceptions
|
24
|
-
|
25
|
-
# Middleware that enables conditional GET using If-None-Match and
|
26
|
-
# Currently Zen doesn't respond to conditional GET
|
27
|
-
# out of the box, it can be useful for custom
|
26
|
+
|
27
|
+
# Middleware that enables conditional GET using If-None-Match and
|
28
|
+
# If-Modified-Since. Currently Zen doesn't respond to conditional GET
|
29
|
+
# requests so it's fairly useless out of the box, it can be useful for custom
|
30
|
+
# extensions and such.
|
28
31
|
# m.use Rack::ConditionalGet
|
29
|
-
|
30
|
-
# Automatically sets the ETag header on all string bodies. Etags can be useful
|
31
|
-
# checking if a certain page has been modified or not.
|
32
|
+
|
33
|
+
# Automatically sets the ETag header on all string bodies. Etags can be useful
|
34
|
+
# for checking if a certain page has been modified or not.
|
32
35
|
#
|
33
|
-
# IMPORTANT: Prior to Rack 1.2.2 Rack::ETag required the second argument of
|
34
|
-
# be set to 'public'. Newer versions no longer require this.
|
36
|
+
# IMPORTANT: Prior to Rack 1.2.2 Rack::ETag required the second argument of
|
37
|
+
# use() to be set to 'public'. Newer versions no longer require this.
|
35
38
|
m.use Rack::ETag
|
36
|
-
|
37
|
-
# Allows HEAD requests. HEAD requests are identical to GET requests but
|
38
|
-
# return the body.
|
39
|
+
|
40
|
+
# Allows HEAD requests. HEAD requests are identical to GET requests but
|
41
|
+
# shouldn't return the body.
|
39
42
|
m.use Rack::Head
|
40
|
-
|
41
|
-
# Automatically reloads your application whenever it detects changes. Note
|
42
|
-
# middleware isn't always as accurate so there may be times when you
|
43
|
-
# restart your server.
|
43
|
+
|
44
|
+
# Automatically reloads your application whenever it detects changes. Note
|
45
|
+
# that this middleware isn't always as accurate so there may be times when you
|
46
|
+
# have to manually restart your server.
|
44
47
|
m.use Ramaze::Reloader
|
45
|
-
|
48
|
+
|
46
49
|
# Runs Ramaze based on all mappings and such.
|
47
50
|
m.run Ramaze::AppMap
|
48
51
|
end
|