tvdeyen-fleximage 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/fleximage.rb +1 -1
- data/lib/fleximage/rails3_view.rb +25 -25
- data/tvdeyen-fleximage.gemspec +2 -2
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.8
|
data/lib/fleximage.rb
CHANGED
@@ -33,7 +33,7 @@ if defined?(ActionView::Template)
|
|
33
33
|
# Rails >= 2.1
|
34
34
|
if Rails.version.to_f >= 3
|
35
35
|
require 'fleximage/rails3_view'
|
36
|
-
ActionView::Template.register_template_handler :flexi,
|
36
|
+
ActionView::Template.register_template_handler :flexi, Fleximage::Rails3View
|
37
37
|
else
|
38
38
|
require 'fleximage/view'
|
39
39
|
ActionView::Template.register_template_handler :flexi, Fleximage::View
|
@@ -1,31 +1,31 @@
|
|
1
|
-
module
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
module Fleximage
|
2
|
+
class Rails3View < ActionView::Template::Handler
|
3
|
+
include ActionView::Template::Handlers::Compilable
|
4
|
+
|
5
|
+
class TemplateDidNotReturnImage < RuntimeError #:nodoc:
|
6
|
+
end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
19
|
-
# Figure out the proper format
|
20
|
-
raise 'Image must be requested with an image type format. jpg, gif and png only are supported.' unless [:jpg, :gif, :png].include?(requested_format)
|
21
|
-
result.output_image(:format => requested_format)
|
22
|
-
rescue Exception => e
|
23
|
-
e
|
8
|
+
def compile(template)
|
9
|
+
<<-CODE
|
10
|
+
@template_format = :flexi
|
11
|
+
controller.response.content_type ||= Mime::JPG
|
12
|
+
result = #{template.source}
|
13
|
+
requested_format = (params[:format] || :jpg).to_sym
|
14
|
+
begin
|
15
|
+
# Raise an error if object returned from template is not an image record
|
16
|
+
unless result.class.include?(Fleximage::Model::InstanceMethods)
|
17
|
+
raise TemplateDidNotReturnImage, ".flexi template was expected to return a model instance that acts_as_fleximage, but got an instance of instead."
|
24
18
|
end
|
25
|
-
|
26
|
-
|
27
|
-
|
19
|
+
# Figure out the proper format
|
20
|
+
raise 'Image must be requested with an image type format. jpg, gif and png only are supported.' unless [:jpg, :gif, :png].include?(requested_format)
|
21
|
+
result.output_image(:format => requested_format)
|
22
|
+
rescue Exception => e
|
23
|
+
e
|
28
24
|
end
|
25
|
+
CODE
|
26
|
+
ensure
|
27
|
+
GC.start
|
29
28
|
end
|
29
|
+
|
30
30
|
end
|
31
31
|
end
|
data/tvdeyen-fleximage.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{tvdeyen-fleximage}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.8"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ahmed Adam", "Alex Wayne", "Andrew White", "Duccio", "Fernando Kosh", "Heiner Wohner", "JJ Buckley", "Jason Lee", "Joshua Abbott", "Koji Ando", "Kouhei Sutou", "Lasse Jansen", "Lo\303\257c Guitaut", "Martin Vielsmaier", "Squeegy", "Thomas von Deyen", "Vannoy", "Wolfgang Klinger", "Wolfgang K\303\266lbl", "josei", "ralph"]
|
12
|
-
s.date = %q{2011-09-
|
12
|
+
s.date = %q{2011-09-09}
|
13
13
|
s.description = %q{Fleximage is a Rails plugin that tries to make image uploading and rendering
|
14
14
|
super easy.
|
15
15
|
}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tvdeyen-fleximage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 8
|
10
|
+
version: 1.0.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ahmed Adam
|
@@ -35,7 +35,7 @@ autorequire:
|
|
35
35
|
bindir: bin
|
36
36
|
cert_chain: []
|
37
37
|
|
38
|
-
date: 2011-09-
|
38
|
+
date: 2011-09-09 00:00:00 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: rmagick
|