acts_as_assets 0.0.7 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Binary file
@@ -14,4 +14,10 @@ describe Books::AssetsController do
14
14
  it {should route(:delete,'books/1/assets/20.js').to(
15
15
  :controller => "books/assets", :action => :destroy, :book_id => 1, :format => 'js', :asset_id => 20)}
16
16
 
17
+ it {should route(:get,'books/1/assets/get/20/thumb/filename.gif').to(
18
+ :controller => "books/assets", :action => :get, :book_id => 1, :style => "thumb", :asset_id => 20, :filename => "filename", :extension => "gif" )}
19
+
20
+ it {should route(:get,'books/1/assets/get/20/filename.gif').to(
21
+ :controller => "books/assets", :action => :get, :book_id => 1, :asset_id => 20, :filename => "filename", :extension => "gif")}
22
+
17
23
  end
@@ -34,6 +34,7 @@ RSpec.configure do |config|
34
34
  end
35
35
  Rails.application.routes.draw do
36
36
  scope "books/:book_id/assets/" do
37
+ get 'get/:asset_id/(:style)/:filename.:extension' => 'books/assets#get', :as => 'book_get_asset'
37
38
  get '*type' => 'books/assets#index', :as => 'book_assets'
38
39
  post '*type' => 'books/assets#create', :as => 'book_create_asset'
39
40
  delete ':asset_id' => 'books/assets#destroy', :as => 'book_destroy_asset'
@@ -47,11 +48,16 @@ RSpec.configure do |config|
47
48
  @dtbd = []
48
49
  end
49
50
  config.after :all do
51
+ require 'fileutils'
50
52
  @dtbd.each {|d| d.destroy unless d.nil? }
53
+ Dir[File.expand_path("spec/temp/*")].each do |file|
54
+ FileUtils.rm file
55
+ end
51
56
  end
52
57
 
53
58
  config.before(:each) do
54
59
  Books::Asset.delete_all
60
+ Books::Image.delete_all
55
61
  Book.delete_all
56
62
  end
57
63
 
@@ -1,3 +1,40 @@
1
1
  class Book < ActiveRecord::Base
2
2
  has_many :assets, :class_name => "Books::Asset"
3
- end
3
+ end
4
+
5
+ module Books
6
+ class Asset < ActiveRecord::Base
7
+ self.table_name = "books_assets"
8
+ acts_as_assets
9
+ end
10
+ end
11
+
12
+ module Books
13
+ module Assets
14
+ class TestDoc < Books::Asset
15
+ end
16
+ end
17
+ end
18
+
19
+ module Books
20
+ module Assets
21
+ class UniqueTestDoc < Books::Asset
22
+ include ActsAsAssets::UniqueAsset
23
+ end
24
+ end
25
+ end
26
+
27
+ module Books
28
+ class Image < ActiveRecord::Base
29
+ self.table_name = "books_assets"
30
+ acts_as_assets :styles => {:thumb => "64x64", :medium => "128x128", :original => "800x600<"}
31
+ end
32
+ end
33
+
34
+ module Books
35
+ module Assets
36
+ class TestImage < Books::Image
37
+ end
38
+ end
39
+ end
40
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-27 00:00:00.000000000Z
12
+ date: 2012-03-06 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &2153968100 !ruby/object:Gem::Requirement
16
+ requirement: &70165570071060 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.2.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153968100
24
+ version_requirements: *70165570071060
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: paperclip
27
- requirement: &2153967640 !ruby/object:Gem::Requirement
27
+ requirement: &70165570070620 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2153967640
35
+ version_requirements: *70165570070620
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: ci_reporter
38
- requirement: &2153966980 !ruby/object:Gem::Requirement
38
+ requirement: &70165570070160 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2153966980
46
+ version_requirements: *70165570070160
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sqlite3
49
- requirement: &2153966520 !ruby/object:Gem::Requirement
49
+ requirement: &70165570069740 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2153966520
57
+ version_requirements: *70165570069740
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec-rails
60
- requirement: &2153966080 !ruby/object:Gem::Requirement
60
+ requirement: &70165570069320 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2153966080
68
+ version_requirements: *70165570069320
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: paperclip
71
- requirement: &2153965640 !ruby/object:Gem::Requirement
71
+ requirement: &70165570068900 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2153965640
79
+ version_requirements: *70165570068900
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: shoulda-matchers
82
- requirement: &2153965040 !ruby/object:Gem::Requirement
82
+ requirement: &70165570068480 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *2153965040
90
+ version_requirements: *70165570068480
91
91
  description: Manage multiple assets related to a specific model
92
92
  email:
93
93
  - acampolonghi@gmail.com
@@ -136,6 +136,8 @@ files:
136
136
  - spec/dummy/config/routes.rb
137
137
  - spec/dummy/config.ru
138
138
  - spec/dummy/db/schema.rb
139
+ - spec/dummy/db/test.sqlite3
140
+ - spec/dummy/log/test.log
139
141
  - spec/dummy/public/404.html
140
142
  - spec/dummy/public/422.html
141
143
  - spec/dummy/public/500.html
@@ -148,10 +150,7 @@ files:
148
150
  - spec/rspec_matchers_spec.rb
149
151
  - spec/spec_helper.rb
150
152
  - spec/support/book.rb
151
- - spec/support/books_asset.rb
152
153
  - spec/support/books_assets_controller.rb
153
- - spec/support/books_assets_test_doc.rb
154
- - spec/support/books_assets_unique_test_doc.rb
155
154
  - spec/unique_asset_spec.rb
156
155
  homepage: ''
157
156
  licenses: []
@@ -167,7 +166,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
167
166
  version: '0'
168
167
  segments:
169
168
  - 0
170
- hash: -271964698832483561
169
+ hash: 4608610428312738961
171
170
  required_rubygems_version: !ruby/object:Gem::Requirement
172
171
  none: false
173
172
  requirements:
@@ -176,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
175
  version: '0'
177
176
  segments:
178
177
  - 0
179
- hash: -271964698832483561
178
+ hash: 4608610428312738961
180
179
  requirements: []
181
180
  rubyforge_project:
182
181
  rubygems_version: 1.8.10
@@ -208,6 +207,8 @@ test_files:
208
207
  - spec/dummy/config/routes.rb
209
208
  - spec/dummy/config.ru
210
209
  - spec/dummy/db/schema.rb
210
+ - spec/dummy/db/test.sqlite3
211
+ - spec/dummy/log/test.log
211
212
  - spec/dummy/public/404.html
212
213
  - spec/dummy/public/422.html
213
214
  - spec/dummy/public/500.html
@@ -220,8 +221,5 @@ test_files:
220
221
  - spec/rspec_matchers_spec.rb
221
222
  - spec/spec_helper.rb
222
223
  - spec/support/book.rb
223
- - spec/support/books_asset.rb
224
224
  - spec/support/books_assets_controller.rb
225
- - spec/support/books_assets_test_doc.rb
226
- - spec/support/books_assets_unique_test_doc.rb
227
225
  - spec/unique_asset_spec.rb
@@ -1,6 +0,0 @@
1
- module Books
2
- class Asset < ActiveRecord::Base
3
- self.table_name = "books_assets"
4
- acts_as_assets
5
- end
6
- end
@@ -1,6 +0,0 @@
1
- module Books
2
- module Assets
3
- class TestDoc < Books::Asset
4
- end
5
- end
6
- end
@@ -1,7 +0,0 @@
1
- module Books
2
- module Assets
3
- class UniqueTestDoc < Books::Asset
4
- include ActsAsAssets::UniqueAsset
5
- end
6
- end
7
- end