attachment_magick 0.3.3 → 0.3.4
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/Gemfile +3 -5
- data/Gemfile.lock +100 -105
- data/README.rdoc +10 -8
- data/app/controllers/attachment_magick/images_controller.rb +19 -14
- data/app/helpers/attachment_magick/attachment_magick_helper.rb +7 -1
- data/app/models/attachment_magick/active_record_image.rb +2 -2
- data/attachment_magick.gemspec +2 -2
- data/lib/attachment_magick.rb +2 -4
- data/lib/attachment_magick/dragonfly/init.rb +6 -6
- data/lib/attachment_magick/test/attachment_magick_test_helper.rb +1 -8
- data/lib/attachment_magick/version.rb +1 -1
- data/test/attachment_magick/controllers/images_controller_test.rb +3 -0
- data/test/attachment_magick/helpers/attachment_magick_test.rb +6 -0
- data/test/attachment_magick/units/attachment_magick_test.rb +3 -1
- data/test/dummy/config/environments/development.rb +7 -3
- data/test/dummy/config/environments/production.rb +23 -12
- data/test/dummy/config/environments/test.rb +30 -26
- data/test/dummy/test/fixtures/little_girl.jpg +0 -0
- data/test/test_helper.rb +4 -2
- metadata +17 -17
data/Gemfile
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
source "http://rubygems.org"
|
|
2
2
|
|
|
3
|
-
gem "rails", "3.
|
|
3
|
+
gem "rails", "3.2.3"
|
|
4
4
|
gem "capybara", ">= 1.0.1"
|
|
5
5
|
gem "sqlite3-ruby", :require => "sqlite3"
|
|
6
6
|
|
|
7
|
-
gem "mongoid", "
|
|
8
|
-
gem "bson_ext", "
|
|
7
|
+
gem "mongoid", "2.4.10"
|
|
8
|
+
gem "bson_ext", "1.5.2"
|
|
9
9
|
gem "nokogiri"
|
|
10
10
|
gem "hpricot"
|
|
11
11
|
gem "colorific"
|
|
12
|
-
gem "ruby-debug19"
|
|
13
12
|
gem "simplecov", :require => false
|
|
14
13
|
gem "mime-types", ">=1.16"
|
|
15
14
|
|
|
16
|
-
|
|
17
15
|
# Specify your gem's dependencies in attachment_magick.gemspec
|
|
18
16
|
gemspec
|
data/Gemfile.lock
CHANGED
|
@@ -2,77 +2,76 @@ PATH
|
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
4
|
attachment_magick (0.3.3)
|
|
5
|
-
dragonfly (>= 0.9.
|
|
5
|
+
dragonfly (>= 0.9.10)
|
|
6
6
|
jquery-rails (>= 0.2.7)
|
|
7
7
|
marcosinger-auto_html (>= 1.3.6)
|
|
8
8
|
marcosinger-css_parser (>= 1.3.0)
|
|
9
|
-
rack-cache (>= 1.
|
|
9
|
+
rack-cache (>= 1.1)
|
|
10
10
|
|
|
11
11
|
GEM
|
|
12
12
|
remote: http://rubygems.org/
|
|
13
13
|
specs:
|
|
14
|
-
RedCloth (4.2.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
rack (~> 1.2
|
|
26
|
-
rack-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
arel (
|
|
44
|
-
bson (1.
|
|
45
|
-
bson_ext (1.
|
|
46
|
-
|
|
47
|
-
|
|
14
|
+
RedCloth (4.2.9)
|
|
15
|
+
actionmailer (3.2.3)
|
|
16
|
+
actionpack (= 3.2.3)
|
|
17
|
+
mail (~> 2.4.4)
|
|
18
|
+
actionpack (3.2.3)
|
|
19
|
+
activemodel (= 3.2.3)
|
|
20
|
+
activesupport (= 3.2.3)
|
|
21
|
+
builder (~> 3.0.0)
|
|
22
|
+
erubis (~> 2.7.0)
|
|
23
|
+
journey (~> 1.0.1)
|
|
24
|
+
rack (~> 1.4.0)
|
|
25
|
+
rack-cache (~> 1.2)
|
|
26
|
+
rack-test (~> 0.6.1)
|
|
27
|
+
sprockets (~> 2.1.2)
|
|
28
|
+
activemodel (3.2.3)
|
|
29
|
+
activesupport (= 3.2.3)
|
|
30
|
+
builder (~> 3.0.0)
|
|
31
|
+
activerecord (3.2.3)
|
|
32
|
+
activemodel (= 3.2.3)
|
|
33
|
+
activesupport (= 3.2.3)
|
|
34
|
+
arel (~> 3.0.2)
|
|
35
|
+
tzinfo (~> 0.3.29)
|
|
36
|
+
activeresource (3.2.3)
|
|
37
|
+
activemodel (= 3.2.3)
|
|
38
|
+
activesupport (= 3.2.3)
|
|
39
|
+
activesupport (3.2.3)
|
|
40
|
+
i18n (~> 0.6)
|
|
41
|
+
multi_json (~> 1.0)
|
|
42
|
+
addressable (2.2.8)
|
|
43
|
+
arel (3.0.2)
|
|
44
|
+
bson (1.5.2)
|
|
45
|
+
bson_ext (1.5.2)
|
|
46
|
+
bson (= 1.5.2)
|
|
47
|
+
builder (3.0.0)
|
|
48
|
+
capybara (1.1.2)
|
|
48
49
|
mime-types (>= 1.16)
|
|
49
50
|
nokogiri (>= 1.3.3)
|
|
50
51
|
rack (>= 1.0.0)
|
|
51
52
|
rack-test (>= 0.5.4)
|
|
52
53
|
selenium-webdriver (~> 2.0)
|
|
53
54
|
xpath (~> 0.1.4)
|
|
54
|
-
childprocess (0.
|
|
55
|
+
childprocess (0.3.2)
|
|
55
56
|
ffi (~> 1.0.6)
|
|
56
|
-
colorific (1.0.
|
|
57
|
-
minitest (~> 2.
|
|
57
|
+
colorific (1.0.2)
|
|
58
|
+
minitest (~> 2.8.0)
|
|
58
59
|
ruby-progressbar (~> 0.0.10)
|
|
59
|
-
|
|
60
|
-
dragonfly (0.9.8)
|
|
60
|
+
dragonfly (0.9.12)
|
|
61
61
|
rack
|
|
62
|
-
erubis (2.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
hpricot (0.8.
|
|
66
|
-
i18n (0.
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
erubis (2.7.0)
|
|
63
|
+
ffi (1.0.11)
|
|
64
|
+
hike (1.2.1)
|
|
65
|
+
hpricot (0.8.6)
|
|
66
|
+
i18n (0.6.0)
|
|
67
|
+
journey (1.0.3)
|
|
68
|
+
jquery-rails (2.0.2)
|
|
69
|
+
railties (>= 3.2.0, < 5.0)
|
|
69
70
|
thor (~> 0.14)
|
|
70
|
-
json (1.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
mail (2.2.19)
|
|
75
|
-
activesupport (>= 2.3.6)
|
|
71
|
+
json (1.7.3)
|
|
72
|
+
libwebsocket (0.1.3)
|
|
73
|
+
addressable
|
|
74
|
+
mail (2.4.4)
|
|
76
75
|
i18n (>= 0.4.0)
|
|
77
76
|
mime-types (~> 1.16)
|
|
78
77
|
treetop (~> 1.4.8)
|
|
@@ -83,73 +82,70 @@ GEM
|
|
|
83
82
|
rinku
|
|
84
83
|
tag_helper
|
|
85
84
|
marcosinger-css_parser (1.3.0)
|
|
86
|
-
mime-types (1.
|
|
87
|
-
minitest (2.
|
|
88
|
-
mongo (1.
|
|
89
|
-
bson (= 1.
|
|
90
|
-
mongoid (2.
|
|
91
|
-
activemodel (~> 3.
|
|
85
|
+
mime-types (1.18)
|
|
86
|
+
minitest (2.8.1)
|
|
87
|
+
mongo (1.5.2)
|
|
88
|
+
bson (= 1.5.2)
|
|
89
|
+
mongoid (2.4.10)
|
|
90
|
+
activemodel (~> 3.1)
|
|
92
91
|
mongo (~> 1.3)
|
|
93
92
|
tzinfo (~> 0.3.22)
|
|
94
|
-
multi_json (1.
|
|
95
|
-
nokogiri (1.5.
|
|
96
|
-
polyglot (0.3.
|
|
97
|
-
rack (1.
|
|
98
|
-
rack-cache (1.
|
|
93
|
+
multi_json (1.3.5)
|
|
94
|
+
nokogiri (1.5.2)
|
|
95
|
+
polyglot (0.3.3)
|
|
96
|
+
rack (1.4.1)
|
|
97
|
+
rack-cache (1.2)
|
|
99
98
|
rack (>= 0.4)
|
|
100
|
-
rack-
|
|
101
|
-
rack
|
|
102
|
-
rack-test (0.
|
|
99
|
+
rack-ssl (1.3.2)
|
|
100
|
+
rack
|
|
101
|
+
rack-test (0.6.1)
|
|
103
102
|
rack (>= 1.0)
|
|
104
|
-
rails (3.
|
|
105
|
-
actionmailer (= 3.
|
|
106
|
-
actionpack (= 3.
|
|
107
|
-
activerecord (= 3.
|
|
108
|
-
activeresource (= 3.
|
|
109
|
-
activesupport (= 3.
|
|
103
|
+
rails (3.2.3)
|
|
104
|
+
actionmailer (= 3.2.3)
|
|
105
|
+
actionpack (= 3.2.3)
|
|
106
|
+
activerecord (= 3.2.3)
|
|
107
|
+
activeresource (= 3.2.3)
|
|
108
|
+
activesupport (= 3.2.3)
|
|
110
109
|
bundler (~> 1.0)
|
|
111
|
-
railties (= 3.
|
|
112
|
-
railties (3.
|
|
113
|
-
actionpack (= 3.
|
|
114
|
-
activesupport (= 3.
|
|
110
|
+
railties (= 3.2.3)
|
|
111
|
+
railties (3.2.3)
|
|
112
|
+
actionpack (= 3.2.3)
|
|
113
|
+
activesupport (= 3.2.3)
|
|
114
|
+
rack-ssl (~> 1.3.2)
|
|
115
115
|
rake (>= 0.8.7)
|
|
116
116
|
rdoc (~> 3.4)
|
|
117
|
-
thor (~> 0.14.
|
|
117
|
+
thor (~> 0.14.6)
|
|
118
118
|
rake (0.9.2.2)
|
|
119
|
-
rdoc (3.
|
|
119
|
+
rdoc (3.12)
|
|
120
120
|
json (~> 1.4)
|
|
121
|
-
redcarpet (1.
|
|
122
|
-
rinku (1.
|
|
123
|
-
ruby-debug-base19 (0.11.25)
|
|
124
|
-
columnize (>= 0.3.1)
|
|
125
|
-
linecache19 (>= 0.5.11)
|
|
126
|
-
ruby_core_source (>= 0.1.4)
|
|
127
|
-
ruby-debug19 (0.11.6)
|
|
128
|
-
columnize (>= 0.3.1)
|
|
129
|
-
linecache19 (>= 0.5.11)
|
|
130
|
-
ruby-debug-base19 (>= 0.11.19)
|
|
121
|
+
redcarpet (2.1.1)
|
|
122
|
+
rinku (1.5.1)
|
|
131
123
|
ruby-progressbar (0.0.10)
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
json_pure
|
|
124
|
+
rubyzip (0.9.8)
|
|
125
|
+
selenium-webdriver (2.21.2)
|
|
126
|
+
childprocess (>= 0.2.5)
|
|
127
|
+
ffi (~> 1.0)
|
|
128
|
+
libwebsocket (~> 0.1.3)
|
|
129
|
+
multi_json (~> 1.0)
|
|
139
130
|
rubyzip
|
|
140
|
-
simplecov (0.
|
|
141
|
-
multi_json (~> 1.0
|
|
131
|
+
simplecov (0.6.4)
|
|
132
|
+
multi_json (~> 1.0)
|
|
142
133
|
simplecov-html (~> 0.5.3)
|
|
143
134
|
simplecov-html (0.5.3)
|
|
144
|
-
|
|
135
|
+
sprockets (2.1.3)
|
|
136
|
+
hike (~> 1.2)
|
|
137
|
+
rack (~> 1.0)
|
|
138
|
+
tilt (~> 1.1, != 1.3.0)
|
|
139
|
+
sqlite3 (1.3.6)
|
|
145
140
|
sqlite3-ruby (1.3.3)
|
|
146
141
|
sqlite3 (>= 1.3.3)
|
|
147
142
|
tag_helper (0.0.3)
|
|
148
143
|
thor (0.14.6)
|
|
144
|
+
tilt (1.3.3)
|
|
149
145
|
treetop (1.4.10)
|
|
150
146
|
polyglot
|
|
151
147
|
polyglot (>= 0.3.1)
|
|
152
|
-
tzinfo (0.3.
|
|
148
|
+
tzinfo (0.3.33)
|
|
153
149
|
xpath (0.1.4)
|
|
154
150
|
nokogiri (~> 1.3)
|
|
155
151
|
|
|
@@ -158,14 +154,13 @@ PLATFORMS
|
|
|
158
154
|
|
|
159
155
|
DEPENDENCIES
|
|
160
156
|
attachment_magick!
|
|
161
|
-
bson_ext (
|
|
157
|
+
bson_ext (= 1.5.2)
|
|
162
158
|
capybara (>= 1.0.1)
|
|
163
159
|
colorific
|
|
164
160
|
hpricot
|
|
165
161
|
mime-types (>= 1.16)
|
|
166
|
-
mongoid (
|
|
162
|
+
mongoid (= 2.4.10)
|
|
167
163
|
nokogiri
|
|
168
|
-
rails (= 3.
|
|
169
|
-
ruby-debug19
|
|
164
|
+
rails (= 3.2.3)
|
|
170
165
|
simplecov
|
|
171
166
|
sqlite3-ruby
|
data/README.rdoc
CHANGED
|
@@ -30,7 +30,7 @@ Create a initializer like this (config/initializers/attachment_magick_setup.rb)
|
|
|
30
30
|
config.columns_width = 52
|
|
31
31
|
config.gutter = 8
|
|
32
32
|
# Or with our magick :)
|
|
33
|
-
|
|
33
|
+
# config.parse_stylesheet('name_of_my_grid_file.css')
|
|
34
34
|
|
|
35
35
|
config.orms = ["ActiveRecord", "Mongoid"] # Mongoid is default
|
|
36
36
|
|
|
@@ -40,16 +40,18 @@ Create a initializer like this (config/initializers/attachment_magick_setup.rb)
|
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
-
* Attachment Magick is based
|
|
43
|
+
* Attachment Magick is based on 960 Grid System (http://960.gs/)
|
|
44
44
|
|
|
45
45
|
Add to application.rb
|
|
46
46
|
|
|
47
|
-
config.middleware.insert 0, '
|
|
48
|
-
config.middleware.insert_before 'Dragonfly::Middleware', 'Rack::Cache', {
|
|
47
|
+
config.middleware.insert 0, 'Rack::Cache', {
|
|
49
48
|
:verbose => true,
|
|
50
|
-
:metastore => "file:#{Rails.root}/tmp/dragonfly/cache/meta",
|
|
51
|
-
:entitystore => "file:#{Rails.root}/tmp/dragonfly/cache/body"
|
|
52
|
-
}
|
|
49
|
+
:metastore => URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/meta"),
|
|
50
|
+
:entitystore => URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/body")
|
|
51
|
+
} # unless Rails.env.production? ## uncomment this 'unless' in Rails 3.1,
|
|
52
|
+
## because it already inserts Rack::Cache in production
|
|
53
|
+
|
|
54
|
+
config.middleware.insert_after 'Rack::Cache', 'Dragonfly::Middleware', :images
|
|
53
55
|
|
|
54
56
|
== Getting started
|
|
55
57
|
|
|
@@ -62,7 +64,7 @@ Include AttachmentMagick Module to your model
|
|
|
62
64
|
class Post
|
|
63
65
|
include AttachmentMagick
|
|
64
66
|
|
|
65
|
-
|
|
67
|
+
attachment_magick
|
|
66
68
|
end
|
|
67
69
|
|
|
68
70
|
Call this helpers in form views
|
|
@@ -4,25 +4,29 @@ class AttachmentMagick::ImagesController < ActionController::Base
|
|
|
4
4
|
before_filter :load_klass
|
|
5
5
|
|
|
6
6
|
def create
|
|
7
|
-
|
|
7
|
+
options = {
|
|
8
|
+
:photo => params[:Filedata],
|
|
9
|
+
:source => params[:source],
|
|
10
|
+
:file_name => (params[:Filedata].original_filename unless params[:source])
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@image = @klass.images.create(options)
|
|
8
14
|
@klass.save
|
|
9
15
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
partial_options = {
|
|
17
|
+
:collection => [@image],
|
|
18
|
+
:as => :image,
|
|
19
|
+
:partial => AttachmentMagick.configuration.default_add_partial
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
partial_options.merge!({:partial => params[:data_partial]}) if params[:data_partial].present?
|
|
23
|
+
render partial_options
|
|
15
24
|
end
|
|
16
25
|
|
|
17
26
|
def update_sortable
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
array_ids.each_with_index do |id, index|
|
|
22
|
-
hash.merge!( {"#{index}" => {:id => "#{id}", :priority => index}} )
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
@klass.images_attributes = hash
|
|
27
|
+
hsh = {}
|
|
28
|
+
params[:images].each_with_index {|id, index| hsh.merge!({"#{index}" => {:id => "#{id}", :priority => index}}) }
|
|
29
|
+
@klass.images_attributes = hsh
|
|
26
30
|
@klass.save
|
|
27
31
|
|
|
28
32
|
render :text => "ok"
|
|
@@ -30,6 +34,7 @@ class AttachmentMagick::ImagesController < ActionController::Base
|
|
|
30
34
|
|
|
31
35
|
def destroy
|
|
32
36
|
@klass.images.find(params[:id]).destroy
|
|
37
|
+
|
|
33
38
|
render :text => "ok"
|
|
34
39
|
end
|
|
35
40
|
|
|
@@ -91,4 +91,10 @@ module AttachmentMagick::AttachmentMagickHelper
|
|
|
91
91
|
<!--<![endif]-->
|
|
92
92
|
</object>".html_safe
|
|
93
93
|
end
|
|
94
|
-
|
|
94
|
+
|
|
95
|
+
def resize_video(html, x)
|
|
96
|
+
y = x.to_i * 2 / 3
|
|
97
|
+
html.gsub(/width=\"([0-9]+)\"/, "width='#{x}'").gsub(/height=\"([0-9]+)\"/, "height='#{y}'").html_safe
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module AttachmentMagick
|
|
2
2
|
if AttachmentMagick.configuration.orms.include?("ActiveRecord")
|
|
3
3
|
class ActiveRecordImage < ActiveRecord::Base
|
|
4
|
-
|
|
4
|
+
self.table_name = "amagick_images"
|
|
5
5
|
|
|
6
6
|
belongs_to :imageable, :polymorphic => true
|
|
7
7
|
image_accessor :photo
|
|
@@ -30,4 +30,4 @@ module AttachmentMagick
|
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
end
|
|
33
|
+
end
|
data/attachment_magick.gemspec
CHANGED
|
@@ -18,8 +18,8 @@ Gem::Specification.new do |s|
|
|
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
19
19
|
s.require_paths = ["lib"]
|
|
20
20
|
|
|
21
|
-
s.add_dependency "dragonfly", ">= 0.9.
|
|
22
|
-
s.add_dependency "rack-cache", ">= 1.
|
|
21
|
+
s.add_dependency "dragonfly", ">= 0.9.10"
|
|
22
|
+
s.add_dependency "rack-cache", ">= 1.1"
|
|
23
23
|
s.add_dependency "jquery-rails", ">= 0.2.7"
|
|
24
24
|
s.add_dependency "marcosinger-auto_html", ">= 1.3.6"
|
|
25
25
|
s.add_dependency "marcosinger-css_parser", ">= 1.3.0"
|
data/lib/attachment_magick.rb
CHANGED
|
@@ -17,12 +17,12 @@ if defined? Mongoid::Document
|
|
|
17
17
|
|
|
18
18
|
app.datastore = Dragonfly::DataStorage::MongoDataStore.new
|
|
19
19
|
app.datastore.configure do |c|
|
|
20
|
-
c.host = yaml_file['host']
|
|
21
|
-
c.port = yaml_file['port']
|
|
22
|
-
c.database = yaml_file['database']
|
|
23
|
-
c.username = yaml_file['username']
|
|
24
|
-
c.password = yaml_file['password']
|
|
20
|
+
c.host = yaml_file['host'] || yaml_file['uri'] # defaults to localhost
|
|
21
|
+
c.port = yaml_file['port'] # defaults to mongo default (27017)
|
|
22
|
+
c.database = yaml_file['database'] # defaults to 'dragonfly'
|
|
23
|
+
c.username = yaml_file['username'] # only needed if mongo is running in auth mode
|
|
24
|
+
c.password = yaml_file['password'] # only needed if mongo is running in auth mode
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
app.define_macro_on_include(Mongoid::Document, :image_accessor)
|
|
28
|
-
end
|
|
28
|
+
end
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
class Tempfile
|
|
2
|
-
def original_filename
|
|
3
|
-
"little_girl.jpg"
|
|
4
|
-
end
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
|
|
8
1
|
module AttachmentMagickTestHelper
|
|
9
2
|
def assert_element_in(target, match)
|
|
10
3
|
target = Nokogiri::HTML(target)
|
|
@@ -41,7 +34,7 @@ module AttachmentMagickTestHelper
|
|
|
41
34
|
end
|
|
42
35
|
|
|
43
36
|
def example_file
|
|
44
|
-
|
|
37
|
+
fixture_file_upload('little_girl.jpg', 'image/jpg')
|
|
45
38
|
end
|
|
46
39
|
|
|
47
40
|
def example_youtube
|
|
@@ -12,6 +12,7 @@ class AttachmentMagick::ImagesControllerTest < ActionController::TestCase
|
|
|
12
12
|
post :create, artist_hash.merge({ :Filedata => example_file })
|
|
13
13
|
assert_response :success
|
|
14
14
|
assert assert_element_in(response.body, "img")
|
|
15
|
+
assert assert_element_in(response.body, "div[@class='grid_5 attachment_magick_image']")
|
|
15
16
|
end
|
|
16
17
|
|
|
17
18
|
test "should create artist vimeo video" do
|
|
@@ -30,6 +31,8 @@ class AttachmentMagick::ImagesControllerTest < ActionController::TestCase
|
|
|
30
31
|
post :create, work_hash.merge({ :Filedata => example_file })
|
|
31
32
|
assert_response :success
|
|
32
33
|
assert assert_element_in(response.body, "img")
|
|
34
|
+
assert assert_element_in(response.body, "div[@class='image_caption']")
|
|
35
|
+
assert assert_element_in(response.body, "div[@class='image_thumb']")
|
|
33
36
|
end
|
|
34
37
|
|
|
35
38
|
test "should create place image" do
|
|
@@ -61,4 +61,10 @@ class AttachmentMagick::AttachmentMagickHelperTest < ActionView::TestCase
|
|
|
61
61
|
assert assert_element_in(html, "object")
|
|
62
62
|
assert assert_element_in(html, "object[@width='100'][@height='60']")
|
|
63
63
|
end
|
|
64
|
+
|
|
65
|
+
def test_should_resize_video
|
|
66
|
+
html = "<iframe width=\"450\" height=\"250\"></iframe>"
|
|
67
|
+
assert_equal(resize_video(html, 300), "<iframe width='300' height='200'></iframe>")
|
|
68
|
+
end
|
|
69
|
+
|
|
64
70
|
end
|
|
@@ -62,7 +62,9 @@ class AttachmentMagickTest < ActiveSupport::TestCase
|
|
|
62
62
|
column_amount = 10
|
|
63
63
|
gutter = 3
|
|
64
64
|
|
|
65
|
-
grid_system = open("http://www.spry-soft.com/grids/grid/?column_width=#{column_width}&column_amount=#{column_amount}&gutter_width=#{gutter}") { |url| Hpricot(url) }
|
|
65
|
+
#grid_system = open("http://www.spry-soft.com/grids/grid/?column_width=#{column_width}&column_amount=#{column_amount}&gutter_width=#{gutter}") { |url| Hpricot(url) }
|
|
66
|
+
grid_system = open("http://grids.heroku.com/grid?column_width=#{column_width}&column_amount=#{column_amount}&gutter_width=#{gutter}") { |url| Hpricot(url) }
|
|
67
|
+
|
|
66
68
|
grids = Artist.send(:generate_grids, column_amount, column_width, gutter)
|
|
67
69
|
|
|
68
70
|
assert_equal grids.size, column_amount + AttachmentMagick.configuration.custom_styles.styles.size
|
|
@@ -3,7 +3,7 @@ Dummy::Application.configure do
|
|
|
3
3
|
|
|
4
4
|
# In the development environment your application's code is reloaded on
|
|
5
5
|
# every request. This slows down response time but is perfect for development
|
|
6
|
-
# since you don't have to restart the
|
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
|
7
7
|
config.cache_classes = false
|
|
8
8
|
|
|
9
9
|
# Log error messages when you accidentally call methods on nil.
|
|
@@ -11,7 +11,6 @@ Dummy::Application.configure do
|
|
|
11
11
|
|
|
12
12
|
# Show full error reports and disable caching
|
|
13
13
|
config.consider_all_requests_local = true
|
|
14
|
-
config.action_view.debug_rjs = true
|
|
15
14
|
config.action_controller.perform_caching = false
|
|
16
15
|
|
|
17
16
|
# Don't care if the mailer can't send
|
|
@@ -22,5 +21,10 @@ Dummy::Application.configure do
|
|
|
22
21
|
|
|
23
22
|
# Only use best-standards-support built into browsers
|
|
24
23
|
config.action_dispatch.best_standards_support = :builtin
|
|
25
|
-
end
|
|
26
24
|
|
|
25
|
+
# Do not compress assets
|
|
26
|
+
config.assets.compress = false
|
|
27
|
+
|
|
28
|
+
# Expands the lines which load the assets
|
|
29
|
+
config.assets.debug = true
|
|
30
|
+
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
Dummy::Application.configure do
|
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb
|
|
3
3
|
|
|
4
|
-
# The production environment is meant for finished, "live" apps.
|
|
5
4
|
# Code is not reloaded between requests
|
|
6
5
|
config.cache_classes = true
|
|
7
6
|
|
|
@@ -9,14 +8,27 @@ Dummy::Application.configure do
|
|
|
9
8
|
config.consider_all_requests_local = false
|
|
10
9
|
config.action_controller.perform_caching = true
|
|
11
10
|
|
|
12
|
-
#
|
|
13
|
-
config.
|
|
11
|
+
# Disable Rails's static asset server (Apache or nginx will already do this)
|
|
12
|
+
config.serve_static_assets = false
|
|
13
|
+
|
|
14
|
+
# Compress JavaScripts and CSS
|
|
15
|
+
config.assets.compress = true
|
|
16
|
+
|
|
17
|
+
# Don't fallback to assets pipeline if a precompiled asset is missed
|
|
18
|
+
config.assets.compile = false
|
|
19
|
+
|
|
20
|
+
# Generate digests for assets URLs
|
|
21
|
+
config.assets.digest = true
|
|
14
22
|
|
|
15
|
-
#
|
|
16
|
-
# config.
|
|
23
|
+
# Defaults to Rails.root.join("public/assets")
|
|
24
|
+
# config.assets.manifest = YOUR_PATH
|
|
17
25
|
|
|
18
|
-
#
|
|
19
|
-
#
|
|
26
|
+
# Specifies the header that your server uses for sending files
|
|
27
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
|
28
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
|
29
|
+
|
|
30
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
|
31
|
+
# config.force_ssl = true
|
|
20
32
|
|
|
21
33
|
# See everything in the log (default is :info)
|
|
22
34
|
# config.log_level = :debug
|
|
@@ -27,13 +39,12 @@ Dummy::Application.configure do
|
|
|
27
39
|
# Use a different cache store in production
|
|
28
40
|
# config.cache_store = :mem_cache_store
|
|
29
41
|
|
|
30
|
-
#
|
|
31
|
-
# In production, Apache or nginx will already do this
|
|
32
|
-
config.serve_static_assets = false
|
|
33
|
-
|
|
34
|
-
# Enable serving of images, stylesheets, and javascripts from an asset server
|
|
42
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
|
35
43
|
# config.action_controller.asset_host = "http://assets.example.com"
|
|
36
44
|
|
|
45
|
+
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
|
46
|
+
# config.assets.precompile += %w( search.js )
|
|
47
|
+
|
|
37
48
|
# Disable delivery errors, bad email addresses will be ignored
|
|
38
49
|
# config.action_mailer.raise_delivery_errors = false
|
|
39
50
|
|
|
@@ -1,35 +1,39 @@
|
|
|
1
1
|
Dummy::Application.configure do
|
|
2
|
-
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
# The test environment is used exclusively to run your application's
|
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
|
8
|
+
config.cache_classes = true
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
# Configure static asset server for tests with Cache-Control for performance
|
|
11
|
+
config.serve_static_assets = true
|
|
12
|
+
config.static_cache_control = "public, max-age=3600"
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
config.action_controller.perform_caching = false
|
|
14
|
+
# Log error messages when you accidentally call methods on nil
|
|
15
|
+
config.whiny_nils = true
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
# Show full error reports and disable caching
|
|
18
|
+
config.consider_all_requests_local = true
|
|
19
|
+
config.action_controller.perform_caching = false
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
# Raise exceptions instead of rendering exception templates
|
|
22
|
+
config.action_dispatch.show_exceptions = false
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
# ActionMailer::Base.deliveries array.
|
|
26
|
-
config.action_mailer.delivery_method = :test
|
|
24
|
+
# Disable request forgery protection in test environment
|
|
25
|
+
config.action_controller.allow_forgery_protection = false
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
|
28
|
+
# The :test delivery method accumulates sent emails in the
|
|
29
|
+
# ActionMailer::Base.deliveries array.
|
|
30
|
+
config.action_mailer.delivery_method = :test
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
|
33
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
|
34
|
+
# like if you have constraints or database-specific column types
|
|
35
|
+
# config.active_record.schema_format = :sql
|
|
36
|
+
|
|
37
|
+
# Print deprecation notices to the stderr
|
|
38
|
+
config.active_support.deprecation = :stderr
|
|
39
|
+
end
|
|
Binary file
|
data/test/test_helper.rb
CHANGED
|
@@ -9,7 +9,6 @@ end
|
|
|
9
9
|
|
|
10
10
|
ENV["RAILS_ENV"] = "test"
|
|
11
11
|
|
|
12
|
-
require 'ruby-debug' ; Debugger.start
|
|
13
12
|
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
|
14
13
|
require "rails/test_help"
|
|
15
14
|
|
|
@@ -34,15 +33,18 @@ require "generators/attachment_magick/migration_generator"
|
|
|
34
33
|
|
|
35
34
|
# Some helpers
|
|
36
35
|
require "attachment_magick/test/attachment_magick_test_helper"
|
|
36
|
+
require "action_dispatch/testing/test_process"
|
|
37
37
|
|
|
38
38
|
class ActiveSupport::TestCase
|
|
39
39
|
include AttachmentMagickTestHelper
|
|
40
|
+
include ActionDispatch::TestProcess
|
|
40
41
|
end
|
|
41
42
|
|
|
42
43
|
class ActionController::TestCase
|
|
43
44
|
include AttachmentMagickTestHelper
|
|
45
|
+
include ActionDispatch::TestProcess
|
|
44
46
|
end
|
|
45
47
|
|
|
46
48
|
class ActionView::TestCase
|
|
47
49
|
include AttachmentMagickTestHelper
|
|
48
|
-
end
|
|
50
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: attachment_magick
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.4
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -11,34 +11,33 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date:
|
|
15
|
-
default_executable:
|
|
14
|
+
date: 2012-05-15 00:00:00.000000000 Z
|
|
16
15
|
dependencies:
|
|
17
16
|
- !ruby/object:Gem::Dependency
|
|
18
17
|
name: dragonfly
|
|
19
|
-
requirement: &
|
|
18
|
+
requirement: &2153159200 !ruby/object:Gem::Requirement
|
|
20
19
|
none: false
|
|
21
20
|
requirements:
|
|
22
21
|
- - ! '>='
|
|
23
22
|
- !ruby/object:Gem::Version
|
|
24
|
-
version: 0.9.
|
|
23
|
+
version: 0.9.10
|
|
25
24
|
type: :runtime
|
|
26
25
|
prerelease: false
|
|
27
|
-
version_requirements: *
|
|
26
|
+
version_requirements: *2153159200
|
|
28
27
|
- !ruby/object:Gem::Dependency
|
|
29
28
|
name: rack-cache
|
|
30
|
-
requirement: &
|
|
29
|
+
requirement: &2153158160 !ruby/object:Gem::Requirement
|
|
31
30
|
none: false
|
|
32
31
|
requirements:
|
|
33
32
|
- - ! '>='
|
|
34
33
|
- !ruby/object:Gem::Version
|
|
35
|
-
version: '1.
|
|
34
|
+
version: '1.1'
|
|
36
35
|
type: :runtime
|
|
37
36
|
prerelease: false
|
|
38
|
-
version_requirements: *
|
|
37
|
+
version_requirements: *2153158160
|
|
39
38
|
- !ruby/object:Gem::Dependency
|
|
40
39
|
name: jquery-rails
|
|
41
|
-
requirement: &
|
|
40
|
+
requirement: &2153157300 !ruby/object:Gem::Requirement
|
|
42
41
|
none: false
|
|
43
42
|
requirements:
|
|
44
43
|
- - ! '>='
|
|
@@ -46,10 +45,10 @@ dependencies:
|
|
|
46
45
|
version: 0.2.7
|
|
47
46
|
type: :runtime
|
|
48
47
|
prerelease: false
|
|
49
|
-
version_requirements: *
|
|
48
|
+
version_requirements: *2153157300
|
|
50
49
|
- !ruby/object:Gem::Dependency
|
|
51
50
|
name: marcosinger-auto_html
|
|
52
|
-
requirement: &
|
|
51
|
+
requirement: &2153156620 !ruby/object:Gem::Requirement
|
|
53
52
|
none: false
|
|
54
53
|
requirements:
|
|
55
54
|
- - ! '>='
|
|
@@ -57,10 +56,10 @@ dependencies:
|
|
|
57
56
|
version: 1.3.6
|
|
58
57
|
type: :runtime
|
|
59
58
|
prerelease: false
|
|
60
|
-
version_requirements: *
|
|
59
|
+
version_requirements: *2153156620
|
|
61
60
|
- !ruby/object:Gem::Dependency
|
|
62
61
|
name: marcosinger-css_parser
|
|
63
|
-
requirement: &
|
|
62
|
+
requirement: &2153155960 !ruby/object:Gem::Requirement
|
|
64
63
|
none: false
|
|
65
64
|
requirements:
|
|
66
65
|
- - ! '>='
|
|
@@ -68,7 +67,7 @@ dependencies:
|
|
|
68
67
|
version: 1.3.0
|
|
69
68
|
type: :runtime
|
|
70
69
|
prerelease: false
|
|
71
|
-
version_requirements: *
|
|
70
|
+
version_requirements: *2153155960
|
|
72
71
|
description:
|
|
73
72
|
email:
|
|
74
73
|
- markaum@gmail.com
|
|
@@ -181,10 +180,10 @@ files:
|
|
|
181
180
|
- test/dummy/public/stylesheets/swfupload.css
|
|
182
181
|
- test/dummy/public/stylesheets/text.css
|
|
183
182
|
- test/dummy/script/rails
|
|
183
|
+
- test/dummy/test/fixtures/little_girl.jpg
|
|
184
184
|
- test/integration/navigation_test.rb
|
|
185
185
|
- test/support/integration_case.rb
|
|
186
186
|
- test/test_helper.rb
|
|
187
|
-
has_rdoc: true
|
|
188
187
|
homepage: http://github.com/marcosinger/attachment_magick
|
|
189
188
|
licenses: []
|
|
190
189
|
post_install_message:
|
|
@@ -205,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
205
204
|
version: '0'
|
|
206
205
|
requirements: []
|
|
207
206
|
rubyforge_project: attachment_magick
|
|
208
|
-
rubygems_version: 1.
|
|
207
|
+
rubygems_version: 1.8.10
|
|
209
208
|
signing_key:
|
|
210
209
|
specification_version: 3
|
|
211
210
|
summary: little more magick when you upload image files (with SwfUpload and Dragonfly)
|
|
@@ -284,6 +283,7 @@ test_files:
|
|
|
284
283
|
- test/dummy/public/stylesheets/swfupload.css
|
|
285
284
|
- test/dummy/public/stylesheets/text.css
|
|
286
285
|
- test/dummy/script/rails
|
|
286
|
+
- test/dummy/test/fixtures/little_girl.jpg
|
|
287
287
|
- test/integration/navigation_test.rb
|
|
288
288
|
- test/support/integration_case.rb
|
|
289
289
|
- test/test_helper.rb
|