bcms_s3 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.markdown +5 -1
  2. data/lib/bcms_s3/s3_module.rb +10 -2
  3. metadata +14 -5
@@ -31,8 +31,12 @@ Set the config vars on heroku to get it working there as well.
31
31
  ## www prefix for non cms urls
32
32
  If your non cms domain is www.myapp.com rather than app.com this can be enabled by setting Cms::S3.www_domain_prefix in config/initializers/browsercms.rb to true.
33
33
 
34
+ ## using cnames to your S3 bucket
35
+ If you've set up CNAMES in your DNS to point to your bucket, then you can enable the use of that instead of the FQDN ending in amazonaws.com by setting Cms::S3.options[:s3_cname] in your s3.yml file.
36
+
34
37
  ## Important things to note
35
- 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.
38
+ 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.
39
+ **Please note**. This no longer applies since the access keys and buckets are now specified in environmental variables and therefore the s3.yml file now contains just references to these environmental variables.
36
40
  2. Changing from local storage to S3 storage will require you to re-upload all your files (or copy the tree to s3)
37
41
  3. This module requires the RightAWS gem from RightScale (sudo gem install right_aws)
38
42
 
@@ -17,7 +17,11 @@ module Cms
17
17
  @attachment = @attachment.as_of_version(params[:version]) if params[:version]
18
18
  if Cms::S3.enabled
19
19
  #get the file off S3
20
- redirect_to("http://#{Cms::S3.options[:bucket]}.s3.amazonaws.com/#{@attachment.file_location}")
20
+ if Cms::S3.options[:s3_cname]
21
+ redirect_to("http://#{Cms::S3.options[:s3_cname]}/#{@attachment.file_location}")
22
+ else
23
+ redirect_to("http://#{Cms::S3.options[:bucket]}.s3.amazonaws.com/#{@attachment.file_location}")
24
+ end
21
25
  else
22
26
  #Construct a path to where this file would be if it were cached
23
27
  @file = @attachment.full_file_location
@@ -56,7 +60,11 @@ module Cms
56
60
 
57
61
  if Cms::S3.enabled
58
62
  #get the file off S3
59
- redirect_to("http://#{Cms::S3.options[:bucket]}.s3.amazonaws.com/#{@attachment.file_location}")
63
+ if Cms::S3.options[:s3_cname]
64
+ redirect_to("http://#{Cms::S3.options[:s3_cname]}/#{@attachment.file_location}")
65
+ else
66
+ redirect_to("http://#{Cms::S3.options[:bucket]}.s3.amazonaws.com/#{@attachment.file_location}")
67
+ end
60
68
  else
61
69
  #Construct a path to where this file would be if it were cached
62
70
  @file = @attachment.full_file_location
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcms_s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ - 1
9
+ version: 0.2.1
5
10
  platform: ruby
6
11
  authors:
7
12
  - Anthony Underwood
@@ -9,7 +14,7 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-06-17 00:00:00 +01:00
17
+ date: 2010-06-29 00:00:00 +01:00
13
18
  default_executable:
14
19
  dependencies: []
15
20
 
@@ -37,21 +42,25 @@ rdoc_options:
37
42
  require_paths:
38
43
  - lib
39
44
  required_ruby_version: !ruby/object:Gem::Requirement
45
+ none: false
40
46
  requirements:
41
47
  - - ">="
42
48
  - !ruby/object:Gem::Version
49
+ segments:
50
+ - 0
43
51
  version: "0"
44
- version:
45
52
  required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
46
54
  requirements:
47
55
  - - ">="
48
56
  - !ruby/object:Gem::Version
57
+ segments:
58
+ - 0
49
59
  version: "0"
50
- version:
51
60
  requirements: []
52
61
 
53
62
  rubyforge_project:
54
- rubygems_version: 1.3.5
63
+ rubygems_version: 1.3.7
55
64
  signing_key:
56
65
  specification_version: 3
57
66
  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