bcms_s3 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -17,3 +17,5 @@ If your non cms domain is www.myapp.com rather than app.com this can be enabled
17
17
  1. The s3.yml should be excluded from public repositories (e.g github) since it contains your secret AWS key which should **never** be revealed to the public.
18
18
  2. Changing from local storage to S3 storage will require you to re-upload all your files (or copy the tree to s3)
19
19
  3. This module requires the RightAWS gem from RightScale (sudo gem install right_aws)
20
+
21
+ ##### Based on original work on S3 storage for BrowserCMS by [Neil Middleton](http://github.com/neilmiddleton/)
@@ -1,7 +1,7 @@
1
- module Cms::Routes
2
- def routes_for_bcms_s3
3
- namespace(:cms) do |cms|
4
- #cms.content_blocks :s3s
5
- end
6
- end
7
- end
1
+ module Cms::Routes
2
+ def routes_for_bcms_s3
3
+ namespace(:cms) do |cms|
4
+ #cms.content_blocks :s3s
5
+ end
6
+ end
7
+ end
@@ -12,10 +12,10 @@ module Cms
12
12
  controller_class.alias_method_chain :render_page_with_caching, :s3
13
13
  controller_class.alias_method_chain :try_to_stream_file, :s3
14
14
  end
15
- def render_page_with_caching_with_s3
16
- render_page
17
- response.headers['Cache-Control'] = 'public, max-age=300' if Cms::S3.heroku_caching
18
- end
15
+ def render_page_with_caching_with_s3
16
+ render_page
17
+ response.headers['Cache-Control'] = 'public, max-age=300' if Cms::S3.heroku_caching
18
+ end
19
19
  def try_to_stream_file_with_s3
20
20
  split = @paths.last.to_s.split('.')
21
21
  ext = split.size > 1 ? split.last.to_s.downcase : nil
@@ -54,16 +54,16 @@ module Cms
54
54
  model_class.alias_method_chain :write_temp_file_to_storage_location, :s3
55
55
  end
56
56
  def set_file_location_with_s3
57
- unless temp_file.blank?
58
- prefix = temp_file.original_filename.sub(/\..+$/,'')
59
- if temp_file.original_filename =~ /.+(\..+)$/
60
- suffix = $1
61
- else
62
- suffix = ""
63
- end
64
- new_filename = "#{prefix}-#{ActiveSupport::SecureRandom.hex(4)}#{suffix}"
65
- self.file_location = "#{Time.now.strftime("%Y/%m/%d")}/#{new_filename}"
57
+ unless temp_file.blank?
58
+ prefix = temp_file.original_filename.sub(/\..+$/,'')
59
+ if temp_file.original_filename =~ /.+(\..+)$/
60
+ suffix = $1
61
+ else
62
+ suffix = ""
66
63
  end
64
+ new_filename = "#{prefix}-#{ActiveSupport::SecureRandom.hex(4)}#{suffix}"
65
+ self.file_location = "#{Time.now.strftime("%Y/%m/%d")}/#{new_filename}"
66
+ end
67
67
  end
68
68
  def write_temp_file_to_storage_location_with_s3
69
69
  unless temp_file.blank?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcms_s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Underwood
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-25 00:00:00 +00:00
12
+ date: 2009-11-26 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -54,6 +54,6 @@ rubyforge_project:
54
54
  rubygems_version: 1.3.5
55
55
  signing_key:
56
56
  specification_version: 3
57
- summary: This is a browsercms (browsercms.org) module to allow the facility to have attachments stored on Amazon S3. Also there is the option to change caching to suit heroku
57
+ summary: This is a browsercms (browsercms.org) module to allow the facility to have attachments stored on Amazon S3. Also there is the option to change caching to suit heroku and/or use 'www' as the prefix for the non-cms site. Based on original work by Neil Middleton
58
58
  test_files: []
59
59