fog-dragonfly 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of fog-dragonfly might be problematic. Click here for more details.
- data/.specopts +2 -0
- data/.yardopts +23 -0
- data/Gemfile +23 -0
- data/Gemfile.rails.2.3.5 +14 -0
- data/History.md +266 -0
- data/LICENSE +20 -0
- data/README.md +88 -0
- data/Rakefile +92 -0
- data/VERSION +1 -0
- data/config.ru +13 -0
- data/docs.watchr +1 -0
- data/dragonfly.gemspec +293 -0
- data/extra_docs/Analysers.md +108 -0
- data/extra_docs/Caching.md +23 -0
- data/extra_docs/Configuration.md +138 -0
- data/extra_docs/DataStorage.md +136 -0
- data/extra_docs/Encoding.md +96 -0
- data/extra_docs/GeneralUsage.md +121 -0
- data/extra_docs/Generators.md +102 -0
- data/extra_docs/Heroku.md +50 -0
- data/extra_docs/Index.md +36 -0
- data/extra_docs/MimeTypes.md +40 -0
- data/extra_docs/Models.md +266 -0
- data/extra_docs/Mongo.md +45 -0
- data/extra_docs/Processing.md +130 -0
- data/extra_docs/Rack.md +52 -0
- data/extra_docs/Rails2.md +55 -0
- data/extra_docs/Rails3.md +62 -0
- data/extra_docs/Sinatra.md +25 -0
- data/extra_docs/URLs.md +169 -0
- data/features/3.0.3.feature +8 -0
- data/features/images.feature +47 -0
- data/features/no_processing.feature +14 -0
- data/features/rails_2.3.5.feature +7 -0
- data/features/steps/common_steps.rb +8 -0
- data/features/steps/dragonfly_steps.rb +66 -0
- data/features/steps/rails_steps.rb +39 -0
- data/features/support/env.rb +40 -0
- data/fixtures/files/app/models/album.rb +3 -0
- data/fixtures/files/app/views/albums/new.html.erb +4 -0
- data/fixtures/files/app/views/albums/show.html.erb +4 -0
- data/fixtures/files/config/initializers/dragonfly.rb +4 -0
- data/fixtures/files/features/manage_album_images.feature +12 -0
- data/fixtures/files/features/step_definitions/image_steps.rb +15 -0
- data/fixtures/files/features/support/paths.rb +15 -0
- data/fixtures/files/features/text_images.feature +7 -0
- data/fixtures/rails_2.3.5/template.rb +10 -0
- data/fixtures/rails_3.0.3/template.rb +20 -0
- data/irbrc.rb +17 -0
- data/lib/dragonfly.rb +45 -0
- data/lib/dragonfly/active_model_extensions.rb +13 -0
- data/lib/dragonfly/active_model_extensions/attachment.rb +169 -0
- data/lib/dragonfly/active_model_extensions/class_methods.rb +45 -0
- data/lib/dragonfly/active_model_extensions/instance_methods.rb +28 -0
- data/lib/dragonfly/active_model_extensions/validations.rb +37 -0
- data/lib/dragonfly/analyser.rb +59 -0
- data/lib/dragonfly/analysis/file_command_analyser.rb +32 -0
- data/lib/dragonfly/analysis/image_magick_analyser.rb +47 -0
- data/lib/dragonfly/analysis/r_magick_analyser.rb +63 -0
- data/lib/dragonfly/app.rb +182 -0
- data/lib/dragonfly/config/heroku.rb +19 -0
- data/lib/dragonfly/config/image_magick.rb +41 -0
- data/lib/dragonfly/config/r_magick.rb +46 -0
- data/lib/dragonfly/config/rails.rb +17 -0
- data/lib/dragonfly/configurable.rb +119 -0
- data/lib/dragonfly/core_ext/object.rb +8 -0
- data/lib/dragonfly/core_ext/string.rb +9 -0
- data/lib/dragonfly/core_ext/symbol.rb +9 -0
- data/lib/dragonfly/data_storage.rb +9 -0
- data/lib/dragonfly/data_storage/file_data_store.rb +114 -0
- data/lib/dragonfly/data_storage/mongo_data_store.rb +82 -0
- data/lib/dragonfly/data_storage/s3data_store.rb +115 -0
- data/lib/dragonfly/encoder.rb +13 -0
- data/lib/dragonfly/encoding/image_magick_encoder.rb +57 -0
- data/lib/dragonfly/encoding/r_magick_encoder.rb +61 -0
- data/lib/dragonfly/function_manager.rb +69 -0
- data/lib/dragonfly/generation/hash_with_css_style_keys.rb +23 -0
- data/lib/dragonfly/generation/image_magick_generator.rb +140 -0
- data/lib/dragonfly/generation/r_magick_generator.rb +155 -0
- data/lib/dragonfly/generator.rb +9 -0
- data/lib/dragonfly/image_magick_utils.rb +81 -0
- data/lib/dragonfly/job.rb +371 -0
- data/lib/dragonfly/job_builder.rb +39 -0
- data/lib/dragonfly/job_definitions.rb +26 -0
- data/lib/dragonfly/job_endpoint.rb +15 -0
- data/lib/dragonfly/loggable.rb +28 -0
- data/lib/dragonfly/middleware.rb +34 -0
- data/lib/dragonfly/processing/image_magick_processor.rb +99 -0
- data/lib/dragonfly/processing/r_magick_processor.rb +126 -0
- data/lib/dragonfly/processor.rb +9 -0
- data/lib/dragonfly/r_magick_utils.rb +48 -0
- data/lib/dragonfly/rails/images.rb +22 -0
- data/lib/dragonfly/response.rb +82 -0
- data/lib/dragonfly/routed_endpoint.rb +40 -0
- data/lib/dragonfly/serializer.rb +32 -0
- data/lib/dragonfly/simple_cache.rb +23 -0
- data/lib/dragonfly/simple_endpoint.rb +63 -0
- data/lib/dragonfly/temp_object.rb +220 -0
- data/samples/beach.png +0 -0
- data/samples/egg.png +0 -0
- data/samples/round.gif +0 -0
- data/samples/sample.docx +0 -0
- data/samples/taj.jpg +0 -0
- data/spec/argument_matchers.rb +19 -0
- data/spec/dragonfly/active_model_extensions/active_model_setup.rb +97 -0
- data/spec/dragonfly/active_model_extensions/active_record_setup.rb +85 -0
- data/spec/dragonfly/active_model_extensions/model_spec.rb +723 -0
- data/spec/dragonfly/active_model_extensions/spec_helper.rb +11 -0
- data/spec/dragonfly/analyser_spec.rb +123 -0
- data/spec/dragonfly/analysis/file_command_analyser_spec.rb +57 -0
- data/spec/dragonfly/analysis/image_magick_analyser_spec.rb +15 -0
- data/spec/dragonfly/analysis/r_magick_analyser_spec.rb +27 -0
- data/spec/dragonfly/analysis/shared_analyser_spec.rb +51 -0
- data/spec/dragonfly/app_spec.rb +280 -0
- data/spec/dragonfly/config/r_magick_spec.rb +25 -0
- data/spec/dragonfly/configurable_spec.rb +220 -0
- data/spec/dragonfly/core_ext/string_spec.rb +17 -0
- data/spec/dragonfly/core_ext/symbol_spec.rb +17 -0
- data/spec/dragonfly/data_storage/data_store_spec.rb +76 -0
- data/spec/dragonfly/data_storage/file_data_store_spec.rb +169 -0
- data/spec/dragonfly/data_storage/mongo_data_store_spec.rb +38 -0
- data/spec/dragonfly/data_storage/s3_data_store_spec.rb +94 -0
- data/spec/dragonfly/deprecation_spec.rb +20 -0
- data/spec/dragonfly/encoding/image_magick_encoder_spec.rb +41 -0
- data/spec/dragonfly/encoding/r_magick_encoder_spec.rb +37 -0
- data/spec/dragonfly/function_manager_spec.rb +154 -0
- data/spec/dragonfly/generation/hash_with_css_style_keys_spec.rb +24 -0
- data/spec/dragonfly/generation/image_magick_generator_spec.rb +12 -0
- data/spec/dragonfly/generation/r_magick_generator_spec.rb +24 -0
- data/spec/dragonfly/generation/shared_generator_spec.rb +91 -0
- data/spec/dragonfly/image_magick_utils_spec.rb +16 -0
- data/spec/dragonfly/job_builder_spec.rb +37 -0
- data/spec/dragonfly/job_definitions_spec.rb +35 -0
- data/spec/dragonfly/job_endpoint_spec.rb +120 -0
- data/spec/dragonfly/job_spec.rb +773 -0
- data/spec/dragonfly/loggable_spec.rb +80 -0
- data/spec/dragonfly/middleware_spec.rb +68 -0
- data/spec/dragonfly/processing/image_magick_processor_spec.rb +29 -0
- data/spec/dragonfly/processing/r_magick_processor_spec.rb +26 -0
- data/spec/dragonfly/processing/shared_processing_spec.rb +215 -0
- data/spec/dragonfly/routed_endpoint_spec.rb +48 -0
- data/spec/dragonfly/serializer_spec.rb +61 -0
- data/spec/dragonfly/simple_cache_spec.rb +27 -0
- data/spec/dragonfly/simple_endpoint_spec.rb +89 -0
- data/spec/dragonfly/temp_object_spec.rb +352 -0
- data/spec/image_matchers.rb +47 -0
- data/spec/simple_matchers.rb +44 -0
- data/spec/spec_helper.rb +58 -0
- data/yard/handlers/configurable_attr_handler.rb +38 -0
- data/yard/setup.rb +15 -0
- data/yard/templates/default/fulldoc/html/css/common.css +107 -0
- data/yard/templates/default/layout/html/layout.erb +87 -0
- data/yard/templates/default/module/html/configuration_summary.erb +31 -0
- data/yard/templates/default/module/setup.rb +17 -0
- metadata +550 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
def image_properties(image)
|
2
|
+
if image.is_a?(Tempfile)
|
3
|
+
tempfile = image
|
4
|
+
else
|
5
|
+
tempfile = Tempfile.new('image')
|
6
|
+
tempfile.write(image.is_a?(Dragonfly::TempObject) ? image.data : image)
|
7
|
+
tempfile.close
|
8
|
+
end
|
9
|
+
details = `identify #{tempfile.path}`
|
10
|
+
# example of details string:
|
11
|
+
# myimage.png PNG 200x100 200x100+0+0 8-bit DirectClass 31.2kb
|
12
|
+
filename, format, geometry, geometry_2, depth, image_class, size = details.split(' ')
|
13
|
+
width, height = geometry.split('x')
|
14
|
+
{
|
15
|
+
:filename => filename,
|
16
|
+
:format => format.downcase,
|
17
|
+
:width => width,
|
18
|
+
:height => height,
|
19
|
+
:depth => depth,
|
20
|
+
:image_class => image_class,
|
21
|
+
:size => size
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
Spec::Matchers.define :have_width do |width|
|
26
|
+
match do |given|
|
27
|
+
width.should === image_properties(given)[:width].to_i
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
Spec::Matchers.define :have_height do |height|
|
32
|
+
match do |given|
|
33
|
+
height.should === image_properties(given)[:height].to_i
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
Spec::Matchers.define :have_format do |format|
|
38
|
+
match do |given|
|
39
|
+
image_properties(given)[:format].should == format
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
Spec::Matchers.define :have_size do |size|
|
44
|
+
match do |given|
|
45
|
+
image_properties(given)[:size].should == size
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
Spec::Matchers.define :match_url do |url|
|
2
|
+
match do |given|
|
3
|
+
given_path, given_query_string = given.split('?')
|
4
|
+
path, query_string = url.split('?')
|
5
|
+
|
6
|
+
path == given_path && given_query_string.split('&').sort == query_string.split('&').sort
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
Spec::Matchers.define :be_an_empty_directory do
|
11
|
+
match do |given|
|
12
|
+
Dir.entries(given) == ['.','..']
|
13
|
+
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
|
+
Spec::Matchers.define :match_ar_error do |string|
|
18
|
+
match do |given|
|
19
|
+
error = given.is_a?(Array) ? given.first : given
|
20
|
+
error == string
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
Spec::Matchers.define :include_hash do |hash|
|
25
|
+
match do |given|
|
26
|
+
given.merge(hash) == given
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def memory_usage
|
31
|
+
GC.start # Garbage collect
|
32
|
+
`ps -o rss= -p #{$$}`.strip.to_i
|
33
|
+
end
|
34
|
+
|
35
|
+
Spec::Matchers.define :leak_memory do
|
36
|
+
match do |given|
|
37
|
+
memory_before = memory_usage
|
38
|
+
given.call
|
39
|
+
memory_after = memory_usage
|
40
|
+
result = memory_after > memory_before
|
41
|
+
puts "#{memory_after} > #{memory_before}" if result
|
42
|
+
result
|
43
|
+
end
|
44
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'spec'
|
3
|
+
require 'rack'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
require File.dirname(__FILE__) + '/../lib/dragonfly'
|
7
|
+
$:.unshift(File.dirname(__FILE__))
|
8
|
+
require 'argument_matchers'
|
9
|
+
require 'simple_matchers'
|
10
|
+
require 'image_matchers'
|
11
|
+
|
12
|
+
ROOT_PATH = File.expand_path(File.dirname(__FILE__) + "/..") unless defined?(ROOT_PATH)
|
13
|
+
|
14
|
+
# A hack as system calls weren't using my path
|
15
|
+
extra_paths = %w(/opt/local/bin)
|
16
|
+
ENV['PATH'] ||= ''
|
17
|
+
ENV['PATH'] += ':' + extra_paths.join(':')
|
18
|
+
|
19
|
+
SAMPLES_DIR = File.expand_path(File.dirname(__FILE__) + '/../samples') unless defined?(SAMPLES_DIR)
|
20
|
+
|
21
|
+
Spec::Runner.configure do |c|
|
22
|
+
c.after(:all){ Dir["#{ROOT_PATH}/Gemfile*.lock"].each{|f| FileUtils.rm_f(f) } }
|
23
|
+
end
|
24
|
+
|
25
|
+
def todo
|
26
|
+
raise "TODO"
|
27
|
+
end
|
28
|
+
|
29
|
+
require 'logger'
|
30
|
+
LOG_FILE = File.dirname(__FILE__) + '/spec.log' unless defined?(LOG_FILE)
|
31
|
+
FileUtils.rm_rf(LOG_FILE)
|
32
|
+
def mock_app(extra_stubs={})
|
33
|
+
mock('app', {
|
34
|
+
:datastore => mock('datastore', :store => 'some_uid', :retrieve => ["SOME_DATA", {}], :destroy => nil),
|
35
|
+
:processor => mock('processor', :process => "SOME_PROCESSED_DATA"),
|
36
|
+
:encoder => mock('encoder', :encode => "SOME_ENCODED_DATA"),
|
37
|
+
:analyser => mock('analyser', :analyse => "some_result", :analysis_methods => Module.new),
|
38
|
+
:generator => mock('generator', :generate => "SOME_GENERATED_DATA"),
|
39
|
+
:log => Logger.new(LOG_FILE),
|
40
|
+
:cache_duration => 10000,
|
41
|
+
:job_definitions => Module.new
|
42
|
+
}.merge(extra_stubs)
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_app
|
47
|
+
Dragonfly::App.send(:new)
|
48
|
+
end
|
49
|
+
|
50
|
+
def suppressing_stderr
|
51
|
+
original_stderr = $stderr.dup
|
52
|
+
tempfile = Tempfile.new('stderr')
|
53
|
+
$stderr.reopen(tempfile)
|
54
|
+
yield
|
55
|
+
ensure
|
56
|
+
tempfile.close
|
57
|
+
$stderr.reopen(original_stderr)
|
58
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class ConfigurableAttrHandler < YARD::Handlers::Ruby::Legacy::Base
|
2
|
+
handles(/^\s*configurable_attr/)
|
3
|
+
|
4
|
+
def process
|
5
|
+
owner[: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
|
+
owner[: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
ADDED
@@ -0,0 +1,15 @@
|
|
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
|
@@ -0,0 +1,107 @@
|
|
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
|
+
pre, code, .code,
|
27
|
+
#filecontents pre.code,
|
28
|
+
.docstring pre.code,
|
29
|
+
.source_code pre {
|
30
|
+
font-family: monaco, 'Trebuchet MS', monospace;
|
31
|
+
}
|
32
|
+
|
33
|
+
pre.code, code {
|
34
|
+
background:#F5F5FF;
|
35
|
+
overflow-x: auto;
|
36
|
+
}
|
37
|
+
#filecontents pre.code {
|
38
|
+
margin:10px 0;
|
39
|
+
padding:5px 12px;
|
40
|
+
border-radius:5px;
|
41
|
+
-webkit-border-radius:5px;
|
42
|
+
-moz-border-radius:5px;
|
43
|
+
border: 1px dotted #CCC;
|
44
|
+
}
|
45
|
+
|
46
|
+
code .val {
|
47
|
+
color:#036A07;
|
48
|
+
}
|
49
|
+
code .kw {
|
50
|
+
color:#0000FF;
|
51
|
+
}
|
52
|
+
code .symbol {
|
53
|
+
color:#C5060B;
|
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:nth-child(odd) {
|
67
|
+
background-color:#fff;
|
68
|
+
}
|
69
|
+
ul.main_files li:nth-child(even) {
|
70
|
+
background-color:#eee;
|
71
|
+
}
|
72
|
+
|
73
|
+
ul.main_files li a {
|
74
|
+
margin: 0;
|
75
|
+
padding:7px 12px;
|
76
|
+
display:block;
|
77
|
+
}
|
78
|
+
|
79
|
+
/* Layout */
|
80
|
+
#header,
|
81
|
+
#content,
|
82
|
+
#footer {
|
83
|
+
margin:0 auto;
|
84
|
+
width:1000px;
|
85
|
+
}
|
86
|
+
#header #logo {
|
87
|
+
float:left;
|
88
|
+
width:50%;
|
89
|
+
font-size: 32px;
|
90
|
+
letter-spacing: -1px;
|
91
|
+
margin-top: 20px;
|
92
|
+
}
|
93
|
+
#header #search {
|
94
|
+
position:static;
|
95
|
+
float:right;
|
96
|
+
}
|
97
|
+
#content .col1 {
|
98
|
+
float:left;
|
99
|
+
width: 750px;
|
100
|
+
}
|
101
|
+
#content .col2 {
|
102
|
+
float:left;
|
103
|
+
margin: 20px 0 0 20px;
|
104
|
+
padding: 0 0 0 20px;
|
105
|
+
width: 200px;
|
106
|
+
border-left: 1px dotted #D5D5D5;
|
107
|
+
}
|
@@ -0,0 +1,87 @@
|
|
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
|
+
<script type="text/javascript" charset="utf-8">
|
7
|
+
(function($){
|
8
|
+
// YARD automatically creates a table of contents
|
9
|
+
// Let's place it inside .col1, instead of #content
|
10
|
+
$(document).ready(function(){
|
11
|
+
$('#toc').prependTo($('.col1'));
|
12
|
+
<% if options[:file] == 'extra_docs/Index.md' %>
|
13
|
+
$('#toc').hide();
|
14
|
+
<% end %>
|
15
|
+
});
|
16
|
+
})(jQuery);
|
17
|
+
</script>
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<!-- GOOGLE ANALYTICS -->
|
21
|
+
<script type="text/javascript">
|
22
|
+
|
23
|
+
var _gaq = _gaq || [];
|
24
|
+
_gaq.push(['_setAccount', 'UA-16382932-1']);
|
25
|
+
_gaq.push(['_trackPageview']);
|
26
|
+
|
27
|
+
(function() {
|
28
|
+
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
29
|
+
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
30
|
+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
31
|
+
})();
|
32
|
+
|
33
|
+
</script>
|
34
|
+
<!-- *************** -->
|
35
|
+
|
36
|
+
<script type="text/javascript" charset="utf-8">
|
37
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
38
|
+
</script>
|
39
|
+
|
40
|
+
<div id="header" class="clearfix">
|
41
|
+
<%#= erb(:breadcrumb) %>
|
42
|
+
<div id="logo">DRAGONFLY (v <%= DRAGONFLY_VERSION %>)</div>
|
43
|
+
<%= erb(:search) %>
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div>
|
47
|
+
<iframe id="search_frame"></iframe>
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<div id="content" class="clearfix">
|
51
|
+
<div class="col1">
|
52
|
+
<%= yieldall %>
|
53
|
+
</div>
|
54
|
+
<div class="col2">
|
55
|
+
<ul class="main_files clearfix">
|
56
|
+
<%= [
|
57
|
+
['Index', 'Home'],
|
58
|
+
['README', 'Quick start for Rails (README)'],
|
59
|
+
['GeneralUsage', 'General usage'],
|
60
|
+
['Rails2', 'Rails 2.3'],
|
61
|
+
['Rails3', 'Rails 3'],
|
62
|
+
['Models', 'Models (ActiveRecord, ActiveModel, etc.)'],
|
63
|
+
['Rack', 'Rack'],
|
64
|
+
['Sinatra', 'Sinatra'],
|
65
|
+
['Heroku', 'Heroku'],
|
66
|
+
['Mongo', 'Mongo'],
|
67
|
+
['DataStorage', 'Data Storage'],
|
68
|
+
['Analysers', 'Analysers'],
|
69
|
+
['Processing', 'Processing'],
|
70
|
+
['Encoding', 'Encoding'],
|
71
|
+
['Generators', 'Generators'],
|
72
|
+
['Configuration', 'Configuration'],
|
73
|
+
['URLs', 'URLs / Endpoints'],
|
74
|
+
['MimeTypes', 'Mime Types'],
|
75
|
+
['Caching', 'Caching'],
|
76
|
+
['History', 'History'],
|
77
|
+
].map{|(file, text)|
|
78
|
+
"<li>#{link_file(file, text)}</li>"
|
79
|
+
}.join
|
80
|
+
%>
|
81
|
+
</ul>
|
82
|
+
</div>
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<%= erb(:footer) %>
|
86
|
+
</body>
|
87
|
+
</html>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<% configurable_attributes = object[:configurable_attributes] || [] %>
|
2
|
+
<% if configurable_attributes.any? %>
|
3
|
+
<h2>Configuration Summary</h2>
|
4
|
+
<h3>Configurable attributes</h3>
|
5
|
+
Configurable attributes for an object in general <code>object</code> can be configured either by using something like
|
6
|
+
<pre class="code">
|
7
|
+
object.configure <%= hl :do %> |c|
|
8
|
+
c.some_configurable_attribute = <%= hl 'some value' %>
|
9
|
+
c.some_other_configurable_attribute = <%= hl 42 %>
|
10
|
+
...
|
11
|
+
<%= hl :end %>
|
12
|
+
</pre>
|
13
|
+
or
|
14
|
+
<pre class="code">
|
15
|
+
object.some_configurable_attribute = <%= hl 'some value' %>
|
16
|
+
</pre>
|
17
|
+
<h4>Configurable attributes for instances of <%= object %></h4>
|
18
|
+
<ul>
|
19
|
+
<% configurable_attributes.each do |attribute| %>
|
20
|
+
<li>
|
21
|
+
<code><%= attribute[:attribute] %></code>
|
22
|
+
<% if attribute[:lazy_default_value] %>
|
23
|
+
- default <code><%= hl attribute[:lazy_default_value] %></code> (evaluated lazily)
|
24
|
+
<% else %>
|
25
|
+
- default <code><%= hl attribute[:default_value] %></code>
|
26
|
+
<% end %>
|
27
|
+
<%= '- ' + attribute[:comments] if attribute[:comments] %>
|
28
|
+
</li>
|
29
|
+
<% end %>
|
30
|
+
</ul>
|
31
|
+
<% end %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
def init
|
2
|
+
super
|
3
|
+
sections.place(:configuration_summary).before(:method_summary)
|
4
|
+
end
|
5
|
+
|
6
|
+
# Highlight stuff
|
7
|
+
def hl(code)
|
8
|
+
case code
|
9
|
+
when :do, :end then %(<span class="kw">#{code}</span>)
|
10
|
+
when Symbol then %(<span class="symbol">#{code.inspect}</span>)
|
11
|
+
when Integer then %(<span class="integer val">#{code}</span>)
|
12
|
+
when String then %(<span class="string val">#{code.inspect}</span>)
|
13
|
+
when true, false then %(<span class="kw">#{code.inspect}</span>)
|
14
|
+
when nil then %(<span class="nil kw">#{code.inspect}</span>)
|
15
|
+
else code
|
16
|
+
end
|
17
|
+
end
|