zena 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +28 -0
- data/README.rdoc +6 -6
- data/Rakefile +3 -0
- data/app/controllers/users_controller.rb +4 -2
- data/app/models/acl.rb +6 -0
- data/app/models/cached_page.rb +2 -1
- data/app/models/document.rb +3 -4
- data/app/models/node.rb +8 -5
- data/app/models/site.rb +1 -1
- data/app/models/template.rb +2 -2
- data/app/models/user.rb +5 -3
- data/app/views/acls/_add.rhtml +2 -1
- data/app/views/acls/_form.rhtml +15 -7
- data/app/views/acls/_li.rhtml +2 -0
- data/app/views/acls/index.rhtml +3 -1
- data/app/views/acls/show.html.erb +1 -1
- data/app/views/links/destroy.rjs +16 -2
- data/app/views/versions/destroy.rjs +1 -1
- data/app/views/zafu/default/Node-admin.zafu +1 -1
- data/bin/zena +5 -3
- data/bricks/acls/lib/bricks/acls.rb +11 -4
- data/bricks/acls/zena/migrate/20110627193757_add_allowed_mode_and_format_to_acl.rb +11 -0
- data/bricks/acls/zena/test/integration/acl_integration_test.rb +42 -0
- data/bricks/acls/zena/test/sites/erebus/acls.yml +8 -0
- data/bricks/mongrel/zena/deploy.rb +19 -0
- data/bricks/single/lib/bricks/single.rb +15 -0
- data/bricks/single/zena/init.rb +1 -0
- data/bricks/sphinx/zena/tasks.rb +1 -1
- data/bricks/static/lib/bricks/static.rb +151 -0
- data/bricks/static/zena/init.rb +1 -0
- data/bricks/static/zena/migrate/20110702010330_add_static_to_idx_templates.rb +12 -0
- data/bricks/static/zena/skins/blog/Image-edit.zafu +6 -0
- data/bricks/static/zena/skins/blog/Image.zafu +19 -0
- data/bricks/static/zena/skins/blog/Node-+index.zafu +1 -0
- data/bricks/static/zena/skins/blog/Node-+notFound.zafu +7 -0
- data/bricks/static/zena/skins/blog/Node-+search.zafu +19 -0
- data/bricks/static/zena/skins/blog/Node.zafu +66 -0
- data/bricks/static/zena/skins/blog/Post.zafu +12 -0
- data/bricks/static/zena/skins/blog/Project--kml.zafu +30 -0
- data/bricks/static/zena/skins/blog/Project.zafu +45 -0
- data/bricks/static/zena/skins/blog/comments.zafu +30 -0
- data/bricks/static/zena/skins/blog/dict.yml +11 -0
- data/bricks/static/zena/skins/blog/img/dateBg.jpg +0 -0
- data/bricks/static/zena/skins/blog/img/header.png +0 -0
- data/bricks/static/zena/skins/blog/img/mapPin.png +0 -0
- data/bricks/static/zena/skins/blog/img/menu.gif +0 -0
- data/bricks/static/zena/skins/blog/img/menuover.gif +0 -0
- data/bricks/static/zena/skins/blog/img/style.css +110 -0
- data/bricks/static/zena/test/integration/static_integration_test.rb +30 -0
- data/bricks/static/zena/test/unit/static_test.rb +33 -0
- data/bricks/zena/zena/migrate/01_base.rb +1 -2
- data/bricks/zena/zena/migrate/20110623072048_fix_cached_path_index.rb +10 -0
- data/bricks/zena/zena/migrate/20110710113731_remove_icon_field.rb +18 -0
- data/config/bricks.yml +4 -0
- data/config/deploy.rb +17 -2
- data/config/gems.yml +9 -7
- data/config/selenium.yml +38 -0
- data/lib/bricks/requirements_validation.rb +8 -2
- data/lib/gettext_strings.rb +2 -1
- data/lib/tasks/zena.rake +5 -0
- data/lib/zena/app.rb +12 -0
- data/lib/zena/console.rb +9 -1
- data/lib/zena/core_ext/string.rb +7 -2
- data/lib/zena/deploy.rb +60 -6
- data/lib/zena/deploy/app_init.rhtml +56 -0
- data/lib/zena/deploy/haproxy.cnf.rhtml +34 -0
- data/lib/zena/deploy/httpd.rhtml +6 -0
- data/lib/zena/deploy/start_stop.rhtml +35 -0
- data/lib/zena/info.rb +1 -1
- data/lib/zena/remote/connection.rb +1 -1
- data/lib/zena/site_worker.rb +9 -5
- data/lib/zena/use.rb +1 -1
- data/lib/zena/use/action.rb +2 -2
- data/lib/zena/use/ajax.rb +22 -9
- data/lib/zena/use/conditional.rb +5 -0
- data/lib/zena/use/context.rb +6 -1
- data/lib/zena/use/dates.rb +17 -2
- data/lib/zena/use/display.rb +14 -3
- data/lib/zena/use/forms.rb +37 -47
- data/lib/zena/use/html_tags.rb +3 -0
- data/lib/zena/use/node_context.rb +17 -17
- data/lib/zena/use/rendering.rb +1 -1
- data/lib/zena/use/urls.rb +11 -2
- data/lib/zena/use/zafu_attributes.rb +1 -0
- data/lib/zena/use/zafu_safe_definitions.rb +16 -1
- data/lib/zena/use/zafu_templates.rb +39 -24
- data/lib/zena/use/zazen.rb +1 -0
- data/locale/de/LC_MESSAGES/zena.mo +0 -0
- data/locale/de/zena.po +105 -89
- data/locale/en/LC_MESSAGES/zena.mo +0 -0
- data/locale/en/zena.mo +0 -0
- data/locale/en/zena.po +188 -253
- data/locale/fr/LC_MESSAGES/zena.mo +0 -0
- data/locale/fr/zena.mo +0 -0
- data/locale/fr/zena.po +200 -257
- data/locale/zena.pot +95 -85
- data/public/javascripts/zena.js +2 -2
- data/test/fixtures/files/{Node-test.zafu → TestNode.zafu} +206 -4
- data/test/functional/nodes_controller_test.rb +2 -2
- data/test/integration/navigation_test.rb +9 -3
- data/test/integration/query_node/basic.yml +4 -4
- data/test/integration/query_node/filters.yml +2 -2
- data/test/integration/zafu_compiler/ajax.yml +6 -6
- data/test/integration/zafu_compiler/basic.yml +1 -1
- data/test/integration/zafu_compiler/calendar.yml +4 -3
- data/test/integration/zafu_compiler/conditional.yml +3 -10
- data/test/integration/zafu_compiler/context.yml +1 -1
- data/test/integration/zafu_compiler/dates.yml +9 -1
- data/test/integration/zafu_compiler/display.yml +7 -1
- data/test/integration/zafu_compiler/eval.yml +12 -46
- data/test/integration/zafu_compiler/forms.yml +1 -1
- data/test/integration/zafu_compiler/query.yml +2 -2
- data/test/integration/zafu_compiler/relations.yml +19 -9
- data/test/integration/zafu_compiler/roles.yml +12 -0
- data/test/integration/zafu_compiler/safe_definitions.yml +1 -1
- data/test/integration/zafu_compiler/urls.yml +13 -5
- data/test/integration/zafu_compiler/version.yml +6 -0
- data/test/integration/zafu_compiler/zafu_attributes.yml +4 -4
- data/test/integration/zafu_compiler_test.rb +1 -1
- data/test/selenium.readme +8 -0
- data/test/selenium/Add/0setup.rsel +12 -0
- data/test/selenium/Add/add1.rsel +22 -0
- data/test/selenium/Add/add2.rsel +22 -0
- data/test/selenium/Add/add3.rsel +22 -0
- data/test/selenium/Drop/0setup.rsel +12 -0
- data/test/selenium/Drop/drop1.rsel +25 -0
- data/test/selenium/Drop/drop2.rsel +25 -0
- data/test/selenium/Drop/drop3.rsel +51 -0
- data/test/selenium/Drop/drop4.rsel +44 -0
- data/test/selenium/Drop/drop5.rsel +16 -0
- data/test/selenium/Edit/0setup.rsel +12 -0
- data/test/selenium/Edit/edit1.rsel +31 -0
- data/test/selenium/Edit/edit2.rsel +39 -0
- data/test/selenium/Edit/edit3.rsel +40 -0
- data/test/selenium/Form/0setup.rsel +12 -0
- data/test/selenium/Form/form1.rsel +9 -0
- data/test/selenium/Form/form2.rsel +9 -0
- data/test/selenium/Paginate/0setup.rsel +12 -0
- data/test/selenium/Paginate/paginate1.rsel +24 -0
- data/test/selenium/Toggle/0setup.rsel +12 -0
- data/test/selenium/Toggle/toggle1.rsel +21 -0
- data/test/sites/zena/nodes.yml +4 -4
- data/test/sites/zena/roles.yml +3 -2
- data/test/sites/zena/versions.yml +12 -11
- data/test/unit/core_ext_test.rb +23 -5
- data/test/unit/document_test.rb +6 -2
- data/test/unit/node_test.rb +2 -2
- data/test/unit/remote_test.rb +1 -2
- data/test/unit/role_test.rb +2 -2
- data/test/unit/user_test.rb +48 -1
- data/test/unit/virtual_class_test.rb +7 -7
- data/test/unit/zena/acts/secure_test.rb +1 -1
- data/test/unit/zena/use/rendering_test.rb +1 -1
- data/test/unit/zena/use/urls_test.rb +3 -3
- data/zena.gemspec +65 -101
- metadata +67 -103
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run 2.tmCommand +0 -24
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run Context.tmCommand +0 -58
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run Focused Should.tmCommand +0 -88
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run.tmCommand +0 -27
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/YAML to Shoulda.tmCommand +0 -23
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Preferences/Symbol List: Context.tmPreferences +0 -19
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Preferences/Symbol List: Should.tmPreferences +0 -19
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory attributes for.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory build.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_define with class.tmSnippet +0 -18
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_define.tmSnippet +0 -18
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_next.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_sequence.tmSnippet +0 -18
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_bad_value.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_contains.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_does_not_contain.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_good_value.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_same_elements.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_save.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_sent_email.tmSnippet +0 -18
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_valid.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/association.tmSnippet +0 -17
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/attribute.tmSnippet +0 -17
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/before_should block.tmSnippet +0 -18
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/context block get.tmSnippet +0 -22
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/context block post.tmSnippet +0 -23
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/context block with setup.tmSnippet +0 -25
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/setup.tmSnippet +0 -18
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should block with before proc.tmSnippet +0 -18
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should block.tmSnippet +0 -18
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_allow_values_for.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_assign_to.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_be_restful denied.tmSnippet +0 -20
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_be_restful.tmSnippet +0 -20
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_belong_to.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_change by.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_change from to.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_length_at_least.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_length_in_range.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_length_is.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_value_in_range.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_eventually.tmSnippet +0 -18
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_filter_params.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_and_belong_to_many.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_class_methods.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_db_column.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_db_columns.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_index.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_indices.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_instance_methods.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_many.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_named_scope.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_one.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_readonly_attributes.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_allow_mass_assignment_of.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_allow_values_for.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_assign_to.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_change.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_set_the_flash.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_redirect_to.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_a_form.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_template.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_with_layout.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_without_layout.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_respond_with.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_respond_with_content_type.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_return_from_session.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_route.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_set_the_flash_to.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_acceptance_of.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_numericality_of.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_presence_of.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_uniqueness_of with scope.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_uniqueness_of.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/catch_exception.rb +0 -39
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/run_script.rb +0 -104
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/stdin_dialog.rb +0 -14
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/test.rb +0 -17
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/todo.txt +0 -13
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/bin/yaml_to_shoulda.rb +0 -25
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Syntaxes/Ruby on Rails (Shoulda).tmLanguage +0 -166
- data/vendor/TextMate/Ruby Shoulda.tmbundle/info.plist +0 -304
- data/vendor/TextMate/Zena.tmbundle/Commands/Run all yaml tests.tmCommand +0 -37
- data/vendor/TextMate/Zena.tmbundle/Commands/Run focused yaml test.tmCommand +0 -52
- data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/catch_exception.rb +0 -39
- data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/run_script.rb +0 -118
- data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/stdin_dialog.rb +0 -14
- data/vendor/TextMate/Zena.tmbundle/info.plist +0 -17
@@ -0,0 +1,11 @@
|
|
1
|
+
class AddAllowedModeAndFormatToAcl < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :acls, :mode, :string, :limit => 20
|
4
|
+
add_column :acls, :format, :string, :limit => 20
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.down
|
8
|
+
remove_column :acls, :mode
|
9
|
+
remove_column :acls, :format
|
10
|
+
end
|
11
|
+
end
|
@@ -56,6 +56,48 @@ class AclIntegrationTest < Zena::Integration::TestCase
|
|
56
56
|
assert_match %r{Persephone, Wedding organization}, response.body
|
57
57
|
end
|
58
58
|
|
59
|
+
context 'with fixed mode' do
|
60
|
+
setup do
|
61
|
+
Zena::Db.execute "UPDATE acls SET mode = 'foo' WHERE id = #{acls_id(:rap)}"
|
62
|
+
login(:hades)
|
63
|
+
# Create special mode template
|
64
|
+
secure(Template) { Template.create(:parent_id => nodes_id(:sky), :title => 'Node-foo', :text => 'foo <r:title/>') }
|
65
|
+
post 'http://erebus.host/session', :login=>'demeter', :password=>'demeter'
|
66
|
+
end
|
67
|
+
|
68
|
+
should 'not allow another mode' do
|
69
|
+
get "http://erebus.host/oo/project#{nodes_zip(:queen)}.html"
|
70
|
+
assert_response :missing
|
71
|
+
end
|
72
|
+
|
73
|
+
should 'allow given mode' do
|
74
|
+
get "http://erebus.host/oo/project#{nodes_zip(:queen)}_foo.html"
|
75
|
+
assert_response :success
|
76
|
+
assert_equal 'foo My Queen', response.body
|
77
|
+
end
|
78
|
+
end # with fixed mode
|
79
|
+
|
80
|
+
context 'with fixed format' do
|
81
|
+
setup do
|
82
|
+
Zena::Db.execute "UPDATE acls SET format = 'csv' WHERE id = #{acls_id(:rap)}"
|
83
|
+
login(:hades)
|
84
|
+
# Create special mode template
|
85
|
+
secure(Template) { Template.create(:parent_id => nodes_id(:sky), :title => 'Node--csv', :text => 'foo;<r:title/>') }
|
86
|
+
post 'http://erebus.host/session', :login=>'demeter', :password=>'demeter'
|
87
|
+
end
|
88
|
+
|
89
|
+
should 'not allow another mode' do
|
90
|
+
get "http://erebus.host/oo/project#{nodes_zip(:queen)}.html"
|
91
|
+
assert_response :missing
|
92
|
+
end
|
93
|
+
|
94
|
+
should 'allow given mode' do
|
95
|
+
get "http://erebus.host/oo/project#{nodes_zip(:queen)}.csv"
|
96
|
+
assert_response :success
|
97
|
+
assert_equal 'foo;My Queen', response.body
|
98
|
+
end
|
99
|
+
end # with fixed format
|
100
|
+
|
59
101
|
context 'using zafu ajax' do
|
60
102
|
setup do
|
61
103
|
@zafu_url = "http://erebus.host/nodes/#{nodes_zip(:queen)}/zafu?t_url=Sky%20view/Node/list1&dom_id=list1"
|
@@ -12,6 +12,10 @@ rap:
|
|
12
12
|
# and viewing it through the 'sky' Skin.
|
13
13
|
exec_skin: sky
|
14
14
|
priority: 10
|
15
|
+
# allow any mode
|
16
|
+
mode: '*'
|
17
|
+
# allow any format
|
18
|
+
format: '*'
|
15
19
|
|
16
20
|
# Read self (this never matches)
|
17
21
|
self:
|
@@ -27,3 +31,7 @@ self:
|
|
27
31
|
# and viewing it through the 'sky' Skin.
|
28
32
|
exec_skin: sky
|
29
33
|
priority: 5
|
34
|
+
# allow any mode
|
35
|
+
mode: '*'
|
36
|
+
# allow any format
|
37
|
+
format: '*'
|
@@ -8,7 +8,20 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
8
8
|
##############################################################################}
|
9
9
|
else
|
10
10
|
#========================== MONGREL ===============================#
|
11
|
+
|
12
|
+
self[:ports] = (mongrel_port.to_i...(mongrel_port.to_i + mongrel_count.to_i)).to_a
|
13
|
+
|
11
14
|
namespace :app do
|
15
|
+
desc "create haproxy config"
|
16
|
+
task :haproxy_setup, :roles => :app do
|
17
|
+
unless debian_host
|
18
|
+
puts "skipping 'logrotate' (debian specific)"
|
19
|
+
else
|
20
|
+
# Create config/haproxy.cnf
|
21
|
+
haproxy_cnf = render("#{templates}/haproxy.cnf.rhtml", :config => self)
|
22
|
+
put(haproxy_cnf, "#{deploy_to}/current/config/haproxy.cnf")
|
23
|
+
end
|
24
|
+
end
|
12
25
|
|
13
26
|
desc "configure mongrel"
|
14
27
|
task :configure, :roles => :app do
|
@@ -28,6 +41,12 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
28
41
|
|
29
42
|
run "#{in_current} mongrel_rails cluster::configure -e production -p #{mongrel_port} -N #{mongrel_count} -c #{deploy_to}/current -P log/mongrel.pid -l log/mongrel.log -a 127.0.0.1 --user www-data --group www-data"
|
30
43
|
run "#{in_current} echo 'config_script: config/mongrel_upload_progress.conf' >> config/mongrel_cluster.yml"
|
44
|
+
|
45
|
+
if self[:haproxy_port]
|
46
|
+
# Setup haproxy
|
47
|
+
haproxy_setup
|
48
|
+
end
|
49
|
+
|
31
50
|
end
|
32
51
|
|
33
52
|
desc "Stop the drb upload_progress server"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Bricks
|
2
|
+
module Single
|
3
|
+
module SiteMethods
|
4
|
+
def self.included(base)
|
5
|
+
base.class_eval do
|
6
|
+
alias_method_chain :public_path, :single
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def public_path_with_single
|
11
|
+
"/../public"
|
12
|
+
end
|
13
|
+
end # SiteMethods
|
14
|
+
end # Single
|
15
|
+
end # Bricks
|
@@ -0,0 +1 @@
|
|
1
|
+
Zena.use Bricks::Single
|
data/bricks/sphinx/zena/tasks.rb
CHANGED
@@ -68,7 +68,7 @@ namespace :sphinx do
|
|
68
68
|
config = YAML.load_file(File.join(RAILS_ROOT, 'config', 'sphinx.yml'))[RAILS_ENV]
|
69
69
|
every = config['run_indexer_at'] || '10,40'
|
70
70
|
res = `crontab -l 2>&1`
|
71
|
-
if $? != 0 || res =~ /
|
71
|
+
if $? != 0 || res =~ /\Acrontab/
|
72
72
|
puts "Sphinx indexer: could not access crontab (#{res.chomp})"
|
73
73
|
else
|
74
74
|
crontab = res.chomp.split("\n")
|
@@ -0,0 +1,151 @@
|
|
1
|
+
module Bricks
|
2
|
+
module Static
|
3
|
+
ELEM = "([a-zA-Z_]+)"
|
4
|
+
ELEM_REGEXP = %r{^#{ELEM}$}
|
5
|
+
SECURE_PATH_REGEXP = %r{^[a-zA-Z_/]+$}
|
6
|
+
STATIC_SKIN_REGEXP = %r{^#{ELEM}-#{ELEM}$}
|
7
|
+
ZAFU_URL_REGEXP = %r{^\$#{ELEM}-#{ELEM}/(.+)$}
|
8
|
+
BRICK_NAME_REGEXP = %r{^#{RAILS_ROOT}/bricks/#{ELEM}/zena/skins$}
|
9
|
+
|
10
|
+
module ControllerMethods
|
11
|
+
def self.included(base)
|
12
|
+
base.alias_method_chain :get_template_text, :static
|
13
|
+
base.alias_method_chain :template_url_for_asset, :static
|
14
|
+
base.alias_method_chain :get_best_template, :static
|
15
|
+
end
|
16
|
+
|
17
|
+
def get_template_text_with_static(path, section_id = nil)
|
18
|
+
if path =~ ZAFU_URL_REGEXP
|
19
|
+
brick_name, skin_name, path = $1, $2, $3
|
20
|
+
text_from_static(brick_name, skin_name, path)
|
21
|
+
elsif section_id.nil? && @static_brick_name && @static_skin_name
|
22
|
+
text_from_static(@static_brick_name, @static_skin_name, path)
|
23
|
+
else
|
24
|
+
get_template_text_without_static(path, section_id)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def template_url_for_asset_with_static(opts)
|
29
|
+
# TODO
|
30
|
+
template_url_for_asset_without_static(opts)
|
31
|
+
end
|
32
|
+
|
33
|
+
def get_best_template_with_static(kpaths, format, mode, skin)
|
34
|
+
return get_best_template_without_static(kpaths, format, mode, skin) unless static = skin.z_static
|
35
|
+
if idx_template = IdxTemplate.first(
|
36
|
+
:conditions => ["tkpath IN (?) AND format = ? AND mode #{mode ? '=' : 'IS'} ? AND (skin_id = ? OR static = ?) AND site_id = ?",
|
37
|
+
kpaths, format, mode, skin.id, static, skin.site_id],
|
38
|
+
:order => "length(tkpath) DESC, skin_id DESC"
|
39
|
+
)
|
40
|
+
if idx_template.path.nil?
|
41
|
+
template = secure(Template) { Template.find(idx_template.node_id) }
|
42
|
+
get_best_template_without_static(kpaths, format, mode, skin, template)
|
43
|
+
elsif static =~ STATIC_SKIN_REGEXP
|
44
|
+
@static_brick_name, @static_skin_name = $1, $2
|
45
|
+
if idx_template.path =~ SECURE_PATH_REGEXP
|
46
|
+
zafu_url = "$#{@static_brick_name}-#{@static_skin_name}/#{idx_template.path}"
|
47
|
+
template = Template.new
|
48
|
+
template.tkpath = idx_template.tkpath
|
49
|
+
[zafu_url, template]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# TODO
|
56
|
+
# Asset resolution: route = /static/static-blog/img/style.css
|
57
|
+
# ===> static brick ==> brick path
|
58
|
+
# ===> blog/img/style.css ==> brick path/zena/skins/ blog/img/style.css
|
59
|
+
# Cache in public directory
|
60
|
+
# FIXME: clear_cache should erase /home/static
|
61
|
+
|
62
|
+
private
|
63
|
+
def text_from_static(brick_name, skin_name, path)
|
64
|
+
if path =~ SECURE_PATH_REGEXP
|
65
|
+
abs_path = File.join(
|
66
|
+
RAILS_ROOT, 'bricks', brick_name,
|
67
|
+
'zena', 'skins', skin_name, path + '.zafu')
|
68
|
+
File.exist?(abs_path) ? File.read(abs_path) : nil
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end # ControllerMethods
|
72
|
+
|
73
|
+
module SkinMethods
|
74
|
+
def self.included(base)
|
75
|
+
base.property do |p|
|
76
|
+
p.string 'z_static'
|
77
|
+
end
|
78
|
+
|
79
|
+
base.validate :validate_z_static
|
80
|
+
end
|
81
|
+
|
82
|
+
private
|
83
|
+
def validate_z_static
|
84
|
+
if !(z_static.nil? || z_static =~ STATIC_SKIN_REGEXP)
|
85
|
+
errors.add(:z_static, _('invalid'))
|
86
|
+
end
|
87
|
+
true
|
88
|
+
end
|
89
|
+
end # SkinMethods
|
90
|
+
|
91
|
+
module SiteMethods
|
92
|
+
def self.included(base)
|
93
|
+
base.alias_method_chain :rebuild_index, :static
|
94
|
+
end
|
95
|
+
|
96
|
+
def rebuild_index_with_static(nodes = nil, page = nil, page_count = nil) if !page
|
97
|
+
Zena::SiteWorker.perform(self, :rebuild_static_index, nil)
|
98
|
+
end
|
99
|
+
rebuild_index_without_static(nodes, page, page_count)
|
100
|
+
end
|
101
|
+
|
102
|
+
def rebuild_static_index
|
103
|
+
Zena::Db.execute "DELETE FROM idx_templates WHERE node_id IS NULL AND site_id = #{id}"
|
104
|
+
Bricks.paths_for('zena/skins').each do |p|
|
105
|
+
if p =~ BRICK_NAME_REGEXP
|
106
|
+
brick_name = $1
|
107
|
+
list = []
|
108
|
+
Dir.foreach(p) do |skin_name|
|
109
|
+
if skin_name =~ ELEM_REGEXP
|
110
|
+
build_static_index(brick_name, skin_name, "#{p}/#{skin_name}")
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
private
|
118
|
+
def build_static_index(brick_name, skin_name, path)
|
119
|
+
# path = absolute path
|
120
|
+
# 1. Find all templates
|
121
|
+
Dir.foreach(path) do |elem|
|
122
|
+
next if elem =~ /^\./
|
123
|
+
elem_path = File.join(path, elem)
|
124
|
+
if File.directory?(elem_path)
|
125
|
+
build_static_index(brick_name, skin_name, elem_path)
|
126
|
+
elsif elem =~ Template::MODE_FORMAT_FROM_TITLE
|
127
|
+
# 2. Get klass, mode, format
|
128
|
+
klass = $1
|
129
|
+
mode = $4.blank? ? nil : $4
|
130
|
+
format = $6 || 'html'
|
131
|
+
idx_path = elem_path[%r{^#{RAILS_ROOT}/bricks/#{brick_name}/zena/skins/#{skin_name}/(.+)\.zafu$}, 1]
|
132
|
+
# 3. Get kpath
|
133
|
+
if idx_path && vclass = VirtualClass[klass]
|
134
|
+
tkpath = vclass.kpath
|
135
|
+
|
136
|
+
# 4. insert idx_template entry (kpath, site_id, mode, format, path relative to bricks/brick/zena/skins/skin_name)
|
137
|
+
IdxTemplate.create(
|
138
|
+
:tkpath => tkpath,
|
139
|
+
:mode => mode,
|
140
|
+
:format => format,
|
141
|
+
:site_id => id,
|
142
|
+
:static => "#{brick_name}-#{skin_name}",
|
143
|
+
:path => idx_path
|
144
|
+
)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end # SiteMethods
|
150
|
+
end # Static
|
151
|
+
end # Bricks
|
@@ -0,0 +1 @@
|
|
1
|
+
Zena.use Bricks::Static
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class AddStaticToIdxTemplates < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :idx_templates, :static, :string, :limit => 30
|
4
|
+
add_column :idx_templates, :path, :string, :limit => 300
|
5
|
+
add_index :idx_templates, [:static], :name => "index_idx_templates_on_static"
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.down
|
9
|
+
remove_index :idx_templates, :name => "index_idx_templates_on_static"
|
10
|
+
remove_column :idx_templates, :static
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<r:include template='Image'>
|
2
|
+
<r:with part='location' do='form'>
|
3
|
+
<r:input type='hidden' name='v_status' value='50'/>
|
4
|
+
<a href='http://maps.google.com' target='_blank'>google maps</a>: lat <r:input name='d_gps_latitude'/> lon <r:input name='d_gps_longitude'/><r:input type='submit' value='valider'/>
|
5
|
+
</r:with>
|
6
|
+
</r:include>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<r:include template='Node'>
|
2
|
+
<r:with part='title'>
|
3
|
+
<h1 do='title' actions='all'/>
|
4
|
+
<div id='location'>
|
5
|
+
<r:case>
|
6
|
+
<r:when test='gps_latitude'>
|
7
|
+
<!-- iframe width="200" height="200" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" style='float:left;' do='void' set_src="http://maps.google.com/maps?q=[d_gps_latitude],[d_gps_longitude]&ie=UTF8&t=h&ll=[d_gps]&z=7&iwloc=A&output=embed"></iframe -->
|
8
|
+
<p>
|
9
|
+
<a target='_blank' do='void' set_href="http://maps.google.com/maps?q=#{gps_latitude},#{gps_longitude}&ie=UTF8&t=h&hq=&ll=#{gps_latitude},#{gps_longitude}&z=7&iwloc=A&source=embed"><r:img src='find(97)'/> voir sur la carte</a> <r:if test='can_write?'>(<r:link mode='edit' do='t'>modifier</r:link>)</r:if>
|
10
|
+
</p>
|
11
|
+
<p class='clear'> </p>
|
12
|
+
</r:when>
|
13
|
+
<r:when can='write'>
|
14
|
+
<r:link mode='edit' do='t'><r:img src='97'/> ajouter la position gps</r:link>
|
15
|
+
</r:when>
|
16
|
+
</r:case>
|
17
|
+
</div>
|
18
|
+
</r:with>
|
19
|
+
</r:include>
|
@@ -0,0 +1 @@
|
|
1
|
+
<r:include template='Project'/>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<r:include template='Node'>
|
2
|
+
<r:with part='main_content'>
|
3
|
+
|
4
|
+
<h2 do='t'>search results</h2>
|
5
|
+
|
6
|
+
<ul id='search_results' do='search_results'>
|
7
|
+
<li class='result_entry' do='each'>
|
8
|
+
<p class='result_image' do='if' kind_of='Document'> <r:link format='data' do='img' alt_src='icon' mode='pv'/><r:else do='img' alt_src='icon' mode='pv' link='self'/></p>
|
9
|
+
<p class='result_name'><r:link/></p>
|
10
|
+
<p class='result_path'><r:show attr='rootpath'/></p>
|
11
|
+
<r:summary/>
|
12
|
+
<div class='clear'></div>
|
13
|
+
</li>
|
14
|
+
<r:else>
|
15
|
+
<p do='trans'>no result found</p>
|
16
|
+
</r:else>
|
17
|
+
</ul>
|
18
|
+
</r:with>
|
19
|
+
</r:include>
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" do='load' dictionary='dict'>
|
3
|
+
<head>
|
4
|
+
<title do='root' do='title'>Website Title</title>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
+
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
|
7
|
+
<r:void name='stylesheets' do='stylesheets'/>
|
8
|
+
<r:javascripts/>
|
9
|
+
<r:uses_datebox/>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
|
13
|
+
<div id="content">
|
14
|
+
<r:root>
|
15
|
+
<div id="header">
|
16
|
+
<p id='logo' do='link' do='t'> </p>
|
17
|
+
</div>
|
18
|
+
<div id="navigation">
|
19
|
+
<ul>
|
20
|
+
<li do='link' do='t'>Home</li>
|
21
|
+
<li do='menus' do='each' do='link'/>
|
22
|
+
<li id='search' do='search_box'/>
|
23
|
+
<li class='visitor' do='if' test='can_write?'><r:visitor_link/> - <r:login_link/></li>
|
24
|
+
</ul>
|
25
|
+
</div>
|
26
|
+
</r:root>
|
27
|
+
<div id="right">
|
28
|
+
<div id='photos' do='images'>
|
29
|
+
<h2>photos</h2>
|
30
|
+
<ul>
|
31
|
+
<li do='each' do='if' test='can_write?'><r:link do='img' mode='pve'/><r:else do='img' mode='pv'/></li>
|
32
|
+
<li do='add_document'/>
|
33
|
+
</ul>
|
34
|
+
</div>
|
35
|
+
<r:void name='latest_comments'/>
|
36
|
+
<div id='pages' do='nodes'>
|
37
|
+
<h2>pages</h2>
|
38
|
+
<ul>
|
39
|
+
<li do='each' do='link'/>
|
40
|
+
<li do='add' klass='Page'/>
|
41
|
+
</ul>
|
42
|
+
</div>
|
43
|
+
<div id='documents' do='Skin?' do='documents'>
|
44
|
+
<h2>documents</h2>
|
45
|
+
<ul>
|
46
|
+
<li do='each' do='link'/>
|
47
|
+
<li do='add_document'/>
|
48
|
+
</ul>
|
49
|
+
</div>
|
50
|
+
</div>
|
51
|
+
|
52
|
+
<div id="main">
|
53
|
+
<div id='main_content'>
|
54
|
+
<r:void name='title'><h1 do='title' actions='all'/></r:void>
|
55
|
+
<r:Image? do='if' test='exif.gps_latitude'><a href='http://maps.google.com?ll=#{exif.gps_latitude},#{exif.gps_longitude}&z=11' do='title'/></r:Image?>
|
56
|
+
<r:zazen attr='text' code='#{content_lang}' else='summary'/>
|
57
|
+
</div>
|
58
|
+
</div>
|
59
|
+
<div style="clear: both;"> </div>
|
60
|
+
|
61
|
+
<div id="footer">
|
62
|
+
© Copyright <a href="#">Static blog</a> | <r:zena type='made'/> | <r:login_link/>
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
</body>
|
66
|
+
</html>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<r:include template='Node'>
|
2
|
+
<r:with part='main'>
|
3
|
+
<ul id='main_content'>
|
4
|
+
<li do='include' template='Project' part='post'>
|
5
|
+
<r:with part='text'>
|
6
|
+
<r:zazen attr='text' live='true'/>
|
7
|
+
<r:include template='comments'/>
|
8
|
+
</r:with>
|
9
|
+
</r:include>
|
10
|
+
</ul>
|
11
|
+
</r:with>
|
12
|
+
</r:include>
|