dragonfly 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of dragonfly might be problematic. Click here for more details.

data/.yardopts CHANGED
@@ -1,4 +1,5 @@
1
1
  --main extra_docs/Index.md
2
+ -e yard/setup.rb
2
3
  -
3
4
  README.md
4
5
  extra_docs/GettingStarted.md
@@ -9,5 +10,6 @@ extra_docs/Shortcuts.md
9
10
  extra_docs/Analysers.md
10
11
  extra_docs/Processing.md
11
12
  extra_docs/Encoding.md
13
+ extra_docs/MimeTypes.md
12
14
  extra_docs/ExampleUseCases.md
13
15
  LICENSE
data/History.txt CHANGED
@@ -1,3 +1,23 @@
1
+ 0.5.2 (2010-03-04)
2
+ ==================
3
+
4
+ Features
5
+ --------
6
+ - Added 'registered mime-types'
7
+ - Enhanced docs
8
+
9
+ Fixes
10
+ -----
11
+ - RMagickEncoder only encodes if not already in that format
12
+
13
+
14
+ 0.5.1 (2010-02-20)
15
+ ==================
16
+
17
+ Fixes
18
+ -----
19
+ - Fixed 'broken pipe' errors in FileCommandAnalyser due to outputting loads of stuff to the command line stdin
20
+
1
21
  0.5.0 (2010-02-20)
2
22
  ==================
3
23
 
data/Rakefile CHANGED
@@ -39,11 +39,11 @@ begin
39
39
  require 'yard'
40
40
  YARD::Rake::YardocTask.new do |t|
41
41
  t.files = ['lib/**/*.rb']
42
- t.options = %w(-e yard/setup.rb)
42
+ t.options = []
43
43
  end
44
44
  YARD::Rake::YardocTask.new 'yard:changed' do |t|
45
45
  t.files = `git status | grep '.rb' | grep modified | grep -v yard | cut -d' ' -f4`.split
46
- t.options = %w(-e yard/setup.rb)
46
+ t.options = []
47
47
  end
48
48
  rescue LoadError
49
49
  puts "YARD is not available. To run the documentation tasks, install it with: (sudo) gem install yard"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.1
1
+ 0.5.2
data/dragonfly.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dragonfly}
8
- s.version = "0.5.1"
8
+ s.version = "0.5.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mark Evans"]
12
- s.date = %q{2010-02-20}
12
+ s.date = %q{2010-03-04}
13
13
  s.email = %q{mark@new-bamboo.co.uk}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
@@ -34,6 +34,7 @@ Gem::Specification.new do |s|
34
34
  "extra_docs/ExampleUseCases.md",
35
35
  "extra_docs/GettingStarted.md",
36
36
  "extra_docs/Index.md",
37
+ "extra_docs/MimeTypes.md",
37
38
  "extra_docs/Processing.md",
38
39
  "extra_docs/Shortcuts.md",
39
40
  "extra_docs/UsingWithRails.md",
@@ -109,7 +110,6 @@ Gem::Specification.new do |s|
109
110
  "spec/dragonfly/active_record_extensions/model_spec.rb",
110
111
  "spec/dragonfly/active_record_extensions/models.rb",
111
112
  "spec/dragonfly/active_record_extensions/spec_helper.rb",
112
- "spec/dragonfly/analyser_list_spec.rb",
113
113
  "spec/dragonfly/analysis/file_command_analyser_spec.rb",
114
114
  "spec/dragonfly/analysis/r_magick_analyser_spec.rb",
115
115
  "spec/dragonfly/app_spec.rb",
@@ -136,6 +136,7 @@ Gem::Specification.new do |s|
136
136
  "yard/handlers/configurable_attr_handler.rb",
137
137
  "yard/setup.rb",
138
138
  "yard/templates/default/fulldoc/html/css/common.css",
139
+ "yard/templates/default/layout/html/layout.erb",
139
140
  "yard/templates/default/module/html/configuration_summary.erb",
140
141
  "yard/templates/default/module/setup.rb"
141
142
  ]
@@ -152,7 +153,6 @@ Gem::Specification.new do |s|
152
153
  "spec/dragonfly/active_record_extensions/model_spec.rb",
153
154
  "spec/dragonfly/active_record_extensions/models.rb",
154
155
  "spec/dragonfly/active_record_extensions/spec_helper.rb",
155
- "spec/dragonfly/analyser_list_spec.rb",
156
156
  "spec/dragonfly/analysis/file_command_analyser_spec.rb",
157
157
  "spec/dragonfly/analysis/r_magick_analyser_spec.rb",
158
158
  "spec/dragonfly/app_spec.rb",
data/extra_docs/Index.md CHANGED
@@ -8,18 +8,7 @@ Dragonfly is a {http://rack.rubyforge.org Rack} framework for on-the-fly process
8
8
  It includes an extension for Ruby on Rails to enable easy image handling.
9
9
  It is intended to be highly customizable, and is not limited to images, but any data type that could suit on-the-fly processing/encoding.
10
10
 
11
- Use the links at the top-right to navigate around the code, or jump straight to one of the guides below.
12
-
13
- - {file:README.md Quick start for using in Rails for image handling (README)}
14
- - {file:GettingStarted.md Getting started}
15
- - {file:UsingWithRails.md Using with Rails}
16
- - {file:ActiveRecord.md Using with ActiveRecord}
17
- - {file:DataStorage.md Data Storage}
18
- - {file:Analysers.md Analysers}
19
- - {file:Processing.md Processing}
20
- - {file:Encoding.md Encoding}
21
- - {file:Shortcuts.md Shortcuts for processing and encoding}
22
- - {file:ExampleUseCases.md Example use cases}
11
+ Use the dropdowns at the top-right to navigate around the code, or jump straight to one of the guides on the right.
23
12
 
24
13
  Installation
25
14
  ------------
@@ -0,0 +1,39 @@
1
+ Mime Types
2
+ ==========
3
+
4
+ Responses from the Dragonfly app have the HTTP 'Content-Type' header set.
5
+
6
+ Suppose we request the url '/media/some_uid.jpg'.
7
+ The mime-type is looked for in the following order (and the first found is used):
8
+
9
+ 1. The app's registered mime-types
10
+ 2. Analyse the content using the analyser's 'mime_type' method (if exists)
11
+ 3. Use the fallback mime-type (default 'application/octet-stream')
12
+
13
+ Registered mime-types
14
+ ---------------------
15
+ Registered mime-types default to the list given by Rack (see {http://rack.rubyforge.org/doc/Rack/Mime.html#MIME_TYPES Rack mime-types}).
16
+
17
+ To register a mime-type for the format 'egg', you can do the following:
18
+
19
+ Dragonfly::App[:my_app].register_mime_type(:egg, 'fried/egg')
20
+
21
+ You can also do this inside a configuration block.
22
+
23
+ Mime-type analysis
24
+ ------------------
25
+ The {Dragonfly::Analysis::FileCommandAnalyser FileCommandAnalyser} has a `mime_type` method which will return the
26
+ mime-type of any given content.
27
+
28
+ If this, or any other analyser that has the `mime_type` method, is registered, then this is used when no mime-type
29
+ is found in the registered list.
30
+
31
+ The FileCommandAnalyser is registered by default when you use the preconfigured 'dragonfly/rails/images' file.
32
+
33
+ Fallback mime-type
34
+ ------------------
35
+ By default this is 'application/octet-stream', but it can be changed using the configuration method on the app
36
+
37
+ Dragonfly::App[:my_app].fallback_mime_type = 'meaty/beef'
38
+
39
+ This can also be done inside a configuration block.
@@ -1,15 +1,5 @@
1
1
  module Dragonfly
2
2
  class AnalyserList
3
3
  include Delegator
4
-
5
- def mime_type(temp_object)
6
- registered_objects.reverse.each do |analyser|
7
- catch :unable_to_handle do
8
- return analyser.mime_type(temp_object) if analyser.respond_to?(:mime_type)
9
- end
10
- end
11
- nil
12
- end
13
-
14
4
  end
15
5
  end
@@ -4,10 +4,6 @@ module Dragonfly
4
4
 
5
5
  include Delegatable
6
6
 
7
- def mime_type(*args)
8
- throw :unable_to_handle
9
- end
10
-
11
7
  end
12
8
  end
13
9
  end
data/lib/dragonfly/app.rb CHANGED
@@ -118,7 +118,7 @@ module Dragonfly
118
118
  parameters = url_handler.url_to_parameters(env['PATH_INFO'], env['QUERY_STRING'])
119
119
  temp_object = fetch(parameters.uid, parameters)
120
120
  [200, {
121
- "Content-Type" => temp_object.mime_type || fallback_mime_type,
121
+ "Content-Type" => mime_type_for(parameters.format, temp_object),
122
122
  "Content-Length" => temp_object.size.to_s,
123
123
  "ETag" => parameters.unique_signature,
124
124
  "Cache-Control" => "public, max-age=#{cache_duration}"
@@ -158,6 +158,18 @@ module Dragonfly
158
158
  create_object(processors.generate(*args))
159
159
  end
160
160
 
161
+ # Return the mime type for a given extension, from the registered list
162
+ # By default uses the list provided by Rack (see Rack::Mime::MIME_TYPES)
163
+ # If not found there, it falls back to the registered analysers (if temp_object provided).
164
+ # If not found there, it falls back to the configured 'fallback_mime_type'
165
+ # @param [Symbol, String] format the format (file-extension)
166
+ # @param [TempObject] temp_object (optional)
167
+ # @return [String] the mime-type
168
+ # @see register_mime_type
169
+ def mime_type_for(format, temp_object=nil)
170
+ registered_mime_types[file_ext_string(format)] || (temp_object.mime_type if temp_object.respond_to?(:mime_type)) || fallback_mime_type
171
+ end
172
+
161
173
  # Store an object, using the configured datastore
162
174
  # @param [String, File, Tempfile, TempObject] object the object holding the data
163
175
  # @return [String] the uid assigned to it
@@ -180,6 +192,15 @@ module Dragonfly
180
192
  end
181
193
  configuration_method :register_encoder
182
194
 
195
+ def register_mime_type(format, mime_type)
196
+ registered_mime_types[file_ext_string(format)] = mime_type
197
+ end
198
+ configuration_method :register_mime_type
199
+
200
+ def registered_mime_types
201
+ @registered_mime_types ||= Rack::Mime::MIME_TYPES.dup
202
+ end
203
+
183
204
  private
184
205
 
185
206
  def initialize_temp_object_class
@@ -190,6 +211,10 @@ module Dragonfly
190
211
  def warn_with_info(message, env)
191
212
  log.warn "Got error: #{message}\nPath was #{env['PATH_INFO'].inspect} and query was #{env['QUERY_STRING'].inspect}"
192
213
  end
214
+
215
+ def file_ext_string(format)
216
+ '.' + format.to_s.downcase.sub(/^.*\./,'')
217
+ end
193
218
 
194
219
  end
195
220
  end
@@ -8,10 +8,15 @@ module Dragonfly
8
8
  SUPPORTED_FORMATS = Magick.formats.select{|k,v| v =~ /.*rw./ }.map{|f| f.first.downcase }
9
9
 
10
10
  def encode(image, format, encoding={})
11
- throw :unable_to_handle unless SUPPORTED_FORMATS.include?(format.to_s)
11
+ format = format.to_s.downcase
12
+ throw :unable_to_handle unless SUPPORTED_FORMATS.include?(format)
12
13
  encoded_image = Magick::Image.from_blob(image.data).first
13
- encoded_image.format = format.to_s
14
- encoded_image.to_blob
14
+ if encoded_image.format.downcase == format
15
+ image # do nothing
16
+ else
17
+ encoded_image.format = format
18
+ encoded_image.to_blob
19
+ end
15
20
  end
16
21
 
17
22
  end
@@ -304,27 +304,27 @@ describe Item do
304
304
  it "should be invalid if the property is nil" do
305
305
  @item.preview_image = "OTHER TYPE"
306
306
  @item.should_not be_valid
307
- @item.errors.on(:preview_image).should == "mime type is incorrect. It needs to be one of 'how/special', 'how/crazy', but was ''"
307
+ @item.errors[:preview_image].should match_ar_error("mime type is incorrect. It needs to be one of 'how/special', 'how/crazy', but was ''")
308
308
  end
309
309
 
310
310
  it "should be invalid if the property is wrong" do
311
311
  @item.preview_image = "WRONG TYPE"
312
312
  @item.should_not be_valid
313
- @item.errors.on(:preview_image).should == "mime type is incorrect. It needs to be one of 'how/special', 'how/crazy', but was 'wrong/type'"
313
+ @item.errors[:preview_image].should match_ar_error("mime type is incorrect. It needs to be one of 'how/special', 'how/crazy', but was 'wrong/type'")
314
314
  end
315
315
 
316
316
  it "should work for a range" do
317
317
  @item.preview_image = "GOOGLE GUM"
318
318
  @item.should_not be_valid
319
- @item.errors.on(:preview_image).should == "number of gs is incorrect. It needs to be between 0 and 2, but was '3'"
319
+ @item.errors[:preview_image].should match_ar_error("number of gs is incorrect. It needs to be between 0 and 2, but was '3'")
320
320
  end
321
321
 
322
322
  it "should validate individually" do
323
323
  @item.other_image = "1234567"
324
324
  @item.yet_another_image = "WRONG TYPE"
325
325
  @item.should_not be_valid
326
- @item.errors.on(:other_image).should be_nil
327
- @item.errors.on(:yet_another_image).should == "mime type is incorrect. It needs to be 'how/special', but was 'wrong/type'"
326
+ @item.errors[:other_image].should match_ar_error(nil)
327
+ @item.errors[:yet_another_image].should match_ar_error("mime type is incorrect. It needs to be 'how/special', but was 'wrong/type'")
328
328
  end
329
329
 
330
330
  it "should include standard extra options like 'if' on mime type validation" do
@@ -67,22 +67,72 @@ describe Dragonfly::App do
67
67
  end
68
68
 
69
69
  describe "mime types" do
70
- before(:each) do
71
- @app = Dragonfly::App[:images]
72
- @app.url_handler.protect_from_dos_attacks = false
73
- @app.fallback_mime_type = 'egg/heads'
74
- @temp_object = Dragonfly::TempObject.new('GOOG')
75
- @app.stub!(:fetch).and_return(@temp_object)
70
+ describe "#mime_type_for" do
71
+ before(:each) do
72
+ Dragonfly::App.send(:apps)[:images] = nil # A Hack to get rspec to reset stuff in between tests
73
+ @app = Dragonfly::App[:images]
74
+ end
75
+ it "should return the correct mime type for a symbol" do
76
+ @app.mime_type_for(:png).should == 'image/png'
77
+ end
78
+ it "should work for strings" do
79
+ @app.mime_type_for('png').should == 'image/png'
80
+ end
81
+ it "should work with uppercase strings" do
82
+ @app.mime_type_for('PNG').should == 'image/png'
83
+ end
84
+ it "should work with a dot" do
85
+ @app.mime_type_for('.png').should == 'image/png'
86
+ end
87
+ it "should return the fallback mime_type if not known" do
88
+ @app.mime_type_for(:mark).should == 'application/octet-stream'
89
+ end
90
+ it "should return the fallback mime_type if not known" do
91
+ @app.configure{|c| c.fallback_mime_type = 'egg/nog'}
92
+ @app.mime_type_for(:mark).should == 'egg/nog'
93
+ end
94
+ it "should allow for configuring extra mime types" do
95
+ @app.configure{|c| c.register_mime_type 'mark', 'application/mark'}
96
+ @app.mime_type_for(:mark).should == 'application/mark'
97
+ end
98
+ it "should override existing mime types when registered" do
99
+ @app.configure{|c| c.register_mime_type :png, 'ping/pong'}
100
+ @app.mime_type_for(:png).should == 'ping/pong'
101
+ end
102
+ it "should have a per-app mime-type configuration" do
103
+ other_app = Dragonfly::App[:other_app]
104
+ @app.register_mime_type(:mark, 'first/one')
105
+ other_app.register_mime_type(:mark, 'second/one')
106
+ @app.mime_type_for(:mark).should == 'first/one'
107
+ other_app.mime_type_for(:mark).should == 'second/one'
108
+ end
76
109
  end
77
- it "should use the temp object mime-type" do
78
- @temp_object.should_receive(:mime_type).and_return 'my/type'
79
- response = make_request(@app, '/hello.png')
80
- response.headers['Content-Type'].should == 'my/type'
81
- end
82
- it "should use the app's fallback mime-type if the temp_object one isn't known" do
83
- @temp_object.should_receive(:mime_type).and_return nil
84
- response = make_request(@app, '/hello.png')
85
- response.headers['Content-Type'].should == 'egg/heads'
110
+
111
+ describe "Content-Type header" do
112
+ before(:each) do
113
+ Dragonfly::App.send(:apps)[:test] = nil # A Hack to get rspec to reset stuff in between tests
114
+ @app = Dragonfly::App[:test]
115
+ @app.url_handler.protect_from_dos_attacks = false
116
+ @app.datastore = Dragonfly::DataStorage::TransparentDataStore.new
117
+ @app.register_encoder(Dragonfly::Encoding::TransparentEncoder)
118
+ @analyser = Class.new(Dragonfly::Analysis::Base){ def mime_type(*args); 'analyser/mime-type'; end }
119
+ end
120
+ it "should return the fallback mime_type if none registered and no mime_type analyser" do
121
+ make_request(@app, '/some_uid.gog').headers['Content-Type'].should == 'application/octet-stream'
122
+ end
123
+ it "should return the analysed mime-type if an analyser is registered" do
124
+ @app.register_analyser(@analyser)
125
+ make_request(@app, '/some_uid.gog').headers['Content-Type'].should == 'analyser/mime-type'
126
+ end
127
+ it "should return the registered mime_type over the analysed one" do
128
+ @app.register_analyser(@analyser)
129
+ @app.register_mime_type(:gog, 'numb/nut')
130
+ make_request(@app, '/some_uid.gog').headers['Content-Type'].should == 'numb/nut'
131
+ end
132
+ it "should use the fallback mime-type if the registered analyser doesn't respond to 'mime-type'" do
133
+ @app.register_analyser(Class.new(Dragonfly::Analysis::Base))
134
+ make_request(@app, '/some_uid.gog').headers['Content-Type'].should == 'application/octet-stream'
135
+ end
86
136
  end
87
137
  end
88
138
 
@@ -23,6 +23,11 @@ describe Dragonfly::Encoding::RMagickEncoder do
23
23
  end
24
24
  test_string.should == "I'm a string"
25
25
  end
26
+
27
+ it "should do nothing if the image is already in the correct format" do
28
+ image = @encoder.encode(@image, :png)
29
+ image.should == @image
30
+ end
26
31
  end
27
32
 
28
33
  end
@@ -16,13 +16,16 @@ describe Dragonfly::ExtendedTempObject do
16
16
  @analyser.stub!(:has_callable_method?).with(:width).and_return(true)
17
17
  @processor = mock('processor')
18
18
  @encoder = mock('encoder')
19
- @app = mock('app', :analysers => @analyser, :processor => @processor, :encoder => @encoder)
19
+ @app = mock('app', :analysers => @analyser, :processors => @processor, :encoders => @encoder)
20
20
  @klass = Class.new(Dragonfly::ExtendedTempObject)
21
21
  @klass.app = @app
22
- @object = @klass.new('asdf')
23
22
  end
24
23
 
25
24
  describe "analysis" do
25
+
26
+ before(:each) do
27
+ @object = @klass.new('asdf')
28
+ end
26
29
 
27
30
  it "should respond to something that the analyser responds to" do
28
31
  @analyser.should_receive(:has_callable_method?).with(:some_method).and_return(true)
@@ -62,6 +65,23 @@ describe Dragonfly::ExtendedTempObject do
62
65
 
63
66
  end
64
67
 
68
+ describe "encoding" do
69
+ before(:each) do
70
+ @temp_object = @klass.new('abcde')
71
+ end
72
+
73
+ it "should encode the data and return the new temp object" do
74
+ @encoder.should_receive(:encode).with(@temp_object, :some_format, :some => 'option').and_return('ABCDE')
75
+ new_temp_object = @temp_object.encode(:some_format, :some => 'option')
76
+ new_temp_object.data.should == 'ABCDE'
77
+ end
78
+ it "should encode its own data" do
79
+ @encoder.should_receive(:encode).with(@temp_object, :some_format, :some => 'option').and_return('ABCDE')
80
+ @temp_object.encode!(:some_format, :some => 'option')
81
+ @temp_object.data.should == 'ABCDE'
82
+ end
83
+ end
84
+
65
85
  end
66
86
 
67
87
  end
@@ -11,4 +11,12 @@ def be_an_empty_directory
11
11
  simple_matcher("be empty") do |given|
12
12
  Dir.entries(given) == ['.','..']
13
13
  end
14
- end
14
+ end
15
+
16
+ # The reason we need this is that ActiveRecord 2.x returns just a string/nil, whereas AR 3 always returns an array
17
+ def match_ar_error(string)
18
+ simple_matcher("match activerecord error") do |given|
19
+ error = given.is_a?(Array) ? given.first : given
20
+ error == string
21
+ end
22
+ end
@@ -1,5 +1,28 @@
1
1
  /* Overrides for yard documentation */
2
2
 
3
+ /* Clearfix */
4
+ .clearfix:after {
5
+ content: ".";
6
+ display: block;
7
+ clear: both;
8
+ visibility: hidden;
9
+ line-height: 0;
10
+ height: 0;
11
+ }
12
+
13
+ .clearfix {
14
+ display: inline-block;
15
+ }
16
+
17
+ html[xmlns] .clearfix {
18
+ display: block;
19
+ }
20
+
21
+ * html .clearfix {
22
+ height: 1%;
23
+ }
24
+ /************/
25
+
3
26
  pre, code, .code,
4
27
  #filecontents pre.code,
5
28
  .docstring pre.code,
@@ -9,11 +32,15 @@ pre, code, .code,
9
32
 
10
33
  pre.code, code {
11
34
  background:#F5F5FF;
12
- border:1px solid #EEEEFF;
35
+ overflow-x: auto;
13
36
  }
14
- pre.code {
15
- margin-top:4px;
37
+ #filecontents pre.code {
38
+ margin:10px 0;
16
39
  padding:5px 12px;
40
+ border-radius:5px;
41
+ -webkit-border-radius:5px;
42
+ -moz-border-radius:5px;
43
+ border: 1px dotted #CCC;
17
44
  }
18
45
 
19
46
  code .val {
@@ -25,3 +52,50 @@ code .kw {
25
52
  code .symbol {
26
53
  color:#C5060B;
27
54
  }
55
+
56
+ ul.main_files {
57
+ list-style-type:none;
58
+ margin:0;
59
+ padding:0;
60
+ font-size:14px;
61
+ }
62
+ ul.main_files li {
63
+ margin:0;
64
+ padding:0;
65
+ }
66
+ ul.main_files li a {
67
+ margin: 5px;
68
+ padding:10px;
69
+ display:block;
70
+ }
71
+
72
+ /* Layout */
73
+ #header,
74
+ #content,
75
+ #footer {
76
+ margin:0 auto;
77
+ width:1000px;
78
+ }
79
+ #header #logo {
80
+ float:left;
81
+ width:50%;
82
+ font-size: 24px;
83
+ letter-spacing: -1px;
84
+ margin-top: 20px;
85
+ text-transform: uppercase;
86
+ }
87
+ #header #search {
88
+ position:static;
89
+ float:right;
90
+ }
91
+ #content .col1 {
92
+ float:left;
93
+ width: 750px;
94
+ }
95
+ #content .col2 {
96
+ float:left;
97
+ margin: 20px 0 0 20px;
98
+ padding: 0 0 0 20px;
99
+ width: 200px;
100
+ border-left: 1px dotted #D5D5D5;
101
+ }
@@ -0,0 +1,50 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <%= erb(:headers) %>
6
+ </head>
7
+ <body>
8
+ <script type="text/javascript" charset="utf-8">
9
+ if (window.top.frames.main) document.body.className = 'frames';
10
+ </script>
11
+
12
+ <div id="header" class="clearfix">
13
+ <%#= erb(:breadcrumb) %>
14
+ <div id="logo">Dragonfly Documentation</div>
15
+ <%= erb(:search) %>
16
+ </div>
17
+
18
+ <div>
19
+ <iframe id="search_frame"></iframe>
20
+ </div>
21
+
22
+ <div id="content" class="clearfix">
23
+ <div class="col1">
24
+ <%= yieldall %>
25
+ </div>
26
+ <div class="col2">
27
+ <ul class="main_files clearfix">
28
+ <%= [
29
+ ['README', 'Quick start for Rails (README)'],
30
+ ['GettingStarted', 'Getting started'],
31
+ ['UsingWithRails', 'Using with Rails'],
32
+ ['ActiveRecord', 'Using with ActiveRecord'],
33
+ ['DataStorage', 'Data Storage'],
34
+ ['Analysers', 'Analysers'],
35
+ ['Processing', 'Processing'],
36
+ ['Encoding', 'Encoding'],
37
+ ['Shortcuts', 'Shortcuts for processing and encoding'],
38
+ ['MimeTypes', 'Mime Types'],
39
+ ['ExampleUseCases', 'Example use cases']
40
+ ].map{|(file, text)|
41
+ "<li>#{link_file(file, text)}</li>"
42
+ }.join
43
+ %>
44
+ </ul>
45
+ </div>
46
+ </div>
47
+
48
+ <%= erb(:footer) %>
49
+ </body>
50
+ </html>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dragonfly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Evans
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-20 00:00:00 +00:00
12
+ date: 2010-03-04 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -150,6 +150,7 @@ files:
150
150
  - extra_docs/ExampleUseCases.md
151
151
  - extra_docs/GettingStarted.md
152
152
  - extra_docs/Index.md
153
+ - extra_docs/MimeTypes.md
153
154
  - extra_docs/Processing.md
154
155
  - extra_docs/Shortcuts.md
155
156
  - extra_docs/UsingWithRails.md
@@ -225,7 +226,6 @@ files:
225
226
  - spec/dragonfly/active_record_extensions/model_spec.rb
226
227
  - spec/dragonfly/active_record_extensions/models.rb
227
228
  - spec/dragonfly/active_record_extensions/spec_helper.rb
228
- - spec/dragonfly/analyser_list_spec.rb
229
229
  - spec/dragonfly/analysis/file_command_analyser_spec.rb
230
230
  - spec/dragonfly/analysis/r_magick_analyser_spec.rb
231
231
  - spec/dragonfly/app_spec.rb
@@ -252,6 +252,7 @@ files:
252
252
  - yard/handlers/configurable_attr_handler.rb
253
253
  - yard/setup.rb
254
254
  - yard/templates/default/fulldoc/html/css/common.css
255
+ - yard/templates/default/layout/html/layout.erb
255
256
  - yard/templates/default/module/html/configuration_summary.erb
256
257
  - yard/templates/default/module/setup.rb
257
258
  has_rdoc: true
@@ -290,7 +291,6 @@ test_files:
290
291
  - spec/dragonfly/active_record_extensions/model_spec.rb
291
292
  - spec/dragonfly/active_record_extensions/models.rb
292
293
  - spec/dragonfly/active_record_extensions/spec_helper.rb
293
- - spec/dragonfly/analyser_list_spec.rb
294
294
  - spec/dragonfly/analysis/file_command_analyser_spec.rb
295
295
  - spec/dragonfly/analysis/r_magick_analyser_spec.rb
296
296
  - spec/dragonfly/app_spec.rb
@@ -1,40 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe Dragonfly::AnalyserList do
4
-
5
- class EggHeads
6
- include Dragonfly::Delegatable
7
- def mime_type(temp_object)
8
- "text/eggnog"
9
- end
10
- end
11
-
12
- class Dingbats
13
- include Dragonfly::Delegatable
14
- def mime_type(temp_object)
15
- throw :unable_to_handle
16
- end
17
- end
18
-
19
- before(:each) do
20
- @analysers = Dragonfly::AnalyserList.new
21
- end
22
-
23
- describe "mime_type" do
24
- before(:each) do
25
- @temp_object = Dragonfly::TempObject.new 'asdfa'
26
- end
27
- it "should return the mime type as per usual if the registered analysers implement it" do
28
- @analysers.register(EggHeads)
29
- @analysers.mime_type(@temp_object).should == 'text/eggnog'
30
- end
31
- it "should return the mime_type as nil if the registered analysers don't implement it" do
32
- @analysers.mime_type(@temp_object).should be_nil
33
- end
34
- it "should return the mime_type as nil if the registered analysers throw :unable_to_handle" do
35
- @analysers.register(Dingbats)
36
- @analysers.mime_type(@temp_object).should be_nil
37
- end
38
- end
39
-
40
- end