analytical 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/.document +5 -0
  2. data/.gitignore +21 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +17 -0
  5. data/Rakefile +46 -0
  6. data/VERSION +1 -0
  7. data/analytical.gemspec +124 -0
  8. data/example/.gitignore +4 -0
  9. data/example/Gemfile +27 -0
  10. data/example/README +244 -0
  11. data/example/Rakefile +10 -0
  12. data/example/app/controllers/application_controller.rb +6 -0
  13. data/example/app/controllers/page_controller.rb +11 -0
  14. data/example/app/helpers/application_helper.rb +2 -0
  15. data/example/app/helpers/page_helper.rb +2 -0
  16. data/example/app/views/layouts/application.html.erb +17 -0
  17. data/example/app/views/page/index.html.erb +5 -0
  18. data/example/app/views/page/test_a.html.erb +10 -0
  19. data/example/app/views/page/test_b.html.erb +6 -0
  20. data/example/config.ru +4 -0
  21. data/example/config/analytical.yml +6 -0
  22. data/example/config/application.rb +46 -0
  23. data/example/config/boot.rb +6 -0
  24. data/example/config/database.yml +22 -0
  25. data/example/config/environment.rb +5 -0
  26. data/example/config/environments/development.rb +19 -0
  27. data/example/config/environments/production.rb +42 -0
  28. data/example/config/environments/test.rb +32 -0
  29. data/example/config/initializers/backtrace_silencers.rb +7 -0
  30. data/example/config/initializers/inflections.rb +10 -0
  31. data/example/config/initializers/mime_types.rb +5 -0
  32. data/example/config/initializers/secret_token.rb +7 -0
  33. data/example/config/initializers/session_store.rb +8 -0
  34. data/example/config/locales/en.yml +5 -0
  35. data/example/config/routes.rb +64 -0
  36. data/example/db/seeds.rb +7 -0
  37. data/example/doc/README_FOR_APP +2 -0
  38. data/example/lib/tasks/.gitkeep +0 -0
  39. data/example/public/404.html +26 -0
  40. data/example/public/422.html +26 -0
  41. data/example/public/500.html +26 -0
  42. data/example/public/favicon.ico +0 -0
  43. data/example/public/images/rails.png +0 -0
  44. data/example/public/javascripts/application.js +2 -0
  45. data/example/public/javascripts/controls.js +965 -0
  46. data/example/public/javascripts/dragdrop.js +974 -0
  47. data/example/public/javascripts/effects.js +1123 -0
  48. data/example/public/javascripts/prototype.js +4874 -0
  49. data/example/public/javascripts/rails.js +118 -0
  50. data/example/public/robots.txt +5 -0
  51. data/example/public/stylesheets/.gitkeep +0 -0
  52. data/example/script/rails +9 -0
  53. data/example/test/functional/page_controller_test.rb +19 -0
  54. data/example/test/performance/browsing_test.rb +9 -0
  55. data/example/test/test_helper.rb +13 -0
  56. data/example/test/unit/helpers/page_helper_test.rb +4 -0
  57. data/example/vendor/plugins/.gitkeep +0 -0
  58. data/lib/analytical.rb +52 -0
  59. data/lib/analytical/api.rb +90 -0
  60. data/lib/analytical/base.rb +34 -0
  61. data/lib/analytical/clicky.rb +51 -0
  62. data/lib/analytical/console.rb +37 -0
  63. data/lib/analytical/google.rb +34 -0
  64. data/lib/analytical/kiss_metrics.rb +35 -0
  65. data/rails/init.rb +1 -0
  66. data/spec/analytical/api_spec.rb +122 -0
  67. data/spec/analytical/clicky_spec.rb +49 -0
  68. data/spec/analytical/google_spec.rb +38 -0
  69. data/spec/analytical/kiss_metrics_spec.rb +44 -0
  70. data/spec/analytical_spec.rb +64 -0
  71. data/spec/config/analytical.yml +6 -0
  72. data/spec/spec.opts +5 -0
  73. data/spec/spec_helper.rb +22 -0
  74. metadata +165 -0
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Joshua Krall
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,17 @@
1
+ = Analytical
2
+
3
+ Gem for managing multiple analytics services in your rails app.
4
+ Initial service implementations include: Google Analytics, Clicky[http://getclicky.com], and KISSMetrics[http://kissmetrics.com].
5
+
6
+ == Note on Patches/Pull Requests
7
+
8
+ * Fork the project.
9
+ * Make your feature addition or bug fix.
10
+ * Add specs for it. This is important so I don't break it in a future version unintentionally.
11
+ * Commit, do not mess with rakefile, version, or history.
12
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
+ * Send me a pull request. Bonus points for topic branches.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2010 Joshua Krall. See LICENSE for details.
@@ -0,0 +1,46 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "analytical"
8
+ gem.summary = %Q{Gem for managing multiple analytics services in your rails app.}
9
+ gem.description = %Q{Gem for managing multiple analytics services in your rails app.}
10
+ gem.email = "josh@transfs.com"
11
+ gem.homepage = "http://github.com/jkrall/analytical"
12
+ gem.authors = ["Joshua Krall"]
13
+ gem.add_development_dependency "rspec", ">= 1.2.9"
14
+ gem.add_dependency "activesupport"
15
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
+ end
17
+ Jeweler::GemcutterTasks.new
18
+ rescue LoadError
19
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
20
+ end
21
+
22
+ require 'spec/rake/spectask'
23
+ Spec::Rake::SpecTask.new(:spec) do |spec|
24
+ spec.libs << 'lib' << 'spec'
25
+ spec.spec_files = FileList['spec/**/*_spec.rb']
26
+ end
27
+
28
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
29
+ spec.libs << 'lib' << 'spec'
30
+ spec.pattern = 'spec/**/*_spec.rb'
31
+ spec.rcov = true
32
+ end
33
+
34
+ task :spec => :check_dependencies
35
+
36
+ task :default => :spec
37
+
38
+ require 'rake/rdoctask'
39
+ Rake::RDocTask.new do |rdoc|
40
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
41
+
42
+ rdoc.rdoc_dir = 'rdoc'
43
+ rdoc.title = "analytical #{version}"
44
+ rdoc.rdoc_files.include('README*')
45
+ rdoc.rdoc_files.include('lib/**/*.rb')
46
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.3.0
@@ -0,0 +1,124 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{analytical}
8
+ s.version = "0.3.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Joshua Krall"]
12
+ s.date = %q{2010-04-28}
13
+ s.description = %q{Gem for managing multiple analytics services in your rails app.}
14
+ s.email = %q{josh@transfs.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "analytical.gemspec",
27
+ "example/.gitignore",
28
+ "example/Gemfile",
29
+ "example/README",
30
+ "example/Rakefile",
31
+ "example/app/controllers/application_controller.rb",
32
+ "example/app/controllers/page_controller.rb",
33
+ "example/app/helpers/application_helper.rb",
34
+ "example/app/helpers/page_helper.rb",
35
+ "example/app/views/layouts/application.html.erb",
36
+ "example/app/views/page/index.html.erb",
37
+ "example/app/views/page/test_a.html.erb",
38
+ "example/app/views/page/test_b.html.erb",
39
+ "example/config.ru",
40
+ "example/config/analytical.yml",
41
+ "example/config/application.rb",
42
+ "example/config/boot.rb",
43
+ "example/config/database.yml",
44
+ "example/config/environment.rb",
45
+ "example/config/environments/development.rb",
46
+ "example/config/environments/production.rb",
47
+ "example/config/environments/test.rb",
48
+ "example/config/initializers/backtrace_silencers.rb",
49
+ "example/config/initializers/inflections.rb",
50
+ "example/config/initializers/mime_types.rb",
51
+ "example/config/initializers/secret_token.rb",
52
+ "example/config/initializers/session_store.rb",
53
+ "example/config/locales/en.yml",
54
+ "example/config/routes.rb",
55
+ "example/db/seeds.rb",
56
+ "example/doc/README_FOR_APP",
57
+ "example/lib/tasks/.gitkeep",
58
+ "example/public/404.html",
59
+ "example/public/422.html",
60
+ "example/public/500.html",
61
+ "example/public/favicon.ico",
62
+ "example/public/images/rails.png",
63
+ "example/public/javascripts/application.js",
64
+ "example/public/javascripts/controls.js",
65
+ "example/public/javascripts/dragdrop.js",
66
+ "example/public/javascripts/effects.js",
67
+ "example/public/javascripts/prototype.js",
68
+ "example/public/javascripts/rails.js",
69
+ "example/public/robots.txt",
70
+ "example/public/stylesheets/.gitkeep",
71
+ "example/script/rails",
72
+ "example/test/functional/page_controller_test.rb",
73
+ "example/test/performance/browsing_test.rb",
74
+ "example/test/test_helper.rb",
75
+ "example/test/unit/helpers/page_helper_test.rb",
76
+ "example/vendor/plugins/.gitkeep",
77
+ "lib/analytical.rb",
78
+ "lib/analytical/api.rb",
79
+ "lib/analytical/base.rb",
80
+ "lib/analytical/clicky.rb",
81
+ "lib/analytical/console.rb",
82
+ "lib/analytical/google.rb",
83
+ "lib/analytical/kiss_metrics.rb",
84
+ "rails/init.rb",
85
+ "spec/analytical/api_spec.rb",
86
+ "spec/analytical/clicky_spec.rb",
87
+ "spec/analytical/google_spec.rb",
88
+ "spec/analytical/kiss_metrics_spec.rb",
89
+ "spec/analytical_spec.rb",
90
+ "spec/config/analytical.yml",
91
+ "spec/spec.opts",
92
+ "spec/spec_helper.rb"
93
+ ]
94
+ s.homepage = %q{http://github.com/jkrall/analytical}
95
+ s.rdoc_options = ["--charset=UTF-8"]
96
+ s.require_paths = ["lib"]
97
+ s.rubygems_version = %q{1.3.6}
98
+ s.summary = %q{Gem for managing multiple analytics services in your rails app.}
99
+ s.test_files = [
100
+ "spec/analytical/api_spec.rb",
101
+ "spec/analytical/clicky_spec.rb",
102
+ "spec/analytical/google_spec.rb",
103
+ "spec/analytical/kiss_metrics_spec.rb",
104
+ "spec/analytical_spec.rb",
105
+ "spec/spec_helper.rb"
106
+ ]
107
+
108
+ if s.respond_to? :specification_version then
109
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
110
+ s.specification_version = 3
111
+
112
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
113
+ s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
114
+ s.add_runtime_dependency(%q<activesupport>, [">= 0"])
115
+ else
116
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
117
+ s.add_dependency(%q<activesupport>, [">= 0"])
118
+ end
119
+ else
120
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
121
+ s.add_dependency(%q<activesupport>, [">= 0"])
122
+ end
123
+ end
124
+
@@ -0,0 +1,4 @@
1
+ .bundle
2
+ db/*.sqlite3
3
+ log/*.log
4
+ tmp/**/*
@@ -0,0 +1,27 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'rails', '3.0.0.beta3'
4
+
5
+ # Bundle edge Rails instead:
6
+ # gem 'rails', :git => 'git://github.com/rails/rails.git'
7
+
8
+ gem 'sqlite3-ruby', :require => 'sqlite3'
9
+ gem 'analytical', :path => '..'
10
+
11
+ # Use unicorn as the web server
12
+ # gem 'unicorn'
13
+
14
+ # Deploy with Capistrano
15
+ # gem 'capistrano'
16
+
17
+ # Bundle the extra gems:
18
+ # gem 'bj'
19
+ # gem 'nokogiri', '1.4.1'
20
+ # gem 'sqlite3-ruby', :require => 'sqlite3'
21
+ # gem 'aws-s3', :require => 'aws/s3'
22
+
23
+ # Bundle gems for certain environments:
24
+ # gem 'rspec', :group => :test
25
+ # group :test do
26
+ # gem 'webrat'
27
+ # end
@@ -0,0 +1,244 @@
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" templates
7
+ that are primarily responsible for inserting pre-built data in between HTML tags.
8
+ The model contains the "smart" domain objects (such as Account, Product, Person,
9
+ Post) that holds all the business logic and knows how to persist themselves to
10
+ a database. The controller handles the incoming requests (such as Save New Account,
11
+ Update Product, Show Post) by manipulating the model and directing data to the view.
12
+
13
+ In Rails, the model is handled by what's called an object-relational mapping
14
+ layer entitled Active Record. This layer allows you to present the data from
15
+ database rows as objects and embellish these data objects with business logic
16
+ methods. You can read more about Active Record in
17
+ link:files/vendor/rails/activerecord/README.html.
18
+
19
+ The controller and view are handled by the Action Pack, which handles both
20
+ layers by its two parts: Action View and Action Controller. These two layers
21
+ are bundled in a single package due to their heavy interdependence. This is
22
+ unlike the relationship between the Active Record and Action Pack that is much
23
+ more separate. Each of these packages can be used independently outside of
24
+ Rails. You can read more about Action Pack in
25
+ link:files/vendor/rails/actionpack/README.html.
26
+
27
+
28
+ == Getting Started
29
+
30
+ 1. At the command prompt, start a new Rails application using the <tt>rails</tt> command
31
+ and your application name. Ex: rails myapp
32
+ 2. Change directory into myapp and start the web server: <tt>rails server</tt> (run with --help for options)
33
+ 3. Go to http://localhost:3000/ and get "Welcome aboard: You're riding the Rails!"
34
+ 4. Follow the guidelines to start developing your application
35
+
36
+
37
+ == Web Servers
38
+
39
+ By default, Rails will try to use Mongrel if it's installed when started with <tt>rails server</tt>, otherwise
40
+ Rails will use WEBrick, the webserver that ships with Ruby. But you can also use Rails
41
+ with a variety of other web servers.
42
+
43
+ Mongrel is a Ruby-based webserver with a C component (which requires compilation) that is
44
+ suitable for development and deployment of Rails applications. If you have Ruby Gems installed,
45
+ getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>.
46
+ More info at: http://mongrel.rubyforge.org
47
+
48
+ Say other Ruby web servers like Thin and Ebb or regular web servers like Apache or LiteSpeed or
49
+ Lighttpd or IIS. The Ruby web servers are run through Rack and the latter can either be setup to use
50
+ FCGI or proxy to a pack of Mongrels/Thin/Ebb servers.
51
+
52
+ == Apache .htaccess example for FCGI/CGI
53
+
54
+ # General Apache options
55
+ AddHandler fastcgi-script .fcgi
56
+ AddHandler cgi-script .cgi
57
+ Options +FollowSymLinks +ExecCGI
58
+
59
+ # If you don't want Rails to look in certain directories,
60
+ # use the following rewrite rules so that Apache won't rewrite certain requests
61
+ #
62
+ # Example:
63
+ # RewriteCond %{REQUEST_URI} ^/notrails.*
64
+ # RewriteRule .* - [L]
65
+
66
+ # Redirect all requests not available on the filesystem to Rails
67
+ # By default the cgi dispatcher is used which is very slow
68
+ #
69
+ # For better performance replace the dispatcher with the fastcgi one
70
+ #
71
+ # Example:
72
+ # RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
73
+ RewriteEngine On
74
+
75
+ # If your Rails application is accessed via an Alias directive,
76
+ # then you MUST also set the RewriteBase in this htaccess file.
77
+ #
78
+ # Example:
79
+ # Alias /myrailsapp /path/to/myrailsapp/public
80
+ # RewriteBase /myrailsapp
81
+
82
+ RewriteRule ^$ index.html [QSA]
83
+ RewriteRule ^([^.]+)$ $1.html [QSA]
84
+ RewriteCond %{REQUEST_FILENAME} !-f
85
+ RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
86
+
87
+ # In case Rails experiences terminal errors
88
+ # Instead of displaying this message you can supply a file here which will be rendered instead
89
+ #
90
+ # Example:
91
+ # ErrorDocument 500 /500.html
92
+
93
+ ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
94
+
95
+
96
+ == Debugging Rails
97
+
98
+ Sometimes your application goes wrong. Fortunately there are a lot of tools that
99
+ will help you debug it and get it back on the rails.
100
+
101
+ First area to check is the application log files. Have "tail -f" commands running
102
+ on the server.log and development.log. Rails will automatically display debugging
103
+ and runtime information to these files. Debugging info will also be shown in the
104
+ browser on requests from 127.0.0.1.
105
+
106
+ You can also log your own messages directly into the log file from your code using
107
+ the Ruby logger class from inside your controllers. Example:
108
+
109
+ class WeblogController < ActionController::Base
110
+ def destroy
111
+ @weblog = Weblog.find(params[:id])
112
+ @weblog.destroy
113
+ logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
114
+ end
115
+ end
116
+
117
+ The result will be a message in your log file along the lines of:
118
+
119
+ Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1
120
+
121
+ More information on how to use the logger is at http://www.ruby-doc.org/core/
122
+
123
+ Also, Ruby documentation can be found at http://www.ruby-lang.org/ including:
124
+
125
+ * The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/
126
+ * Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
127
+
128
+ These two online (and free) books will bring you up to speed on the Ruby language
129
+ and also on programming in general.
130
+
131
+
132
+ == Debugger
133
+
134
+ Debugger support is available through the debugger command when you start your Mongrel or
135
+ Webrick server with --debugger. This means that you can break out of execution at any point
136
+ in the code, investigate and change the model, AND then resume execution!
137
+ You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
138
+ Example:
139
+
140
+ class WeblogController < ActionController::Base
141
+ def index
142
+ @posts = Post.find(:all)
143
+ debugger
144
+ end
145
+ end
146
+
147
+ So the controller will accept the action, run the first line, then present you
148
+ with a IRB prompt in the server window. Here you can do things like:
149
+
150
+ >> @posts.inspect
151
+ => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
152
+ #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
153
+ >> @posts.first.title = "hello from a debugger"
154
+ => "hello from a debugger"
155
+
156
+ ...and even better is that you can examine how your runtime objects actually work:
157
+
158
+ >> f = @posts.first
159
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
160
+ >> f.
161
+ Display all 152 possibilities? (y or n)
162
+
163
+ Finally, when you're ready to resume execution, you enter "cont"
164
+
165
+
166
+ == Console
167
+
168
+ You can interact with the domain model by starting the console through <tt>rails console</tt>.
169
+ Here you'll have all parts of the application configured, just like it is when the
170
+ application is running. You can inspect domain models, change values, and save to the
171
+ database. Starting the script without arguments will launch it in the development environment.
172
+ Passing an argument will specify a different environment, like <tt>rails console production</tt>.
173
+
174
+ To reload your controllers and models after launching the console run <tt>reload!</tt>
175
+
176
+ == dbconsole
177
+
178
+ You can go to the command line of your database directly through <tt>rails dbconsole</tt>.
179
+ You would be connected to the database with the credentials defined in database.yml.
180
+ Starting the script without arguments will connect you to the development database. Passing an
181
+ argument will connect you to a different database, like <tt>rails dbconsole production</tt>.
182
+ Currently works for mysql, postgresql and sqlite.
183
+
184
+ == Description of Contents
185
+
186
+ app
187
+ Holds all the code that's specific to this particular application.
188
+
189
+ app/controllers
190
+ Holds controllers that should be named like weblogs_controller.rb for
191
+ automated URL mapping. All controllers should descend from ApplicationController
192
+ which itself descends from ActionController::Base.
193
+
194
+ app/models
195
+ Holds models that should be named like post.rb.
196
+ Most models will descend from ActiveRecord::Base.
197
+
198
+ app/views
199
+ Holds the template files for the view that should be named like
200
+ weblogs/index.html.erb for the WeblogsController#index action. All views use eRuby
201
+ syntax.
202
+
203
+ app/views/layouts
204
+ Holds the template files for layouts to be used with views. This models the common
205
+ header/footer method of wrapping views. In your views, define a layout using the
206
+ <tt>layout :default</tt> and create a file named default.html.erb. Inside default.html.erb,
207
+ call <% yield %> to render the view using this layout.
208
+
209
+ app/helpers
210
+ Holds view helpers that should be named like weblogs_helper.rb. These are generated
211
+ for you automatically when using rails generate for controllers. Helpers can be used to
212
+ wrap functionality for your views into methods.
213
+
214
+ config
215
+ Configuration files for the Rails environment, the routing map, the database, and other dependencies.
216
+
217
+ db
218
+ Contains the database schema in schema.rb. db/migrate contains all
219
+ the sequence of Migrations for your schema.
220
+
221
+ doc
222
+ This directory is where your application documentation will be stored when generated
223
+ using <tt>rake doc:app</tt>
224
+
225
+ lib
226
+ Application specific libraries. Basically, any kind of custom code that doesn't
227
+ belong under controllers, models, or helpers. This directory is in the load path.
228
+
229
+ public
230
+ The directory available for the web server. Contains subdirectories for images, stylesheets,
231
+ and javascripts. Also contains the dispatchers and the default HTML files. This should be
232
+ set as the DOCUMENT_ROOT of your web server.
233
+
234
+ script
235
+ Helper scripts for automation and generation.
236
+
237
+ test
238
+ Unit and functional tests along with fixtures. When using the rails generate command, template
239
+ test files will be generated for you and placed in this directory.
240
+
241
+ vendor
242
+ External libraries that the application depends on. Also includes the plugins subdirectory.
243
+ If the app has frozen rails, those gems also go here, under vendor/rails/.
244
+ This directory is in the load path.