zena 1.0.0.rc1 → 1.0.0.rc2

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.
@@ -1,3 +1,11 @@
1
+ == 1.0.0.rc2 2011-02-14
2
+
3
+ * major changes
4
+ * Fixed Template bug with special '+' modes.
5
+ * Fixed migration bug (should use NULL as brick name for app).
6
+ * Fixed custom query loading bug (when brick is not activated).
7
+ * Fixed Mongrel bug (incompatibility with Rails 2.3.8).
8
+
1
9
  == 1.0.0.rc1 2011-02-11
2
10
 
3
11
  * major changes
@@ -29,7 +29,7 @@ class Template < TextDocument
29
29
  'skin_id' => record[:section_id],
30
30
  }
31
31
  end
32
-
32
+
33
33
  safe_property :tkpath, :mode, :target_klass, :format
34
34
  end
35
35
 
@@ -67,7 +67,7 @@ class Template < TextDocument
67
67
  if title =~ /^([A-Z][a-zA-Z]+?)(-(([a-zA-Z_\+]*)(-([a-zA-Z_]+)|))|)(\.|\Z)/
68
68
  # title changed force update
69
69
  prop['target_klass'] = $1 unless prop.target_klass_changed?
70
- prop['mode'] = ($4 || '').url_name unless prop.mode_changed?
70
+ prop['mode'] = ($4 || '') unless prop.mode_changed?
71
71
  prop['format'] = ($6 || 'html') unless prop.format_changed?
72
72
  else
73
73
  # title set but it is not a master template name
@@ -78,7 +78,7 @@ class Template < TextDocument
78
78
  end
79
79
 
80
80
  if version.edited?
81
- prop['mode'] = prop['mode'].gsub(/[^a-zA-Z]/, '') if prop['mode']
81
+ prop['mode'] = prop['mode'].gsub(/[^a-zA-Z\+]/, '') if prop['mode']
82
82
 
83
83
  if !prop['target_klass'].blank?
84
84
  # update title
@@ -19,7 +19,7 @@ Capistrano::Configuration.instance(:must_exist).load do
19
19
  asset_port = Bricks.raw_config['asset_port']
20
20
  if asset_port == self[:mongrel_port].to_i - 1
21
21
  mongrel_port = asset_port
22
- mongrel_count = self[:mongrel_count] + 1
22
+ mongrel_count = self[:mongrel_count].to_i + 1
23
23
  elsif asset_port.nil?
24
24
  # no asset port: OK.
25
25
  else
@@ -0,0 +1,85 @@
1
+ # This fixes a bug between Rails 2.3.8 and Mongrel
2
+ # Error calling Dispatcher.dispatch #<NoMethodError: undefined method `[]' for nil:NilClass>
3
+ #
4
+ if Rails.version == '2.3.8' && Gem.available?('mongrel', Gem::Requirement.new('~>1.1.5')) && self.class.const_defined?(:Mongrel)
5
+
6
+ # Pulled right from latest rack. Old looked like this in 1.1.0 version.
7
+ #
8
+ # def [](k)
9
+ # super(@names[k] ||= @names[k.downcase])
10
+ # end
11
+ #
12
+ module Rack
13
+ module Utils
14
+ class HeaderHash < Hash
15
+ def [](k)
16
+ super(@names[k]) if @names[k]
17
+ super(@names[k.downcase])
18
+ end
19
+ end
20
+ end
21
+ end
22
+
23
+ # Code pulled from the ticket above.
24
+ #
25
+ class Mongrel::CGIWrapper
26
+ def header_with_rails_fix(options = 'text/html')
27
+ @head['cookie'] = options.delete('cookie').flatten.map { |v| v.sub(/^\n/,'') } if options.class != String and options['cookie']
28
+ header_without_rails_fix(options)
29
+ end
30
+ alias_method_chain :header, :rails_fix
31
+ end
32
+
33
+ # Pulled right from 2.3.8 ActionPack. Simple diff was
34
+ #
35
+ # if headers.include?('Set-Cookie')
36
+ # headers['cookie'] = headers.delete('Set-Cookie').split("\n")
37
+ # end
38
+ #
39
+ # to
40
+ #
41
+ # if headers['Set-Cookie']
42
+ # headers['cookie'] = headers.delete('Set-Cookie').split("\n")
43
+ # end
44
+ #
45
+ module ActionController
46
+ class CGIHandler
47
+ def self.dispatch_cgi(app, cgi, out = $stdout)
48
+ env = cgi.__send__(:env_table)
49
+ env.delete "HTTP_CONTENT_LENGTH"
50
+ cgi.stdinput.extend ProperStream
51
+ env["SCRIPT_NAME"] = "" if env["SCRIPT_NAME"] == "/"
52
+ env.update({
53
+ "rack.version" => [0,1],
54
+ "rack.input" => cgi.stdinput,
55
+ "rack.errors" => $stderr,
56
+ "rack.multithread" => false,
57
+ "rack.multiprocess" => true,
58
+ "rack.run_once" => false,
59
+ "rack.url_scheme" => ["yes", "on", "1"].include?(env["HTTPS"]) ? "https" : "http"
60
+ })
61
+ env["QUERY_STRING"] ||= ""
62
+ env["HTTP_VERSION"] ||= env["SERVER_PROTOCOL"]
63
+ env["REQUEST_PATH"] ||= "/"
64
+ env.delete "PATH_INFO" if env["PATH_INFO"] == ""
65
+ status, headers, body = app.call(env)
66
+ begin
67
+ out.binmode if out.respond_to?(:binmode)
68
+ out.sync = false if out.respond_to?(:sync=)
69
+ headers['Status'] = status.to_s
70
+ if headers['Set-Cookie']
71
+ headers['cookie'] = headers.delete('Set-Cookie').split("\n")
72
+ end
73
+ out.write(cgi.header(headers))
74
+ body.each { |part|
75
+ out.write part
76
+ out.flush if out.respond_to?(:flush)
77
+ }
78
+ ensure
79
+ body.close if body.respond_to?(:close)
80
+ end
81
+ end
82
+ end
83
+ end
84
+
85
+ end
@@ -26,7 +26,9 @@ input { padding:3px 4px;}
26
26
  .summary p { margin:0; font-style:italic; font-family:Georgia,Times,serif;}
27
27
  #context { width:180px; float:left; border-right:1px solid grey;}
28
28
  #context a { color:#aaa; }
29
+ #context .admin_links a { color:inherit; }
29
30
  #context a:hover { color:#04a; }
31
+ #context .admin_links a:hover { color:inherit; }
30
32
  ol { padding-left:14px;}
31
33
 
32
34
  #content { margin-left: 200px; }
@@ -21,13 +21,18 @@ module Bricks
21
21
  !File.exist?(f)
22
22
  end
23
23
  end
24
-
24
+
25
+ # Find all paths matching 'sub_path' in the active bricks.
26
+ def paths_for(sub_path)
27
+ bricks.map {|f| Dir["#{f}/#{sub_path}"] }.flatten
28
+ end
29
+
25
30
  def models_paths
26
- bricks.map {|f| Dir["#{f}/models"] }.flatten
31
+ paths_for('models')
27
32
  end
28
33
 
29
34
  def init_paths
30
- bricks.map {|f| Dir["#{f}/zena/init.rb"] }.flatten
35
+ paths_for('zena/init.rb')
31
36
  end
32
37
 
33
38
  def migrations_for(brick)
@@ -39,15 +44,13 @@ module Bricks
39
44
  end
40
45
 
41
46
  def zafu_tests
42
- ["#{Zena::ROOT}/bricks/*/zena/test/zafu", "#{RAILS_ROOT}/bricks/*/zena/test/zafu"]
47
+ paths_for('zena/test/zafu')
43
48
  end
44
49
 
45
50
  def test_files
46
- [
47
- 'bricks/*/zena/test/unit/*_test.rb',
48
- 'bricks/*/zena/test/functional/*_test.rb',
49
- 'bricks/*/zena/test/integration/*_test.rb',
50
- ]
51
+ paths_for('zena/test/unit/*_test.rb') +
52
+ paths_for('zena/test/functional/*_test.rb') +
53
+ paths_for('zena/test/integration/*_test.rb')
51
54
  end
52
55
 
53
56
  # FIXME: remove
@@ -273,7 +273,7 @@ namespace :zena do
273
273
  paths['_app'] = "#{RAILS_ROOT}/db/migrate"
274
274
 
275
275
  bricks.each do |brick_name, path|
276
- Zena::Migrator.migrate(paths[brick_name], brick_name, nil)
276
+ Zena::Migrator.migrate(paths[brick_name], brick_name == '_app' ? nil : brick_name, nil)
277
277
  end
278
278
  #ActiveRecord::Migrator.migrate("db/migrate/", nil)
279
279
  end
@@ -1,4 +1,4 @@
1
1
  module Zena
2
- VERSION = '1.0.0.rc1'
2
+ VERSION = '1.0.0.rc2'
3
3
  ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
4
4
  end
@@ -105,7 +105,7 @@ module Zena
105
105
  after_process :insert_links_fields
106
106
  after_process :secure_query
107
107
 
108
- load_custom_queries ["#{RAILS_ROOT}/bricks/*/queries"]
108
+ load_custom_queries Bricks.paths_for('queries')
109
109
 
110
110
  CORE_CONTEXTS = %w{parent project section}
111
111
 
@@ -264,9 +264,21 @@ class NodesControllerTest < Zena::Controller::TestCase
264
264
  end # with a bad value
265
265
 
266
266
  end # by changing skin
267
-
267
+
268
268
  end # updating a node
269
+
270
+ # ======================================= Template update
271
+ context 'updating a template' do
272
+ subject do
273
+ {:action => 'update', :controller => 'nodes', :id => nodes_zip(:Node_zafu), :node => {:mode => '+index'}}
274
+ end
269
275
 
276
+ should 'update template with new mode' do
277
+ put_subject
278
+ assert_equal '+index', assigns(:node).mode
279
+ end
280
+ end # updating a template
281
+
270
282
  context 'using xml' do
271
283
  context 'without being in the api_group' do
272
284
  setup do
@@ -31,6 +31,11 @@ class SiteTest < Zena::Unit::TestCase
31
31
 
32
32
  # should return a new project as root node
33
33
  assert_kind_of Project, subject.root_node
34
+
35
+ # should install base skin
36
+ index_zafu = secure(Node) { subject.root_node.find(:first, "template where title like 'Node%login' in site") }
37
+ assert_kind_of Template, index_zafu
38
+ assert_equal '+login', index_zafu.mode
34
39
  end
35
40
  end
36
41
 
@@ -134,7 +134,7 @@ class TemplateTest < Zena::Unit::TestCase
134
134
 
135
135
  context 'with a format' do
136
136
  subject do
137
- secure(Template) { Template.create(:parent_id=>nodes_id(:default), :title => 'Node-tree', :format => 'xml') }
137
+ secure(Template) { Template.create(:parent_id => nodes_id(:default), :title => 'Node-tree', :format => 'xml') }
138
138
  end
139
139
 
140
140
  should 'use format in title' do
@@ -143,6 +143,30 @@ class TemplateTest < Zena::Unit::TestCase
143
143
  end
144
144
  end # with a blank title
145
145
 
146
+ context 'with a special mode' do
147
+ subject do
148
+ secure(Template) { Template.create(:parent_id => nodes_id(:default), :title => 'Node', :mode => '+edit') }
149
+ end
150
+
151
+ should 'use mode in title' do
152
+ assert !subject.new_record?
153
+ assert_equal 'Node-+edit', subject.title
154
+ end
155
+
156
+ context 'in the title' do
157
+ subject do
158
+ secure(Template) { Template.create(:parent_id => nodes_id(:default), :title => 'Node-+index') }
159
+ end
160
+
161
+ should 'description' do
162
+ assert_difference('Template.count', 1) do
163
+ assert_equal '+index', subject.mode
164
+ end
165
+ end
166
+ end # in the title
167
+
168
+ end # with a special mode
169
+
146
170
  context 'with class format and mode in title' do
147
171
  subject do
148
172
  secure!(Document) { Document.create(:parent_id => nodes_id(:default), :title => 'Project-collab-xml.zafu')}
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{zena}
8
- s.version = "1.0.0.rc1"
8
+ s.version = "1.0.0.rc2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Gaspard Bucher"]
12
- s.date = %q{2011-02-11}
12
+ s.date = %q{2011-02-14}
13
13
  s.default_executable = %q{zena}
14
14
  s.description = %q{zena is a Ruby on Rails CMS (content managment system) with a focus on usability, ease of customization and web 2.0 goodness (application like behaviour).}
15
15
  s.email = %q{gaspard@teti.ch}
@@ -272,6 +272,7 @@ Gem::Specification.new do |s|
272
272
  "bricks/math/zena/init.rb",
273
273
  "bricks/mongrel/README",
274
274
  "bricks/mongrel/zena/deploy.rb",
275
+ "bricks/mongrel/zena/init.rb",
275
276
  "bricks/passenger/README",
276
277
  "bricks/passenger/zena/deploy.rb",
277
278
  "bricks/pdf/.document",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zena
3
3
  version: !ruby/object:Gem::Version
4
- hash: 977940574
4
+ hash: 977940575
5
5
  prerelease: true
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
9
  - 0
10
- - rc1
11
- version: 1.0.0.rc1
10
+ - rc2
11
+ version: 1.0.0.rc2
12
12
  platform: ruby
13
13
  authors:
14
14
  - Gaspard Bucher
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-02-11 00:00:00 +01:00
19
+ date: 2011-02-14 00:00:00 +01:00
20
20
  default_executable: zena
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -614,6 +614,7 @@ files:
614
614
  - bricks/math/zena/init.rb
615
615
  - bricks/mongrel/README
616
616
  - bricks/mongrel/zena/deploy.rb
617
+ - bricks/mongrel/zena/init.rb
617
618
  - bricks/passenger/README
618
619
  - bricks/passenger/zena/deploy.rb
619
620
  - bricks/pdf/.document