refinerycms 0.9.6.8 → 0.9.6.9

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.6.8
1
+ 0.9.6.9
@@ -51,13 +51,14 @@ unless (app_path = ARGV.shift).nil? or app_path.length == 0
51
51
  3.times { new_digest << Digest::SHA1.hexdigest("--refinery--#{Time.now.to_s}--#{rand(10000000)}--") }
52
52
 
53
53
  # read in the file and split up the lines
54
- lines = File.open(File.join(%W(#{RAILS_ROOT} config environment.rb)), "r").read.split("\n")
54
+ app_config_file = File.exist?(File.join(%W(#{RAILS_ROOT} config application.rb))) ? "application.rb" : "environment.rb"
55
+ lines = File.open(File.join(%W(#{RAILS_ROOT} config #{app_config_file})), "r").read.split("\n")
55
56
  lines.each do |line|
56
57
  match = line.scan(/(:secret)([^']*)([\'])([^\']*)/).flatten.last
57
58
  line.gsub!(match, new_digest) unless match.nil?
58
59
  end
59
60
  # write the new content into the file.
60
- File.open(File.join(%W(#{RAILS_ROOT} config environment.rb)), "w").puts(lines.join("\n"))
61
+ File.open(File.join(%W(#{RAILS_ROOT} config #{app_config_file})), "w").puts(lines.join("\n"))
61
62
 
62
63
  puts "\n---------"
63
64
  puts "Refinery successfully installed in '#{RAILS_ROOT}'!\n\n"
@@ -24,18 +24,45 @@ unless RAILS_ROOT.nil? or RAILS_ROOT.length == 0
24
24
  FileUtils::cp File.join(%W(#{REFINERY_ROOT} config preinitializer.rb)), File.join(%W(#{RAILS_ROOT} config preinitializer.rb))
25
25
 
26
26
  # read in the config files
27
- app_config = File.open(File.join(%W(#{RAILS_ROOT} config environment.rb)), "r").read
27
+ if File.exist?(File.join(%W(#{RAILS_ROOT} config application.rb)))
28
+ FileUtils::cp File.join(%W(#{REFINERY_ROOT} config environment.rb)), File.join(%W(#{RAILS_ROOT} config environment.rb))
29
+ else
30
+ # update secret key if environment still exists
31
+ lines = File.open(File.join(%W(#{RAILS_ROOT} config environment.rb)), "r").read.split("\n")
32
+ secret_key = ""
33
+ lines.each do |line|
34
+ match = line.scan(/(:secret)([^']*)([\'])([^\']*)/).flatten.last
35
+ secret_key = match unless match.nil?
36
+ end
37
+ # write the new content into the file.
38
+ FileUtils::cp File.join(%W(#{REFINERY_ROOT} config application.rb)), File.join(%W(#{RAILS_ROOT} config application.rb))
39
+
40
+ app_rb_lines = File.open(File.join(%W(#{RAILS_ROOT} config application.rb)), "r").read.split("\n")
41
+ app_rb_lines.each do |line|
42
+ match = line.scan(/(:secret)([^']*)([\'])([^\']*)/).flatten.last
43
+ line.gsub!(match, secret_key) unless match.nil?
44
+ end
45
+
46
+ # write the new content into the file.
47
+ File.open(File.join(%W(#{RAILS_ROOT} config application.rb)), "w").puts(app_rb_lines.join("\n"))
48
+
49
+ FileUtils::cp File.join(%W(#{REFINERY_ROOT} config environment.rb)), File.join(%W(#{RAILS_ROOT} config environment.rb))
50
+ end
51
+
52
+ app_config_file = "application.rb"
53
+
54
+ app_config = File.open(File.join(%W(#{RAILS_ROOT} config #{app_config_file})), "r").read
28
55
  environment_updated = false
29
56
 
30
57
  # backup app's environment.rb
31
58
  matcher = /(#===REFINERY REQUIRED GEMS===)(.+?)(#===REFINERY END OF REQUIRED GEMS===)/m
32
59
  unless (app_refinery_gems_section = app_config.scan(matcher).join("")).length == 0
33
60
  # read in the config file in the gem
34
- refinery_config = File.open(File.join(REFINERY_ROOT, %w(config environment.rb)), "r").read
35
- FileUtils.cp File.join(%W(#{RAILS_ROOT} config environment.rb)), File.join(%W(#{RAILS_ROOT} config environment.autobackupbyrefinery.rb))
61
+ refinery_config = File.open(File.join(%W(#{REFINERY_ROOT} config #{app_config_file})), "r").read
62
+ FileUtils.cp File.join(%W(#{RAILS_ROOT} config #{app_config_file})), File.join(%W(#{RAILS_ROOT} config #{app_config_file.gsub(".rb", "")}.autobackupbyrefinery.rb))
36
63
 
37
64
  # write the new content into the file.
38
- File.open(File.join(%W(#{RAILS_ROOT} config environment.rb)), "w").puts(app_config.gsub!(
65
+ File.open(File.join(%W(#{RAILS_ROOT} config #{app_config_file})), "w").puts(app_config.gsub!(
39
66
  app_refinery_gems_section,
40
67
  refinery_config.scan(matcher).join("")
41
68
  ))
@@ -47,8 +74,8 @@ unless RAILS_ROOT.nil? or RAILS_ROOT.length == 0
47
74
  puts "---------"
48
75
  puts "Copied new Refinery core assets."
49
76
  if environment_updated
50
- puts "I've made a backup of your current config/environment.rb file as it has been updated with the latest Refinery RubyGem requirements."
51
- puts "The backup is located at config/environment.autobackupbyrefinery.rb incase you need it."
77
+ puts "I've made a backup of your current config/#{app_config_file} file as it has been updated with the latest Refinery RubyGem requirements."
78
+ puts "The backup is located at config/#{app_config_file.gsub(".rb", "")}.autobackupbyrefinery.rb incase you need it."
52
79
  end
53
80
  puts ""
54
81
  puts "=== ACTION REQUIRED ==="
@@ -85,8 +85,5 @@ else
85
85
  config.gem "slim_scrooge", :version => ">= 1.0.3", :lib => "slim_scrooge", :source => "http://gemcutter.org" unless RUBY_PLATFORM =~ /mswin|mingw/ # kill gem when windows is running.
86
86
  config.gem "hpricot", :version => ">= 0.8.1", :lib => "hpricot", :source => "http://gemcutter.org"
87
87
  #===REFINERY END OF REQUIRED GEMS===
88
-
89
- # Pull in attachment_fu patch for windows
90
- require 'attachment_fu_patch' if RUBY_PLATFORM =~ /mswin/
91
88
  end
92
89
  end
@@ -7,3 +7,6 @@ unless REFINERY_ROOT == RAILS_ROOT # e.g. only if we're in a gem.
7
7
  require 'refinery'
8
8
  require 'refinery/initializer'
9
9
  end
10
+
11
+ # Pull in attachment_fu patch for windows
12
+ require 'refinery/attachment_fu_patch' if RUBY_PLATFORM =~ /mswin/
@@ -87,7 +87,7 @@ class Page < ActiveRecord::Base
87
87
  if self.link_url.present?
88
88
  self.link_url =~ /^\// ? {:controller => self.link_url} : self.link_url
89
89
  elsif self.to_param.present?
90
- {:controller => "pages", :action => "show", :id => self.to_param}
90
+ {:controller => "/pages", :action => "show", :id => self.to_param}
91
91
  end
92
92
  end
93
93
 
@@ -1,8 +1,10 @@
1
1
  <%
2
- hide_empty_sections ||= !(show_empty_sections ||= false)
3
- body_content_title = ((title = yield :body_content_title).present? or hide_empty_sections) ? title : page_title
4
- body_content_left = ((body_content_left = yield :body_content_left).present? or hide_empty_sections) ? body_content_left : @page[:body]
5
- body_content_right = ((body_content_right = yield :body_content_right).present? or hide_empty_sections) ? body_content_right : @page[:side_body]
2
+ show_empty_sections ||= false
3
+
4
+ body_content_title = ((title = yield :body_content_title).present? or (title.blank? and show_empty_sections)) ? title : page_title
5
+ body_content_left = ((body_content_left = yield :body_content_left).present? or (body_content_left.blank? and show_empty_sections)) ? body_content_left : @page[:body]
6
+ body_content_right = ((body_content_right = yield :body_content_right).present? or (body_content_right.blank? and show_empty_sections)) ? body_content_right : @page[:side_body]
7
+
6
8
  extra_body_content_classes = []
7
9
  extra_body_content_classes << "no_title" if body_content_title.blank?
8
10
  extra_body_content_classes << "no_left" if body_content_left.blank?
@@ -10,17 +12,17 @@
10
12
  -%>
11
13
  <%= render :partial => "/shared/submenu" if !admin? and (show_submenu ||= true) and RefinerySetting.find_or_set(:show_submenu_on_content_pages, true) %>
12
14
  <div id='body_content' class='clearfix<%= " #{extra_body_content_classes.join(" ")}" if extra_body_content_classes.any? %>'>
13
- <% unless body_content_title.blank? and hide_empty_sections -%>
15
+ <% if body_content_title.present? or show_empty_sections -%>
14
16
  <h1 id='body_content_page_title'>
15
17
  <%= body_content_title %>
16
18
  </h1>
17
19
  <% end -%>
18
- <% unless body_content_left.blank? and hide_empty_sections -%>
20
+ <% if body_content_left.present? or show_empty_sections -%>
19
21
  <div id='body_content_left' class='clearfix'>
20
22
  <%= body_content_left %>
21
23
  </div>
22
24
  <% end -%>
23
- <% unless body_content_right.blank? and hide_empty_sections -%>
25
+ <% if body_content_right.present? or show_empty_sections -%>
24
26
  <div id='body_content_right' class='clearfix'>
25
27
  <%= body_content_right %>
26
28
  </div>
@@ -12,10 +12,10 @@ class ThemeServer
12
12
  if env["PATH_INFO"] =~ /^\/theme/
13
13
  relative_path = env["PATH_INFO"].gsub(/^\/theme\//, '')
14
14
 
15
- if (file_path = Rails.root.join "themes", RefinerySetting[:theme], relative_path).exist?
15
+ if (file_path = Rails.root.join("themes", RefinerySetting[:theme], relative_path)).exist?
16
16
  # generate an etag for client-side caching.
17
17
  etag = Digest::MD5.hexdigest("#{file_path.to_s}#{file_path.mtime}")
18
- unless env["HTTP_IF_NONE_MATCH"] == etag
18
+ unless (env["HTTP_IF_NONE_MATCH"] == etag and RefinerySetting.find_or_set(:themes_use_etags, false))
19
19
  [200, {
20
20
  "Content-Type" => Rack::Mime.mime_type(file_path.extname),
21
21
  "ETag" => etag
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6.8
4
+ version: 0.9.6.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Resolve Digital
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2010-02-15 00:00:00 +13:00
14
+ date: 2010-02-16 00:00:00 +13:00
15
15
  default_executable:
16
16
  dependencies: []
17
17
 
@@ -69,7 +69,6 @@ files:
69
69
  - doc/.yardoc/checksums
70
70
  - doc/.yardoc/objects/root.dat
71
71
  - doc/.yardoc/proxy_types
72
- - lib/attachment_fu_patch.rb
73
72
  - lib/refinery_initializer.rb
74
73
  - license.md
75
74
  - public/.htaccess
@@ -509,6 +508,7 @@ files:
509
508
  - vendor/plugins/refinery/lib/refinery/admin_base_controller.rb
510
509
  - vendor/plugins/refinery/lib/refinery/application_controller.rb
511
510
  - vendor/plugins/refinery/lib/refinery/application_helper.rb
511
+ - vendor/plugins/refinery/lib/refinery/attachment_fu_patch.rb
512
512
  - vendor/plugins/refinery/lib/refinery/base_presenter.rb
513
513
  - vendor/plugins/refinery/lib/refinery/form_helpers.rb
514
514
  - vendor/plugins/refinery/lib/refinery/html_truncation_helper.rb