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
@@ -0,0 +1,94 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
#:nodoc:
|
4
|
+
module Zen
|
5
|
+
#:nodoc:
|
6
|
+
module Bin
|
7
|
+
##
|
8
|
+
# Command that can be used to create a new application prototype.
|
9
|
+
#
|
10
|
+
# @author Yorick Peterse
|
11
|
+
# @since 0.2.8
|
12
|
+
#
|
13
|
+
class Create
|
14
|
+
# The description of this command.
|
15
|
+
Description = 'Creates a new application prototype.'
|
16
|
+
|
17
|
+
# The banner of this application.
|
18
|
+
Banner = <<-TXT.strip
|
19
|
+
Creates a new application prototype and saves it in the given path.
|
20
|
+
|
21
|
+
Usage:
|
22
|
+
zen create [NAME] [OPTIONS]
|
23
|
+
|
24
|
+
Example:
|
25
|
+
zen create blog
|
26
|
+
TXT
|
27
|
+
|
28
|
+
# Hash containing options that can be overwritten via the command line.
|
29
|
+
Options = {
|
30
|
+
:force => false
|
31
|
+
}
|
32
|
+
|
33
|
+
##
|
34
|
+
# Creates a new instance of the class and specifies all the options.
|
35
|
+
#
|
36
|
+
# @author Yorick Peterse
|
37
|
+
# @since 0.2.8
|
38
|
+
#
|
39
|
+
def initialize
|
40
|
+
@stop = false
|
41
|
+
@options = OptionParser.new do |opt|
|
42
|
+
opt.banner = Banner
|
43
|
+
opt.summary_indent = ' '
|
44
|
+
|
45
|
+
opt.separator "\nOptions:\n"
|
46
|
+
|
47
|
+
opt.on('-h', '--help', 'Shows this help message') do
|
48
|
+
puts @options
|
49
|
+
|
50
|
+
@stop = true
|
51
|
+
end
|
52
|
+
|
53
|
+
opt.on('-f', '--force', 'Overwrites existing directories') do
|
54
|
+
Options[:force] = true
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
##
|
60
|
+
# Executes the command based on the specified command line arguments.
|
61
|
+
#
|
62
|
+
# @author Yorick Peterse
|
63
|
+
# @since 0.2.8
|
64
|
+
# @param [Array] argv An array containing all the additional options that
|
65
|
+
# were specified in the command line.
|
66
|
+
#
|
67
|
+
def run(argv = [])
|
68
|
+
@options.parse!(argv)
|
69
|
+
|
70
|
+
app = argv.delete_at(0)
|
71
|
+
|
72
|
+
return if @stop === true
|
73
|
+
return puts @options if app.nil?
|
74
|
+
|
75
|
+
proto = __DIR__('../../../proto/app')
|
76
|
+
|
77
|
+
if File.directory?(app) and Options[:force] === false
|
78
|
+
return $stderr.puts "The application #{app} already exists, use -f " \
|
79
|
+
+ "to overwrite it."
|
80
|
+
else
|
81
|
+
FileUtils.rm_rf(app)
|
82
|
+
end
|
83
|
+
|
84
|
+
# Copy the prototype
|
85
|
+
begin
|
86
|
+
FileUtils.cp_r(proto, app)
|
87
|
+
puts "The application has been generated and saved in #{app}"
|
88
|
+
rescue => e
|
89
|
+
return $stderr.puts "Failed to generate the application: #{e.message}"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end # App
|
93
|
+
end # Bin
|
94
|
+
end # Zen
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# Load all commands
|
2
|
+
require __DIR__('create')
|
3
|
+
|
4
|
+
#:nodoc:
|
5
|
+
module Zen
|
6
|
+
#:nodoc:
|
7
|
+
module Bin
|
8
|
+
##
|
9
|
+
# Module used to set various global options for the command line utility and
|
10
|
+
# run a command based on the specified parameters.
|
11
|
+
#
|
12
|
+
# @author Yorick Peterse
|
13
|
+
# @since 0.2.8
|
14
|
+
#
|
15
|
+
module Runner
|
16
|
+
# Hash containing all the available commands and their class names.
|
17
|
+
Commands = {
|
18
|
+
:create => Zen::Bin::Create
|
19
|
+
}
|
20
|
+
|
21
|
+
# The banner of this command.
|
22
|
+
Banner = <<-TXT.strip
|
23
|
+
Zen is a modular CMS written on top of the awesome Ramaze framework.
|
24
|
+
|
25
|
+
Usage:
|
26
|
+
zen [COMMAND] [OPTIONS]
|
27
|
+
|
28
|
+
Example:
|
29
|
+
zen create blog
|
30
|
+
TXT
|
31
|
+
|
32
|
+
##
|
33
|
+
# Runs a command based on the command line arguments or a specified array
|
34
|
+
# to use instead of ARGV.
|
35
|
+
#
|
36
|
+
# @author Yorick Peterse
|
37
|
+
# @since 0.2.8
|
38
|
+
# @param [Array] argv An array containing command line arguments.
|
39
|
+
#
|
40
|
+
def self.run(argv=ARGV)
|
41
|
+
stop = false
|
42
|
+
op = OptionParser.new do |opt|
|
43
|
+
opt.banner = Banner
|
44
|
+
opt.summary_indent = ' '
|
45
|
+
|
46
|
+
opt.separator "\nCommands:\n #{commands_info.join("\n ")}"
|
47
|
+
opt.separator "\nOptions:\n"
|
48
|
+
|
49
|
+
# Define the available options
|
50
|
+
opt.on('-v', '--version', 'Shows the version of Zen') do
|
51
|
+
puts Zen::Version
|
52
|
+
|
53
|
+
stop = true
|
54
|
+
end
|
55
|
+
|
56
|
+
opt.on('-h', '--help', 'Shows this help message') do
|
57
|
+
puts op
|
58
|
+
|
59
|
+
stop = true
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# Parse it
|
64
|
+
op.order!(argv)
|
65
|
+
|
66
|
+
# exit() doesn't work for specs.
|
67
|
+
return if stop === true
|
68
|
+
return puts op if !argv[0]
|
69
|
+
|
70
|
+
# Run the command if it exists
|
71
|
+
cmd = argv.delete_at(0).to_sym
|
72
|
+
|
73
|
+
if Commands.key?(cmd)
|
74
|
+
cmd = Commands[cmd].new
|
75
|
+
cmd.run(argv)
|
76
|
+
else
|
77
|
+
return $stderr.puts "The specified command is invalid"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# Generates an array of "rows" where each row contains the name and
|
83
|
+
# description of a command. The descriptions of all commands are aligned
|
84
|
+
# based on the length of the longest command name.
|
85
|
+
#
|
86
|
+
# This method has been ported from Ramaze.
|
87
|
+
#
|
88
|
+
# @author Yorick Peterse
|
89
|
+
# @since 23-07-2011
|
90
|
+
# @return [Array]
|
91
|
+
#
|
92
|
+
def self.commands_info
|
93
|
+
cmds = []
|
94
|
+
longest = Commands.map { |name, klass| name.to_s }.sort[0].size
|
95
|
+
|
96
|
+
Commands.each do |name, klass|
|
97
|
+
name = name.to_s
|
98
|
+
desc = ''
|
99
|
+
|
100
|
+
# Try to extract the command description
|
101
|
+
if klass.respond_to?(:const_defined?) \
|
102
|
+
and klass.const_defined?(:Description)
|
103
|
+
desc = klass.const_get(:Description)
|
104
|
+
end
|
105
|
+
|
106
|
+
# Align the description based on the length of the name
|
107
|
+
while name.size <= longest do
|
108
|
+
name += ' '
|
109
|
+
end
|
110
|
+
|
111
|
+
cmds.push(["#{name} #{desc}"])
|
112
|
+
end
|
113
|
+
|
114
|
+
return cmds
|
115
|
+
end
|
116
|
+
end # Runner
|
117
|
+
end # Bin
|
118
|
+
end # Zen
|
@@ -3,17 +3,18 @@ module Zen
|
|
3
3
|
#:nodoc:
|
4
4
|
module Controller
|
5
5
|
##
|
6
|
-
# The admin controller is a base controller that should be extended by all
|
7
|
-
# for the backend of Zen. This controller will automatically
|
8
|
-
# user is logged in and perform several other tasks such
|
9
|
-
# and CSS stylesheet along with our helpers and
|
6
|
+
# The admin controller is a base controller that should be extended by all
|
7
|
+
# controllers for the backend of Zen. This controller will automatically
|
8
|
+
# check to see if the user is logged in and perform several other tasks such
|
9
|
+
# as loading all Javascript and CSS stylesheet along with our helpers and
|
10
|
+
# so on.
|
10
11
|
#
|
11
12
|
# ## Authentication
|
12
13
|
#
|
13
|
-
# It's important to remember that any controller that extends this one will
|
14
|
-
# the user to be logged in. The only exception for this is the login
|
15
|
-
# Users controller, mapped to /admin/users/login. If a user
|
16
|
-
# will be redirected to the login page.
|
14
|
+
# It's important to remember that any controller that extends this one will
|
15
|
+
# require the user to be logged in. The only exception for this is the login
|
16
|
+
# method for the Users controller, mapped to /admin/users/login. If a user
|
17
|
+
# isn't logged in he/she will be redirected to the login page.
|
17
18
|
#
|
18
19
|
# @author Yorick Peterse
|
19
20
|
# @since 0.1
|
@@ -21,29 +22,35 @@ module Zen
|
|
21
22
|
class AdminController < Zen::Controller::BaseController
|
22
23
|
layout :admin
|
23
24
|
engine :etanni
|
24
|
-
helper :
|
25
|
+
helper :blue_form_vendor, :breadcrumb, :user, :acl, :message, :paginate
|
26
|
+
|
27
|
+
# Configure the pagination
|
28
|
+
trait :paginate => {
|
29
|
+
:limit => 20,
|
30
|
+
:var => 'page'
|
31
|
+
}
|
25
32
|
|
26
33
|
##
|
27
|
-
# The initialize method is called upon class initalization and is used to
|
28
|
-
# items before loading the controller(s) for the current
|
34
|
+
# The initialize method is called upon class initalization and is used to
|
35
|
+
# process several items before loading the controller(s) for the current
|
36
|
+
# extension.
|
29
37
|
#
|
30
38
|
# @author Yorick Peterse
|
31
39
|
# @since 1.0
|
32
40
|
#
|
33
41
|
def initialize
|
34
42
|
super
|
35
|
-
|
36
|
-
# Only allow users to access admin/users/login when they aren't logged in
|
37
|
-
if request.env['SCRIPT_NAME'] != 'admin/users/' and request.env['PATH_INFO'] != '/login'
|
38
|
-
redirect '/admin/users/login' unless logged_in?
|
39
|
-
end
|
40
43
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
44
|
+
# Only allow users to access admin/users/login when they aren't logged
|
45
|
+
# in
|
46
|
+
if request.env['SCRIPT_NAME'] != 'admin/users/' \
|
47
|
+
and request.env['PATH_INFO'] != '/login' \
|
48
|
+
and !logged_in?
|
49
|
+
message(:error, lang('zen_general.errors.require_login'))
|
50
|
+
redirect('/admin/users/login')
|
51
|
+
end
|
45
52
|
end
|
46
|
-
|
53
|
+
|
47
54
|
##
|
48
55
|
# Shortcut for Zen::Asset.stylesheet.
|
49
56
|
#
|
@@ -52,9 +59,7 @@ module Zen
|
|
52
59
|
# @since 0.2.5
|
53
60
|
#
|
54
61
|
def self.stylesheet(files, options = {})
|
55
|
-
options = {
|
56
|
-
:controller => self
|
57
|
-
}.merge(options)
|
62
|
+
options = {:controller => self}.merge(options)
|
58
63
|
|
59
64
|
::Zen::Asset.stylesheet(files, options)
|
60
65
|
end
|
@@ -67,26 +72,37 @@ module Zen
|
|
67
72
|
# @since 0.2.5
|
68
73
|
#
|
69
74
|
def self.javascript(files, options = {})
|
70
|
-
options = {
|
71
|
-
:controller => self
|
72
|
-
}.merge(options)
|
75
|
+
options = {:controller => self}.merge(options)
|
73
76
|
|
74
77
|
::Zen::Asset.javascript(files, options)
|
75
78
|
end
|
76
79
|
|
77
|
-
# Load all stylesheets
|
80
|
+
# Load all default stylesheets
|
78
81
|
stylesheet(
|
79
82
|
[
|
80
|
-
'zen/reset',
|
81
|
-
'zen/
|
82
|
-
|
83
|
+
'zen/reset',
|
84
|
+
'zen/grid',
|
85
|
+
'zen/layout',
|
86
|
+
'zen/general',
|
87
|
+
'zen/forms',
|
88
|
+
'zen/tables',
|
89
|
+
'zen/buttons',
|
90
|
+
'zen/messages'
|
91
|
+
],
|
83
92
|
:global => true
|
84
93
|
)
|
85
94
|
|
86
|
-
# Load all
|
95
|
+
# Load all default javascript files
|
87
96
|
javascript(
|
88
|
-
[
|
97
|
+
[
|
98
|
+
'vendor/mootools/core',
|
99
|
+
'vendor/mootools/more',
|
100
|
+
'zen/lib/asset',
|
101
|
+
'zen/lib/html_table',
|
102
|
+
'zen/index'
|
103
|
+
],
|
104
|
+
:global => true
|
89
105
|
)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
106
|
+
end # AdminController
|
107
|
+
end # Controller
|
108
|
+
end # Zen
|
@@ -4,8 +4,8 @@ module Zen
|
|
4
4
|
module Controller
|
5
5
|
##
|
6
6
|
# The BaseController is extended by both the FrontendController and the
|
7
|
-
# BackendController. This controller is mostly used to set and retrieve
|
8
|
-
# used in both the backend and the frontend.
|
7
|
+
# BackendController. This controller is mostly used to set and retrieve
|
8
|
+
# data that's used in both the backend and the frontend.
|
9
9
|
#
|
10
10
|
# @author Yorick Peterse
|
11
11
|
# @since 0.1
|
@@ -14,6 +14,6 @@ module Zen
|
|
14
14
|
include ::Zen::Language
|
15
15
|
|
16
16
|
helper :csrf, :cgi
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
17
|
+
end # BaseController
|
18
|
+
end # Controller
|
19
|
+
end # Zen
|
@@ -3,9 +3,9 @@ module Zen
|
|
3
3
|
#:nodoc:
|
4
4
|
module Controller
|
5
5
|
##
|
6
|
-
# Controller that should be extended by other controllers that can be
|
7
|
-
# the web without having to log in. Frontend controllers don't
|
8
|
-
# use the Liquid template engine for all views.
|
6
|
+
# Controller that should be extended by other controllers that can be
|
7
|
+
# accessed from the web without having to log in. Frontend controllers don't
|
8
|
+
# have a layout and use the Liquid template engine for all views.
|
9
9
|
#
|
10
10
|
# @author Yorick Peterse
|
11
11
|
# @since 0.1
|
@@ -13,7 +13,7 @@ module Zen
|
|
13
13
|
class FrontendController < Zen::Controller::BaseController
|
14
14
|
engine :etanni
|
15
15
|
layout :none
|
16
|
-
helper :theme
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
16
|
+
helper :theme
|
17
|
+
end # FrontendController
|
18
|
+
end # Controller
|
19
|
+
end # Zen
|
@@ -3,9 +3,9 @@ module Zen
|
|
3
3
|
#:nodoc:
|
4
4
|
module Controller
|
5
5
|
##
|
6
|
-
# The MainController controller is used to load the correct template files
|
7
|
-
# on the current URI. If no section is specified the default section
|
8
|
-
# from the settings table.
|
6
|
+
# The MainController controller is used to load the correct template files
|
7
|
+
# based on the current URI. If no section is specified the default section
|
8
|
+
# will be retrieved from the settings table.
|
9
9
|
#
|
10
10
|
# @author Yorick Peterse
|
11
11
|
# @since 0.1
|
@@ -15,9 +15,9 @@ module Zen
|
|
15
15
|
|
16
16
|
##
|
17
17
|
# The index method acts as a catch-all method. Based on the requested URI
|
18
|
-
# the correct template group/file will be loaded. If no templates are
|
19
|
-
# a 404 template will be loaded. If that's not found either a
|
20
|
-
# will be shown.
|
18
|
+
# the correct template group/file will be loaded. If no templates are
|
19
|
+
# found a 404 template will be loaded. If that's not found either a
|
20
|
+
# default error will be shown.
|
21
21
|
#
|
22
22
|
# @author Yorick Peterse
|
23
23
|
# @since 0.1
|
@@ -31,7 +31,9 @@ module Zen
|
|
31
31
|
uri.each { |v| @request_uri.push(h(v)) }
|
32
32
|
|
33
33
|
if !@request_uri[0] or @request_uri[0].empty?
|
34
|
-
|
34
|
+
section = plugin(:settings, :get, :default_section).value
|
35
|
+
section = ::Sections::Model::Section[section].slug
|
36
|
+
@request_uri[0] = section
|
35
37
|
end
|
36
38
|
|
37
39
|
if !@request_uri[1] or @request_uri[1].empty?
|
@@ -65,6 +67,6 @@ module Zen
|
|
65
67
|
end
|
66
68
|
end
|
67
69
|
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
70
|
+
end # MainController
|
71
|
+
end # Controller
|
72
|
+
end # Zen
|
@@ -3,11 +3,12 @@ module Zen
|
|
3
3
|
#:nodoc
|
4
4
|
module Controller
|
5
5
|
##
|
6
|
-
# Controller that can be used to render a block of markup based on the POST
|
7
|
-
# controller is useful for generating previews when using the
|
6
|
+
# Controller that can be used to render a block of markup based on the POST
|
7
|
+
# data. This controller is useful for generating previews when using the
|
8
|
+
# text editor for example.
|
8
9
|
#
|
9
|
-
# In order to render a preview you'll have to send a POST request with the
|
10
|
-
# data in it:
|
10
|
+
# In order to render a preview you'll have to send a POST request with the
|
11
|
+
# following data in it:
|
11
12
|
#
|
12
13
|
# * engine: The markup engine to use (Markdown, Textile, etc).
|
13
14
|
# * markup: The markup to convert to HTML.
|
@@ -18,9 +19,9 @@ module Zen
|
|
18
19
|
# engine: "markdown"
|
19
20
|
# markup: "Hello **world**!"
|
20
21
|
#
|
21
|
-
# The return data is an HTTP status code and the HTML as the body. The HTTP
|
22
|
-
# code will be 200 whenever the data was converted and or 400 in case
|
23
|
-
# (e.g. an incorrect markup engine was specified).
|
22
|
+
# The return data is an HTTP status code and the HTML as the body. The HTTP
|
23
|
+
# status code will be 200 whenever the data was converted and or 400 in case
|
24
|
+
# of an error (e.g. an incorrect markup engine was specified).
|
24
25
|
#
|
25
26
|
# @author Yorick Peterse
|
26
27
|
# @since 0.2.6
|
@@ -40,11 +41,14 @@ module Zen
|
|
40
41
|
end
|
41
42
|
|
42
43
|
begin
|
43
|
-
respond(
|
44
|
+
respond(
|
45
|
+
plugin(:markup, request.params['engine'], request.params['markup']),
|
46
|
+
200
|
47
|
+
)
|
44
48
|
rescue
|
45
49
|
respond(lang('zen_general.errors.invalid_request'), 400)
|
46
50
|
end
|
47
51
|
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
52
|
+
end # Preview
|
53
|
+
end # Controller
|
54
|
+
end # Zen
|