radiant-images-extension 0.4.0 → 0.4.1

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
data/app/models/image.rb CHANGED
@@ -16,8 +16,8 @@ class Image < ActiveRecord::Base
16
16
  :default_url => '/images/extensions/images/missing_:style.png',
17
17
  :storage => Radiant::Config['images.storage'] == 's3' ? :s3 : :filesystem,
18
18
  :s3_credentials => {
19
- :access_key_id => Radiant::Config['s3.key'],
20
- :secret_access_key => Radiant::Config['s3.secret']
19
+ :access_key_id => ImagesExtension.s3_credentials['access_key_id'],
20
+ :secret_access_key => ImagesExtension.s3_credentials['secret_access_key']
21
21
  },
22
22
  :s3_host_alias => Radiant::Config['s3.host_alias'],
23
23
  :bucket => Radiant::Config['s3.bucket'],
data/images_extension.rb CHANGED
@@ -1,23 +1,16 @@
1
- # Uncomment this if you reference any of your controllers in activate
2
- # require_dependency 'application_controller'
3
-
4
1
  require 'paperclip'
5
2
  require 'aws/s3'
3
+ require 'acts_as_list'
6
4
 
7
5
  class ImagesExtension < Radiant::Extension
8
- version "0.1"
6
+ version YAML::load_file(File.join(File.dirname(__FILE__), 'VERSION'))
9
7
  description "Images stores images on s3"
10
8
  url "http://github.com/squaretalent/radiant-images-extension"
11
9
 
12
10
  extension_config do |config|
13
- config.gem 'paperclip', :version => '~> 2.3.5'
14
- config.gem 'aws-s3', :version => '>= 0.6.2', :lib => 'aws/s3'
15
- config.gem 'acts_as_list', :version => '>= 0.1.2'
16
-
17
- if RAILS_ENV == :test
18
- config.gem 'rr', :version => '>= 1.0.0'
19
- end
20
-
11
+ config.gem 'paperclip', :lib => 'paperclip'
12
+ config.gem 'aws-s3', :lib => 'aws/s3'
13
+ config.gem 'acts_as_list', :lib => 'acts_as_list'
21
14
  end
22
15
 
23
16
  def activate
@@ -43,12 +36,11 @@ class ImagesExtension < Radiant::Extension
43
36
  Radiant::Config['images.styles'] ||= "icon=45x45#,preview=200x200#,normal=640x640#"
44
37
  Radiant::Config['images.url'] ||= "/:class/:basename-:style.:extension"
45
38
 
46
- Radiant::Config['s3.bucket'] ||= "set"
47
- Radiant::Config['s3.host_alias'] ||= "set"
48
- Radiant::Config['s3.key'] ||= "set"
49
- Radiant::Config['s3.secret'] ||= "set"
39
+ #Radiant::Config['s3.bucket']
40
+ #Radiant::Config['s3.host_alias']
41
+ #Radiant::Config['s3.key']
42
+ #Radiant::Config['s3.secret']
50
43
 
51
-
52
44
  unless Radiant::Config["images.image_magick_path"].nil?
53
45
  # Passenger needs this configuration to work with Image magick
54
46
  # Radiant::Config["assets.image_magick_path"] = '/usr/local/bin/' # OS X Homebrew
@@ -56,4 +48,16 @@ class ImagesExtension < Radiant::Extension
56
48
  end
57
49
 
58
50
  end
51
+
52
+ def self.s3_credentials
53
+ result = {}
54
+ if File.exists?(File.join(Rails.root, 'config', 'amazon_s3.yml'))
55
+ result.merge!(YAML.load_file(File.join(Rails.root, 'config', 'amazon_s3.yml'))[RAILS_ENV])
56
+ else
57
+ result['access_key_id'] = Radiant::Config['s3.key']
58
+ result['secret_access_key'] = Radiant::Config['s3.secret']
59
+ end
60
+ result
61
+ end
62
+
59
63
  end
@@ -0,0 +1 @@
1
+ # Nothing to see here
@@ -1,77 +1,78 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{radiant-images-extension}
8
- s.version = "0.4.0"
8
+ s.version = "0.4.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dirk Kelly", "Mario Visic"]
12
- s.date = %q{2010-11-02}
12
+ s.date = %q{2010-11-23}
13
13
  s.description = %q{Image Radiant Extension management tool, meant only to be useful to pages and extensions that need to require images.}
14
14
  s.email = %q{info@squaretalent.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README.md"
17
+ "README.md"
18
18
  ]
19
19
  s.files = [
20
- ".gitignore",
21
- "LICENSE",
22
- "README.md",
23
- "Rakefile",
24
- "VERSION",
25
- "app/controllers/admin/images_controller.rb",
26
- "app/models/image.rb",
27
- "app/views/admin/images/_bottom.haml",
28
- "app/views/admin/images/_fields.haml",
29
- "app/views/admin/images/_fields_bottom.haml",
30
- "app/views/admin/images/_fields_top.haml",
31
- "app/views/admin/images/_image.haml",
32
- "app/views/admin/images/edit.haml",
33
- "app/views/admin/images/index.haml",
34
- "app/views/admin/images/new.haml",
35
- "app/views/admin/images/remove.haml",
36
- "config/locales/en.yml",
37
- "config/routes.rb",
38
- "cucumber.yml",
39
- "db/migrate/20100601042237_create_images.rb",
40
- "db/migrate/20100602044124_add_position_to_images.rb",
41
- "db/migrate/20100929150930_change_images_to_created_by_id.rb",
42
- "features/support/env.rb",
43
- "features/support/paths.rb",
44
- "images_extension.rb",
45
- "lib/images/interface/admin/images.rb",
46
- "lib/images/tags/core.rb",
47
- "lib/images/tags/helpers.rb",
48
- "lib/tasks/images_extension_tasks.rake",
49
- "public/images/admin/extensions/images/sort.png",
50
- "public/images/extensions/images/missing_icon.png",
51
- "public/images/extensions/images/missing_normal.png",
52
- "public/images/extensions/images/missing_preview.png",
53
- "public/stylesheets/sass/admin/extensions/images/edit.sass",
54
- "public/stylesheets/sass/admin/extensions/images/index.sass",
55
- "radiant-images-extension.gemspec",
56
- "spec/controllers/admin/images_controller_spec.rb",
57
- "spec/datasets/images.rb",
58
- "spec/datasets/squaretalent.png",
59
- "spec/lib/images/tags/core_spec.rb",
60
- "spec/models/image_spec.rb",
61
- "spec/spec.opts",
62
- "spec/spec_helper.rb"
20
+ "LICENSE",
21
+ "README.md",
22
+ "Rakefile",
23
+ "VERSION",
24
+ "app/controllers/admin/images_controller.rb",
25
+ "app/models/image.rb",
26
+ "app/views/admin/images/_bottom.haml",
27
+ "app/views/admin/images/_fields.haml",
28
+ "app/views/admin/images/_fields_bottom.haml",
29
+ "app/views/admin/images/_fields_top.haml",
30
+ "app/views/admin/images/_image.haml",
31
+ "app/views/admin/images/edit.haml",
32
+ "app/views/admin/images/index.haml",
33
+ "app/views/admin/images/new.haml",
34
+ "app/views/admin/images/remove.haml",
35
+ "config/locales/en.yml",
36
+ "config/routes.rb",
37
+ "cucumber.yml",
38
+ "db/migrate/20100601042237_create_images.rb",
39
+ "db/migrate/20100602044124_add_position_to_images.rb",
40
+ "db/migrate/20100929150930_change_images_to_created_by_id.rb",
41
+ "features/support/env.rb",
42
+ "features/support/paths.rb",
43
+ "images_extension.rb",
44
+ "lib/images/interface/admin/images.rb",
45
+ "lib/images/tags/core.rb",
46
+ "lib/images/tags/helpers.rb",
47
+ "lib/radiant-images-extension.rb",
48
+ "lib/tasks/images_extension_tasks.rake",
49
+ "public/images/admin/extensions/images/sort.png",
50
+ "public/images/extensions/images/missing_icon.png",
51
+ "public/images/extensions/images/missing_normal.png",
52
+ "public/images/extensions/images/missing_preview.png",
53
+ "public/stylesheets/sass/admin/extensions/images/edit.sass",
54
+ "public/stylesheets/sass/admin/extensions/images/index.sass",
55
+ "radiant-images-extension.gemspec",
56
+ "spec/controllers/admin/images_controller_spec.rb",
57
+ "spec/datasets/images.rb",
58
+ "spec/datasets/squaretalent.png",
59
+ "spec/lib/images/tags/core_spec.rb",
60
+ "spec/lib/images_extension_spec.rb",
61
+ "spec/models/image_spec.rb",
62
+ "spec/spec.opts",
63
+ "spec/spec_helper.rb"
63
64
  ]
64
65
  s.homepage = %q{http://github.com/squaretalent/radiant-images-extension}
65
- s.rdoc_options = ["--charset=UTF-8"]
66
66
  s.require_paths = ["lib"]
67
67
  s.rubygems_version = %q{1.3.7}
68
68
  s.summary = %q{Images Extension for Radiant CMS}
69
69
  s.test_files = [
70
70
  "spec/controllers/admin/images_controller_spec.rb",
71
- "spec/datasets/images.rb",
72
- "spec/lib/images/tags/core_spec.rb",
73
- "spec/models/image_spec.rb",
74
- "spec/spec_helper.rb"
71
+ "spec/datasets/images.rb",
72
+ "spec/lib/images/tags/core_spec.rb",
73
+ "spec/lib/images_extension_spec.rb",
74
+ "spec/models/image_spec.rb",
75
+ "spec/spec_helper.rb"
75
76
  ]
76
77
 
77
78
  if s.respond_to? :specification_version then
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require File.dirname(__FILE__) + "/../../spec_helper"
2
2
 
3
3
  describe Admin::ImagesController do
4
4
 
@@ -106,7 +106,7 @@ describe Admin::ImagesController do
106
106
  controller.send :rescue_s3_exceptions do
107
107
  raise AWS::S3::ResponseError.new('some error' ,'')
108
108
  end
109
- (controller.send :flash)[:error].should == 'some error'
109
+ flash.now[:error].should == 'some error'
110
110
 
111
111
  end
112
112
 
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require File.dirname(__FILE__) + "/../../../spec_helper"
2
2
 
3
3
  describe Images::Tags::Core do
4
4
 
@@ -7,6 +7,11 @@ describe Images::Tags::Core do
7
7
  before(:all) do
8
8
  @images = [ images(:first), images(:second), images(:third),
9
9
  images(:fourth), images(:fifth), images(:sixth) ]
10
+ Radiant::Config['images.default'] = "original"
11
+ Radiant::Config['images.path'] = ":rails_root/public/:class/:basename-:style.:extension"
12
+ Radiant::Config['images.storage'] = "local"
13
+ Radiant::Config['images.styles'] = "icon=45x45#,preview=200x200#,normal=640x640#"
14
+ Radiant::Config['images.url'] = "/:class/:basename-:style.:extension"
10
15
  end
11
16
 
12
17
  before(:each) do
@@ -0,0 +1,64 @@
1
+ require File.dirname(__FILE__) + "/../spec_helper"
2
+
3
+ describe ImagesExtension do
4
+
5
+ describe 's3_credentials' do
6
+
7
+ context 'load through yaml' do
8
+
9
+ before :each do
10
+
11
+ if File.exists?(File.join(Rails.root,'config','amazon_s3.yml'))
12
+ FileUtils.mv(File.join(Rails.root,'config','amazon_s3.yml'),File.join(Rails.root,'config','amazon_s3-back.yml'))
13
+ end
14
+
15
+ f = File.new(File.join(Rails.root,'config','amazon_s3.yml'), 'w')
16
+ f << "#{RAILS_ENV}:\n"
17
+ f << " access_key_id: FILE KEY\n"
18
+ f << " secret_access_key: FILE SECRET"
19
+ f.close
20
+
21
+ end
22
+
23
+ it 'should return the file config strings' do
24
+ ImagesExtension.s3_credentials.should == { 'access_key_id' => 'FILE KEY', 'secret_access_key' => 'FILE SECRET' }
25
+ end
26
+
27
+ after :each do
28
+ File.delete(File.join(Rails.root,'config','amazon_s3.yml'))
29
+
30
+ if File.exists?(File.join(Rails.root,'config','amazon_s3-back.yml'))
31
+ FileUtils.mv(File.join(Rails.root,'config','amazon_s3-back.yml'),File.join(Rails.root,'config','amazon_s3.yml'))
32
+ end
33
+ end
34
+
35
+ end
36
+
37
+ context 'load through Radiant::Config' do
38
+
39
+ before :each do
40
+
41
+ Radiant::Config['s3.key'] = 'DB KEY'
42
+ Radiant::Config['s3.secret'] = 'DB SECRET'
43
+
44
+ if File.exists?(File.join(Rails.root,'config','amazon_s3.yml'))
45
+ FileUtils.mv(File.join(Rails.root,'config','amazon_s3.yml'),File.join(Rails.root,'config','amazon_s3-back.yml'))
46
+ end
47
+
48
+ end
49
+
50
+ it 'should return the radiant config strings' do
51
+ ImagesExtension.s3_credentials.should == { 'access_key_id' => 'DB KEY', 'secret_access_key' => 'DB SECRET' }
52
+ end
53
+
54
+ after :each do
55
+ if File.exists?(File.join(Rails.root,'config','amazon_s3-back.yml'))
56
+ FileUtils.mv(File.join(Rails.root,'config','amazon_s3-back.yml'),File.join(Rails.root,'config','amazon_s3.yml'))
57
+ end
58
+ end
59
+
60
+ end
61
+
62
+ end
63
+
64
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiant-images-extension
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 0
10
- version: 0.4.0
9
+ - 1
10
+ version: 0.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dirk Kelly
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-02 00:00:00 +08:00
19
+ date: 2010-11-23 00:00:00 +08:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -125,7 +125,6 @@ extra_rdoc_files:
125
125
  - LICENSE
126
126
  - README.md
127
127
  files:
128
- - .gitignore
129
128
  - LICENSE
130
129
  - README.md
131
130
  - Rakefile
@@ -153,6 +152,7 @@ files:
153
152
  - lib/images/interface/admin/images.rb
154
153
  - lib/images/tags/core.rb
155
154
  - lib/images/tags/helpers.rb
155
+ - lib/radiant-images-extension.rb
156
156
  - lib/tasks/images_extension_tasks.rake
157
157
  - public/images/admin/extensions/images/sort.png
158
158
  - public/images/extensions/images/missing_icon.png
@@ -165,6 +165,7 @@ files:
165
165
  - spec/datasets/images.rb
166
166
  - spec/datasets/squaretalent.png
167
167
  - spec/lib/images/tags/core_spec.rb
168
+ - spec/lib/images_extension_spec.rb
168
169
  - spec/models/image_spec.rb
169
170
  - spec/spec.opts
170
171
  - spec/spec_helper.rb
@@ -173,8 +174,8 @@ homepage: http://github.com/squaretalent/radiant-images-extension
173
174
  licenses: []
174
175
 
175
176
  post_install_message:
176
- rdoc_options:
177
- - --charset=UTF-8
177
+ rdoc_options: []
178
+
178
179
  require_paths:
179
180
  - lib
180
181
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -206,5 +207,6 @@ test_files:
206
207
  - spec/controllers/admin/images_controller_spec.rb
207
208
  - spec/datasets/images.rb
208
209
  - spec/lib/images/tags/core_spec.rb
210
+ - spec/lib/images_extension_spec.rb
209
211
  - spec/models/image_spec.rb
210
212
  - spec/spec_helper.rb
data/.gitignore DELETED
@@ -1,2 +0,0 @@
1
- .DS_Store
2
- *.gem