dragonfly 0.9.15 → 1.0
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.
- checksums.yaml +7 -0
- data/.gitignore +1 -8
- data/.travis.yml +11 -0
- data/Gemfile +1 -0
- data/History.md +52 -2
- data/LICENSE +1 -1
- data/README.md +38 -95
- data/dev/grid.jpg +0 -0
- data/dev/irbrc.rb +27 -0
- data/dev/rails_template.rb +38 -0
- data/dev/test.ru +56 -0
- data/dev/test_rails +19 -0
- data/dragonfly.gemspec +3 -21
- data/lib/dragonfly.rb +45 -44
- data/lib/dragonfly/app.rb +175 -96
- data/lib/dragonfly/configurable.rb +71 -170
- data/lib/dragonfly/content.rb +211 -0
- data/lib/dragonfly/core_ext/object.rb +1 -6
- data/lib/dragonfly/file_data_store.rb +197 -0
- data/lib/dragonfly/image_magick/analysers/image_properties.rb +23 -0
- data/lib/dragonfly/image_magick/generators/convert.rb +19 -0
- data/lib/dragonfly/image_magick/generators/plain.rb +26 -0
- data/lib/dragonfly/image_magick/generators/plasma.rb +25 -0
- data/lib/dragonfly/image_magick/generators/text.rb +127 -0
- data/lib/dragonfly/image_magick/plugin.rb +83 -0
- data/lib/dragonfly/image_magick/processors/convert.rb +29 -0
- data/lib/dragonfly/image_magick/processors/encode.rb +18 -0
- data/lib/dragonfly/image_magick/processors/thumb.rb +76 -0
- data/lib/dragonfly/job.rb +118 -134
- data/lib/dragonfly/job_endpoint.rb +2 -0
- data/lib/dragonfly/memory_data_store.rb +34 -0
- data/lib/dragonfly/middleware.rb +5 -3
- data/lib/dragonfly/{active_model_extensions.rb → model.rb} +5 -3
- data/lib/dragonfly/{active_model_extensions → model}/attachment.rb +40 -35
- data/lib/dragonfly/{active_model_extensions → model}/attachment_class_methods.rb +36 -40
- data/lib/dragonfly/model/class_methods.rb +109 -0
- data/lib/dragonfly/{active_model_extensions → model}/instance_methods.rb +2 -2
- data/lib/dragonfly/{active_model_extensions → model}/validations.rb +17 -12
- data/lib/dragonfly/railtie.rb +8 -6
- data/lib/dragonfly/register.rb +27 -0
- data/lib/dragonfly/response.rb +47 -52
- data/lib/dragonfly/routed_endpoint.rb +4 -0
- data/lib/dragonfly/serializer.rb +15 -5
- data/lib/dragonfly/server.rb +56 -29
- data/lib/dragonfly/shell.rb +12 -23
- data/lib/dragonfly/spec/data_store_examples.rb +64 -0
- data/lib/dragonfly/temp_object.rb +32 -47
- data/lib/dragonfly/url_attributes.rb +19 -22
- data/lib/dragonfly/url_mapper.rb +3 -0
- data/lib/dragonfly/utils.rb +12 -0
- data/lib/dragonfly/version.rb +1 -1
- data/lib/dragonfly/whitelist.rb +19 -0
- data/lib/rails/generators/dragonfly/USAGE +8 -0
- data/lib/rails/generators/dragonfly/dragonfly_generator.rb +24 -0
- data/lib/rails/generators/dragonfly/templates/initializer.rb.erb +27 -0
- data/samples/gif.gif +0 -0
- data/spec/dragonfly/app_spec.rb +270 -64
- data/spec/dragonfly/configurable_spec.rb +142 -418
- data/spec/dragonfly/content_spec.rb +353 -0
- data/spec/dragonfly/cookie_monster_spec.rb +2 -1
- data/spec/dragonfly/file_data_store_spec.rb +301 -0
- data/spec/dragonfly/image_magick/analysers/image_properties_spec.rb +20 -0
- data/spec/dragonfly/image_magick/generators/convert_spec.rb +19 -0
- data/spec/dragonfly/image_magick/generators/plain_spec.rb +50 -0
- data/spec/dragonfly/image_magick/generators/plasma_spec.rb +32 -0
- data/spec/dragonfly/image_magick/generators/text_spec.rb +77 -0
- data/spec/dragonfly/image_magick/plugin_spec.rb +131 -0
- data/spec/dragonfly/image_magick/processors/convert_spec.rb +56 -0
- data/spec/dragonfly/image_magick/processors/thumb_spec.rb +173 -0
- data/spec/dragonfly/job_endpoint_spec.rb +30 -73
- data/spec/dragonfly/job_spec.rb +280 -608
- data/spec/dragonfly/memory_data_store_spec.rb +20 -0
- data/spec/dragonfly/middleware_spec.rb +47 -27
- data/spec/dragonfly/{active_model_extensions → model}/model_spec.rb +331 -555
- data/spec/dragonfly/model/validations_spec.rb +196 -0
- data/spec/dragonfly/register_spec.rb +35 -0
- data/spec/dragonfly/routed_endpoint_spec.rb +6 -6
- data/spec/dragonfly/serializer_spec.rb +13 -15
- data/spec/dragonfly/server_spec.rb +122 -46
- data/spec/dragonfly/shell_spec.rb +43 -24
- data/spec/dragonfly/temp_object_spec.rb +69 -94
- data/spec/dragonfly/url_attributes_spec.rb +49 -0
- data/spec/dragonfly/utils_spec.rb +32 -0
- data/spec/dragonfly/whitelist_spec.rb +30 -0
- data/spec/dragonfly_spec.rb +43 -0
- data/spec/fixtures/deprecated_stored_content/eggs.bonus +1 -0
- data/spec/fixtures/deprecated_stored_content/eggs.bonus.meta +1 -0
- data/spec/functional/configuration_spec.rb +19 -0
- data/spec/functional/model_urls_spec.rb +43 -41
- data/spec/functional/remote_on_the_fly_spec.rb +14 -16
- data/spec/functional/shell_commands_spec.rb +24 -14
- data/spec/functional/to_response_spec.rb +10 -10
- data/spec/functional/urls_spec.rb +5 -3
- data/spec/spec_helper.rb +23 -28
- data/spec/support/argument_matchers.rb +7 -8
- data/spec/support/image_matchers.rb +14 -36
- data/spec/support/model_helpers.rb +97 -0
- data/spec/support/simple_matchers.rb +12 -0
- metadata +92 -393
- data/.yardopts +0 -29
- data/Rakefile +0 -36
- data/config.ru +0 -14
- data/docs.watchr +0 -1
- data/extra_docs/Analysers.md +0 -68
- data/extra_docs/Caching.md +0 -23
- data/extra_docs/Configuration.md +0 -149
- data/extra_docs/Couch.md +0 -49
- data/extra_docs/DataStorage.md +0 -226
- data/extra_docs/Encoding.md +0 -67
- data/extra_docs/ExampleUseCases.md +0 -116
- data/extra_docs/GeneralUsage.md +0 -105
- data/extra_docs/Generators.md +0 -68
- data/extra_docs/Heroku.md +0 -50
- data/extra_docs/ImageMagick.md +0 -136
- data/extra_docs/Index.md +0 -33
- data/extra_docs/MimeTypes.md +0 -40
- data/extra_docs/Models.md +0 -441
- data/extra_docs/Mongo.md +0 -42
- data/extra_docs/Processing.md +0 -77
- data/extra_docs/Rack.md +0 -52
- data/extra_docs/Rails2.md +0 -57
- data/extra_docs/Rails3.md +0 -56
- data/extra_docs/ServingRemotely.md +0 -104
- data/extra_docs/Sinatra.md +0 -25
- data/extra_docs/URLs.md +0 -203
- data/features/images.feature +0 -47
- data/features/no_processing.feature +0 -14
- data/features/rails.feature +0 -8
- data/features/steps/common_steps.rb +0 -8
- data/features/steps/dragonfly_steps.rb +0 -66
- data/features/steps/rails_steps.rb +0 -40
- data/features/support/env.rb +0 -13
- data/features/support/setup.rb +0 -41
- data/fixtures/rails/files/app/models/album.rb +0 -6
- data/fixtures/rails/files/app/views/albums/new.html.erb +0 -7
- data/fixtures/rails/files/app/views/albums/show.html.erb +0 -6
- data/fixtures/rails/files/config/initializers/dragonfly.rb +0 -4
- data/fixtures/rails/files/features/manage_album_images.feature +0 -38
- data/fixtures/rails/files/features/step_definitions/helper_steps.rb +0 -7
- data/fixtures/rails/files/features/step_definitions/image_steps.rb +0 -25
- data/fixtures/rails/files/features/step_definitions/web_steps.rb +0 -189
- data/fixtures/rails/files/features/support/paths.rb +0 -17
- data/fixtures/rails/files/features/text_images.feature +0 -7
- data/fixtures/rails/template.rb +0 -20
- data/irbrc.rb +0 -19
- data/lib/dragonfly/active_model_extensions/class_methods.rb +0 -98
- data/lib/dragonfly/analyser.rb +0 -58
- data/lib/dragonfly/analysis/file_command_analyser.rb +0 -33
- data/lib/dragonfly/analysis/image_magick_analyser.rb +0 -6
- data/lib/dragonfly/config/heroku.rb +0 -26
- data/lib/dragonfly/config/image_magick.rb +0 -6
- data/lib/dragonfly/config/rails.rb +0 -20
- data/lib/dragonfly/data_storage.rb +0 -11
- data/lib/dragonfly/data_storage/couch_data_store.rb +0 -83
- data/lib/dragonfly/data_storage/file_data_store.rb +0 -144
- data/lib/dragonfly/data_storage/mongo_data_store.rb +0 -96
- data/lib/dragonfly/data_storage/s3data_store.rb +0 -168
- data/lib/dragonfly/encoder.rb +0 -13
- data/lib/dragonfly/encoding/image_magick_encoder.rb +0 -6
- data/lib/dragonfly/function_manager.rb +0 -67
- data/lib/dragonfly/generation/image_magick_generator.rb +0 -6
- data/lib/dragonfly/generator.rb +0 -9
- data/lib/dragonfly/image_magick/analyser.rb +0 -53
- data/lib/dragonfly/image_magick/config.rb +0 -44
- data/lib/dragonfly/image_magick/encoder.rb +0 -57
- data/lib/dragonfly/image_magick/generator.rb +0 -147
- data/lib/dragonfly/image_magick/processor.rb +0 -114
- data/lib/dragonfly/image_magick/utils.rb +0 -46
- data/lib/dragonfly/image_magick_utils.rb +0 -4
- data/lib/dragonfly/job_builder.rb +0 -39
- data/lib/dragonfly/job_definitions.rb +0 -30
- data/lib/dragonfly/loggable.rb +0 -28
- data/lib/dragonfly/processing/image_magick_processor.rb +0 -6
- data/lib/dragonfly/processor.rb +0 -9
- data/lib/dragonfly/rails/images.rb +0 -32
- data/lib/dragonfly/simple_cache.rb +0 -23
- data/spec/dragonfly/active_model_extensions/spec_helper.rb +0 -95
- data/spec/dragonfly/analyser_spec.rb +0 -123
- data/spec/dragonfly/analysis/file_command_analyser_spec.rb +0 -49
- data/spec/dragonfly/data_storage/couch_data_store_spec.rb +0 -84
- data/spec/dragonfly/data_storage/file_data_store_spec.rb +0 -308
- data/spec/dragonfly/data_storage/mongo_data_store_spec.rb +0 -81
- data/spec/dragonfly/data_storage/s3_data_store_spec.rb +0 -277
- data/spec/dragonfly/data_storage/shared_data_store_examples.rb +0 -77
- data/spec/dragonfly/function_manager_spec.rb +0 -154
- data/spec/dragonfly/image_magick/analyser_spec.rb +0 -73
- data/spec/dragonfly/image_magick/encoder_spec.rb +0 -46
- data/spec/dragonfly/image_magick/generator_spec.rb +0 -178
- data/spec/dragonfly/image_magick/processor_spec.rb +0 -293
- data/spec/dragonfly/job_builder_spec.rb +0 -37
- data/spec/dragonfly/job_definitions_spec.rb +0 -57
- data/spec/dragonfly/loggable_spec.rb +0 -80
- data/spec/dragonfly/simple_cache_spec.rb +0 -27
- data/spec/dragonfly/url_attributes.rb +0 -47
- data/spec/functional/deprecations_spec.rb +0 -51
- data/spec/functional/image_magick_app_spec.rb +0 -27
- data/spec/test_imagemagick.ru +0 -49
- data/yard/handlers/configurable_attr_handler.rb +0 -38
- data/yard/setup.rb +0 -15
- data/yard/templates/default/fulldoc/html/css/common.css +0 -109
- data/yard/templates/default/layout/html/layout.erb +0 -93
- data/yard/templates/default/module/html/configuration_summary.erb +0 -31
- data/yard/templates/default/module/setup.rb +0 -17
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Dragonfly::JobBuilder do
|
4
|
-
|
5
|
-
describe "a multi-step job" do
|
6
|
-
|
7
|
-
before(:each) do
|
8
|
-
@job_builder = Dragonfly::JobBuilder.new do |size, format|
|
9
|
-
process :thumb, size
|
10
|
-
encode format unless format.nil?
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should correctly call job steps" do
|
15
|
-
job = mock
|
16
|
-
job.should_receive(:process).with(:thumb, '30x30#').and_return(job2=mock)
|
17
|
-
job2.should_receive(:encode).with(:jpg).and_return(job3=mock)
|
18
|
-
@job_builder.build(job, '30x30#', :jpg).should == job3
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should work consistently with bang methods" do
|
22
|
-
job = mock
|
23
|
-
job.should_receive(:process!).with(:thumb, '30x30#').and_return(job)
|
24
|
-
job.should_receive(:encode!).with(:jpg).and_return(job)
|
25
|
-
@job_builder.build!(job, '30x30#', :jpg).should == job
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should yield nil if the arg isn't passed in" do
|
29
|
-
job = mock
|
30
|
-
job.should_receive(:process).with(:thumb, '30x30#').and_return(job2=mock)
|
31
|
-
job2.should_not_receive(:encode)
|
32
|
-
@job_builder.build(job, '30x30#').should == job2
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Dragonfly::JobDefinitions do
|
4
|
-
|
5
|
-
describe "defining jobs" do
|
6
|
-
|
7
|
-
before(:each) do
|
8
|
-
@job_definitions = Dragonfly::JobDefinitions.new
|
9
|
-
@object = Object.new
|
10
|
-
@object.extend @job_definitions
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "a simple job" do
|
14
|
-
|
15
|
-
before(:each) do
|
16
|
-
@job_definitions.add :thumb do |size|
|
17
|
-
process :thumb, size
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
it "correctly call job steps" do
|
22
|
-
@object.should_receive(:process).with(:thumb, '30x30#').and_return(job=mock)
|
23
|
-
@object.thumb('30x30#').should == job
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should correctly call job steps when bang is given" do
|
27
|
-
@object.should_receive(:process!).with(:thumb, '30x30#').and_return(@object)
|
28
|
-
@object.thumb!('30x30#').should == @object
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
describe "#definition_names" do
|
37
|
-
|
38
|
-
before(:each) do
|
39
|
-
@job_definitions = Dragonfly::JobDefinitions.new
|
40
|
-
@object = Object.new
|
41
|
-
@object.extend @job_definitions
|
42
|
-
end
|
43
|
-
|
44
|
-
it "should provide an empty list when no jobs have been defined" do
|
45
|
-
@job_definitions.definition_names.should == []
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should contain the job name when one is defined" do
|
49
|
-
@job_definitions.add :foo do |size|
|
50
|
-
process :thumb, size
|
51
|
-
end
|
52
|
-
@job_definitions.definition_names.should eq [:foo]
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
@@ -1,80 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
class Testoast
|
4
|
-
include Dragonfly::Loggable
|
5
|
-
end
|
6
|
-
|
7
|
-
describe Dragonfly::Loggable do
|
8
|
-
|
9
|
-
before(:each) do
|
10
|
-
@object = Testoast.new
|
11
|
-
end
|
12
|
-
|
13
|
-
shared_examples_for "common" do
|
14
|
-
it "should return a log" do
|
15
|
-
@object.log.should be_a(Logger)
|
16
|
-
end
|
17
|
-
it "should cache the log" do
|
18
|
-
@object.log.should == @object.log
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe "without being set" do
|
23
|
-
it "should return the log object as nil" do
|
24
|
-
@object.log_object.should be_nil
|
25
|
-
end
|
26
|
-
it_should_behave_like 'common'
|
27
|
-
end
|
28
|
-
|
29
|
-
describe "when set" do
|
30
|
-
before(:each) do
|
31
|
-
@log = Logger.new($stdout)
|
32
|
-
@object.log = @log
|
33
|
-
end
|
34
|
-
it "should return the new log" do
|
35
|
-
@object.log.should == @log
|
36
|
-
end
|
37
|
-
it "should return the log object" do
|
38
|
-
@object.log_object.should == @log
|
39
|
-
end
|
40
|
-
it_should_behave_like 'common'
|
41
|
-
end
|
42
|
-
|
43
|
-
describe "when set as a proc" do
|
44
|
-
before(:each) do
|
45
|
-
@log = Logger.new($stdout)
|
46
|
-
@object.log = proc{ @log }
|
47
|
-
end
|
48
|
-
it "should return the new log" do
|
49
|
-
@object.log.should == @log
|
50
|
-
end
|
51
|
-
it "should return the log object" do
|
52
|
-
@object.log_object.should be_a(Proc)
|
53
|
-
end
|
54
|
-
it "should allow for changing logs" do
|
55
|
-
logs = [@log]
|
56
|
-
@object.log = proc{ logs[0] }
|
57
|
-
@object.log.should == @log
|
58
|
-
|
59
|
-
new_log = Logger.new($stdout)
|
60
|
-
logs[0] = new_log
|
61
|
-
|
62
|
-
@object.log.should == new_log
|
63
|
-
end
|
64
|
-
it_should_behave_like 'common'
|
65
|
-
end
|
66
|
-
|
67
|
-
describe "sharing logs" do
|
68
|
-
before(:each) do
|
69
|
-
@log = Logger.new($stdout)
|
70
|
-
@obj1 = Testoast.new
|
71
|
-
@obj2 = Testoast.new
|
72
|
-
end
|
73
|
-
it "should enable sharing logs" do
|
74
|
-
@obj1.log = proc{ @log }
|
75
|
-
@obj2.use_same_log_as(@obj1)
|
76
|
-
@obj2.log.should == @log
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Dragonfly::SimpleCache do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
@cache = Dragonfly::SimpleCache.new(2)
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should act as a normal hash" do
|
10
|
-
@cache[:egg] = 'four'
|
11
|
-
@cache[:egg].should == 'four'
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should allow filling up to the limit" do
|
15
|
-
@cache[:a] = 1
|
16
|
-
@cache[:b] = 2
|
17
|
-
@cache.should == {:a => 1, :b => 2}
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should get rid of the first added when full" do
|
21
|
-
@cache[:a] = 1
|
22
|
-
@cache[:b] = 2
|
23
|
-
@cache[:c] = 3
|
24
|
-
@cache.should == {:b => 2, :c => 3}
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Dragonfly::UrlAttributes do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
@hash = Dragonfly::UrlAttributes.new
|
7
|
-
end
|
8
|
-
|
9
|
-
describe "name" do
|
10
|
-
it "should default to nil" do
|
11
|
-
@hash.name.should be_nil
|
12
|
-
end
|
13
|
-
it "should return the name if set" do
|
14
|
-
@hash[:name] = 'long.pigs'
|
15
|
-
@hash.name.should == 'long.pigs'
|
16
|
-
end
|
17
|
-
it "should allow setting via an accessor" do
|
18
|
-
@hash.name = 'john.doe'
|
19
|
-
@hash[:name].should == 'john.doe'
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe "sanity check for use of HasFilename" do
|
24
|
-
it "should provide ext and basename" do
|
25
|
-
@hash.name = 'dog.leg'
|
26
|
-
@hash.basename.should == 'dog'
|
27
|
-
@hash.ext.should == 'leg'
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe "slice" do
|
32
|
-
it "should return a subset of the params" do
|
33
|
-
hash = Dragonfly::UrlAttributes[:a => 1, :b => 2, :c => 3]
|
34
|
-
hash.slice(:a, :b).should == {:a => 1, :b => 2}
|
35
|
-
end
|
36
|
-
it "should use the method instead of the param for basename" do
|
37
|
-
Dragonfly::UrlAttributes[:name => 'hello.ted'].slice(:basename).should == {:basename => 'hello'}
|
38
|
-
end
|
39
|
-
it "should use the method instead of the param for ext" do
|
40
|
-
Dragonfly::UrlAttributes[:name => 'hello.ted'].slice(:ext).should == {:ext => 'ted'}
|
41
|
-
end
|
42
|
-
it "should treat strings like symbols" do
|
43
|
-
Dragonfly::UrlAttributes[:yog => 'gurt', :john => 'doe'].slice('yog').should == {:yog => 'gurt'}
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'deprecations' do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
@app = test_app
|
7
|
-
end
|
8
|
-
|
9
|
-
describe "url_suffix" do
|
10
|
-
it "should give an appropriate error" do
|
11
|
-
@app.configure do |c|
|
12
|
-
expect{
|
13
|
-
c.url_suffix = 'darble'
|
14
|
-
}.to raise_error(NoMethodError, /deprecated.*please use url_format/)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "url_path_prefix" do
|
20
|
-
it "should give an appropriate error" do
|
21
|
-
@app.configure do |c|
|
22
|
-
expect{
|
23
|
-
c.url_path_prefix = '/darble'
|
24
|
-
}.to raise_error(NoMethodError, /deprecated.*please use url_format/)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe "middleware" do
|
30
|
-
it "should give an appropriate error" do
|
31
|
-
app = Rack::Builder.new do
|
32
|
-
use Dragonfly::Middleware, :images, '/media'
|
33
|
-
run proc{[200, {}, []]}
|
34
|
-
end
|
35
|
-
expect{
|
36
|
-
app.call({})
|
37
|
-
}.to raise_error(ArgumentError, /deprecated/)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe "infer_mime_type_from_file_ext" do
|
42
|
-
it "should give an appropriate error" do
|
43
|
-
@app.configure do |c|
|
44
|
-
expect{
|
45
|
-
c.infer_mime_type_from_file_ext = false
|
46
|
-
}.to raise_error(NoMethodError, /deprecated.*please use trust_file_extensions = false/)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "a configured imagemagick app" do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
@app = test_app.configure_with(:imagemagick)
|
7
|
-
end
|
8
|
-
|
9
|
-
describe "convert command path" do
|
10
|
-
before(:each) do
|
11
|
-
@processor = @app.processor.get_registered(Dragonfly::ImageMagick::Processor)
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should default to 'convert'" do
|
15
|
-
@processor.convert_command.should == 'convert'
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should change when configured through the app" do
|
19
|
-
@app.configure do |c|
|
20
|
-
c.convert_command = '/usr/eggs'
|
21
|
-
end
|
22
|
-
@processor.convert_command.should == '/usr/eggs'
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
data/spec/test_imagemagick.ru
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
require "rubygems"
|
2
|
-
require "bundler/setup"
|
3
|
-
$:.unshift(File.expand_path('../../lib', __FILE__))
|
4
|
-
require 'dragonfly'
|
5
|
-
|
6
|
-
ROOT = (File.expand_path('../..', __FILE__))
|
7
|
-
APP = Dragonfly[:images].configure_with(:imagemagick).configure do |c|
|
8
|
-
c.url_format = '/images/:job'
|
9
|
-
c.allow_fetch_file = true
|
10
|
-
end
|
11
|
-
|
12
|
-
def row(geometry)
|
13
|
-
image = APP.fetch_file(ROOT + '/samples/beach.png').thumb('100x100#')
|
14
|
-
%(<tr>
|
15
|
-
<th>#{geometry}</th>
|
16
|
-
<th><img src="#{image.url}" /></th>
|
17
|
-
<th><img src="#{image.thumb(geometry).url}" /></th>
|
18
|
-
</tr>)
|
19
|
-
end
|
20
|
-
|
21
|
-
use Dragonfly::Middleware, :images
|
22
|
-
run proc{[
|
23
|
-
200,
|
24
|
-
{'Content-Type' => 'text/html'},
|
25
|
-
[%(
|
26
|
-
<table>
|
27
|
-
<tr>
|
28
|
-
<th>Geometry</th>
|
29
|
-
<th>Original(100x100)</th>
|
30
|
-
<th>Thumb</th>
|
31
|
-
</tr>
|
32
|
-
#{[
|
33
|
-
row('80x60'),
|
34
|
-
row('80x60!'),
|
35
|
-
row('80x'),
|
36
|
-
row('x60'),
|
37
|
-
row('80x60>'),
|
38
|
-
row('80x60<'),
|
39
|
-
row('50x50%'),
|
40
|
-
row('80x60^'),
|
41
|
-
row('2000@'),
|
42
|
-
row('80x60#'),
|
43
|
-
row('80x60#ne'),
|
44
|
-
row('80x60se'),
|
45
|
-
row('80x60+5+35')
|
46
|
-
].join}
|
47
|
-
</table>
|
48
|
-
)]
|
49
|
-
]}
|
@@ -1,38 +0,0 @@
|
|
1
|
-
class ConfigurableAttrHandler < YARD::Handlers::Ruby::Legacy::Base
|
2
|
-
handles(/^\s*configurable_attr/)
|
3
|
-
|
4
|
-
def process
|
5
|
-
namespace[:configurable_attributes] ||= []
|
6
|
-
|
7
|
-
attribute = token_to_object(statement.tokens[2])
|
8
|
-
comments = statement.comments.join(' ') if statement.comments
|
9
|
-
|
10
|
-
if statement.block
|
11
|
-
# e.g. configurable_attr :datastore do FileDataStore.new end
|
12
|
-
lazy_default_value = statement.block.to_s
|
13
|
-
else
|
14
|
-
# e.g. configurable_attr :fallback_mime_type, 'application/octet-stream'
|
15
|
-
default_value = token_to_object(statement.tokens[5..-1])
|
16
|
-
end
|
17
|
-
namespace[:configurable_attributes] << {
|
18
|
-
:attribute => attribute,
|
19
|
-
:default_value => default_value,
|
20
|
-
:lazy_default_value => lazy_default_value,
|
21
|
-
:comments => comments
|
22
|
-
}
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def token_to_object(token)
|
28
|
-
if token
|
29
|
-
if token.is_a?(YARD::Parser::Ruby::Legacy::TokenList)
|
30
|
-
eval(token.to_s)
|
31
|
-
else # is a single token
|
32
|
-
eval(token.text)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|
data/yard/setup.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
this_dir = File.dirname(__FILE__)
|
2
|
-
|
3
|
-
YARD::Templates::Engine.register_template_path(this_dir + '/templates')
|
4
|
-
Dir[this_dir + '/handlers/*.rb'].each do |file|
|
5
|
-
require File.expand_path(file)
|
6
|
-
end
|
7
|
-
YARD::Parser::SourceParser.parser_type = :ruby18
|
8
|
-
|
9
|
-
version = ENV['DRAGONFLY_VERSION']
|
10
|
-
DRAGONFLY_VERSION = if version
|
11
|
-
puts "Setting the version in the docs to #{version}"
|
12
|
-
version
|
13
|
-
else
|
14
|
-
File.read(this_dir + '/../VERSION').strip
|
15
|
-
end
|
@@ -1,109 +0,0 @@
|
|
1
|
-
/* Overrides for yard documentation */
|
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
|
-
|
26
|
-
body {
|
27
|
-
font-family: "PT Sans",Verdana,Arial,sans-serif;
|
28
|
-
font-size: 14px;
|
29
|
-
}
|
30
|
-
|
31
|
-
pre, code, .code,
|
32
|
-
#filecontents pre.code,
|
33
|
-
.docstring pre.code,
|
34
|
-
.source_code pre {
|
35
|
-
font-family: Inconsolata,Monaco,"Courier New","DejaVu Sans Mono","Bitstream Vera Sans Mono",monospace;
|
36
|
-
}
|
37
|
-
|
38
|
-
pre.code, code {
|
39
|
-
background:#F5F5FF;
|
40
|
-
overflow-x: auto;
|
41
|
-
}
|
42
|
-
#filecontents pre.code {
|
43
|
-
margin:10px 0;
|
44
|
-
padding:5px 12px;
|
45
|
-
border-radius:5px;
|
46
|
-
-webkit-border-radius:5px;
|
47
|
-
-moz-border-radius:5px;
|
48
|
-
border: 1px dotted #CCC;
|
49
|
-
}
|
50
|
-
|
51
|
-
code .val {
|
52
|
-
color:#036A07;
|
53
|
-
}
|
54
|
-
code .kw {
|
55
|
-
color:#0000FF;
|
56
|
-
}
|
57
|
-
code .symbol {
|
58
|
-
color:#C5060B;
|
59
|
-
}
|
60
|
-
|
61
|
-
ul.main_files {
|
62
|
-
list-style-type:none;
|
63
|
-
margin:0;
|
64
|
-
padding:0;
|
65
|
-
font-size:14px;
|
66
|
-
}
|
67
|
-
ul.main_files li {
|
68
|
-
margin:0;
|
69
|
-
padding:0;
|
70
|
-
}
|
71
|
-
|
72
|
-
ul.main_files li a {
|
73
|
-
margin: 0;
|
74
|
-
padding:3px 12px;
|
75
|
-
display:block;
|
76
|
-
cursor:pointer;
|
77
|
-
}
|
78
|
-
#content ul.main_files li a:hover {
|
79
|
-
background-color:#F4F9E4;
|
80
|
-
}
|
81
|
-
/* Layout */
|
82
|
-
#header,
|
83
|
-
#content,
|
84
|
-
#footer {
|
85
|
-
margin:0 auto;
|
86
|
-
width:1000px;
|
87
|
-
}
|
88
|
-
#header #logo {
|
89
|
-
float:left;
|
90
|
-
width:50%;
|
91
|
-
font-size: 32px;
|
92
|
-
letter-spacing: -1px;
|
93
|
-
margin-top: 20px;
|
94
|
-
}
|
95
|
-
#header #search {
|
96
|
-
position:static;
|
97
|
-
float:right;
|
98
|
-
}
|
99
|
-
#content .col1 {
|
100
|
-
float:left;
|
101
|
-
width: 750px;
|
102
|
-
}
|
103
|
-
#content .col2 {
|
104
|
-
float:left;
|
105
|
-
margin: 0 0 0 20px;
|
106
|
-
padding: 0 0 0 20px;
|
107
|
-
width: 200px;
|
108
|
-
border-left: 1px dotted #D5D5D5;
|
109
|
-
}
|