radiant 0.6.8 → 0.6.9

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of radiant might be problematic. Click here for more details.

data/CHANGELOG CHANGED
@@ -1,10 +1,21 @@
1
1
  == Change Log
2
2
 
3
+ === 0.6.9 Etch
4
+ * Make <r:random> accept dynamically generated options. [Jim Gay, Sean Cribbs]
5
+ * Correctly set default 'inherit' to false on <r:unless_content> [Mark A. Yoon]
6
+ * Correct authenticity token errors when using cookie session store [Sean
7
+ Cribbs]
8
+ * Make script/extension executable. [Sean Cribbs]
9
+ * Correct bugs in radiant:freeze:edge task. [Sean Cribbs]
10
+ * Fix strange Page subclass loading errors in development mode. [Sean Cribbs]
11
+ * Fix typo in if_content description. [Jim Gay]
12
+ * Correct error in radiant:update:configs task. [Sean Cribbs]
13
+
3
14
  === 0.6.8 Incise
4
15
  * Hide page publish date selector unless page.edit.published_date? config is
5
16
  set. [Sean Cribbs]
6
17
  * Add <r:yield /> tag to support snippets that accept blocks. [Andrew Neil]
7
- * Fix bug with FileNotFoundPage subclasses and draft status. [cradle]
18
+ * Fix bug with FileNotFoundPage subclasses and draft status. [Glenn Murray]
8
19
  * Update radiant:freeze:edge task to support BRANCH, TAG, and REVISION. [John
9
20
  Muhl]
10
21
  * Update to Haml 2.0.1. [Jim Gay]
@@ -4,9 +4,14 @@
4
4
  The following people have submitted changes which have been applied to the
5
5
  core:
6
6
 
7
+ === 0.6.9 Etch
8
+ * Mark A. Yoon
9
+ * Jim Gay
10
+ * Sean Cribbs
11
+
7
12
  === 0.6.8 Incise
8
13
  * Andrew Neil
9
- * cradle
14
+ * Glenn Murray
10
15
  * Tim Gossett
11
16
  * John Muhl
12
17
  * Josh French
@@ -5,7 +5,7 @@ class ApplicationController < ActionController::Base
5
5
 
6
6
  filter_parameter_logging :password, :password_confirmation
7
7
 
8
- protect_from_forgery :secret => "sweet-harmonious-biscuits"
8
+ protect_from_forgery
9
9
 
10
10
  before_filter :set_current_user
11
11
  before_filter :set_javascripts_and_stylesheets
@@ -188,13 +188,16 @@ class Page < ActiveRecord::Base
188
188
  def load_subclasses
189
189
  ([RADIANT_ROOT] + Radiant::Extension.descendants.map(&:root)).each do |path|
190
190
  Dir["#{path}/app/models/*_page.rb"].each do |page|
191
- require page
192
191
  $1.camelize.constantize if page =~ %r{/([^/]+)\.rb}
193
192
  end
194
193
  end
195
194
  unless Page.connection.tables.empty? # Haven't bootstrapped yet
196
195
  Page.connection.select_values("SELECT DISTINCT class_name FROM pages WHERE class_name <> '' AND class_name IS NOT NULL").each do |p|
197
- eval(%Q{class #{p} < Page; def self.missing?; true end end}, TOPLEVEL_BINDING) unless Object.const_defined?(p)
196
+ begin
197
+ p.constantize
198
+ rescue NameError, LoadError
199
+ eval(%Q{class #{p} < Page; def self.missing?; true end end}, TOPLEVEL_BINDING)
200
+ end
198
201
  end
199
202
  end
200
203
  end
@@ -277,7 +277,7 @@ module StandardTags
277
277
  desc %{
278
278
  Renders the containing elements if all of the listed parts exist on a page.
279
279
  By default the @part@ attribute is set to @body@, but you may list more than one
280
- part by seprating them with a comma. Setting the optional @inherit@ to true will
280
+ part by separating them with a comma. Setting the optional @inherit@ to true will
281
281
  search ancestors independently for each part. By default @inherit@ is set to @false@.
282
282
 
283
283
  When listing more than one part, you may optionally set the @find@ attribute to @any@
@@ -320,13 +320,13 @@ module StandardTags
320
320
  By default the @find@ attribute is set to @all@.
321
321
 
322
322
  *Usage:*
323
- <pre><code><r:unless_content [part="part_name, other_part"] [inherit="true"] [find="any"]>...</r:unless_content></code></pre>
323
+ <pre><code><r:unless_content [part="part_name, other_part"] [inherit="false"] [find="any"]>...</r:unless_content></code></pre>
324
324
  }
325
325
  tag 'unless_content' do |tag|
326
326
  page = tag.locals.page
327
327
  part_name = tag_part_name(tag)
328
328
  parts_arr = part_name.split(',')
329
- inherit = boolean_attr_or_error(tag, 'inherit', true)
329
+ inherit = boolean_attr_or_error(tag, 'inherit', false)
330
330
  find = attr_or_error(tag, :attribute_name => 'find', :default => 'all', :values => 'any, all')
331
331
  expandable, all_found = true, true
332
332
  part_page = page
@@ -604,11 +604,11 @@ module StandardTags
604
604
  tag.expand
605
605
  options = tag.locals.random
606
606
  option = options[rand(options.size)]
607
- option.call if option
607
+ option if option
608
608
  end
609
609
  tag 'random:option' do |tag|
610
610
  items = tag.locals.random
611
- items << tag.block
611
+ items << tag.expand
612
612
  end
613
613
 
614
614
  desc %{
@@ -84,6 +84,4 @@ Radiant::Initializer.run do |config|
84
84
  ResponseCache.defaults[:directory] = ActionController::Base.page_cache_directory
85
85
  ResponseCache.defaults[:logger] = ActionController::Base.logger
86
86
  end
87
- end
88
-
89
- Page.load_subclasses
87
+ end
@@ -84,6 +84,4 @@ Radiant::Initializer.run do |config|
84
84
  ResponseCache.defaults[:directory] = ActionController::Base.page_cache_directory
85
85
  ResponseCache.defaults[:logger] = ActionController::Base.logger
86
86
  end
87
- end
88
-
89
- Page.load_subclasses
87
+ end
@@ -5,7 +5,7 @@ unless defined? Radiant::Version
5
5
  module Version
6
6
  Major = '0'
7
7
  Minor = '6'
8
- Tiny = '8'
8
+ Tiny = '9'
9
9
 
10
10
  class << self
11
11
  def to_s
@@ -92,6 +92,8 @@ module Radiant
92
92
  # Reset the admin UI regions
93
93
  initializer.admin.load_default_regions
94
94
  extensions.each &:activate
95
+ # Make sure we have our subclasses loaded!
96
+ Page.load_subclasses
95
97
  end
96
98
  alias :reactivate :activate_extensions
97
99
 
@@ -31,8 +31,7 @@ unless File.directory? "#{RAILS_ROOT}/app"
31
31
  desc "Lock to latest Edge Radiant or a specific revision with REVISION=X (ex: REVISION=245484e), a tag with TAG=Y (ex: TAG=0.6.6), or a branch with BRANCH=Z (ex: BRANCH=mental)"
32
32
  task :edge do
33
33
  $verbose = false
34
- system "git --version" rescue nil
35
- unless !$?.nil? && $?.success?
34
+ unless system "git --version"
36
35
  $stderr.puts "ERROR: Must have git available in the PATH to lock this application to Edge Radiant"
37
36
  exit 1
38
37
  end
@@ -40,28 +39,18 @@ unless File.directory? "#{RAILS_ROOT}/app"
40
39
  radiant_git = "git://github.com/radiant/radiant.git"
41
40
 
42
41
  if File.exist?("vendor/radiant/.git/HEAD")
43
- case
44
- when ENV['TAG']
45
- system "cd vendor/radiant; git pull origin master; git checkout -b #{ENV['TAG']}"
46
- when ENV['BRANCH']
47
- system "cd vendor/radiant; git pull origin master; git checkout --track -b #{ENV['BRANCH']} origin/#{ENV['BRANCH']}"
48
- when ENV['REVISION']
49
- system "cd vendor/radiant; git pull origin master; git checkout -b REV_#{ENV['REVISION']} #{ENV['REVISION']}"
50
- else
51
- system "cd vendor/radiant; git pull origin master"
52
- end
42
+ system "cd vendor/radiant; git checkout master; git pull origin master"
53
43
  else
54
- case
55
- when ENV['TAG']
56
- system "git clone #{radiant_git} vendor/radiant"
57
- system "cd vendor/radiant; git checkout -b #{ENV['TAG']}"
58
- when ENV['BRANCH']
59
- system "git clone #{radiant_git} vendor/radiant"
60
- system "cd vendor/radiant; git checkout --track -b #{ENV['BRANCH']} origin/#{ENV['BRANCH']}"
61
- when ENV['REVISION']
62
- system "git clone #{radiant_git} vendor/radiant"
63
- system "cd vendor/radiant; git checkout -b REV_#{ENV['REVISION']} #{ENV['REVISION']}"
64
- end
44
+ system "git clone #{radiant_git} vendor/radiant"
45
+ end
46
+
47
+ case
48
+ when ENV['TAG']
49
+ system "cd vendor/radiant; git checkout -b v#{ENV['TAG']} #{ENV['TAG']}"
50
+ when ENV['BRANCH']
51
+ system "cd vendor/radiant; git checkout --track -b #{ENV['BRANCH']} origin/#{ENV['BRANCH']}"
52
+ when ENV['REVISION']
53
+ system "cd vendor/radiant; git checkout -b REV_#{ENV['REVISION']} #{ENV['REVISION']}"
65
54
  end
66
55
  end
67
56
  end
@@ -70,7 +59,7 @@ unless File.directory? "#{RAILS_ROOT}/app"
70
59
  task :unfreeze do
71
60
  rm_rf "vendor/radiant"
72
61
  end
73
-
62
+
74
63
  desc "Update both configs, scripts and public/javascripts from Radiant"
75
64
  task :update => [ "update:scripts", "update:javascripts", "update:configs", "update:images", "update:stylesheets" ]
76
65
 
@@ -79,11 +68,11 @@ unless File.directory? "#{RAILS_ROOT}/app"
79
68
  task :scripts do
80
69
  local_base = "script"
81
70
  edge_base = "#{File.dirname(__FILE__)}/../../scripts"
82
-
71
+
83
72
  local = Dir["#{local_base}/**/*"].reject { |path| File.directory?(path) }
84
73
  edge = Dir["#{edge_base}/**/*"].reject { |path| File.directory?(path) }
85
74
  edge = edge.reject { |f| f =~ /(generate|plugin|destroy)$/ }
86
-
75
+
87
76
  edge.each do |script|
88
77
  base_name = script[(edge_base.length+1)..-1]
89
78
  next if local.detect { |path| base_name == path[(local_base.length+1)..-1] }
@@ -112,13 +101,12 @@ unless File.directory? "#{RAILS_ROOT}/app"
112
101
  FileUtils.cp("#{File.dirname(__FILE__)}/../generators/instance/templates/instance_boot.rb", RAILS_ROOT + '/config/boot.rb')
113
102
  instance_env = "#{RAILS_ROOT}/config/environment.rb"
114
103
  tmp_env = "#{RAILS_ROOT}/config/environment.tmp"
115
- File.open(tmp_env, 'w') do |f|
116
- f.write ERB.new(File.read(instance_env)).result(lambda do
117
- app_name = File.basename(File.expand_path(RAILS_ROOT))
118
- end)
119
- end
120
104
  gen_env = "#{File.dirname(__FILE__)}/../generators/instance/templates/instance_environment.rb"
121
105
  backup_env = "#{RAILS_ROOT}/config/environment.bak"
106
+ File.open(tmp_env, 'w') do |f|
107
+ app_name = File.basename(File.expand_path(RAILS_ROOT))
108
+ f.write ERB.new(File.read(gen_env)).result(binding)
109
+ end
122
110
  unless FileUtils.compare_file(instance_env, tmp_env)
123
111
  FileUtils.cp(instance_env, backup_env)
124
112
  FileUtils.cp(tmp_env, instance_env)
@@ -129,20 +117,20 @@ Please copy your customizations to the new file."
129
117
  end
130
118
  FileUtils.rm(tmp_env)
131
119
  end
132
-
120
+
133
121
  desc "Update admin images from your current radiant install"
134
122
  task :images do
135
123
  project_dir = RAILS_ROOT + '/public/images/admin/'
136
124
  images = Dir["#{File.dirname(__FILE__)}/../../public/images/admin/*"]
137
125
  FileUtils.cp(images, project_dir)
138
126
  end
139
-
127
+
140
128
  desc "Update admin stylesheets from your current radiant install"
141
129
  task :stylesheets do
142
130
  project_dir = RAILS_ROOT + '/public/stylesheets/admin/'
143
131
  stylesheets = Dir["#{File.dirname(__FILE__)}/../../public/stylesheets/admin/*.css"]
144
132
  FileUtils.cp(stylesheets, project_dir)
145
- end
133
+ end
146
134
  end
147
135
  end
148
136
  end
File without changes
@@ -151,6 +151,16 @@ describe Radiant::ExtensionLoader do
151
151
  @instance.activate_extensions
152
152
  extensions.all?(&:active?).should be_true
153
153
  end
154
+
155
+ it "should (re)load Page subclasses activation" do
156
+ @initializer.should_receive(:initialize_default_admin_tabs)
157
+ @initializer.should_receive(:initialize_framework_views)
158
+ @admin.should_receive(:load_default_regions)
159
+ extensions = [BasicExtension, OverridingExtension]
160
+ @instance.extensions = extensions
161
+ Page.should_receive(:load_subclasses)
162
+ @instance.activate_extensions
163
+ end
154
164
  end
155
165
 
156
166
 
@@ -316,7 +316,12 @@ describe "Standard Tags" do
316
316
  it 'should render the contained block if the current or ancestor pages do not have the specified parts' do
317
317
  page(:guests).should render('<r:unless_content part="madeup, imaginary" inherit="true">true</r:unless_content>').as('true')
318
318
  end
319
+
320
+ it "should not render the contained block if the specified part does not exist but does exist on an ancestor" do
321
+ page.should render('<r:unless_content part="sidebar" inherit="true">false</r:unless_content>').as('')
322
+ end
319
323
  end
324
+
320
325
  it "without 'part' attribute should not render the contained block if the 'body' part exists" do
321
326
  page.should render('<r:unless_content>false</r:unless_content>').as('')
322
327
  end
@@ -328,6 +333,10 @@ describe "Standard Tags" do
328
333
  it "should render the contained block if the specified part does not exist" do
329
334
  page.should render('<r:unless_content part="asdf">false</r:unless_content>').as('false')
330
335
  end
336
+
337
+ it "should render the contained block if the specified part does not exist but does exist on an ancestor" do
338
+ page.should render('<r:unless_content part="sidebar">false</r:unless_content>').as('false')
339
+ end
331
340
 
332
341
  describe "with more than one part given (separated by comma)" do
333
342
 
@@ -341,17 +350,17 @@ describe "Standard Tags" do
341
350
 
342
351
  describe "with the 'inherit' attribute set to 'true'" do
343
352
  it "should render the contained block if the current or ancestor pages have none of the specified parts" do
344
- page.should render('<r:unless_content part="imaginary, madeup">true</r:unless_content>').as('true')
353
+ page.should render('<r:unless_content part="imaginary, madeup" inherit="true">true</r:unless_content>').as('true')
345
354
  end
346
355
 
347
356
  it "should not render the contained block if all of the specified parts are present on the current or ancestor pages" do
348
- page(:party).should render('<r:unless_content part="favors, extended">true</r:unless_content>').as('')
357
+ page(:party).should render('<r:unless_content part="favors, extended" inherit="true">true</r:unless_content>').as('')
349
358
  end
350
359
  end
351
360
 
352
361
  describe "with the 'find' attribute set to 'all'" do
353
362
  it "should not render the contained block if all of the specified parts exist" do
354
- page.should render('<r:unless_content part="body, sidebar" find="all">true</r:unless_content>').as('')
363
+ page(:home).should render('<r:unless_content part="body, sidebar" find="all">true</r:unless_content>').as('')
355
364
  end
356
365
 
357
366
  it "should render the contained block unless all of the specified parts exist" do
@@ -510,6 +519,10 @@ describe "Standard Tags" do
510
519
  it '<r:random> should render a randomly selected contained <r:option>' do
511
520
  page.should render("<r:random> <r:option>1</r:option> <r:option>2</r:option> <r:option>3</r:option> </r:random>").matching(/^(1|2|3)$/)
512
521
  end
522
+
523
+ it '<r:random> should render a randomly selected, dynamically set <r:option>' do
524
+ page(:parent).should render("<r:random:children:each:option:title />").matching(/^(Child|Child\ 2|Child\ 3)$/)
525
+ end
513
526
 
514
527
  it '<r:comment> should render nothing it contains' do
515
528
  page.should render('just a <r:comment>small </r:comment>test').as('just a test')
@@ -802,11 +815,11 @@ describe "Standard Tags" do
802
815
 
803
816
  describe "<r:unless_ancestor_or_self>" do
804
817
  it "should render the tag's content when the current page is not an ancestor of tag.locals.page" do
805
- page(:radius).should render(%{<r:find url="/"><r:unless_ancestor_or_self>true</r:unless_ancestor_or_self></r:find>}).as('')
818
+ page(:parent).should render(%{<r:find url="/radius"><r:unless_ancestor_or_self>true</r:unless_ancestor_or_self></r:find>}).as('true')
806
819
  end
807
820
 
808
821
  it "should not render the tag's content when current page is an ancestor of tag.locals.page" do
809
- page(:parent).should render(%{<r:find url="/radius"><r:unless_ancestor_or_self>true</r:unless_ancestor_or_self></r:find>}).as('true')
822
+ page(:radius).should render(%{<r:find url="/"><r:unless_ancestor_or_self>true</r:unless_ancestor_or_self></r:find>}).as('')
810
823
  end
811
824
  end
812
825
 
@@ -822,11 +835,11 @@ describe "Standard Tags" do
822
835
 
823
836
  describe "<r:unless_self>" do
824
837
  it "should render the tag's content when the current page is not the same as the local contextual page" do
825
- page(:home).should render(%{<r:find url="/"><r:unless_self>true</r:unless_self></r:find>}).as('')
838
+ page(:radius).should render(%{<r:find url="/"><r:unless_self>true</r:unless_self></r:find>}).as('true')
826
839
  end
827
840
 
828
841
  it "should not render the tag's content when the current page is the same as the local contextual page" do
829
- page(:radius).should render(%{<r:find url="/"><r:unless_self>true</r:unless_self></r:find>}).as('true')
842
+ page(:home).should render(%{<r:find url="/"><r:unless_self>true</r:unless_self></r:find>}).as('')
830
843
  end
831
844
  end
832
845
 
@@ -1,3 +1,4 @@
1
+ require 'file_not_found_page'
1
2
  class CustomFileNotFoundPage < FileNotFoundPage
2
3
  end
3
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.8
4
+ version: 0.6.9
5
5
  platform: ruby
6
6
  authors: []
7
7
 
@@ -9,7 +9,7 @@ autorequire: radiant
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-07-27 00:00:00 -04:00
12
+ date: 2008-08-01 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -62,8 +62,6 @@ files:
62
62
  - app/helpers/admin/welcome_helper.rb
63
63
  - app/helpers/application_helper.rb
64
64
  - app/helpers/site_helper.rb
65
- - app/migrate
66
- - app/migrate/020_add_session_info_to_users.rb
67
65
  - app/models
68
66
  - app/models/env_dump_page.rb
69
67
  - app/models/file_not_found_page.rb
@@ -3012,6 +3010,8 @@ rdoc_options:
3012
3010
  - --exclude
3013
3011
  - log
3014
3012
  - --exclude
3013
+ - pkg
3014
+ - --exclude
3015
3015
  - public
3016
3016
  - --exclude
3017
3017
  - script
@@ -1,11 +0,0 @@
1
- class AddSessionInfoToUsers < ActiveRecord::Migration
2
- def self.up
3
- add_column :users, :session_token, :string
4
- add_column :users, :session_expire, :datetime
5
- end
6
-
7
- def self.down
8
- remove_column :users, :session_token
9
- remove_column :users, :session_expire
10
- end
11
- end