zen 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/CHANGELOG.md +12 -2
  2. data/MANIFEST +17 -10
  3. data/ROADMAP.md +8 -4
  4. data/bin/zen +2 -3
  5. data/lib/zen.rb +20 -14
  6. data/lib/zen/bin/{zen_binary.rb → base.rb} +0 -0
  7. data/lib/zen/controller/main_controller.rb +7 -4
  8. data/lib/zen/{base/database.rb → database.rb} +3 -2
  9. data/lib/zen/error/language_error.rb +10 -0
  10. data/lib/zen/error/package_error.rb +10 -0
  11. data/lib/zen/error/plugin_error.rb +10 -0
  12. data/lib/zen/error/theme_error.rb +10 -0
  13. data/lib/zen/helper/acl.rb +11 -4
  14. data/lib/zen/{base/language.rb → language.rb} +11 -3
  15. data/lib/zen/layout/admin.xhtml +21 -12
  16. data/lib/zen/layout/login.xhtml +17 -11
  17. data/lib/zen/liquid/general.rb +1 -27
  18. data/lib/zen/{base/logger.rb → logger.rb} +0 -0
  19. data/lib/zen/{base/package.rb → package.rb} +65 -55
  20. data/lib/zen/package/all.rb +5 -0
  21. data/lib/zen/package/categories/lib/categories.rb +7 -8
  22. data/lib/zen/package/comments/lib/comments.rb +7 -8
  23. data/lib/zen/package/comments/lib/comments/controller/comments_form.rb +1 -1
  24. data/lib/zen/package/comments/lib/comments/liquid/comments.rb +3 -1
  25. data/lib/zen/package/custom_fields/lib/custom_fields.rb +7 -8
  26. data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_value.rb +14 -0
  27. data/lib/zen/package/custom_fields/migrations/1295255665_create_schema.rb +1 -1
  28. data/lib/zen/package/menus/lib/menus.rb +5 -6
  29. data/lib/zen/package/sections/lib/sections.rb +4 -5
  30. data/lib/zen/package/sections/lib/sections/language/en/section_entries.yml +2 -2
  31. data/lib/zen/package/sections/lib/sections/liquid/section_entries.rb +9 -2
  32. data/lib/zen/package/settings/lib/settings.rb +7 -8
  33. data/lib/zen/package/users/lib/users.rb +7 -8
  34. data/lib/zen/package/users/lib/users/view/admin/access-rules/form.xhtml +5 -5
  35. data/lib/zen/package/users/lib/users/view/admin/access-rules/index.xhtml +4 -4
  36. data/lib/zen/plugin.rb +172 -0
  37. data/lib/zen/plugin/markup.rb +30 -0
  38. data/lib/zen/public/admin/css/layout.css +17 -0
  39. data/lib/zen/strict_struct.rb +36 -0
  40. data/lib/zen/task/db.rb +14 -4
  41. data/lib/zen/task/package.rb +13 -8
  42. data/lib/zen/task/theme.rb +88 -0
  43. data/lib/zen/theme.rb +129 -0
  44. data/lib/zen/{base/version.rb → version.rb} +1 -1
  45. data/proto/app/config/config.rb +19 -6
  46. data/proto/app/config/database.rb +58 -2
  47. data/proto/app/config/middlewares.rb +69 -4
  48. data/proto/app/config/requires.rb +9 -2
  49. data/proto/app/{logs → log}/.gitkeep +0 -0
  50. data/proto/package/lib/package.rb +3 -13
  51. data/proto/package/lib/package/controller/controllers.rb +5 -9
  52. data/proto/package/lib/package/language/en/languages.yml +4 -0
  53. metadata +66 -26
  54. data/proto/package/LICENSE +0 -0
  55. data/proto/package/README.textile +0 -0
  56. data/proto/package/lib/package/language/en/languages.rb +0 -3
@@ -1,13 +1,23 @@
1
1
  # Changelog
2
2
 
3
- ## 0.2 - March 18th, 2011
3
+ ## 0.2.4 - March 27th, 2011
4
+
5
+ * Fix an issue that would prevent migrations from being executed in the correct order.
6
+ * Fixed a small translation bug in the section entries translation file.
7
+ * Restyled the footer in the admin panel.
8
+ * Removed the requirement of having to specify the type of package/extension.
9
+ * Navigation items will now be hidden according to the user's permissions.
10
+ * Split packages into packages, themes and plugins. This makes it much easier to extend
11
+ small features such as the markup generator and the comment validation system
12
+
13
+ ## 0.2 - March 20th, 2011
4
14
 
5
15
  * Added a package for managing navigation items.
6
16
  * Introduced a new language system using YAML files instead of Ruby files.
7
17
  * Added a datepicker for date fields.
8
18
  * Improved several existing Liquid tags.
9
19
  * Form data is no longer lost in case of an error.
10
- * Converted all markup from Textile to Markdown
20
+ * Converted all markup from Textile to Markdown.
11
21
  * Replaced Bacon by RSpec 2 and Webrat.
12
22
  * Replaced Rake by Thor.
13
23
  * Cleaned up a lot of code.
data/MANIFEST CHANGED
@@ -4,28 +4,30 @@ README.md
4
4
  ROADMAP.md
5
5
  Thorfile
6
6
  bin/zen
7
- lib/zen/base/database.rb
8
- lib/zen/base/language.rb
9
- lib/zen/base/logger.rb
10
- lib/zen/base/package.rb
11
- lib/zen/base/version.rb
12
- lib/zen/bin/zen_binary.rb
7
+ lib/zen/bin/base.rb
13
8
  lib/zen/controller/admin_controller.rb
14
9
  lib/zen/controller/base_controller.rb
15
10
  lib/zen/controller/frontend_controller.rb
16
11
  lib/zen/controller/main_controller.rb
12
+ lib/zen/database.rb
13
+ lib/zen/error/language_error.rb
14
+ lib/zen/error/package_error.rb
15
+ lib/zen/error/plugin_error.rb
16
+ lib/zen/error/theme_error.rb
17
17
  lib/zen/helper/acl.rb
18
18
  lib/zen/helper/asset.rb
19
19
  lib/zen/helper/breadcrumb.rb
20
20
  lib/zen/helper/common.rb
21
21
  lib/zen/language/en/zen_general.yml
22
22
  lib/zen/language/en/zen_models.yml
23
+ lib/zen/language.rb
23
24
  lib/zen/layout/admin.xhtml
24
25
  lib/zen/layout/login.xhtml
25
26
  lib/zen/liquid/controller_behavior.rb
26
27
  lib/zen/liquid/general.rb
27
28
  lib/zen/liquid/redirect.rb
28
29
  lib/zen/liquid/strip.rb
30
+ lib/zen/logger.rb
29
31
  lib/zen/model/methods.rb
30
32
  lib/zen/model/settings.rb
31
33
  lib/zen/package/all.rb
@@ -152,6 +154,9 @@ lib/zen/package/users/lib/users/view/admin/users/new.xhtml
152
154
  lib/zen/package/users/lib/users.rb
153
155
  lib/zen/package/users/migrations/.gitkeep
154
156
  lib/zen/package/users/migrations/1295281013_create_schema.rb
157
+ lib/zen/package.rb
158
+ lib/zen/plugin/markup.rb
159
+ lib/zen/plugin.rb
155
160
  lib/zen/public/admin/css/boilerplate.css
156
161
  lib/zen/public/admin/css/buttons.css
157
162
  lib/zen/public/admin/css/datepicker.css
@@ -201,11 +206,15 @@ lib/zen/public/admin/js/zen/init.js
201
206
  lib/zen/public/admin/js/zen/modal.js
202
207
  lib/zen/public/admin/js/zen/notification.js
203
208
  lib/zen/public/admin/js/zen/tabs.js
209
+ lib/zen/strict_struct.rb
204
210
  lib/zen/task/build.rb
205
211
  lib/zen/task/clean.rb
206
212
  lib/zen/task/db.rb
207
213
  lib/zen/task/package.rb
208
214
  lib/zen/task/proto.rb
215
+ lib/zen/task/theme.rb
216
+ lib/zen/theme.rb
217
+ lib/zen/version.rb
209
218
  lib/zen.rb
210
219
  license.txt
211
220
  proto/app/Thorfile
@@ -215,16 +224,14 @@ proto/app/config/database.rb
215
224
  proto/app/config/middlewares.rb
216
225
  proto/app/config/requires.rb
217
226
  proto/app/config.ru
218
- proto/app/logs/.gitkeep
227
+ proto/app/log/.gitkeep
219
228
  proto/app/public/.gitkeep
220
229
  proto/app/start.rb
221
230
  proto/app/vendor/.gitkeep
222
231
  proto/app/vendor/themes/.gitkeep
223
232
  proto/migration.rb
224
- proto/package/LICENSE
225
- proto/package/README.textile
226
233
  proto/package/lib/package/controller/controllers.rb
227
- proto/package/lib/package/language/en/languages.rb
234
+ proto/package/lib/package/language/en/languages.yml
228
235
  proto/package/lib/package/model/model.rb
229
236
  proto/package/lib/package/view/admin/package/edit.xhtml
230
237
  proto/package/lib/package/view/admin/package/form.xhtml
data/ROADMAP.md CHANGED
@@ -9,14 +9,18 @@ to be unverified/undecided and might not be added/completed at all.
9
9
 
10
10
  ### 0.3 - June 2011
11
11
 
12
- * Most parts of the core covered by specs. (!)
13
- * A working (although probably rough) plugin system to extend the inner parts of Zen.
14
- An example of a plugin would be something that allows the use of Akismet for comments
15
- rather than Defensio.
16
12
  * Website completely up and running. (!)
17
13
  * Translation system for the Javascript used in the backend
18
14
  * Documentation/Userguide online
19
15
 
16
+ ### 0.2.4 - March 2011
17
+
18
+ * Liquid tags work when caching is enabled.
19
+ * Compatibility with 1.9 and 1.9.1. (?)
20
+ * A working (although probably rough) plugin system to extend the inner parts of Zen.
21
+ An example of a plugin would be something that allows the use of Akismet for comments
22
+ rather than Defensio.
23
+
20
24
  ### 0.2 - March 2011
21
25
 
22
26
  * General code improvements.
data/bin/zen CHANGED
@@ -2,8 +2,7 @@
2
2
  zen_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'zen'))
3
3
 
4
4
  require 'thor'
5
-
6
5
  require zen_path
7
- require zen_path + "/bin/zen_binary"
6
+ require zen_path + "/bin/base"
8
7
 
9
- Zen::Bin::Base.start
8
+ Zen::Bin::Base.start
data/lib/zen.rb CHANGED
@@ -4,6 +4,8 @@
4
4
  #
5
5
  # @author Yorick Peterse
6
6
  # @since 0.1
7
+ # @attr_reader [Array] languages An array containing all the currently loaded language
8
+ # files stored as hashes.
7
9
  #
8
10
  module Zen
9
11
  require 'sequel'
@@ -12,29 +14,37 @@ module Zen
12
14
  require 'liquid'
13
15
  require 'json'
14
16
  require 'defensio'
15
- require 'thor'
16
17
  require 'sequel_sluggable'
17
18
  require 'yaml'
18
- require __DIR__('zen/base/version')
19
+ require __DIR__('zen/version')
19
20
 
20
21
  include Innate::Optioned
22
+
23
+ class << self
24
+ attr_reader :languages
25
+ end
21
26
 
22
27
  # Update several paths so we can load helpers/layouts from the Zen gem
23
28
  Innate::HelpersHelper.options.paths.push(__DIR__('zen'))
24
29
  Ramaze.options.roots.push(__DIR__('zen'))
25
30
 
26
31
  options.dsl do
27
- # General configuration options
28
- o 'The character encoding to use when dealing with data', :encoding, 'utf8'
29
- o 'The date format to use for log files and such.', :date_format, '%d-%m-%Y'
30
- o 'The base directory of Zen.', :root, ''
32
+ o 'The character encoding to use when dealing with data', :encoding, 'utf8'
33
+ o 'The date format to use for log files and such.', :date_format, '%d-%m-%Y'
34
+ o 'The base directory of Zen.', :root, ''
31
35
  end
32
36
 
33
37
  # Load all classes/modules provided by Zen itself.
34
- require __DIR__ 'zen/base/logger'
35
- require __DIR__ 'zen/base/database'
36
- require __DIR__ 'zen/base/package'
37
- require __DIR__ 'zen/base/language'
38
+ require __DIR__ 'zen/strict_struct'
39
+ require __DIR__ 'zen/logger'
40
+ require __DIR__ 'zen/database'
41
+ require __DIR__ 'zen/package'
42
+ require __DIR__ 'zen/language'
43
+ require __DIR__ 'zen/plugin'
44
+ require __DIR__ 'zen/theme'
45
+
46
+ # Load all required plugins
47
+ require __DIR__ 'zen/plugin/markup'
38
48
 
39
49
  # Load all the base controllers
40
50
  require __DIR__ 'zen/controller/base_controller'
@@ -48,10 +58,6 @@ module Zen
48
58
  require __DIR__ 'zen/liquid/redirect'
49
59
  require __DIR__ 'zen/liquid/strip'
50
60
 
51
- class << self
52
- attr_reader :languages
53
- end
54
-
55
61
  # Update the language paths
56
62
  Zen::Language.options.paths.push(__DIR__('zen'))
57
63
 
File without changes
@@ -43,7 +43,7 @@ module Zen
43
43
  respond(lang('zen_general.errors.no_theme'))
44
44
  end
45
45
 
46
- theme = ::Zen::Package[@settings[:theme]]
46
+ theme = ::Zen::Theme[@settings[:theme]]
47
47
  group = @uri[0]
48
48
  template = @uri[1]
49
49
 
@@ -57,13 +57,16 @@ module Zen
57
57
  end
58
58
 
59
59
  # Create the group, template and partial paths
60
- theme_path = theme.directory + '/templates'
60
+ theme_path = theme.template_dir
61
61
  group_path = theme_path + "/#{group}"
62
62
  template_path = theme_path + "/#{group}/#{template}.liquid"
63
63
 
64
64
  # Register our partial path
65
- partial_path = theme_path + "/partials"
66
- ::Liquid::Template.file_system = ::Liquid::LocalFileSystem.new(partial_path)
65
+ if theme.respond_to?(:partial_dir) and !theme.partial_dir.nil?
66
+ ::Liquid::Template.file_system = ::Liquid::LocalFileSystem.new(
67
+ theme.partial_dir
68
+ )
69
+ end
67
70
 
68
71
  # Is the website down?
69
72
  if @settings[:website_enabled] == '0'
@@ -43,6 +43,7 @@ module Zen
43
43
  #
44
44
  # @author Yorick Peterse
45
45
  # @since 0.1
46
+ # @attr_reader [Object] handle The Sequel database handle to use for all models.
46
47
  #
47
48
  module Database
48
49
  include Innate::Optioned
@@ -98,9 +99,9 @@ module Zen
98
99
  # @author Yorick Peterse
99
100
  # @since 0.1
100
101
  # @param [Symbol] mode The development mode for which the database settings should be used.
101
- # @param [Block] &block Block containing all database settings.
102
+ # @yield [config] Object containing all the options to set for the current mode.
102
103
  #
103
- def self.mode mode, &block
104
+ def self.mode(mode)
104
105
  mode = mode.to_sym
105
106
 
106
107
  if mode == Ramaze.options.mode
@@ -0,0 +1,10 @@
1
+ #:nodoc:
2
+ module Zen
3
+ ##
4
+ # Error class used by Zen::Language.
5
+ #
6
+ # @author Yorick Peterse
7
+ # @since 0.2.4
8
+ #
9
+ class LanguageError < StandardError; end
10
+ end
@@ -0,0 +1,10 @@
1
+ #:nodoc:
2
+ module Zen
3
+ ##
4
+ # Error class used by Zen::Package.
5
+ #
6
+ # @author Yorick Peterse
7
+ # @since 0.2.4
8
+ #
9
+ class PackageError < StandardError; end
10
+ end
@@ -0,0 +1,10 @@
1
+ #:nodoc:
2
+ module Zen
3
+ ##
4
+ # Error class used by Zen::Plugin.
5
+ #
6
+ # @author Yorick Peterse
7
+ # @since 0.2.4
8
+ #
9
+ class PluginError < StandardError; end
10
+ end
@@ -0,0 +1,10 @@
1
+ #:nodoc:
2
+ module Zen
3
+ ##
4
+ # Error class used by Zen::Theme.
5
+ #
6
+ # @author Yorick Peterse
7
+ # @since 0.2.4
8
+ #
9
+ class ThemeError < StandardError; end
10
+ end
@@ -84,12 +84,18 @@ module Ramaze
84
84
  # should have ALL specified permissios. Setting this to false causes
85
85
  # this method to return true if any of the permissions are set for the
86
86
  # current user.
87
+ # @param [String] identifier A custom identifier to use for validating the user's
88
+ # permissions instead of using a class trait.
87
89
  # @return [Boolean]
88
90
  #
89
- def user_authorized?(reqs, require_all = true)
90
- identifier = ancestral_trait.values_at(:extension_identifier)
91
- identifier = identifier[0]
92
-
91
+ def user_authorized?(reqs, require_all = true, identifier = nil)
92
+ # Retrieve the identifier from the class trait if we didn't already have one
93
+ if identifier.nil?
94
+ identifier = ancestral_trait.values_at(:extension_identifier)
95
+ identifier = identifier[0]
96
+ end
97
+
98
+ # Still don't have an identifier?
93
99
  if identifier.nil?
94
100
  raise "You need to specify an extension identifier"
95
101
  end
@@ -122,6 +128,7 @@ module Ramaze
122
128
 
123
129
  return true
124
130
  end
131
+
125
132
  end
126
133
  end
127
134
  end
@@ -1,3 +1,5 @@
1
+ require __DIR__('error/language_error')
2
+
1
3
  #:nodoc:
2
4
  module Zen
3
5
  ##
@@ -107,7 +109,7 @@ module Zen
107
109
  end
108
110
  end
109
111
 
110
- raise "No language file could be found for \"#{lang_name}\""
112
+ raise(Zen::LanguageError, "No language file could be found for \"#{lang_name}\"")
111
113
  end
112
114
 
113
115
  ##
@@ -140,14 +142,20 @@ module Zen
140
142
  translations = ::Zen::Language.translations
141
143
 
142
144
  if !translations or !translations.key?(lang)
143
- raise "No translation files have been added for the language code \"#{lang}\""
145
+ raise(
146
+ Zen::LanguageError,
147
+ "No translation files have been added for the language code \"#{lang}\""
148
+ )
144
149
  end
145
150
 
146
151
  if translations[lang][key]
147
152
  return translations[lang][key]
148
153
  end
149
154
 
150
- raise "The specified language item \"#{key}\" does not exist"
155
+ raise(
156
+ Zen::LanguageError,
157
+ "The specified language item \"#{key}\" does not exist"
158
+ )
151
159
  end
152
160
 
153
161
  private
@@ -17,7 +17,10 @@
17
17
  doesn't have the required permissions for the extension that created it.
18
18
  -->
19
19
  <nav id="main_nav" class="grid_12">
20
- #{Zen::Package.build_menu("left")}
20
+ #{
21
+ perms = extension_permissions
22
+ Zen::Package.build_menu("left", perms[0], perms[1])
23
+ }
21
24
 
22
25
  <ul class="right clearfix">
23
26
  <li>
@@ -53,17 +56,23 @@
53
56
  <footer id="main_footer" class="container">
54
57
  <div class="grid_12">
55
58
  <p>#{lang('zen_general.labels.zen_version') % Zen::Version}</p>
56
- <p>
57
- <a href="http://zen-cms.com/">
58
- #{lang('zen_general.labels.zen_website')}
59
- </a> |
60
- <a href="http://zen-cms.com/documentation">
61
- #{lang('zen_general.labels.zen_docs')}
62
- </a> |
63
- <a href="https://github.com/zen-cms/">
64
- #{lang('zen_general.labels.zen_github')}
65
- </a>
66
- </p>
59
+ <ul class="clearfix">
60
+ <li>
61
+ <a href="http://zen-cms.com/">
62
+ #{lang('zen_general.labels.zen_website')}
63
+ </a>
64
+ </li>
65
+ <li>
66
+ <a href="http://zen-cms.com/documentation">
67
+ #{lang('zen_general.labels.zen_docs')}
68
+ </a>
69
+ </li>
70
+ <li>
71
+ <a href="https://github.com/zen-cms/">
72
+ #{lang('zen_general.labels.zen_github')}
73
+ </a>
74
+ </li>
75
+ </ul>
67
76
  </div>
68
77
  </footer>
69
78
 
@@ -23,17 +23,23 @@
23
23
  <footer id="main_footer" class="container">
24
24
  <div class="grid_12">
25
25
  <p>#{lang('zen_general.labels.zen_version') % Zen::Version}</p>
26
- <p>
27
- <a href="http://zen-cms.com/">
28
- #{lang('zen_general.labels.zen_website')}
29
- </a> |
30
- <a href="http://zen-cms.com/documentation">
31
- #{lang('zen_general.labels.zen_docs')}
32
- </a> |
33
- <a href="https://github.com/zen-cms/">
34
- #{lang('zen_general.labels.zen_github')}
35
- </a>
36
- </p>
26
+ <ul class="clearfix">
27
+ <li>
28
+ <a href="http://zen-cms.com/">
29
+ #{lang('zen_general.labels.zen_website')}
30
+ </a>
31
+ </li>
32
+ <li>
33
+ <a href="http://zen-cms.com/documentation">
34
+ #{lang('zen_general.labels.zen_docs')}
35
+ </a>
36
+ </li>
37
+ <li>
38
+ <a href="https://github.com/zen-cms/">
39
+ #{lang('zen_general.labels.zen_github')}
40
+ </a>
41
+ </li>
42
+ </ul>
37
43
  </div>
38
44
  </footer>
39
45