radiant-images-extension 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/LICENSE +19 -0
- data/README.md +41 -0
- data/Rakefile +141 -0
- data/VERSION +1 -0
- data/app/controllers/admin/images_controller.rb +50 -0
- data/app/models/image.rb +91 -0
- data/app/views/admin/images/_bottom.haml +13 -0
- data/app/views/admin/images/_fields.haml +22 -0
- data/app/views/admin/images/_fields_bottom.haml +10 -0
- data/app/views/admin/images/_fields_top.haml +7 -0
- data/app/views/admin/images/_image.haml +12 -0
- data/app/views/admin/images/edit.haml +14 -0
- data/app/views/admin/images/index.haml +16 -0
- data/app/views/admin/images/new.haml +12 -0
- data/app/views/admin/images/remove.haml +12 -0
- data/config/locales/en.yml +8 -0
- data/config/routes.rb +7 -0
- data/cucumber.yml +1 -0
- data/db/migrate/20100601042237_create_images.rb +22 -0
- data/db/migrate/20100602044124_add_position_to_images.rb +13 -0
- data/features/support/env.rb +16 -0
- data/features/support/paths.rb +14 -0
- data/images_extension.rb +53 -0
- data/lib/images/interface/admin/images.rb +37 -0
- data/lib/images/tags/image.rb +171 -0
- data/lib/tasks/images_extension_tasks.rake +77 -0
- data/public/images/extensions/images/missing_icon.png +0 -0
- data/public/images/extensions/images/missing_normal.png +0 -0
- data/public/images/extensions/images/missing_preview.png +0 -0
- data/public/javascripts/admin/extensions/images/edit.js +0 -0
- data/public/stylesheets/sass/admin/extensions/images/edit.sass +8 -0
- data/public/stylesheets/sass/admin/extensions/images/index.sass +103 -0
- data/radiant-images-extension.gemspec +99 -0
- data/spec/controllers/admin/images_controller_spec.rb +135 -0
- data/spec/datasets/images.rb +15 -0
- data/spec/lib/images/tags/image_spec.rb +240 -0
- data/spec/models/image_spec.rb +65 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +22 -0
- metadata +191 -0
@@ -0,0 +1,65 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe Image do
|
4
|
+
dataset :images
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
stub(AWS::S3::Base).establish_connection!
|
8
|
+
@image = images(:first)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should have a title' do
|
12
|
+
@image.title.should == 'first'
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should have a caption' do
|
16
|
+
@image.caption.should == 'brief description'
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should require a unique title' do
|
20
|
+
@new_image = @image.clone
|
21
|
+
@new_image.valid?
|
22
|
+
@new_image.errors.on(:title).should include 'name is already in use'
|
23
|
+
end
|
24
|
+
|
25
|
+
context 's3 assets' do
|
26
|
+
it 'should have an asset' do
|
27
|
+
@image.asset.class.should == Paperclip::Attachment
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should have a file_name' do
|
31
|
+
@image.asset_file_name.should == 'first.png'
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should have a file_type' do
|
35
|
+
@image.asset_content_type.should == 'image/png'
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should have a file_size' do
|
39
|
+
@image.asset_file_size.should == "1000"
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should require a valid asset' do
|
43
|
+
# create an invalid image without an asset!
|
44
|
+
image = Image.new
|
45
|
+
image.valid?
|
46
|
+
image.errors.on(:asset).should include 'must be set'
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should require a unique filename' do
|
50
|
+
@new_image = @image.clone
|
51
|
+
@new_image.valid?
|
52
|
+
@new_image.errors.on(:asset_file_name).should include 'file already exists'
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'should only allow image content types' do
|
56
|
+
@image.asset_content_type = 'not/image'
|
57
|
+
@image.valid?
|
58
|
+
@image.errors.on(:asset).should include 'not one of the allowed file types'
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
end
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
unless defined? RADIANT_ROOT
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
case
|
4
|
+
when ENV["RADIANT_ENV_FILE"]
|
5
|
+
require ENV["RADIANT_ENV_FILE"]
|
6
|
+
when File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions}
|
7
|
+
require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../../")}/config/environment"
|
8
|
+
else
|
9
|
+
require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../")}/config/environment"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
require "#{RADIANT_ROOT}/spec/spec_helper"
|
13
|
+
|
14
|
+
Dataset::Resolver.default << (File.dirname(__FILE__) + "/datasets")
|
15
|
+
|
16
|
+
if File.directory?(File.dirname(__FILE__) + "/matchers")
|
17
|
+
Dir[File.dirname(__FILE__) + "/matchers/*.rb"].each {|file| require file }
|
18
|
+
end
|
19
|
+
|
20
|
+
Spec::Runner.configure do |config|
|
21
|
+
config.mock_with :rr
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,191 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: radiant-images-extension
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- squaretalent
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-09-16 00:00:00 +08:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: paperclip
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 113
|
30
|
+
segments:
|
31
|
+
- 2
|
32
|
+
- 3
|
33
|
+
- 1
|
34
|
+
- 1
|
35
|
+
version: 2.3.1.1
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id001
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: aws-s3
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
hash: 3
|
47
|
+
segments:
|
48
|
+
- 0
|
49
|
+
- 6
|
50
|
+
- 2
|
51
|
+
version: 0.6.2
|
52
|
+
type: :runtime
|
53
|
+
version_requirements: *id002
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: acts_as_list
|
56
|
+
prerelease: false
|
57
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
hash: 31
|
63
|
+
segments:
|
64
|
+
- 0
|
65
|
+
- 1
|
66
|
+
- 2
|
67
|
+
version: 0.1.2
|
68
|
+
type: :runtime
|
69
|
+
version_requirements: *id003
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rspec
|
72
|
+
prerelease: false
|
73
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
hash: 27
|
79
|
+
segments:
|
80
|
+
- 1
|
81
|
+
- 3
|
82
|
+
- 0
|
83
|
+
version: 1.3.0
|
84
|
+
type: :development
|
85
|
+
version_requirements: *id004
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
name: rr
|
88
|
+
prerelease: false
|
89
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
hash: 23
|
95
|
+
segments:
|
96
|
+
- 1
|
97
|
+
- 0
|
98
|
+
- 0
|
99
|
+
version: 1.0.0
|
100
|
+
type: :development
|
101
|
+
version_requirements: *id005
|
102
|
+
description: Image Radiant Extension management tool, meant only to be useful to pages and extensions that need to require images.
|
103
|
+
email: info@squaretalent.com
|
104
|
+
executables: []
|
105
|
+
|
106
|
+
extensions: []
|
107
|
+
|
108
|
+
extra_rdoc_files:
|
109
|
+
- LICENSE
|
110
|
+
- README.md
|
111
|
+
files:
|
112
|
+
- .gitignore
|
113
|
+
- LICENSE
|
114
|
+
- README.md
|
115
|
+
- Rakefile
|
116
|
+
- VERSION
|
117
|
+
- app/controllers/admin/images_controller.rb
|
118
|
+
- app/models/image.rb
|
119
|
+
- app/views/admin/images/_bottom.haml
|
120
|
+
- app/views/admin/images/_fields.haml
|
121
|
+
- app/views/admin/images/_fields_bottom.haml
|
122
|
+
- app/views/admin/images/_fields_top.haml
|
123
|
+
- app/views/admin/images/_image.haml
|
124
|
+
- app/views/admin/images/edit.haml
|
125
|
+
- app/views/admin/images/index.haml
|
126
|
+
- app/views/admin/images/new.haml
|
127
|
+
- app/views/admin/images/remove.haml
|
128
|
+
- config/locales/en.yml
|
129
|
+
- config/routes.rb
|
130
|
+
- cucumber.yml
|
131
|
+
- db/migrate/20100601042237_create_images.rb
|
132
|
+
- db/migrate/20100602044124_add_position_to_images.rb
|
133
|
+
- features/support/env.rb
|
134
|
+
- features/support/paths.rb
|
135
|
+
- images_extension.rb
|
136
|
+
- lib/images/interface/admin/images.rb
|
137
|
+
- lib/images/tags/image.rb
|
138
|
+
- lib/tasks/images_extension_tasks.rake
|
139
|
+
- public/images/extensions/images/missing_icon.png
|
140
|
+
- public/images/extensions/images/missing_normal.png
|
141
|
+
- public/images/extensions/images/missing_preview.png
|
142
|
+
- public/javascripts/admin/extensions/images/edit.js
|
143
|
+
- public/stylesheets/sass/admin/extensions/images/edit.sass
|
144
|
+
- public/stylesheets/sass/admin/extensions/images/index.sass
|
145
|
+
- radiant-images-extension.gemspec
|
146
|
+
- spec/controllers/admin/images_controller_spec.rb
|
147
|
+
- spec/datasets/images.rb
|
148
|
+
- spec/lib/images/tags/image_spec.rb
|
149
|
+
- spec/models/image_spec.rb
|
150
|
+
- spec/spec.opts
|
151
|
+
- spec/spec_helper.rb
|
152
|
+
has_rdoc: true
|
153
|
+
homepage: http://github.com/squaretalent/radiant-images-extension
|
154
|
+
licenses: []
|
155
|
+
|
156
|
+
post_install_message:
|
157
|
+
rdoc_options:
|
158
|
+
- --charset=UTF-8
|
159
|
+
require_paths:
|
160
|
+
- lib
|
161
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
162
|
+
none: false
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
hash: 3
|
167
|
+
segments:
|
168
|
+
- 0
|
169
|
+
version: "0"
|
170
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
|
+
none: false
|
172
|
+
requirements:
|
173
|
+
- - ">="
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
hash: 3
|
176
|
+
segments:
|
177
|
+
- 0
|
178
|
+
version: "0"
|
179
|
+
requirements: []
|
180
|
+
|
181
|
+
rubyforge_project:
|
182
|
+
rubygems_version: 1.3.7
|
183
|
+
signing_key:
|
184
|
+
specification_version: 3
|
185
|
+
summary: Images Extension for Radiant CMS
|
186
|
+
test_files:
|
187
|
+
- spec/controllers/admin/images_controller_spec.rb
|
188
|
+
- spec/datasets/images.rb
|
189
|
+
- spec/lib/images/tags/image_spec.rb
|
190
|
+
- spec/models/image_spec.rb
|
191
|
+
- spec/spec_helper.rb
|