zena 0.15.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. data/History.txt +14 -0
  2. data/{README.txt → README.rdoc} +13 -19
  3. data/app/controllers/documents_controller.rb +7 -2
  4. data/app/controllers/nodes_controller.rb +4 -0
  5. data/app/models/iformat.rb +43 -1
  6. data/app/models/skin.rb +1 -2
  7. data/app/models/text_document.rb +2 -2
  8. data/app/models/version.rb +1 -0
  9. data/app/views/documents/new.rhtml +2 -2
  10. data/app/views/iformats/_form.rhtml +5 -4
  11. data/app/views/iformats/_li.rhtml +1 -0
  12. data/app/views/iformats/index.rhtml +1 -1
  13. data/app/views/nodes/_import_results.rhtml +1 -1
  14. data/app/views/nodes/edit.html.erb +2 -2
  15. data/app/views/templates/edit_tabs/_custom.rhtml +2 -2
  16. data/app/views/templates/edit_tabs/_document.rhtml +3 -3
  17. data/app/views/versions/_tr.rhtml +5 -6
  18. data/app/views/versions/edit.rhtml +2 -2
  19. data/bin/zena +2 -2
  20. data/bricks/captcha/patch/application_controller.rb +1 -1
  21. data/bricks/captcha/zafu/captcha.rb +1 -1
  22. data/config/deploy.rb +36 -380
  23. data/config/gems.yml +2 -7
  24. data/db/migrate/20091018200734_add_popup_info_to_image_format.rb +9 -0
  25. data/db/schema.rb +3 -2
  26. data/lib/gettext_strings.rb +8 -0
  27. data/lib/tasks/zena.rake +30 -12
  28. data/lib/zena/app.rb +2 -0
  29. data/{config → lib/zena/deploy}/awstats.conf.rhtml +0 -0
  30. data/{config → lib/zena/deploy}/database.rhtml +0 -0
  31. data/lib/zena/deploy/httpd.rhtml +22 -0
  32. data/{config → lib/zena/deploy}/start.html +2 -2
  33. data/{config → lib/zena/deploy}/stats.vhost.rhtml +0 -0
  34. data/{config/zena.rb → lib/zena/deploy/template.rb} +13 -8
  35. data/{config → lib/zena/deploy}/vhost.rhtml +28 -14
  36. data/{config → lib/zena/deploy}/vhost_www.rhtml +0 -0
  37. data/lib/zena/deploy.rb +377 -0
  38. data/lib/zena/info.rb +13 -0
  39. data/lib/zena/parser/zena_tags.rb +3 -0
  40. data/lib/zena/parser.rb +1 -0
  41. data/lib/zena/use/calendar.rb +2 -1
  42. data/lib/zena/use/dates.rb +6 -1
  43. data/lib/zena/use/fixtures.rb +9 -0
  44. data/lib/zena/use/html_tags.rb +44 -5
  45. data/lib/zena/use/node_query_finders.rb +1 -2
  46. data/lib/zena/use/refactor.rb +0 -13
  47. data/lib/zena/use/rendering.rb +13 -0
  48. data/lib/zena/use/zafu.rb +21 -9
  49. data/lib/zena.rb +4 -11
  50. data/locale/en/LC_MESSAGES/zena.mo +0 -0
  51. data/locale/en/zena.po +29 -1
  52. data/locale/fr/LC_MESSAGES/zena.mo +0 -0
  53. data/locale/fr/zena.po +29 -1
  54. data/locale/zena.pot +28 -0
  55. data/public/images/popup_next.png +0 -0
  56. data/public/images/popup_prev.png +0 -0
  57. data/public/javascripts/upload-progress.js +13 -3
  58. data/public/javascripts/zena.js +177 -23
  59. data/public/stylesheets/popup.css +5 -3
  60. data/public/stylesheets/zena.css +10 -1
  61. data/{lib/zena/use → test}/custom_queries/complex.host.yml +0 -0
  62. data/test/fixtures/iformats.yml +1 -0
  63. data/test/fixtures/nodes.yml +1 -1
  64. data/test/fixtures/versions.yml +3 -1
  65. data/test/sites/zena/iformats.yml +1 -0
  66. data/test/sites/zena/versions.yml +3 -1
  67. data/test/test_helper.rb +2 -0
  68. data/test/unit/iformat_test.rb +53 -1
  69. data/test/unit/text_document_test.rb +3 -0
  70. data/test/unit/zena/use/html_tags_test.rb +24 -2
  71. data/test/unit/zena/use/refactor_test.rb +0 -4
  72. data/test/unit/zena/use/zafu_test.rb +12 -0
  73. data/test/unit/zena/use/zazen_test.rb +6 -3
  74. data/test/unit/zena/zena_tags/basic.yml +3 -3
  75. data/vendor/apache2_upload_progress/MIT-LICENSE +22 -0
  76. data/vendor/apache2_upload_progress/README +53 -0
  77. data/vendor/apache2_upload_progress/mod_upload_progress.c +813 -0
  78. metadata +45 -45
  79. data/config/deploy_config_example.rb +0 -7
  80. data/config/httpd.rhtml +0 -18
  81. data/config/locales/de.yml +0 -120
  82. data/config/locales/fr-CH.yml +0 -123
  83. data/config/locales/fr.yml +0 -123
  84. data/lib/zena/root.rb +0 -3
data/config/deploy.rb CHANGED
@@ -1,382 +1,38 @@
1
- =begin
2
-
3
- Deployment 'recipe' for capistrano. Creates everything for your zena app.
4
-
5
- Assumed:
6
- - mysql root user has the same password as ssh
7
- - you are using apache 2.2+ (using balance_proxy)
8
- - server is running debian etch
9
- - you have installed subversion on the server (aptitude install subversion)
10
- - you have installed mysql on the server (aptitude install mysql...)
11
- - you have installed the required dependencies (see main README file)
12
-
13
- ========== USAGE ==========
14
-
15
- 1. Copy the file 'deploy_config_example.rb' to 'deploy_config.rb' and edit the entries in this new file.
16
- 2. Run => cap initial_setup
17
- 3. Run => cap mksite -s host='example.com' -s pass='secret' -s lang='en'
18
-
19
- If anything goes wrong, ask the mailing list (lists.zenadmin.org) or read the content of this file to understand what went wrong...
20
-
21
- And yes, 'pass' is not as intuitive as 'password' but we cannot use the latter because it's used for the ssh login.
22
-
23
-
24
- =end
25
- require 'erb'
26
-
27
- #================= ADVANCED SETTINGS =============#
28
-
29
- set :deploy_to, "/var/zena"
30
- set :zena_sites, "/var/www/zena"
31
- set :apache2_vhost_root, "/etc/apache2/sites-available"
32
- set :apache2_deflate, true
33
- set :apache2_debug_deflate, false
34
- set :apache2_debug_rewrite, false
35
- set :apache2_static, []
36
- set :apache2_reload_cmd, "/etc/init.d/apache2 reload"
37
- set :debian_host, true
38
- set :ssh_user, "root"
39
-
40
- load File.join(File.dirname(__FILE__), 'deploy_config')
41
-
42
- role :web, "#{ssh_user}@#{server_ip}"
43
- role :app, "#{ssh_user}@#{server_ip}"
44
- role :db, "#{ssh_user}@#{server_ip}", :primary => true
45
-
46
- #================= END ADVANCED SETTINGS ==========#
47
-
48
-
49
- # helper
50
- set :in_current, "cd #{deploy_to}/current &&"
51
- class RenderClass
52
- def initialize(path)
53
- @text = File.read(path)
54
- end
55
-
56
- def render(hash)
57
- @values = hash
58
- ERB.new(@text).result(binding)
59
- end
60
-
61
- def method_missing(sym)
62
- return @values[sym] if @values.has_key?(sym)
63
- super
64
- end
65
- end
66
-
67
- def render(file, hash)
68
- RenderClass.new(file).render(hash)
69
- end
70
-
71
- #========================== SOURCE CODE =========================#
72
-
73
-
74
- desc "set permissions to www-data"
75
- task :set_permissions, :roles => :app do
76
- run "chown -R www-data:www-data #{deploy_to}"
77
- run "chown -R www-data:www-data #{zena_sites}"
78
- end
79
-
80
- "Update the currently released version of the software directly via an SCM update operation"
81
- task :update_current do
82
- source.sync(revision, self[:release_path])
83
- end
84
-
85
- desc "clear all zafu compiled templates"
86
- task :clear_zafu, :roles => :app do
87
- run "#{in_current} rake zena:clear_zafu RAILS_ENV=production"
88
- end
89
-
90
- desc "clear all cache compiled templates"
91
- task :clear_cache, :roles => :app do
92
- run "#{in_current} rake zena:clear_cache RAILS_ENV=production"
93
- end
94
-
95
- desc "after code update"
96
- task :after_update, :roles => :app do
97
- app_update_symlinks
98
- db_update_config
99
- migrate
100
- clear_zafu
101
- clear_cache
102
- end
103
-
104
- desc "update symlink to 'sites' directory"
105
- task :app_update_symlinks, :roles => :app do
106
- run "test ! -e #{deploy_to}/current/sites || rm #{deploy_to}/current/sites"
107
- run "ln -sf #{zena_sites} #{deploy_to}/current/sites"
108
- set_permissions
109
- end
110
-
111
- desc "migrate database (zena version)"
112
- task :migrate, :roles => :db do
113
- run "#{in_current} rake zena:migrate RAILS_ENV=production"
114
- end
115
-
116
- desc "initial app setup"
117
- task :app_setup, :roles => :app do
118
- run "test -e #{deploy_to} || mkdir #{deploy_to}"
119
- run "test -e #{zena_sites} || mkdir #{zena_sites}"
120
- deploy::setup
121
- end
122
-
123
- #========================== MANAGE HOST =========================#
124
- desc "create a new site"
125
- task :mksite, :roles => :app do
126
- run "#{in_current} rake zena:mksite HOST='#{self[:host]}' PASSWORD='#{self[:pass]}' RAILS_ENV='production' LANG='#{self[:lang] || 'en'}'"
127
- create_vhost
128
- create_awstats
129
- set_permissions
130
- end
131
-
132
- desc "update code in the current version"
133
- task :up, :roles => :app do
134
- run "cd #{deploy_to}/current && svn up && (echo #{strategy.configuration[:real_revision]} > #{deploy_to}/current/REVISION)"
135
- db_update_config
136
- clear_zafu
137
- clear_cache
138
- migrate
139
- restart
140
- end
141
-
142
- desc "light update code (no migration, no clear)"
143
- task :lightup, :roles => :app do
144
- run "cd #{deploy_to}/current && svn up"
145
- restart
146
- end
147
-
148
- #========================== MONGREL ===============================#
149
- desc "configure mongrel"
150
- task :mongrel_setup, :roles => :app do
151
- 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"
152
- run "#{in_current} echo 'config_script: config/mongrel_upload_progress.conf' >> config/mongrel_cluster.yml"
153
- end
154
-
155
- desc "Stop the drb upload_progress server"
156
- task :stop_upload_progress , :roles => :app do
157
- run "#{in_current} ruby lib/upload_progress_server.rb stop"
158
- end
159
-
160
- desc "Start the drb upload_progress server"
161
- task :start_upload_progress , :roles => :app do
162
- run "#{in_current} lib/upload_progress_server.rb start"
163
- end
164
-
165
- desc "Restart the upload_progress server"
166
- task :restart_upload_progress, :roles => :app do
167
- stop_upload_progress
168
- start_upload_progress
169
- end
170
-
171
- desc "Start mongrel"
172
- task :start, :roles => :app do
173
- restart_upload_progress
174
- run "#{in_current} mongrel_rails cluster::start"
175
- end
176
-
177
- desc "Stop mongrel"
178
- task :stop, :roles => :app do
179
- stop_upload_progress
180
- run "#{in_current} mongrel_rails cluster::stop"
181
- end
182
-
183
- desc "Restart mongrel"
184
- task :restart, :roles => :app do
185
- stop
186
- restart_upload_progress
187
- start
188
- end
189
-
190
- #========================== APACHE2 ===============================#
191
- desc "Update vhost configuration file"
192
- task :create_vhost, :roles => :web do
193
- unless self[:host]
194
- puts "HOST not set (use -s host=...)"
195
- else
196
- vhost = render("config/vhost.rhtml",
197
- :host => self[:host],
198
- :static => apache2_static,
199
- :deflate => apache2_deflate,
200
- :debug_deflate => apache2_debug_deflate,
201
- :debug_rewrite => apache2_debug_rewrite,
202
- :balancer => db_name
203
- )
204
- put(vhost, "#{apache2_vhost_root}/#{self[:host]}")
205
-
206
- run "test -e /etc/apache2/sites-enabled/#{self[:host]} || a2ensite #{self[:host]}" if debian_host
207
-
208
- unless self[:host] =~ /^www/
209
- vhost_www = render("config/vhost_www.rhtml",
210
- :host => self[:host]
211
- )
212
- put(vhost_www, "#{apache2_vhost_root}/www.#{self[:host]}")
213
- run "test -e /etc/apache2/sites-enabled/www.#{self[:host]} || a2ensite www.#{self[:host]}" if debian_host
214
- end
215
- run apache2_reload_cmd
216
- end
217
- end
218
-
219
- #========================== APACHE2 ===============================#
220
- desc "Update awstats configuration file"
221
- task :create_awstats, :roles => :web do
222
- unless debian_host
223
- puts "skipping debian specific awstats"
224
- else
225
- unless self[:host] && self[:pass]
226
- puts "host or password not set (use -s host=... -s pass=...)"
227
- else
228
- # create awstats config file
229
- awstats_conf = render("config/awstats.conf.rhtml", :host => self[:host] )
230
- put(awstats_conf, "/etc/awstats/awstats.#{self[:host]}.conf")
231
- run "chown www-data:www-data /etc/awstats/awstats.#{self[:host]}.conf"
232
- run "chmod 640 /etc/awstats/awstats.#{self[:host]}.conf"
233
-
234
- # create stats vhost
235
- stats_vhost = render("config/stats.vhost.rhtml", :host => self[:host] )
236
- put(stats_vhost, "#{apache2_vhost_root}/stats.#{self[:host]}")
237
- run "test -e /etc/apache2/sites-enabled/stats.#{self[:host]} || a2ensite stats.#{self[:host]}"
238
-
239
- # directory setup for stats
240
- run "test -e #{zena_sites}/#{self[:host]}/log/awstats || mkdir #{zena_sites}/#{self[:host]}/log/awstats"
241
- run "chown www-data:www-data #{zena_sites}/#{self[:host]}/log/awstats"
242
-
243
- # setup cron task for awstats
244
- run "cat /etc/cron.d/awstats | grep \"#{self[:host]}\" || echo \"0,10,20,30,40,50 * * * * www-data [ -x /usr/lib/cgi-bin/awstats.pl -a -f /etc/awstats/awstats.#{self[:host]}.conf -a -r #{zena_sites}/#{self[:host]}/log/apache2.access.log ] && /usr/lib/cgi-bin/awstats.pl -config=#{self[:host]} -update >/dev/null\n\" >> /etc/cron.d/awstats"
245
-
246
- # create .htpasswd file
247
- run "test ! -e #{zena_sites}/#{self[:host]}/log/.awstatspw || rm #{zena_sites}/#{self[:host]}/log/.awstatspw"
248
- run "htpasswd -c -b #{zena_sites}/#{self[:host]}/log/.awstatspw 'admin' '#{self[:pass]}'"
249
-
250
- # reload apache
251
- run "/etc/init.d/apache2 reload"
252
- end
253
- end
254
- end
255
-
256
- desc "Rename a webhost"
257
- task :rename_host, :roles => :web do
258
- unless self[:host] && self[:old_host]
259
- puts "host or old_host not set (use -s host=... -s old_host=...)"
260
- else
261
- run "#{in_current} rake zena:rename_host OLD_HOST='#{self[:old_host]}' HOST='#{self[:host]}' RAILS_ENV='production'"
262
- old_vhost_path = "#{apache2_vhost_root}/#{self[:old_host]}"
263
- run "a2dissite #{self[:old_host]}"
264
- run "test -e #{old_vhost_path} && rm #{old_vhost_path}"
265
- # FIXME: remove old awstats vhost !!
266
- create_vhost
267
- create_awstats
268
- clear_zafu
269
- clear_cache
270
- set_permissions
271
- end
272
- end
273
-
274
- desc "Apache2 initial setup"
275
- task :apache2_setup, :roles => :web do
276
- ports = (mongrel_port.to_i...(mongrel_port.to_i + mongrel_count.to_i)).to_a
277
- httpd_conf = render("config/httpd.rhtml", :balancer => db_name, :ports => ports)
278
- if debian_host
279
- put(httpd_conf, "/etc/apache2/conf.d/#{db_name}")
280
- else
281
- put(httpd_conf, "/etc/apache2/conf.d/#{db_name}")
282
- end
283
-
284
- run "test -e /etc/apache2/sites-enabled/000-default && a2dissite default || echo 'default already disabled'"
285
- run "test -e /etc/apache2/mods-enabled/rewrite.load || a2enmod rewrite"
286
- run "test -e /etc/apache2/mods-enabled/deflate.load || a2enmod deflate"
287
- run "test -e /etc/apache2/mods-enabled/proxy_balancer.load || a2enmod proxy_balancer"
288
- run "test -e /etc/apache2/mods-enabled/proxy.load || a2enmod proxy"
289
- run "test -e /etc/apache2/mods-enabled/proxy_http.load || a2enmod proxy_http"
290
- run "test -e /etc/apache2/mods-enabled/expires.load || a2enmod expires"
291
- run "/etc/init.d/apache2 force-reload"
292
- end
293
-
294
- #========================== MYSQL ===============================#
295
-
296
- desc "set database.yml file according to settings"
297
- task :db_update_config, :roles => :app do
298
- db_app_config = render("config/database.rhtml",
299
- :db_name => db_name,
300
- :db_user => db_user,
301
- :db_password => db_password
302
- )
303
- put(db_app_config, "#{deploy_to}/current/config/database.yml")
304
- end
305
-
306
- desc "create database"
307
- task :db_create, :roles => :db do
308
- on_rollback do
309
- run "mysql -u root -p -e \"DROP DATABASE #{db_name};\"" do |channel, stream, data|
310
- if data =~ /^Enter password:\s*/m
311
- logger.info "#{channel[:host]} asked for password"
312
- channel.send_data "#{password}\n"
313
- end
314
- puts data
315
- end
316
- end
317
-
318
- run "mysql -u root -p -e \"CREATE DATABASE #{db_name} DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; GRANT ALL ON #{db_name}.* TO '#{db_user}'@'localhost' IDENTIFIED BY '#{db_password}';\"" do |channel, stream, data|
319
- if data =~ /^Enter password:\s*/m
320
- logger.info "#{channel[:host]} asked for password"
321
- channel.send_data "#{password}\n"
322
- end
323
- puts data
324
- end
325
- end
326
-
327
- desc "initial database setup"
328
- task :db_setup, :roles => :db do
329
- transaction do
330
- db_create
331
- end
332
- end
333
-
334
-
335
- desc "Full initial setup"
336
- task :initial_setup do
337
- transaction do
338
- app_setup
339
-
340
- db_setup
341
-
342
- deploy::update
343
-
344
- mongrel_setup
345
-
346
- apache2_setup
347
-
348
- set_permissions
349
-
350
- start
351
- end
1
+ set :db_name, "zena" # If you change this: no dots in this name !
2
+ set :server_ip, nil # FIXME: set this to your remote server IP in the form: "215.0.0.1"
3
+ set :mongrel_port, "8000"
4
+ set :mongrel_count, "3"
5
+ set :db_password, nil # FIXME: set password (can be anything).
6
+ set :db_user, "zena"
7
+ set :repository, "http://svn.zenadmin.org/zena/trunk"
8
+
9
+ if self[:server_ip]
10
+ #================= ADVANCED SETTINGS =============#
11
+
12
+ set :deploy_to, "/var/zena"
13
+ set :sites_root, "/var/www/zena"
14
+ set :vhost_root, "/etc/apache2/sites-available"
15
+ set :deflate, true
16
+ set :debug_deflate, false
17
+ set :debug_rewrite, false
18
+ set :static, []
19
+ set :apache2_reload_cmd, "/etc/init.d/apache2 reload"
20
+ set :debian_host, true
21
+ set :ssh_user, "root"
22
+
23
+ role :web, "#{ssh_user}@#{server_ip}"
24
+ role :app, "#{ssh_user}@#{server_ip}"
25
+ role :db, "#{ssh_user}@#{server_ip}", :primary => true
26
+
27
+ #================= END ADVANCED SETTINGS ==========#
28
+ require 'zena/deploy'
29
+
30
+ else
31
+ puts <<-TXT
32
+ ***********************************************************
33
+ You should fix your configurations file 'config/deploy.rb'
34
+ before running capistrano
35
+ ***********************************************************
36
+ TXT
352
37
  end
353
38
 
354
- desc "Database dump"
355
- task :db_dump, :roles => :db do
356
- run "mysqldump #{db_name} -u root -p > #{deploy_to}/current/#{db_name}.sql" do |channel, stream, data|
357
- if data =~ /^Enter password:\s*/m
358
- logger.info "#{channel[:host]} asked for password"
359
- channel.send_data "#{password}\n"
360
- end
361
- puts data
362
- end
363
- run "#{in_current} tar czf #{db_name}.sql.tgz #{db_name}.sql"
364
- run "#{in_current} rm #{db_name}.sql"
365
- end
366
-
367
- desc "Get backup file back"
368
- task :get_backup, :roles => :app do
369
- get "#{deploy_to}/current/#{db_name}_data.tgz", "./#{db_name}_#{Time.now.strftime '%Y-%m-%d-%H'}.tgz"
370
- end
371
-
372
- # FIXME: backup not loading data for every site...
373
- desc "Backup all data and bring it backup here"
374
- task :backup, :roles => :app do
375
- db_dump
376
- # key track of the current svn revision for app
377
-
378
- run "#{in_current} svn info > #{deploy_to}/current/zena_version.txt"
379
- run "#{in_current} rake zena:full_backup RAILS_ENV='production'"
380
- run "#{in_current} tar czf #{db_name}_data.tgz #{db_name}.sql.tgz sites_data.tgz zena_version.txt"
381
- get_backup
382
- end
data/config/gems.yml CHANGED
@@ -1,10 +1,10 @@
1
1
  hpricot:
2
2
  gettext: '= 1.93.0'
3
3
  querybuilder: '= 0.5.6'
4
- rubyless: '= 0.3.2'
4
+ rubyless: '= 0.3.3'
5
5
  ruby-recaptcha: '= 1.0.0'
6
6
  syntax: '= 1.0.0'
7
- tzinfo: '= 0.3.12'
7
+ tzinfo: '>= 0.3.12'
8
8
  uuidtools: '= 2.0.0'
9
9
  rails: '= 2.3.4'
10
10
  json: '>= 1.1.9'
@@ -17,12 +17,7 @@ RedCloth:
17
17
  # lib: 'RMagick'
18
18
  # version: '= 2.11.1'
19
19
 
20
- sqlite3-ruby:
21
- lib: 'sqlite3'
22
- version: '>= 1.2.4'
23
-
24
20
  yamltest:
25
- development_only: yes
26
21
  version: '= 0.5.3'
27
22
 
28
23
  grosser-fast_gettext:
@@ -0,0 +1,9 @@
1
+ class AddPopupInfoToImageFormat < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :iformats, :popup, :string, :limit => 120
4
+ end
5
+
6
+ def self.down
7
+ remove_column :iformats, :popup
8
+ end
9
+ end
data/db/schema.rb CHANGED
@@ -1,4 +1,4 @@
1
- # This file is auto-generated from the current state of the database. Instead of editing this file,
1
+ # This file is auto-generated from the current state of the database. Instead of editing this file,
2
2
  # please use the migrations feature of Active Record to incrementally modify your database, and
3
3
  # then regenerate this schema definition.
4
4
  #
@@ -9,7 +9,7 @@
9
9
  #
10
10
  # It's strongly recommended to check this file into your version control system.
11
11
 
12
- ActiveRecord::Schema.define(:version => 20091014183726) do
12
+ ActiveRecord::Schema.define(:version => 20091018200734) do
13
13
 
14
14
  create_table "cached_pages", :force => true do |t|
15
15
  t.text "path"
@@ -134,6 +134,7 @@ ActiveRecord::Schema.define(:version => 20091014183726) do
134
134
  t.integer "gravity"
135
135
  t.integer "width"
136
136
  t.integer "height"
137
+ t.string "popup", :limit => 120
137
138
  end
138
139
 
139
140
  create_table "links", :force => true do |t|
@@ -89,6 +89,14 @@ module Zena
89
89
  N_('status_10') # removed
90
90
  N_('status_0') # deleted
91
91
 
92
+ N_('status_50_img') # published
93
+ N_('status_60_img') # proposed
94
+ N_('status_65_img') # proposed with
95
+ N_('status_70_img') # redaction
96
+ N_('status_20_img') # replaced
97
+ N_('status_10_img') # removed
98
+ N_('status_0_img') # deleted
99
+
92
100
  N_('en')
93
101
  N_('fr')
94
102
  N_('de')
data/lib/tasks/zena.rake CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'yaml'
2
2
  require 'fileutils'
3
3
 
4
- require File.join(File.dirname(__FILE__), '..', 'zena.rb') # to have Zena::ROOT
4
+ require File.join(File.dirname(__FILE__), '..', 'zena', 'info') # to have Zena::ROOT
5
5
 
6
6
  def symlink_assets(from, to)
7
7
  from = File.expand_path(from)
@@ -12,7 +12,7 @@ def symlink_assets(from, to)
12
12
  # we could create a symlink in the sites dir to 'shared' -> /var/zena/current/public
13
13
  # and then symlink with "#{host_path}/public/#{dir}" -> "../shared/public/#{dir}"
14
14
  # OR we could symlink /var/zena/current/...
15
- ['calendar', 'images', 'javascripts', 'stylesheets', 'icons'].each do |dir|
15
+ ['calendar', 'images', 'javascripts', 'stylesheets'].each do |dir|
16
16
  File.unlink("#{to}/public/#{dir}") if File.symlink?("#{to}/public/#{dir}")
17
17
  if File.exist?("#{to}/public/#{dir}")
18
18
  if File.directory?("#{to}/public/#{dir}")
@@ -39,23 +39,41 @@ def copy_assets(from, to)
39
39
  from = File.expand_path(from)
40
40
  to = File.expand_path(to)
41
41
  return if from == to
42
+ ['config/mongrel_upload_progress.conf', 'lib/upload_progress_server.rb', 'config/deploy.rb', 'db/migrate/*.rb', 'public/**/*'].each do |base_path|
43
+ if base_path =~ /\*/
44
+ Dir["#{from}/#{base_path}"].each do |path|
45
+ path = path[(from.length + 1)..-1]
46
+ next if File.directory?(path)
47
+ copy_files("#{from}/#{path}", "#{to}/#{path}")
48
+ end
49
+ else
50
+ copy_files("#{from}/#{base_path}", "#{to}/#{base_path}")
51
+ end
52
+ end
53
+ end
42
54
 
43
- ['config/mongrel_upload_progress.conf', 'lib/upload_progress_server.rb'].each do |path|
44
- FileUtils.cp("#{from}/#{path}", "#{to}/#{path}") unless File.exist?("#{to}/#{path}")
55
+ def copy_files(from, to)
56
+ base = File.dirname(to)
57
+ unless File.exist?(base)
58
+ FileUtils.mkpath(base)
59
+ end
60
+ if File.directory?(from)
61
+ Dir.foreach(from) do |f|
62
+ next if f =~ /\A./
63
+ copy_files("#{from}/#{f}", "#{to}/#{f}")
64
+ end
65
+ else
66
+ FileUtils.cp(from, base)
45
67
  end
46
68
  end
47
69
 
48
70
  namespace :zena do
49
- desc "Setup a new zena application (symlink static assets, check routes, etc)"
50
- task :setup => :zena_config do
51
- puts "zena:setup"
71
+ desc "Copy latest assets from zena gem to application (images, stylesheets, javascripts)."
72
+ task :assets => :zena_config do
52
73
  if Zena::ROOT == RAILS_ROOT
53
74
  puts "Copy assets should only be used when zena is loaded externally (via gem for example)."
54
75
  else
55
- symlink_assets(Zena::ROOT, RAILS_ROOT)
56
- puts "* symlinked assets"
57
76
  copy_assets(Zena::ROOT, RAILS_ROOT)
58
- puts "* copied assets"
59
77
  end
60
78
  end
61
79
 
@@ -103,7 +121,7 @@ namespace :zena do
103
121
  FileUtils.mkpath("#{host_path}/#{dir}")
104
122
  end
105
123
 
106
- symlink_assets(Zena::ROOT, host_path)
124
+ symlink_assets(RAILS_ROOT, host_path)
107
125
  end
108
126
  end
109
127
 
@@ -210,7 +228,7 @@ namespace :zena do
210
228
  end
211
229
  else
212
230
  # migrate all to latest
213
- paths = {'zena' => "#{Zena::ROOT}/db/migrate"}
231
+ paths = {'zena' => "#{RAILS_ROOT}/db/migrate"}
214
232
  bricks = ['zena']
215
233
 
216
234
  Bricks::Patcher.foreach_brick do |brick_path|
data/lib/zena/app.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require File.join(File.dirname(__FILE__), 'info')
1
2
  module Zena
2
3
  module App
3
4
  def self.included(base)
@@ -28,6 +29,7 @@ module Zena
28
29
  helper Zena::Use::I18n::ViewMethods
29
30
  helper Zena::Use::NestedAttributesAlias::ViewMethods
30
31
  helper Zena::Use::Refactor::ViewMethods
32
+ helper Zena::Use::Rendering::ViewMethods
31
33
  helper Zena::Use::Urls::ViewMethods
32
34
  helper Zena::Use::Zafu::ViewMethods
33
35
  helper Zena::Use::Zazen::ViewMethods
File without changes
File without changes
@@ -0,0 +1,22 @@
1
+ # zena apache2 setup for <%= config[:balancer] %>
2
+ # automatically generated file
3
+
4
+ NameVirtualHost *
5
+ <% if config[:app_type] == :passenger %>
6
+ LoadModule upload_progress_module <%= config[:app_root] %>/vendor/apache2_upload_progress/mod_upload_progress.so
7
+ <% elsif config[:app_type] == :mongrel %>
8
+ <Proxy *>
9
+ Order allow,deny
10
+ Allow from all
11
+ </Proxy>
12
+ <Proxy balancer://<%= config[:balancer] %>><% config[:ports].each do |port| %>
13
+ BalancerMember http://127.0.0.1:<%= port %><% end %>
14
+ </Proxy>
15
+ <% end %>
16
+
17
+ <ifmodule mode_expires.c>
18
+ <filesmatch "\.(jpg|gif|png|css|js)$">
19
+ ExpiresActive on
20
+ ExpiresDefault "access plus 1 year"
21
+ </filesmatch>
22
+ </ifmodule>
@@ -3,8 +3,8 @@
3
3
  <html lang='en' xmlns='http://www.w3.org/1999/xhtml'>
4
4
  <head>
5
5
  <title>zena</title>
6
- <script src="../public/javascripts/prototype.js" type="text/javascript"></script>
7
- <script src="../public/javascripts/effects.js" type="text/javascript"></script>
6
+ <script src="../../../public/javascripts/prototype.js" type="text/javascript"></script>
7
+ <script src="../../../public/javascripts/effects.js" type="text/javascript"></script>
8
8
 
9
9
  <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
10
10
  <style>
File without changes
@@ -1,17 +1,22 @@
1
1
  require 'digest/sha1'
2
- require 'zena/root'
2
+ require 'zena/info'
3
3
  # This is a rails template to generate a basic zena application
4
4
 
5
5
  run 'rm public/index.html'
6
6
 
7
- gem 'zena'
7
+ gem 'zena', :version => Zena::VERSION
8
8
  route 'map.zen_routes'
9
9
 
10
10
  rakefile("zena_tasks.rake") do
11
- <<-TASK
12
- require 'zena'
13
- require 'tasks/zena'
14
- TASK
11
+ <<-TASK
12
+ # sync zena tasks to gem version
13
+ env = File.read(File.join(File.dirname(__FILE__), '..', '..', 'config', 'environment.rb'))
14
+ if env =~ /config.gem.*zena.*version.*'(.*?)'/
15
+ gem 'zena', "= \#{$1}"
16
+ end
17
+ require 'zena'
18
+ require 'tasks/zena'
19
+ TASK
15
20
  end
16
21
 
17
22
  ['development', 'test', 'production'].each do |env|
@@ -27,13 +32,13 @@ inside('app/controllers') do
27
32
  end
28
33
  end
29
34
 
30
- rake "zena:setup"
35
+ rake 'zena:assets'
31
36
  rake 'db:create'
32
37
  rake 'zena:migrate'
33
38
  rake "zena:mksite HOST='localhost' PASSWORD='admin' LANG='en'"
34
39
  inside('.') do
35
40
  run 'rake zena:migrate RAILS_ENV=production'
36
41
  run "rake zena:mksite HOST='localhost' PASSWORD='admin' LANG='en' RAILS_ENV=production"
37
- run "#{Gem.win_platform? ? 'start' : 'open'} #{File.join(Zena::ROOT, 'config', 'start.html')}"
42
+ run "#{Gem.win_platform? ? 'start' : 'open'} #{File.join(Zena::ROOT, 'lib/zena/deploy/start.html')}"
38
43
  exec "script/server -e production -p 3211"
39
44
  end