tvdeyen-fleximage 1.0.9 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/.gitignore +28 -0
  2. data/Gemfile +8 -0
  3. data/README.rdoc +3 -32
  4. data/Rakefile +23 -34
  5. data/VERSION +1 -1
  6. data/lib/dsl_accessor.rb +12 -9
  7. data/lib/fleximage.rb +0 -1
  8. data/lib/fleximage/model.rb +4 -41
  9. data/test/rails_root/README.rdoc +261 -0
  10. data/test/rails_root/Rakefile +7 -0
  11. data/test/rails_root/app/assets/javascripts/application.js +15 -0
  12. data/test/rails_root/app/assets/stylesheets/application.css +13 -0
  13. data/test/rails_root/app/controllers/application_controller.rb +3 -0
  14. data/test/rails_root/app/helpers/application_helper.rb +0 -1
  15. data/test/rails_root/app/mailers/.gitkeep +0 -0
  16. data/test/rails_root/app/models/.gitkeep +0 -0
  17. data/test/rails_root/app/models/abstract.rb +1 -1
  18. data/test/rails_root/app/models/photo_custom_error.rb +1 -1
  19. data/test/rails_root/app/views/layouts/application.html.erb +14 -0
  20. data/test/rails_root/config.ru +4 -0
  21. data/test/rails_root/config/application.rb +56 -0
  22. data/test/rails_root/config/boot.rb +7 -106
  23. data/test/rails_root/config/database.yml +19 -1
  24. data/test/rails_root/config/environment.rb +4 -65
  25. data/test/rails_root/config/environments/development.rb +33 -14
  26. data/test/rails_root/config/environments/production.rb +62 -14
  27. data/test/rails_root/config/environments/test.rb +32 -17
  28. data/test/rails_root/config/initializers/backtrace_silencers.rb +7 -0
  29. data/test/rails_root/config/initializers/inflections.rb +7 -2
  30. data/test/rails_root/config/initializers/secret_token.rb +7 -0
  31. data/test/rails_root/config/initializers/session_store.rb +8 -0
  32. data/test/rails_root/config/initializers/wrap_parameters.rb +14 -0
  33. data/test/rails_root/config/locales/en.yml +5 -0
  34. data/test/rails_root/config/routes.rb +38 -23
  35. data/test/rails_root/db/schema.rb +45 -0
  36. data/test/rails_root/lib/assets/.gitkeep +0 -0
  37. data/test/rails_root/public/404.html +15 -19
  38. data/test/rails_root/public/422.html +15 -19
  39. data/test/rails_root/public/500.html +15 -20
  40. data/test/rails_root/script/rails +6 -0
  41. data/test/test_helper.rb +4 -4
  42. data/test/unit/minimum_image_size_test.rb +3 -3
  43. data/test/unit/require_image_option_test.rb +1 -1
  44. data/tvdeyen-fleximage.gemspec +9 -163
  45. metadata +67 -62
  46. data/test/rails_root/app/controllers/application.rb +0 -10
  47. data/test/rails_root/app/models/photo_s3.rb +0 -5
  48. data/test/rails_root/db/migrate/005_create_photo_s3s.rb +0 -12
  49. data/test/s3_stubs.rb +0 -7
data/.gitignore ADDED
@@ -0,0 +1,28 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ TAGS
15
+ *.sw[op]
16
+
17
+ ## PROJECT::GENERAL
18
+ coverage
19
+ rdoc
20
+ pkg
21
+ *.gem
22
+ Gemfile.lock
23
+
24
+ ## PROJECT::SPECIFIC
25
+ test/rails_root/log/*
26
+ test/rails_root/public/uploads/*
27
+ test/rails_root/tmp/**/*
28
+ *.sqlite3
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :test do
6
+ gem 'rails', '~> 3.2.1'
7
+ gem 'sqlite3'
8
+ end
data/README.rdoc CHANGED
@@ -1,36 +1,7 @@
1
1
  For all istructions refers to git://github.com/Squeegy/fleximage.
2
- I add a rails3_view.rb to manage template in rails3.
3
2
 
4
- #rails3_view.rb
3
+ This version of fleximage runs with Rails 3.x incuding Rails 3.2.
5
4
 
6
- module ActionView
7
- module TemplateHandlers
8
- class Rails3View < TemplateHandler
9
- include Compilable
10
- class TemplateDidNotReturnImage < RuntimeError #:nodoc:
11
- end
5
+ NOTE:
12
6
 
13
- def compile(template)
14
- <<-CODE
15
- @template_format = :flexi
16
- controller.response.content_type ||= Mime::JPG
17
- result = #{template.source}
18
- requested_format = (params[:format] || :jpg).to_sym
19
- begin
20
- # Raise an error if object returned from template is not an image record
21
- unless result.class.include?(Fleximage::Model::InstanceMethods)
22
- raise TemplateDidNotReturnImage, ".flexi template was expected to return a model instance that acts_as_fleximage, but got an instance of instead."
23
- end
24
- # Figure out the proper format
25
- raise 'Image must be requested with an image type format. jpg, gif and png only are supported.' unless [:jpg, :gif, :png].include?(requested_format)
26
- result.output_image(:format => requested_format)
27
- rescue Exception => e
28
- e
29
- end
30
- CODE
31
- ensure
32
- GC.start
33
- end
34
- end
35
- end
36
- end
7
+ I removed Amazon S3 support.
data/Rakefile CHANGED
@@ -1,18 +1,20 @@
1
- require 'rake'
2
- require 'rake/testtask'
3
- require 'rake/rdoctask'
4
- require 'rubygems'
1
+ #!/usr/bin/env rake
5
2
 
6
- desc 'Default: run unit tests.'
7
- task :default => :test
3
+ require 'rake/testtask'
8
4
 
9
- desc 'Test the fleximage plugin.'
10
- Rake::TestTask.new(:test) do |t|
11
- t.libs << 'lib'
12
- t.pattern = 'test/unit/**/*_test.rb'
13
- t.verbose = true
5
+ begin
6
+ require 'bundler/setup'
7
+ rescue LoadError
8
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
14
9
  end
15
10
 
11
+ begin
12
+ require 'rdoc/task'
13
+ rescue LoadError
14
+ require 'rdoc/rdoc'
15
+ require 'rake/rdoctask'
16
+ RDoc::Task = Rake::RDocTask
17
+ end
16
18
 
17
19
  desc 'Generate documentation for the fleximage plugin.'
18
20
  Rake::RDocTask.new(:rdoc) do |rdoc|
@@ -23,27 +25,14 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
23
25
  rdoc.rdoc_files.include('lib/**/*.rb')
24
26
  end
25
27
 
26
- begin
27
- require 'jeweler'
28
- Jeweler::Tasks.new do |gem|
29
- gem.name = "tvdeyen-fleximage"
30
- gem.summary = <<EOF
31
- Rails plugin for uploading images as resources, with support for resizing, text
32
- stamping, and other special effects.
33
- EOF
34
- gem.description = <<EOF
35
- Fleximage is a Rails plugin that tries to make image uploading and rendering
36
- super easy.
37
- EOF
38
- gem.email = "tvdeyen@gmail.com"
39
- gem.homepage = "http://github.com/tvdeyen/fleximage"
40
- gem.authors = `git log --pretty=format:"%an"`.split("\n").uniq.sort
41
- gem.add_dependency "rmagick"
42
- gem.add_dependency "aws-s3"
43
- gem.add_development_dependency "rails", ">=3.0.0"
44
- end
45
- Jeweler::GemcutterTasks.new
46
- rescue LoadError
47
- puts "Jeweler (or a dependency) not available."
48
- puts "Install it with: gem install jeweler"
28
+ desc 'Default: run unit tests.'
29
+ task :default => :test
30
+
31
+ desc 'Test the fleximage plugin.'
32
+ Rake::TestTask.new(:test) do |t|
33
+ t.libs << 'lib'
34
+ t.pattern = 'test/unit/**/*_test.rb'
35
+ t.verbose = true
49
36
  end
37
+
38
+ Bundler::GemHelper.install_tasks
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.9
1
+ 1.1.0
data/lib/dsl_accessor.rb CHANGED
@@ -11,7 +11,9 @@ class Class
11
11
  when Proc then writer
12
12
  else raise TypeError, "DSL Error: writer should be a symbol or proc. but got `#{options[:writer].class}'"
13
13
  end
14
- write_inheritable_attribute(:"#{name}_writer", writer)
14
+ class_attribute :"#{name}_writer"
15
+ class_attribute :"#{name}_value"
16
+ self.send(:"#{name}_writer=", writer)
15
17
 
16
18
  default =
17
19
  case options[:default]
@@ -22,28 +24,29 @@ class Class
22
24
  when Proc then options[:default]
23
25
  else Proc.new{options[:default]}
24
26
  end
25
- write_inheritable_attribute(:"#{name}_default", default)
27
+ class_attribute :"#{name}_default"
28
+ self.send(:"#{name}_default=", default)
26
29
 
27
30
  self.class.class_eval do
28
31
  define_method("#{name}=") do |value|
29
- writer = read_inheritable_attribute(:"#{name}_writer")
32
+ writer = self.send(:"#{name}_writer")
30
33
  value = writer.call(value) if writer
31
- write_inheritable_attribute(:"#{name}", value)
34
+ self.send(:"#{name}_value=", value)
32
35
  end
33
36
 
34
37
  define_method(name) do |*values|
35
38
  if values.empty?
36
39
  # getter method
37
40
  key = :"#{name}"
38
- if !inheritable_attributes.has_key?(key)
39
- default = read_inheritable_attribute(:"#{name}_default")
41
+ if !self.respond_to?(key)
42
+ default = self.send(:"#{name}_default")
40
43
  value = default ? default.call(self) : nil
41
- __send__("#{name}=", value)
44
+ self.send("#{name}_value=", value)
42
45
  end
43
- read_inheritable_attribute(key)
46
+ self.send("#{key}_value")
44
47
  else
45
48
  # setter method
46
- __send__("#{name}=", *values)
49
+ __send__("#{name}_value=", *values)
47
50
  end
48
51
  end
49
52
  end
data/lib/fleximage.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'open-uri'
2
2
  require 'base64'
3
3
  require 'digest/sha1'
4
- require 'aws/s3'
5
4
 
6
5
  require 'RMagick' unless defined?(Magick)
7
6
 
@@ -18,9 +18,6 @@ module Fleximage
18
18
  #
19
19
  # * +image_directory+: (String, no default) Where the master images are stored, directory path relative to your
20
20
  # app root.
21
- # * <tt>s3_bucket</tt>: Name of the bucket on Amazon S3 where your master images are stored. To use this you must
22
- # call <tt>establish_connection!</tt> on the aws/s3 gem form your app's initilization to authenticate with your
23
- # S3 account.
24
21
  # * +use_creation_date_based_directories+: (Boolean, default +true+) If true, master images will be stored in
25
22
  # directories based on creation date. For example: <tt>"#{image_directory}/2007/11/24/123.png"</tt> for an
26
23
  # image with an id of 123 and a creation date of November 24, 2007. Turing this off would cause the path
@@ -89,7 +86,6 @@ module Fleximage
89
86
 
90
87
  # Internal method to ask this class if it stores image in the DB.
91
88
  def self.db_store?
92
- return false if s3_store?
93
89
  if respond_to?(:columns)
94
90
  columns.find do |col|
95
91
  col.name == 'image_file_data'
@@ -99,16 +95,12 @@ module Fleximage
99
95
  end
100
96
  end
101
97
 
102
- def self.s3_store?
103
- !!s3_bucket
104
- end
105
-
106
98
  def self.file_store?
107
- !db_store? && !s3_store?
99
+ !db_store?
108
100
  end
109
101
 
110
102
  def self.has_store?
111
- respond_to?(:columns) && (db_store? || s3_store? || image_directory)
103
+ respond_to?(:columns) && (db_store? || image_directory)
112
104
  end
113
105
 
114
106
  # validation callback
@@ -124,9 +116,6 @@ module Fleximage
124
116
  # Where images get stored
125
117
  dsl_accessor :image_directory
126
118
 
127
- # Amazon S3 bucket where the master images are stored
128
- dsl_accessor :s3_bucket
129
-
130
119
  # Put uploads from different days into different subdirectories
131
120
  dsl_accessor :use_creation_date_based_directories, :default => true
132
121
 
@@ -219,20 +208,11 @@ module Fleximage
219
208
  # execute configuration block
220
209
  yield if block_given?
221
210
 
222
- # Create S3 bucket if it's not present
223
- if s3_bucket
224
- begin
225
- AWS::S3::Bucket.find(s3_bucket)
226
- rescue AWS::S3::NoSuchBucket
227
- AWS::S3::Bucket.create(s3_bucket)
228
- end
229
- end
230
-
231
211
  # set the image directory from passed options
232
212
  image_directory options[:image_directory] if options[:image_directory]
233
213
 
234
214
  # Require the declaration of a master image storage directory
235
- if respond_to?(:validate) && !image_directory && !db_store? && !s3_store? && !default_image && !default_image_path
215
+ if respond_to?(:validate) && !image_directory && !db_store? && !default_image && !default_image_path
236
216
  raise "No place to put images! Declare this via the :image_directory => 'path/to/directory' option\n"+
237
217
  "Or add a database column named image_file_data for DB storage\n"+
238
218
  "Or set :virtual to true if this class has no image store at all\n"+
@@ -456,8 +436,6 @@ module Fleximage
456
436
  def has_saved_image?
457
437
  if self.class.db_store?
458
438
  !!image_file_data
459
- elsif self.class.s3_store?
460
- AWS::S3::S3Object.exists?("#{id}.#{self.class.image_storage_format}", self.class.s3_bucket)
461
439
  elsif self.class.file_store?
462
440
  File.exists?(file_path)
463
441
  end
@@ -502,16 +480,7 @@ module Fleximage
502
480
  if image_file_data && image_file_data.present?
503
481
  @output_image = Magick::Image.from_blob(image_file_data).first
504
482
  end
505
-
506
- elsif self.class.s3_store?
507
- # Load image from S3
508
- filename = "#{id}.#{self.class.image_storage_format}"
509
- bucket = self.class.s3_bucket
510
-
511
- if AWS::S3::S3Object.exists?(filename, bucket)
512
- @output_image = Magick::Image.from_blob(AWS::S3::S3Object.value(filename, bucket)).first
513
- end
514
-
483
+
515
484
  else
516
485
  # Load the image from the disk
517
486
  @output_image = Magick::Image.read(file_path).first
@@ -555,8 +524,6 @@ module Fleximage
555
524
 
556
525
  if self.class.db_store?
557
526
  update_attribute :image_file_data, nil unless frozen?
558
- elsif self.class.s3_store?
559
- AWS::S3::S3Object.delete "#{id}.#{self.class.image_storage_format}", self.class.s3_bucket
560
527
  else
561
528
  File.delete(file_path) if File.exists?(file_path)
562
529
  end
@@ -616,10 +583,6 @@ module Fleximage
616
583
  # Write master image file
617
584
  @uploaded_image.write(file_path)
618
585
 
619
- elsif self.class.s3_store?
620
- blob = StringIO.new(@uploaded_image.to_blob)
621
- AWS::S3::S3Object.store("#{id}.#{self.class.image_storage_format}", blob, self.class.s3_bucket)
622
-
623
586
  end
624
587
  end
625
588
 
@@ -0,0 +1,261 @@
1
+ == Welcome to Rails
2
+
3
+ Rails is a web-application framework that includes everything needed to create
4
+ database-backed web applications according to the Model-View-Control pattern.
5
+
6
+ This pattern splits the view (also called the presentation) into "dumb"
7
+ templates that are primarily responsible for inserting pre-built data in between
8
+ HTML tags. The model contains the "smart" domain objects (such as Account,
9
+ Product, Person, Post) that holds all the business logic and knows how to
10
+ persist themselves to a database. The controller handles the incoming requests
11
+ (such as Save New Account, Update Product, Show Post) by manipulating the model
12
+ and directing data to the view.
13
+
14
+ In Rails, the model is handled by what's called an object-relational mapping
15
+ layer entitled Active Record. This layer allows you to present the data from
16
+ database rows as objects and embellish these data objects with business logic
17
+ methods. You can read more about Active Record in
18
+ link:files/vendor/rails/activerecord/README.html.
19
+
20
+ The controller and view are handled by the Action Pack, which handles both
21
+ layers by its two parts: Action View and Action Controller. These two layers
22
+ are bundled in a single package due to their heavy interdependence. This is
23
+ unlike the relationship between the Active Record and Action Pack that is much
24
+ more separate. Each of these packages can be used independently outside of
25
+ Rails. You can read more about Action Pack in
26
+ link:files/vendor/rails/actionpack/README.html.
27
+
28
+
29
+ == Getting Started
30
+
31
+ 1. At the command prompt, create a new Rails application:
32
+ <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
33
+
34
+ 2. Change directory to <tt>myapp</tt> and start the web server:
35
+ <tt>cd myapp; rails server</tt> (run with --help for options)
36
+
37
+ 3. Go to http://localhost:3000/ and you'll see:
38
+ "Welcome aboard: You're riding Ruby on Rails!"
39
+
40
+ 4. Follow the guidelines to start developing your application. You can find
41
+ the following resources handy:
42
+
43
+ * The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
44
+ * Ruby on Rails Tutorial Book: http://www.railstutorial.org/
45
+
46
+
47
+ == Debugging Rails
48
+
49
+ Sometimes your application goes wrong. Fortunately there are a lot of tools that
50
+ will help you debug it and get it back on the rails.
51
+
52
+ First area to check is the application log files. Have "tail -f" commands
53
+ running on the server.log and development.log. Rails will automatically display
54
+ debugging and runtime information to these files. Debugging info will also be
55
+ shown in the browser on requests from 127.0.0.1.
56
+
57
+ You can also log your own messages directly into the log file from your code
58
+ using the Ruby logger class from inside your controllers. Example:
59
+
60
+ class WeblogController < ActionController::Base
61
+ def destroy
62
+ @weblog = Weblog.find(params[:id])
63
+ @weblog.destroy
64
+ logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
65
+ end
66
+ end
67
+
68
+ The result will be a message in your log file along the lines of:
69
+
70
+ Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
71
+
72
+ More information on how to use the logger is at http://www.ruby-doc.org/core/
73
+
74
+ Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
75
+ several books available online as well:
76
+
77
+ * Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
78
+ * Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
79
+
80
+ These two books will bring you up to speed on the Ruby language and also on
81
+ programming in general.
82
+
83
+
84
+ == Debugger
85
+
86
+ Debugger support is available through the debugger command when you start your
87
+ Mongrel or WEBrick server with --debugger. This means that you can break out of
88
+ execution at any point in the code, investigate and change the model, and then,
89
+ resume execution! You need to install ruby-debug to run the server in debugging
90
+ mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
91
+
92
+ class WeblogController < ActionController::Base
93
+ def index
94
+ @posts = Post.all
95
+ debugger
96
+ end
97
+ end
98
+
99
+ So the controller will accept the action, run the first line, then present you
100
+ with a IRB prompt in the server window. Here you can do things like:
101
+
102
+ >> @posts.inspect
103
+ => "[#<Post:0x14a6be8
104
+ @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
105
+ #<Post:0x14a6620
106
+ @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
107
+ >> @posts.first.title = "hello from a debugger"
108
+ => "hello from a debugger"
109
+
110
+ ...and even better, you can examine how your runtime objects actually work:
111
+
112
+ >> f = @posts.first
113
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
114
+ >> f.
115
+ Display all 152 possibilities? (y or n)
116
+
117
+ Finally, when you're ready to resume execution, you can enter "cont".
118
+
119
+
120
+ == Console
121
+
122
+ The console is a Ruby shell, which allows you to interact with your
123
+ application's domain model. Here you'll have all parts of the application
124
+ configured, just like it is when the application is running. You can inspect
125
+ domain models, change values, and save to the database. Starting the script
126
+ without arguments will launch it in the development environment.
127
+
128
+ To start the console, run <tt>rails console</tt> from the application
129
+ directory.
130
+
131
+ Options:
132
+
133
+ * Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
134
+ made to the database.
135
+ * Passing an environment name as an argument will load the corresponding
136
+ environment. Example: <tt>rails console production</tt>.
137
+
138
+ To reload your controllers and models after launching the console run
139
+ <tt>reload!</tt>
140
+
141
+ More information about irb can be found at:
142
+ link:http://www.rubycentral.org/pickaxe/irb.html
143
+
144
+
145
+ == dbconsole
146
+
147
+ You can go to the command line of your database directly through <tt>rails
148
+ dbconsole</tt>. You would be connected to the database with the credentials
149
+ defined in database.yml. Starting the script without arguments will connect you
150
+ to the development database. Passing an argument will connect you to a different
151
+ database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
152
+ PostgreSQL and SQLite 3.
153
+
154
+ == Description of Contents
155
+
156
+ The default directory structure of a generated Ruby on Rails application:
157
+
158
+ |-- app
159
+ | |-- assets
160
+ | |-- images
161
+ | |-- javascripts
162
+ | `-- stylesheets
163
+ | |-- controllers
164
+ | |-- helpers
165
+ | |-- mailers
166
+ | |-- models
167
+ | `-- views
168
+ | `-- layouts
169
+ |-- config
170
+ | |-- environments
171
+ | |-- initializers
172
+ | `-- locales
173
+ |-- db
174
+ |-- doc
175
+ |-- lib
176
+ | `-- tasks
177
+ |-- log
178
+ |-- public
179
+ |-- script
180
+ |-- test
181
+ | |-- fixtures
182
+ | |-- functional
183
+ | |-- integration
184
+ | |-- performance
185
+ | `-- unit
186
+ |-- tmp
187
+ | |-- cache
188
+ | |-- pids
189
+ | |-- sessions
190
+ | `-- sockets
191
+ `-- vendor
192
+ |-- assets
193
+ `-- stylesheets
194
+ `-- plugins
195
+
196
+ app
197
+ Holds all the code that's specific to this particular application.
198
+
199
+ app/assets
200
+ Contains subdirectories for images, stylesheets, and JavaScript files.
201
+
202
+ app/controllers
203
+ Holds controllers that should be named like weblogs_controller.rb for
204
+ automated URL mapping. All controllers should descend from
205
+ ApplicationController which itself descends from ActionController::Base.
206
+
207
+ app/models
208
+ Holds models that should be named like post.rb. Models descend from
209
+ ActiveRecord::Base by default.
210
+
211
+ app/views
212
+ Holds the template files for the view that should be named like
213
+ weblogs/index.html.erb for the WeblogsController#index action. All views use
214
+ eRuby syntax by default.
215
+
216
+ app/views/layouts
217
+ Holds the template files for layouts to be used with views. This models the
218
+ common header/footer method of wrapping views. In your views, define a layout
219
+ using the <tt>layout :default</tt> and create a file named default.html.erb.
220
+ Inside default.html.erb, call <% yield %> to render the view using this
221
+ layout.
222
+
223
+ app/helpers
224
+ Holds view helpers that should be named like weblogs_helper.rb. These are
225
+ generated for you automatically when using generators for controllers.
226
+ Helpers can be used to wrap functionality for your views into methods.
227
+
228
+ config
229
+ Configuration files for the Rails environment, the routing map, the database,
230
+ and other dependencies.
231
+
232
+ db
233
+ Contains the database schema in schema.rb. db/migrate contains all the
234
+ sequence of Migrations for your schema.
235
+
236
+ doc
237
+ This directory is where your application documentation will be stored when
238
+ generated using <tt>rake doc:app</tt>
239
+
240
+ lib
241
+ Application specific libraries. Basically, any kind of custom code that
242
+ doesn't belong under controllers, models, or helpers. This directory is in
243
+ the load path.
244
+
245
+ public
246
+ The directory available for the web server. Also contains the dispatchers and the
247
+ default HTML files. This should be set as the DOCUMENT_ROOT of your web
248
+ server.
249
+
250
+ script
251
+ Helper scripts for automation and generation.
252
+
253
+ test
254
+ Unit and functional tests along with fixtures. When using the rails generate
255
+ command, template test files will be generated for you and placed in this
256
+ directory.
257
+
258
+ vendor
259
+ External libraries that the application depends on. Also includes the plugins
260
+ subdirectory. If the app has frozen rails, those gems also go here, under
261
+ vendor/rails/. This directory is in the load path.