mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 15:20:13 +01:00
* Upgraded to use Rails 0.10.0
* Changed require of Redcloth to favour gem version of version 3.0.3 or greater * Changed the way that URLs are generated for stylesheets and javascripts by using AssetTagHelper git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@28 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
2f182327e8
commit
de31b57852
23 changed files with 804 additions and 185 deletions
435
tracks/CHANGELOG
Normal file
435
tracks/CHANGELOG
Normal file
|
|
@ -0,0 +1,435 @@
|
||||||
|
*0.10.0* (24th February, 2005)
|
||||||
|
|
||||||
|
* Changed default IP binding for WEBrick from 127.0.0.1 to 0.0.0.0 so that the server is accessible both locally and remotely #696 [Marcel]
|
||||||
|
|
||||||
|
* Fixed that script/server -d was broken so daemon mode couldn't be used #687 [Nicholas Seckar]
|
||||||
|
|
||||||
|
* Upgraded to breakpoint 92 which fixes:
|
||||||
|
|
||||||
|
* overload IRB.parse_opts(), fixes #443
|
||||||
|
=> breakpoints in tests work even when running them via rake
|
||||||
|
* untaint handlers, might fix an issue discussed on the Rails ML
|
||||||
|
* added verbose mode to breakpoint_client
|
||||||
|
* less noise caused by breakpoint_client by default
|
||||||
|
* ignored TerminateLineInput exception in signal handler
|
||||||
|
=> quiet exit on Ctrl-C
|
||||||
|
|
||||||
|
* Added support for independent components residing in /components. Example:
|
||||||
|
|
||||||
|
Controller: components/list/items_controller.rb
|
||||||
|
(holds a List::ItemsController class with uses_component_template_root called)
|
||||||
|
|
||||||
|
Model : components/list/item.rb
|
||||||
|
(namespace is still shared, so an Item model in app/models will take precedence)
|
||||||
|
|
||||||
|
Views : components/list/items/show.rhtml
|
||||||
|
|
||||||
|
|
||||||
|
* Added --sandbox option to script/console that'll roll back all changes made to the database when you quit #672 [bitsweat]
|
||||||
|
|
||||||
|
* Added 'recent' as a rake target that'll run tests for files that changed in the last 10 minutes #612 [bitsweat]
|
||||||
|
|
||||||
|
* Changed script/console to default to development environment and drop --no-inspect #650 [bitsweat]
|
||||||
|
|
||||||
|
* Added that the 'fixture :posts' syntax can be used for has_and_belongs_to_many fixtures where a model doesn't exist #572 [bitsweat]
|
||||||
|
|
||||||
|
* Added that running test_units and test_functional now performs the clone_structure_to_test as well #566 [rasputnik]
|
||||||
|
|
||||||
|
* Added new generator framework that informs about its doings on generation and enables updating and destruction of generated artifacts. See the new script/destroy and script/update for more details #487 [bitsweat]
|
||||||
|
|
||||||
|
* Added Action Web Service as a new add-on framework for Action Pack [Leon Bredt]
|
||||||
|
|
||||||
|
* Added Active Support as an independent utility and standard library extension bundle
|
||||||
|
|
||||||
|
* Upgraded to Active Record 1.7.0, Action Pack 1.5.0, Action Mailer 0.7.0
|
||||||
|
|
||||||
|
|
||||||
|
*0.9.5* (January 25th, 2005)
|
||||||
|
|
||||||
|
* Fixed dependency reloading by switching to a remove_const approach where all Active Records, Active Record Observers, and Action Controllers are reloading by undefining their classes. This enables you to remove methods in all three types and see the change reflected immediately and it fixes #539. This also means that only those three types of classes will benefit from the const_missing and reloading approach. If you want other classes (like some in lib/) to reload, you must use require_dependency to do it.
|
||||||
|
|
||||||
|
* Added Florian Gross' latest version of Breakpointer and friends that fixes a variaty of bugs #441 [Florian Gross]
|
||||||
|
|
||||||
|
* Fixed skeleton Rakefile to work with sqlite3 out of the box #521 [rasputnik]
|
||||||
|
|
||||||
|
* Fixed that script/breakpointer didn't get the Ruby path rewritten as the other scripts #523 [brandt@kurowski.net]
|
||||||
|
|
||||||
|
* Fixed handling of syntax errors in models that had already been succesfully required once in the current interpreter
|
||||||
|
|
||||||
|
* Fixed that models that weren't referenced in associations weren't being reloaded in the development mode by reinstating the reload
|
||||||
|
|
||||||
|
* Fixed that generate scaffold would produce bad functional tests
|
||||||
|
|
||||||
|
* Fixed that FCGI can also display SyntaxErrors
|
||||||
|
|
||||||
|
* Upgraded to Active Record 1.6.0, Action Pack 1.4.0
|
||||||
|
|
||||||
|
|
||||||
|
*0.9.4.1* (January 18th, 2005)
|
||||||
|
|
||||||
|
* Added 5-second timeout to WordNet alternatives on creating reserved-word models #501 [Marcel Molina]
|
||||||
|
|
||||||
|
* Fixed binding of caller #496 [Alexey]
|
||||||
|
|
||||||
|
* Upgraded to Active Record 1.5.1, Action Pack 1.3.1, Action Mailer 0.6.1
|
||||||
|
|
||||||
|
|
||||||
|
*0.9.4* (January 17th, 2005)
|
||||||
|
|
||||||
|
* Added that ApplicationController will catch a ControllerNotFound exception if someone attempts to access a url pointing to an unexisting controller [Tobias Luetke]
|
||||||
|
|
||||||
|
* Flipped code-to-test ratio around to be more readable #468 [Scott Baron]
|
||||||
|
|
||||||
|
* Fixed log file permissions to be 666 instead of 777 (so they're not executable) #471 [Lucas Carlson]
|
||||||
|
|
||||||
|
* Fixed that auto reloading would some times not work or would reload the models twice #475 [Tobias Luetke]
|
||||||
|
|
||||||
|
* Added rewrite rules to deal with caching to public/.htaccess
|
||||||
|
|
||||||
|
* Added the option to specify a controller name to "generate scaffold" and made the default controller name the plural form of the model.
|
||||||
|
|
||||||
|
* Added that rake clone_structure_to_test, db_structure_dump, and purge_test_database tasks now pick up the source database to use from
|
||||||
|
RAILS_ENV instead of just forcing development #424 [Tobias Luetke]
|
||||||
|
|
||||||
|
* Fixed script/console to work with Windows (that requires the use of irb.bat) #418 [octopod]
|
||||||
|
|
||||||
|
* Fixed WEBrick servlet slowdown over time by restricting the load path reloading to mod_ruby
|
||||||
|
|
||||||
|
* Removed Fancy Indexing as a default option on the WEBrick servlet as it made it harder to use various caching schemes
|
||||||
|
|
||||||
|
* Upgraded to Active Record 1.5, Action Pack 1.3, Action Mailer 0.6
|
||||||
|
|
||||||
|
|
||||||
|
*0.9.3* (January 4th, 2005)
|
||||||
|
|
||||||
|
* Added support for SQLite in the auto-dumping/importing of schemas for development -> test #416
|
||||||
|
|
||||||
|
* Added automated rewriting of the shebang lines on installs through the gem rails command #379 [Manfred Stienstra]
|
||||||
|
|
||||||
|
* Added ActionMailer::Base.deliver_method = :test to the test environment so that mail objects are available in ActionMailer::Base.deliveries
|
||||||
|
for functional testing.
|
||||||
|
|
||||||
|
* Added protection for creating a model through the generators with a name of an existing class, like Thread or Date.
|
||||||
|
It'll even offer you a synonym using wordnet.princeton.edu as a look-up. No, I'm not kidding :) [Florian Gross]
|
||||||
|
|
||||||
|
* Fixed dependency management to happen in a unified fashion for Active Record and Action Pack using the new Dependencies module. This means that
|
||||||
|
the environment options needs to change from:
|
||||||
|
|
||||||
|
Before in development.rb:
|
||||||
|
ActionController::Base.reload_dependencies = true
|
||||||
|
ActiveRecord::Base.reload_associations = true
|
||||||
|
|
||||||
|
Now in development.rb:
|
||||||
|
Dependencies.mechanism = :load
|
||||||
|
|
||||||
|
Before in production.rb and test.rb:
|
||||||
|
ActionController::Base.reload_dependencies = false
|
||||||
|
ActiveRecord::Base.reload_associations = false
|
||||||
|
|
||||||
|
Now in production.rb and test.rb:
|
||||||
|
Dependencies.mechanism = :require
|
||||||
|
|
||||||
|
* Fixed problems with dependency caching and controller hierarchies on Ruby 1.8.2 in development mode #351
|
||||||
|
|
||||||
|
* Fixed that generated action_mailers doesnt need to require the action_mailer since thats already done in the environment #382 [Lucas Carlson]
|
||||||
|
|
||||||
|
* Upgraded to Action Pack 1.2.0 and Active Record 1.4.0
|
||||||
|
|
||||||
|
|
||||||
|
*0.9.2*
|
||||||
|
|
||||||
|
* Fixed CTRL-C exists from the Breakpointer to be a clean affair without error dumping [Kent Sibilev]
|
||||||
|
|
||||||
|
* Fixed "rake stats" to work with sub-directories in models and controllers and to report the code to test ration [Scott Baron]
|
||||||
|
|
||||||
|
* Added that Active Record associations are now reloaded instead of cleared to work with the new const_missing hook in Active Record.
|
||||||
|
|
||||||
|
* Added graceful handling of an inaccessible log file by redirecting output to STDERR with a warning #330 [rainmkr]
|
||||||
|
|
||||||
|
* Added support for a -h/--help parameter in the generator #331 [Ulysses]
|
||||||
|
|
||||||
|
* Fixed that File.expand_path in config/environment.rb would fail when dealing with symlinked public directories [mjobin]
|
||||||
|
|
||||||
|
* Upgraded to Action Pack 1.1.0 and Active Record 1.3.0
|
||||||
|
|
||||||
|
|
||||||
|
*0.9.1*
|
||||||
|
|
||||||
|
* Upgraded to Action Pack 1.0.1 for important bug fix
|
||||||
|
|
||||||
|
* Updated gem dependencies
|
||||||
|
|
||||||
|
|
||||||
|
*0.9.0*
|
||||||
|
|
||||||
|
* Renamed public/dispatch.servlet to script/server -- it wasn't really dispatching anyway as its delegating calls to public/dispatch.rb
|
||||||
|
|
||||||
|
* Renamed AbstractApplicationController and abstract_application.rb to ApplicationController and application.rb, so that it will be possible
|
||||||
|
for the framework to automatically pick up on app/views/layouts/application.rhtml and app/helpers/application.rb
|
||||||
|
|
||||||
|
* Added script/console that makes it even easier to start an IRB session for interacting with the domain model. Run with no-args to
|
||||||
|
see help.
|
||||||
|
|
||||||
|
* Added breakpoint support through the script/breakpointer client. This means that you can break out of execution at any point in
|
||||||
|
the code, investigate and change the model, AND then resume execution! Example:
|
||||||
|
|
||||||
|
class WeblogController < ActionController::Base
|
||||||
|
def index
|
||||||
|
@posts = Post.find_all
|
||||||
|
breakpoint "Breaking out from the list"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
So the controller will accept the action, run the first line, then present you with a IRB prompt in the breakpointer window.
|
||||||
|
Here you can do things like:
|
||||||
|
|
||||||
|
Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint'
|
||||||
|
|
||||||
|
>> @posts.inspect
|
||||||
|
=> "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
|
||||||
|
#<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
|
||||||
|
>> @posts.first.title = "hello from a breakpoint"
|
||||||
|
=> "hello from a breakpoint"
|
||||||
|
|
||||||
|
...and even better is that you can examine how your runtime objects actually work:
|
||||||
|
|
||||||
|
>> f = @posts.first
|
||||||
|
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
|
||||||
|
>> f.
|
||||||
|
Display all 152 possibilities? (y or n)
|
||||||
|
|
||||||
|
Finally, when you're ready to resume execution, you press CTRL-D
|
||||||
|
|
||||||
|
* Changed environments to be configurable through an environment variable. By default, the environment is "development", but you
|
||||||
|
can change that and set your own by configuring the Apache vhost with a string like (mod_env must be available on the server):
|
||||||
|
|
||||||
|
SetEnv RAILS_ENV production
|
||||||
|
|
||||||
|
...if you're using WEBrick, you can pick the environment to use with the command-line parameters -e/--environment, like this:
|
||||||
|
|
||||||
|
ruby public/dispatcher.servlet -e production
|
||||||
|
|
||||||
|
* Added a new default environment called "development", which leaves the production environment to be tuned exclusively for that.
|
||||||
|
|
||||||
|
* Added a start_server in the root of the Rails application to make it even easier to get started
|
||||||
|
|
||||||
|
* Fixed public/.htaccess to use RewriteBase and share the same rewrite rules for all the dispatch methods
|
||||||
|
|
||||||
|
* Fixed webrick_server to handle requests in a serialized manner (the Rails reloading infrastructure is not thread-safe)
|
||||||
|
|
||||||
|
* Added support for controllers in directories. So you can have:
|
||||||
|
|
||||||
|
app/controllers/account_controller.rb # URL: /account/
|
||||||
|
app/controllers/admin/account_controller.rb # URL: /admin/account/
|
||||||
|
|
||||||
|
NOTE: You need to update your public/.htaccess with the new rules to pick it up
|
||||||
|
|
||||||
|
* Added reloading for associations and dependencies under cached environments like FastCGI and mod_ruby. This makes it possible to use
|
||||||
|
those environments for development. This is turned on by default, but can be turned off with
|
||||||
|
ActiveRecord::Base.reload_associations = false and ActionController::Base.reload_dependencies = false in production environments.
|
||||||
|
|
||||||
|
* Added support for sub-directories in app/models. So now you can have something like Basecamp with:
|
||||||
|
|
||||||
|
app/models/accounting
|
||||||
|
app/models/project
|
||||||
|
app/models/participants
|
||||||
|
app/models/settings
|
||||||
|
|
||||||
|
It's poor man's namespacing, but only for file-system organization. You still require files just like before.
|
||||||
|
Nothing changes inside the files themselves.
|
||||||
|
|
||||||
|
|
||||||
|
* Fixed a few references in the tests generated by new_mailer [bitsweat]
|
||||||
|
|
||||||
|
* Added support for mocks in testing with test/mocks
|
||||||
|
|
||||||
|
* Cleaned up the environments a bit and added global constant RAILS_ROOT
|
||||||
|
|
||||||
|
|
||||||
|
*0.8.5* (9)
|
||||||
|
|
||||||
|
* Made dev-util available to all tests, so you can insert breakpoints in any test case to get an IRB prompt at that point [bitsweat]:
|
||||||
|
|
||||||
|
def test_complex_stuff
|
||||||
|
@david.projects << @new_project
|
||||||
|
breakpoint "Let's have a closer look at @david"
|
||||||
|
end
|
||||||
|
|
||||||
|
You need to install dev-utils yourself for this to work ("gem install dev-util").
|
||||||
|
|
||||||
|
* Added shared generator behavior so future upgrades should be possible without manually copying over files [bitsweat]
|
||||||
|
|
||||||
|
* Added the new helper style to both controller and helper templates [bitsweat]
|
||||||
|
|
||||||
|
* Added new_crud generator for creating a model and controller at the same time with explicit scaffolding [bitsweat]
|
||||||
|
|
||||||
|
* Added configuration of Test::Unit::TestCase.fixture_path to test_helper to concide with the new AR fixtures style
|
||||||
|
|
||||||
|
* Fixed that new_model was generating singular table/fixture names
|
||||||
|
|
||||||
|
* Upgraded to Action Mailer 0.4.0
|
||||||
|
|
||||||
|
* Upgraded to Action Pack 0.9.5
|
||||||
|
|
||||||
|
* Upgraded to Active Record 1.1.0
|
||||||
|
|
||||||
|
|
||||||
|
*0.8.0 (15)*
|
||||||
|
|
||||||
|
* Removed custom_table_name option for new_model now that the Inflector is as powerful as it is
|
||||||
|
|
||||||
|
* Changed the default rake action to just do testing and separate API generation and coding statistics into a "doc" task.
|
||||||
|
|
||||||
|
* Fixed WEBrick dispatcher to handle missing slashes in the URLs gracefully [alexey]
|
||||||
|
|
||||||
|
* Added user option for all postgresql tool calls in the rakefile [elvstone]
|
||||||
|
|
||||||
|
* Fixed problem with running "ruby public/dispatch.servlet" instead of "cd public; ruby dispatch.servlet" [alexey]
|
||||||
|
|
||||||
|
* Fixed WEBrick server so that it no longer hardcodes the ruby interpreter used to "ruby" but will get the one used based
|
||||||
|
on the Ruby runtime configuration. [Marcel Molina Jr.]
|
||||||
|
|
||||||
|
* Fixed Dispatcher so it'll route requests to magic_beans to MagicBeansController/magic_beans_controller.rb [Caio Chassot]
|
||||||
|
|
||||||
|
* "new_controller MagicBeans" and "new_model SubscriptionPayments" will now both behave properly as they use the new Inflector.
|
||||||
|
|
||||||
|
* Fixed problem with MySQL foreign key constraint checks in Rake :clone_production_structure_to_test target [Andreas Schwarz]
|
||||||
|
|
||||||
|
* Changed WEBrick server to by default be auto-reloading, which is slower but makes source changes instant.
|
||||||
|
Class compilation cache can be turned on with "-c" or "--cache-classes".
|
||||||
|
|
||||||
|
* Added "-b/--binding" option to WEBrick dispatcher to bind the server to a specific IP address (default: 127.0.0.1) [Kevin Temp]
|
||||||
|
|
||||||
|
* dispatch.fcgi now DOESN'T set FCGI_PURE_RUBY as it was slowing things down for now reason [Andreas Schwarz]
|
||||||
|
|
||||||
|
* Added new_mailer generator to work with Action Mailer
|
||||||
|
|
||||||
|
* Included new framework: Action Mailer 0.3
|
||||||
|
|
||||||
|
* Upgraded to Action Pack 0.9.0
|
||||||
|
|
||||||
|
* Upgraded to Active Record 1.0.0
|
||||||
|
|
||||||
|
|
||||||
|
*0.7.0*
|
||||||
|
|
||||||
|
* Added an optional second argument to the new_model script that allows the programmer to specify the table name,
|
||||||
|
which will used to generate a custom table_name method in the model and will also be used in the creation of fixtures.
|
||||||
|
[Kevin Radloff]
|
||||||
|
|
||||||
|
* script/new_model now turns AccountHolder into account_holder instead of accountholder [Kevin Radloff]
|
||||||
|
|
||||||
|
* Fixed the faulty handleing of static files with WEBrick [Andreas Schwarz]
|
||||||
|
|
||||||
|
* Unified function_test_helper and unit_test_helper into test_helper
|
||||||
|
|
||||||
|
* Fixed bug with the automated production => test database dropping on PostgreSQL [dhawkins]
|
||||||
|
|
||||||
|
* create_fixtures in both the functional and unit test helper now turns off the log during fixture generation
|
||||||
|
and can generate more than one fixture at a time. Which makes it possible for assignments like:
|
||||||
|
|
||||||
|
@people, @projects, @project_access, @companies, @accounts =
|
||||||
|
create_fixtures "people", "projects", "project_access", "companies", "accounts"
|
||||||
|
|
||||||
|
* Upgraded to Action Pack 0.8.5 (locally-scoped variables, partials, advanced send_file)
|
||||||
|
|
||||||
|
* Upgraded to Active Record 0.9.5 (better table_name guessing, cloning, find_all_in_collection)
|
||||||
|
|
||||||
|
|
||||||
|
*0.6.5*
|
||||||
|
|
||||||
|
* No longer specifies a template for rdoc, so it'll use whatever is default (you can change it in the rakefile)
|
||||||
|
|
||||||
|
* The new_model generator will now use the same rules for plural wordings as Active Record
|
||||||
|
(so Category will give categories, not categorys) [Kevin Radloff]
|
||||||
|
|
||||||
|
* dispatch.fcgi now sets FCGI_PURE_RUBY to true to ensure that it's the Ruby version that's loaded [danp]
|
||||||
|
|
||||||
|
* Made the GEM work with Windows
|
||||||
|
|
||||||
|
* Fixed bug where mod_ruby would "forget" the load paths added when switching between controllers
|
||||||
|
|
||||||
|
* PostgreSQL are now supported for the automated production => test database dropping [Kevin Radloff]
|
||||||
|
|
||||||
|
* Errors thrown by the dispatcher are now properly handled in FCGI.
|
||||||
|
|
||||||
|
* Upgraded to Action Pack 0.8.0 (lots and lots and lots of fixes)
|
||||||
|
|
||||||
|
* Upgraded to Active Record 0.9.4 (a bunch of fixes)
|
||||||
|
|
||||||
|
|
||||||
|
*0.6.0*
|
||||||
|
|
||||||
|
* Added AbstractionApplicationController as a superclass for all controllers generated. This class can be used
|
||||||
|
to carry filters and methods that are to be shared by all. It has an accompanying ApplicationHelper that all
|
||||||
|
controllers will also automatically have available.
|
||||||
|
|
||||||
|
* Added environments that can be included from any script to get the full Active Record and Action Controller
|
||||||
|
context running. This can be used by maintenance scripts or to interact with the model through IRB. Example:
|
||||||
|
|
||||||
|
require 'config/environments/production'
|
||||||
|
|
||||||
|
for account in Account.find_all
|
||||||
|
account.recalculate_interests
|
||||||
|
end
|
||||||
|
|
||||||
|
A short migration script for an account model that had it's interest calculation strategy changed.
|
||||||
|
|
||||||
|
* Accessing the index of a controller with "/weblog" will now redirect to "/weblog/" (only on Apache, not WEBrick)
|
||||||
|
|
||||||
|
* Simplified the default Apache config so even remote requests are served off CGI as a default.
|
||||||
|
You'll now have to do something specific to activate mod_ruby and FCGI (like using the force urls).
|
||||||
|
This should make it easier for new comers that start on an external server.
|
||||||
|
|
||||||
|
* Added more of the necessary Apache options to .htaccess to make it easier to setup
|
||||||
|
|
||||||
|
* Upgraded to Action Pack 0.7.9 (lots of fixes)
|
||||||
|
|
||||||
|
* Upgraded to Active Record 0.9.3 (lots of fixes)
|
||||||
|
|
||||||
|
|
||||||
|
*0.5.7*
|
||||||
|
|
||||||
|
* Fixed bug in the WEBrick dispatcher that prevented it from getting parameters from the URL
|
||||||
|
(through GET requests or otherwise)
|
||||||
|
|
||||||
|
* Added lib in root as a place to store app specific libraries
|
||||||
|
|
||||||
|
* Added lib and vendor to load_path, so anything store within can be loaded directly.
|
||||||
|
Hence lib/redcloth.rb can be loaded with require "redcloth"
|
||||||
|
|
||||||
|
* Upgraded to Action Pack 0.7.8 (lots of fixes)
|
||||||
|
|
||||||
|
* Upgraded to Active Record 0.9.2 (minor upgrade)
|
||||||
|
|
||||||
|
|
||||||
|
*0.5.6*
|
||||||
|
|
||||||
|
* Upgraded to Action Pack 0.7.7 (multipart form fix)
|
||||||
|
|
||||||
|
* Updated the generated template stubs to valid XHTML files
|
||||||
|
|
||||||
|
* Ensure that controllers generated are capitalized, so "new_controller TodoLists"
|
||||||
|
gives the same as "new_controller Todolists" and "new_controller todolists".
|
||||||
|
|
||||||
|
|
||||||
|
*0.5.5*
|
||||||
|
|
||||||
|
* Works on Windows out of the box! (Dropped symlinks)
|
||||||
|
|
||||||
|
* Added webrick dispatcher: Try "ruby public/dispatch.servlet --help" [Florian Gross]
|
||||||
|
|
||||||
|
* Report errors about initialization to browser (instead of attempting to use uninitialized logger)
|
||||||
|
|
||||||
|
* Upgraded to Action Pack 0.7.6
|
||||||
|
|
||||||
|
* Upgraded to Active Record 0.9.1
|
||||||
|
|
||||||
|
* Added distinct 500.html instead of reusing 404.html
|
||||||
|
|
||||||
|
* Added MIT license
|
||||||
|
|
||||||
|
|
||||||
|
*0.5.0*
|
||||||
|
|
||||||
|
* First public release
|
||||||
189
tracks/README
Normal file
189
tracks/README
Normal file
|
|
@ -0,0 +1,189 @@
|
||||||
|
== Welcome to Rails
|
||||||
|
|
||||||
|
Rails is a web-application and persistance framework that includes everything
|
||||||
|
needed to create database-backed web-applications according to the
|
||||||
|
Model-View-Control pattern of separation. This pattern splits the view (also
|
||||||
|
called the presentation) into "dumb" templates that are primarily responsible
|
||||||
|
for inserting pre-build data in between HTML tags. The model contains the
|
||||||
|
"smart" domain objects (such as Account, Product, Person, Post) that holds all
|
||||||
|
the business logic and knows how to persist themselves to a database. The
|
||||||
|
controller handles the incoming requests (such as Save New Account, Update
|
||||||
|
Product, Show Post) by manipulating the model and directing data to the view.
|
||||||
|
|
||||||
|
In Rails, the model is handled by what's called a object-relational mapping
|
||||||
|
layer entitled Active Record. This layer allows you to present the data from
|
||||||
|
database rows as objects and embellish these data objects with business logic
|
||||||
|
methods. You can read more about Active Record in
|
||||||
|
link:files/vendor/activerecord/README.html.
|
||||||
|
|
||||||
|
The controller and view is handled by the Action Pack, which handles both
|
||||||
|
layers by its two parts: Action View and Action Controller. These two layers
|
||||||
|
are bundled in a single package due to their heavy interdependence. This is
|
||||||
|
unlike the relationship between the Active Record and Action Pack that is much
|
||||||
|
more separate. Each of these packages can be used independently outside of
|
||||||
|
Rails. You can read more about Action Pack in
|
||||||
|
link:files/vendor/actionpack/README.html.
|
||||||
|
|
||||||
|
|
||||||
|
== Requirements
|
||||||
|
|
||||||
|
* Database and driver (MySQL, PostgreSQL, or SQLite)
|
||||||
|
* Rake[http://rake.rubyforge.org] for running tests and the generating documentation
|
||||||
|
|
||||||
|
== Optionals
|
||||||
|
|
||||||
|
* Apache 1.3.x or 2.x or lighttpd 1.3.11+ (or any FastCGI-capable webserver with a
|
||||||
|
mod_rewrite-like module)
|
||||||
|
* FastCGI (or mod_ruby) for better performance on Apache
|
||||||
|
|
||||||
|
== Getting started
|
||||||
|
|
||||||
|
1. Run the WEBrick servlet: <tt>ruby script/server</tt>
|
||||||
|
(run with --help for options)
|
||||||
|
2. Go to http://localhost:3000/ and get "Congratulations, you've put Ruby on Rails!"
|
||||||
|
3. Follow the guidelines on the "Congratulations, you've put Ruby on Rails!" screen
|
||||||
|
|
||||||
|
|
||||||
|
== Example for Apache conf
|
||||||
|
|
||||||
|
<VirtualHost *:80>
|
||||||
|
ServerName rails
|
||||||
|
DocumentRoot /path/application/public/
|
||||||
|
ErrorLog /path/application/log/server.log
|
||||||
|
|
||||||
|
<Directory /path/application/public/>
|
||||||
|
Options ExecCGI FollowSymLinks
|
||||||
|
AllowOverride all
|
||||||
|
Allow from all
|
||||||
|
Order allow,deny
|
||||||
|
</Directory>
|
||||||
|
</VirtualHost>
|
||||||
|
|
||||||
|
NOTE: Be sure that CGIs can be executed in that directory as well. So ExecCGI
|
||||||
|
should be on and ".cgi" should respond. All requests from 127.0.0.1 goes
|
||||||
|
through CGI, so no Apache restart is necessary for changes. All other requests
|
||||||
|
goes through FCGI (or mod_ruby) that requires restart to show changes.
|
||||||
|
|
||||||
|
|
||||||
|
== Example for lighttpd conf (with FastCGI)
|
||||||
|
|
||||||
|
server.port = 8080
|
||||||
|
server.bind = "127.0.0.1"
|
||||||
|
# server.event-handler = "freebsd-kqueue" # needed on OS X
|
||||||
|
|
||||||
|
server.modules = ( "mod_rewrite", "mod_fastcgi" )
|
||||||
|
|
||||||
|
url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" )
|
||||||
|
server.error-handler-404 = "/dispatch.fcgi"
|
||||||
|
|
||||||
|
server.document-root = "/path/application/public"
|
||||||
|
server.errorlog = "/path/application/log/server.log"
|
||||||
|
|
||||||
|
fastcgi.server = ( ".fcgi" =>
|
||||||
|
( "localhost" =>
|
||||||
|
(
|
||||||
|
"min-procs" => 1,
|
||||||
|
"max-procs" => 5,
|
||||||
|
"socket" => "/tmp/application.fcgi.socket",
|
||||||
|
"bin-path" => "/path/application/public/dispatch.fcgi",
|
||||||
|
"bin-environment" => ( "RAILS_ENV" => "development" )
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
== Debugging Rails
|
||||||
|
|
||||||
|
Have "tail -f" commands running on both the server.log, production.log, and
|
||||||
|
test.log files. Rails will automatically display debugging and runtime
|
||||||
|
information to these files. Debugging info will also be shown in the browser
|
||||||
|
on requests from 127.0.0.1.
|
||||||
|
|
||||||
|
|
||||||
|
== Breakpoints
|
||||||
|
|
||||||
|
Breakpoint support is available through the script/breakpointer client. This
|
||||||
|
means that you can break out of execution at any point in the code, investigate
|
||||||
|
and change the model, AND then resume execution! Example:
|
||||||
|
|
||||||
|
class WeblogController < ActionController::Base
|
||||||
|
def index
|
||||||
|
@posts = Post.find_all
|
||||||
|
breakpoint "Breaking out from the list"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
So the controller will accept the action, run the first line, then present you
|
||||||
|
with a IRB prompt in the breakpointer window. Here you can do things like:
|
||||||
|
|
||||||
|
Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint'
|
||||||
|
|
||||||
|
>> @posts.inspect
|
||||||
|
=> "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
|
||||||
|
#<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
|
||||||
|
>> @posts.first.title = "hello from a breakpoint"
|
||||||
|
=> "hello from a breakpoint"
|
||||||
|
|
||||||
|
...and even better is that you can examine how your runtime objects actually work:
|
||||||
|
|
||||||
|
>> f = @posts.first
|
||||||
|
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
|
||||||
|
>> f.
|
||||||
|
Display all 152 possibilities? (y or n)
|
||||||
|
|
||||||
|
Finally, when you're ready to resume execution, you press CTRL-D
|
||||||
|
|
||||||
|
|
||||||
|
== Console
|
||||||
|
|
||||||
|
You can interact with the domain model by starting the console through script/console.
|
||||||
|
Here you'll have all parts of the application configured, just like it is when the
|
||||||
|
application is running. You can inspect domain models, change values, and save to the
|
||||||
|
database. Start the script without arguments to see the options.
|
||||||
|
|
||||||
|
|
||||||
|
== Description of contents
|
||||||
|
|
||||||
|
app
|
||||||
|
Holds all the code that's specific to this particular application.
|
||||||
|
|
||||||
|
app/controllers
|
||||||
|
Holds controllers that should be named like weblog_controller.rb for
|
||||||
|
automated URL mapping. All controllers should descend from
|
||||||
|
ActionController::Base.
|
||||||
|
|
||||||
|
app/models
|
||||||
|
Holds models that should be named like post.rb.
|
||||||
|
Most models will descent from ActiveRecord::Base.
|
||||||
|
|
||||||
|
app/views
|
||||||
|
Holds the template files for the view that should be named like
|
||||||
|
weblog/index.rhtml for the WeblogController#index action. All views uses eRuby
|
||||||
|
syntax. This directory can also be used to keep stylesheets, images, and so on
|
||||||
|
that can be symlinked to public.
|
||||||
|
|
||||||
|
app/helpers
|
||||||
|
Holds view helpers that should be named like weblog_helper.rb.
|
||||||
|
|
||||||
|
config
|
||||||
|
Configuration files for the Rails environment, the routing map, the database, and other dependencies.
|
||||||
|
|
||||||
|
components
|
||||||
|
Self-contained mini-applications that can bundle controllers, models, and views together.
|
||||||
|
|
||||||
|
lib
|
||||||
|
Application specific libraries. Basically, any kind of custom code that doesn't
|
||||||
|
belong controllers, models, or helpers. This directory is in the load path.
|
||||||
|
|
||||||
|
public
|
||||||
|
The directory available for the web server. Contains sub-directories for images, stylesheets,
|
||||||
|
and javascripts. Also contains the dispatchers and the default HTML files.
|
||||||
|
|
||||||
|
script
|
||||||
|
Helper scripts for automation and generation.
|
||||||
|
|
||||||
|
test
|
||||||
|
Unit and functional tests along with fixtures.
|
||||||
|
|
||||||
|
vendor
|
||||||
|
External libraries that the application depend on. This directory is in the load path.
|
||||||
114
tracks/Rakefile
114
tracks/Rakefile
|
|
@ -3,30 +3,61 @@ require 'rake/testtask'
|
||||||
require 'rake/rdoctask'
|
require 'rake/rdoctask'
|
||||||
|
|
||||||
$VERBOSE = nil
|
$VERBOSE = nil
|
||||||
|
TEST_CHANGES_SINCE = Time.now - 600
|
||||||
require File.dirname(__FILE__) + '/config/environment'
|
|
||||||
require 'code_statistics'
|
|
||||||
|
|
||||||
desc "Run all the tests on a fresh test database"
|
desc "Run all the tests on a fresh test database"
|
||||||
task :default => [ :clone_development_structure_to_test, :test_units, :test_functional ]
|
task :default => [ :test_units, :test_functional ]
|
||||||
|
|
||||||
|
|
||||||
|
desc 'Require application environment.'
|
||||||
|
task :environment do
|
||||||
|
unless defined? RAILS_ROOT
|
||||||
|
require File.dirname(__FILE__) + '/config/environment'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
desc "Generate API documentatio, show coding stats"
|
desc "Generate API documentatio, show coding stats"
|
||||||
task :doc => [ :appdoc, :stats ]
|
task :doc => [ :appdoc, :stats ]
|
||||||
|
|
||||||
|
|
||||||
|
# Look up tests for recently modified sources.
|
||||||
|
def recent_tests(source_pattern, test_path, touched_since = 10.minutes.ago)
|
||||||
|
FileList[source_pattern].map do |path|
|
||||||
|
if File.mtime(path) > touched_since
|
||||||
|
test = "#{test_path}/#{File.basename(path, '.rb')}_test.rb"
|
||||||
|
test if File.exists?(test)
|
||||||
|
end
|
||||||
|
end.compact
|
||||||
|
end
|
||||||
|
|
||||||
|
desc 'Test recent changes.'
|
||||||
|
Rake::TestTask.new(:recent => [ :clone_structure_to_test ]) do |t|
|
||||||
|
since = TEST_CHANGES_SINCE
|
||||||
|
touched = FileList['test/**/*_test.rb'].select { |path| File.mtime(path) > since } +
|
||||||
|
recent_tests('app/models/*.rb', 'test/unit', since) +
|
||||||
|
recent_tests('app/controllers/*.rb', 'test/functional', since)
|
||||||
|
|
||||||
|
t.libs << 'test'
|
||||||
|
t.verbose = true
|
||||||
|
t.test_files = touched.uniq
|
||||||
|
end
|
||||||
|
task :test_recent => [ :clone_structure_to_test ]
|
||||||
|
|
||||||
desc "Run the unit tests in test/unit"
|
desc "Run the unit tests in test/unit"
|
||||||
Rake::TestTask.new("test_units") { |t|
|
Rake::TestTask.new("test_units") { |t|
|
||||||
t.libs << "test"
|
t.libs << "test"
|
||||||
t.pattern = 'test/unit/*_test.rb'
|
t.pattern = 'test/unit/**/*_test.rb'
|
||||||
t.verbose = true
|
t.verbose = true
|
||||||
}
|
}
|
||||||
|
task :test_units => [ :clone_structure_to_test ]
|
||||||
|
|
||||||
desc "Run the functional tests in test/functional"
|
desc "Run the functional tests in test/functional"
|
||||||
Rake::TestTask.new("test_functional") { |t|
|
Rake::TestTask.new("test_functional") { |t|
|
||||||
t.libs << "test"
|
t.libs << "test"
|
||||||
t.pattern = 'test/functional/*_test.rb'
|
t.pattern = 'test/functional/**/*_test.rb'
|
||||||
t.verbose = true
|
t.verbose = true
|
||||||
}
|
}
|
||||||
|
task :test_functional => [ :clone_structure_to_test ]
|
||||||
|
|
||||||
desc "Generate documentation for the application"
|
desc "Generate documentation for the application"
|
||||||
Rake::RDocTask.new("appdoc") { |rdoc|
|
Rake::RDocTask.new("appdoc") { |rdoc|
|
||||||
|
|
@ -62,6 +93,7 @@ Rake::RDocTask.new("apidoc") { |rdoc|
|
||||||
|
|
||||||
desc "Report code statistics (KLOCs, etc) from the application"
|
desc "Report code statistics (KLOCs, etc) from the application"
|
||||||
task :stats do
|
task :stats do
|
||||||
|
require 'code_statistics'
|
||||||
CodeStatistics.new(
|
CodeStatistics.new(
|
||||||
["Helpers", "app/helpers"],
|
["Helpers", "app/helpers"],
|
||||||
["Controllers", "app/controllers"],
|
["Controllers", "app/controllers"],
|
||||||
|
|
@ -72,41 +104,53 @@ task :stats do
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Recreate the test databases from the development structure"
|
desc "Recreate the test databases from the development structure"
|
||||||
task :clone_development_structure_to_test => [ :db_structure_dump, :purge_test_database ] do
|
task :clone_structure_to_test => [ :db_structure_dump, :purge_test_database ] do
|
||||||
if ActiveRecord::Base.configurations["test"]["adapter"] == "mysql"
|
abcs = ActiveRecord::Base.configurations
|
||||||
ActiveRecord::Base.establish_connection(:test)
|
case abcs["test"]["adapter"]
|
||||||
ActiveRecord::Base.connection.execute('SET foreign_key_checks = 0')
|
when "mysql"
|
||||||
IO.readlines("db/development_structure.sql").join.split("\n\n").each do |table|
|
ActiveRecord::Base.establish_connection(:test)
|
||||||
ActiveRecord::Base.connection.execute(table)
|
ActiveRecord::Base.connection.execute('SET foreign_key_checks = 0')
|
||||||
end
|
IO.readlines("db/#{RAILS_ENV}_structure.sql").join.split("\n\n").each do |table|
|
||||||
elsif ActiveRecord::Base.configurations["test"]["adapter"] == "postgresql"
|
ActiveRecord::Base.connection.execute(table)
|
||||||
`psql -U #{ActiveRecord::Base.configurations["test"]["username"]} -f db/development_structure.sql #{ActiveRecord::Base.configurations["test"]["database"]}`
|
end
|
||||||
elsif ActiveRecord::Base.configurations["test"]["adapter"] == "sqlite"
|
when "postgresql"
|
||||||
`sqlite #{ActiveRecord::Base.configurations["test"]["dbfile"]} < db/development_structure.sql`
|
`psql -U #{abcs["test"]["username"]} -f db/#{RAILS_ENV}_structure.sql #{abcs["test"]["database"]}`
|
||||||
|
when "sqlite", "sqlite3"
|
||||||
|
`#{abcs[RAILS_ENV]["adapter"]} #{abcs["test"]["dbfile"]} < db/#{RAILS_ENV}_structure.sql`
|
||||||
|
else
|
||||||
|
raise "Unknown database adapter '#{abcs["test"]["adapter"]}'"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Dump the database structure to a SQL file"
|
desc "Dump the database structure to a SQL file"
|
||||||
task :db_structure_dump do
|
task :db_structure_dump => :environment do
|
||||||
if ActiveRecord::Base.configurations["development"]["adapter"] == "mysql"
|
abcs = ActiveRecord::Base.configurations
|
||||||
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations["development"])
|
case abcs[RAILS_ENV]["adapter"]
|
||||||
File.open("db/development_structure.sql", "w+") { |f| f << ActiveRecord::Base.connection.structure_dump }
|
when "mysql"
|
||||||
elsif ActiveRecord::Base.configurations["development"]["adapter"] == "postgresql"
|
ActiveRecord::Base.establish_connection(abcs[RAILS_ENV])
|
||||||
`pg_dump -U #{ActiveRecord::Base.configurations["development"]["username"]} -s -f db/development_structure.sql #{ActiveRecord::Base.configurations["development"]["database"]}`
|
File.open("db/#{RAILS_ENV}_structure.sql", "w+") { |f| f << ActiveRecord::Base.connection.structure_dump }
|
||||||
elsif ActiveRecord::Base.configurations["development"]["adapter"] == "sqlite"
|
when "postgresql"
|
||||||
`sqlite #{ActiveRecord::Base.configurations["development"]["dbfile"]} .schema > db/development_structure.sql`
|
`pg_dump -U #{abcs[RAILS_ENV]["username"]} -s -f db/#{RAILS_ENV}_structure.sql #{abcs[RAILS_ENV]["database"]}`
|
||||||
|
when "sqlite", "sqlite3"
|
||||||
|
`#{abcs[RAILS_ENV]["adapter"]} #{abcs[RAILS_ENV]["dbfile"]} .schema > db/#{RAILS_ENV}_structure.sql`
|
||||||
|
else
|
||||||
|
raise "Unknown database adapter '#{abcs["test"]["adapter"]}'"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Drop the test database and bring it back again"
|
desc "Empty the test database"
|
||||||
task :purge_test_database do
|
task :purge_test_database => :environment do
|
||||||
if ActiveRecord::Base.configurations["test"]["adapter"] == "mysql"
|
abcs = ActiveRecord::Base.configurations
|
||||||
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations["development"])
|
case abcs["test"]["adapter"]
|
||||||
ActiveRecord::Base.connection.recreate_database(ActiveRecord::Base.configurations["test"]["database"])
|
when "mysql"
|
||||||
elsif ActiveRecord::Base.configurations["test"]["adapter"] == "postgresql"
|
ActiveRecord::Base.establish_connection(abcs[RAILS_ENV])
|
||||||
`dropdb -U #{ActiveRecord::Base.configurations["test"]["username"]} #{ActiveRecord::Base.configurations["test"]["database"]}`
|
ActiveRecord::Base.connection.recreate_database(abcs["test"]["database"])
|
||||||
`createdb -U #{ActiveRecord::Base.configurations["test"]["username"]} #{ActiveRecord::Base.configurations["test"]["database"]}`
|
when "postgresql"
|
||||||
elsif ActiveRecord::Base.configurations["test"]["adapter"] == "sqlite"
|
`dropdb -U #{abcs["test"]["username"]} #{abcs["test"]["database"]}`
|
||||||
File.delete(ActiveRecord::Base.configurations["test"]["dbfile"]) if File.exist?(ActiveRecord::Base.configurations["test"]["dbfile"])
|
`createdb -U #{abcs["test"]["username"]} #{abcs["test"]["database"]}`
|
||||||
|
when "sqlite","sqlite3"
|
||||||
|
File.delete(abcs["test"]["dbfile"]) if File.exist?(abcs["test"]["dbfile"])
|
||||||
|
else
|
||||||
|
raise "Unknown database adapter '#{abcs["test"]["adapter"]}'"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
# Likewise will all the methods added be available for all controllers.
|
# Likewise will all the methods added be available for all controllers.
|
||||||
|
|
||||||
require_dependency "login_system"
|
require_dependency "login_system"
|
||||||
require_dependency "redcloth"
|
|
||||||
# require_dependency "iCal"
|
|
||||||
require 'date'
|
require 'date'
|
||||||
|
|
||||||
$delete_img = "<img src=\"/images/delete.png\" width=\"10\" height=\"10\" border=\"0\" />"
|
$delete_img = "<img src=\"/images/delete.png\" width=\"10\" height=\"10\" border=\"0\" />"
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ class TodoController < ApplicationController
|
||||||
|
|
||||||
# List the completed tasks, sorted by completion date
|
# List the completed tasks, sorted by completion date
|
||||||
#
|
#
|
||||||
|
# Use days declaration? 1.day.ago?
|
||||||
def completed
|
def completed
|
||||||
@page_title = "Completed tasks"
|
@page_title = "Completed tasks"
|
||||||
today_query = "DATE_SUB(CURDATE(),INTERVAL 1 DAY) <= completed"
|
today_query = "DATE_SUB(CURDATE(),INTERVAL 1 DAY) <= completed"
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ module ApplicationHelper
|
||||||
# Check due date in comparison to today's date
|
# Check due date in comparison to today's date
|
||||||
# Flag up date appropriately with a 'traffic light' colour code
|
# Flag up date appropriately with a 'traffic light' colour code
|
||||||
#
|
#
|
||||||
|
# Use 2.days.until?
|
||||||
def due_date(due)
|
def due_date(due)
|
||||||
if due == nil
|
if due == nil
|
||||||
return ""
|
return ""
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<% tracks_path = app_configurations["path"]["base"] %>
|
<%= stylesheet_link_tag "standard" %>
|
||||||
<style type="text/css" media="screen">
|
<%= javascript_include_tag "toggle_notes" %>
|
||||||
<%= "@import url(/stylesheets/standard.css);" %>
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/javascripts/toggle_notes.js"></script>
|
|
||||||
<link rel="shortcut icon" href="/favicon.ico" />
|
<link rel="shortcut icon" href="/favicon.ico" />
|
||||||
|
|
||||||
<title><%= @page_title %></title>
|
<title><%= @page_title %></title>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
RAILS_ROOT = File.dirname(__FILE__) + "/../"
|
RAILS_ROOT = File.dirname(__FILE__) + "/../"
|
||||||
RAILS_ENV = ENV['RAILS_ENV'] || 'production'
|
RAILS_ENV = ENV['RAILS_ENV'] || 'development'
|
||||||
|
|
||||||
|
|
||||||
# Mocks first.
|
# Mocks first.
|
||||||
|
|
@ -7,6 +7,7 @@ ADDITIONAL_LOAD_PATHS = ["#{RAILS_ROOT}/test/mocks/#{RAILS_ENV}"]
|
||||||
|
|
||||||
# Then model subdirectories.
|
# Then model subdirectories.
|
||||||
ADDITIONAL_LOAD_PATHS.concat(Dir["#{RAILS_ROOT}/app/models/[_a-z]*"])
|
ADDITIONAL_LOAD_PATHS.concat(Dir["#{RAILS_ROOT}/app/models/[_a-z]*"])
|
||||||
|
ADDITIONAL_LOAD_PATHS.concat(Dir["#{RAILS_ROOT}/components/[_a-z]*"])
|
||||||
|
|
||||||
# Followed by the standard includes.
|
# Followed by the standard includes.
|
||||||
ADDITIONAL_LOAD_PATHS.concat %w(
|
ADDITIONAL_LOAD_PATHS.concat %w(
|
||||||
|
|
@ -14,7 +15,9 @@ ADDITIONAL_LOAD_PATHS.concat %w(
|
||||||
app/models
|
app/models
|
||||||
app/controllers
|
app/controllers
|
||||||
app/helpers
|
app/helpers
|
||||||
|
app/apis
|
||||||
config
|
config
|
||||||
|
components
|
||||||
lib
|
lib
|
||||||
vendor
|
vendor
|
||||||
).map { |dir| "#{RAILS_ROOT}/#{dir}" }
|
).map { |dir| "#{RAILS_ROOT}/#{dir}" }
|
||||||
|
|
@ -24,14 +27,22 @@ ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(di
|
||||||
|
|
||||||
|
|
||||||
# Require Rails gems.
|
# Require Rails gems.
|
||||||
# Restricted the usuable versions of Rails gems to guard against the new routing
|
require 'rubygems'
|
||||||
# features in Rails
|
require_gem 'activesupport'
|
||||||
require 'rubygems'
|
require_gem 'activerecord'
|
||||||
require_gem 'activerecord', '<= 1.6.0'
|
require_gem 'actionpack'
|
||||||
require_gem 'actionpack', '<= 1.4.0'
|
require_gem 'actionmailer'
|
||||||
require_gem 'actionmailer', '<= 0.6.1'
|
require_gem 'actionwebservice'
|
||||||
require_gem 'rails', '<= 0.9.5'
|
require_gem 'rails'
|
||||||
|
|
||||||
|
# Try loading gem Redcloth first, but if that fails
|
||||||
|
# fall back on lib version
|
||||||
|
# FIXME
|
||||||
|
begin
|
||||||
|
require_gem 'redcloth', '>= 3.0.3'
|
||||||
|
rescue StandardError
|
||||||
|
require_dependency "redcloth"
|
||||||
|
end
|
||||||
|
|
||||||
# Environment-specific configuration.
|
# Environment-specific configuration.
|
||||||
require_dependency "environments/#{RAILS_ENV}"
|
require_dependency "environments/#{RAILS_ENV}"
|
||||||
|
|
@ -46,18 +57,19 @@ rescue StandardError
|
||||||
RAILS_DEFAULT_LOGGER = Logger.new(STDERR)
|
RAILS_DEFAULT_LOGGER = Logger.new(STDERR)
|
||||||
RAILS_DEFAULT_LOGGER.level = Logger::WARN
|
RAILS_DEFAULT_LOGGER.level = Logger::WARN
|
||||||
RAILS_DEFAULT_LOGGER.warn(
|
RAILS_DEFAULT_LOGGER.warn(
|
||||||
"Rails Error: Unable to access log file. Please ensure that log/#{RAILS_ENV}.log exists and is chmod 0777. " +
|
"Rails Error: Unable to access log file. Please ensure that log/#{RAILS_ENV}.log exists and is chmod 0666. " +
|
||||||
"The log level has been raised to WARN and the output directed to STDERR until the problem is fixed."
|
"The log level has been raised to WARN and the output directed to STDERR until the problem is fixed."
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
[ActiveRecord::Base, ActionController::Base, ActionMailer::Base].each do |klass|
|
[ActiveRecord, ActionController, ActionMailer].each { |mod| mod::Base.logger ||= RAILS_DEFAULT_LOGGER }
|
||||||
klass.logger ||= RAILS_DEFAULT_LOGGER
|
[ActionController, ActionMailer].each { |mod| mod::Base.template_root ||= "#{RAILS_ROOT}/app/views/" }
|
||||||
end
|
ActionController::Routing::Routes.reload
|
||||||
[ActionController::Base, ActionMailer::Base].each do |klass|
|
|
||||||
klass.template_root ||= "#{RAILS_ROOT}/app/views/"
|
|
||||||
end
|
|
||||||
|
|
||||||
|
Controllers = Dependencies::LoadingModule.root(
|
||||||
|
File.expand_path(File.join(RAILS_ROOT, 'app', 'controllers')),
|
||||||
|
File.expand_path(File.join(RAILS_ROOT, 'components'))
|
||||||
|
)
|
||||||
|
|
||||||
# Include your app's configuration here:
|
# Include your app's configuration here:
|
||||||
def app_configurations
|
def app_configurations
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
Dependencies.mechanism = :load
|
Dependencies.mechanism = :load
|
||||||
ActionController::Base.consider_all_requests_local = true
|
ActionController::Base.consider_all_requests_local = true
|
||||||
BREAKPOINT_SERVER_PORT = 42531
|
ActionController::Base.perform_caching = false
|
||||||
|
BREAKPOINT_SERVER_PORT = 42531
|
||||||
ActionController::Base.fragment_cache_store = ActionController::Caching::Fragments::FileStore.new("/Users/jchappell/Sites/tracks/cache")
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
Dependencies.mechanism = :require
|
Dependencies.mechanism = :require
|
||||||
ActionController::Base.consider_all_requests_local = false
|
ActionController::Base.consider_all_requests_local = false
|
||||||
|
ActionController::Base.perform_caching = true
|
||||||
ActionController::Base.fragment_cache_store = ActionController::Caching::Fragments::FileStore.new("/Users/jchappell/Sites/tracks/cache")
|
|
||||||
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
Dependencies.mechanism = :require
|
Dependencies.mechanism = :require
|
||||||
ActionController::Base.consider_all_requests_local = true
|
ActionController::Base.consider_all_requests_local = true
|
||||||
|
ActionController::Base.perform_caching = false
|
||||||
ActionMailer::Base.delivery_method = :test
|
ActionMailer::Base.delivery_method = :test
|
||||||
17
tracks/config/routes.rb
Normal file
17
tracks/config/routes.rb
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
ActionController::Routing::Routes.draw do |map|
|
||||||
|
# Add your own custom routes here.
|
||||||
|
# The priority is based upon order of creation: first created -> highest priority.
|
||||||
|
|
||||||
|
# Here's a sample route:
|
||||||
|
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
|
||||||
|
# Keep in mind you can assign values other than :controller and :action
|
||||||
|
|
||||||
|
# Allow downloading Web Service WSDL as a file with an extension
|
||||||
|
# instead of a file named 'wsdl'
|
||||||
|
map.connect ':controller/service.wsdl', :action => 'wsdl'
|
||||||
|
|
||||||
|
map.connect '', :controller => 'todo', :action => 'list'
|
||||||
|
|
||||||
|
# Install the default route as the lowest priority.
|
||||||
|
map.connect ':controller/:action/:id'
|
||||||
|
end
|
||||||
|
|
@ -7,7 +7,7 @@ Project wiki: <http://www.rousette.org.uk/projects/wiki/>
|
||||||
|
|
||||||
## Version 1.02
|
## Version 1.02
|
||||||
|
|
||||||
1. Uses Rails 0.9.4.1
|
1. Uses Rails 0.10.0
|
||||||
2. Added validation for the entry fields. If you enter a bit of text that's too long or you omit the description (not much point in a blank next action!) you'll get an error message and the action won't be saved.
|
2. Added validation for the entry fields. If you enter a bit of text that's too long or you omit the description (not much point in a blank next action!) you'll get an error message and the action won't be saved.
|
||||||
3. Added action caching.
|
3. Added action caching.
|
||||||
4. Did a bit of refactoring to try to make page loading a bit more efficient.
|
4. Did a bit of refactoring to try to make page loading a bit more efficient.
|
||||||
|
|
@ -20,6 +20,7 @@ Project wiki: <http://www.rousette.org.uk/projects/wiki/>
|
||||||
http://my.domain.tld/subdir/tracks
|
http://my.domain.tld/subdir/tracks
|
||||||
or whatever the full URL is. This should help people who put Tracks in a subdirectory.
|
or whatever the full URL is. This should help people who put Tracks in a subdirectory.
|
||||||
11. Added some rudimentary sorting of completed items. They are now sorted in to done today, done in the last 7 days and done in the last 31 days. At the bottom of completed.rhtml, there's a link to completed_archive.rhtml, which shows archived items older than 31 days.
|
11. Added some rudimentary sorting of completed items. They are now sorted in to done today, done in the last 7 days and done in the last 31 days. At the bottom of completed.rhtml, there's a link to completed_archive.rhtml, which shows archived items older than 31 days.
|
||||||
|
12. Changed the method of generating links to stylesheet and javascripts. Together with the new Routes, this should sort out any problems with putting Tracks in a sub-directory.
|
||||||
|
|
||||||
## Version 1.01
|
## Version 1.01
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,27 +3,12 @@ AddHandler fastcgi-script .fcgi
|
||||||
AddHandler cgi-script .cgi
|
AddHandler cgi-script .cgi
|
||||||
Options +FollowSymLinks +ExecCGI
|
Options +FollowSymLinks +ExecCGI
|
||||||
|
|
||||||
# Make sure that mod_ruby.c has been added and loaded as a module with Apache
|
# Redirect all requests not available on the filesystem to Rails
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
|
RewriteRule ^$ index.html [QSA]
|
||||||
|
RewriteRule ^([^.]+)$ $1.html [QSA]
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteRule ^(.*)$ /dispatch.cgi?$1 [QSA,L]
|
||||||
|
|
||||||
# Change extension from .cgi to .fcgi to switch to FCGI and to .rb to switch to mod_ruby
|
# In case Rails experiences terminal errors
|
||||||
RewriteBase /dispatch.fcgi
|
ErrorDocument 500 /500.html
|
||||||
|
|
||||||
# Enable this rewrite rule to point to the controller/action that should serve root.
|
|
||||||
RewriteRule ^$ /todo/list [R]
|
|
||||||
|
|
||||||
# Add missing slash
|
|
||||||
RewriteRule ^([-_a-zA-Z0-9]+)$ /$1/ [R]
|
|
||||||
|
|
||||||
# Default rewriting rules.
|
|
||||||
RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/([0-9]+)$ ?controller=$1&action=$2&id=$3 [QSA,L]
|
|
||||||
RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)$ ?controller=$1&action=$2 [QSA,L]
|
|
||||||
RewriteRule ^([-_a-zA-Z0-9]+)/$ ?controller=$1&action=index [QSA,L]
|
|
||||||
|
|
||||||
RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/([0-9]+)$ ?module=$1&controller=$2&action=$3&id=$4 [QSA,L]
|
|
||||||
RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)$ ?module=$1&controller=$2&action=$3 [QSA,L]
|
|
||||||
RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/$ ?module=$1&controller=$2&action=index [QSA,L]
|
|
||||||
|
|
||||||
# You can also point these error messages to a controller/action
|
|
||||||
ErrorDocument 500 /500.html
|
|
||||||
ErrorDocument 404 /404.html
|
|
||||||
|
|
@ -6,5 +6,5 @@ require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_
|
||||||
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
|
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
|
||||||
require "dispatcher"
|
require "dispatcher"
|
||||||
|
|
||||||
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) }
|
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
|
||||||
Dispatcher.dispatch
|
Dispatcher.dispatch
|
||||||
|
|
@ -6,5 +6,5 @@ require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_
|
||||||
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
|
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
|
||||||
require "dispatcher"
|
require "dispatcher"
|
||||||
|
|
||||||
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) }
|
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
|
||||||
Dispatcher.dispatch
|
Dispatcher.dispatch
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<html><head><META HTTP-EQUIV="Refresh" CONTENT="0;URL=_doc/index.html"></head></html>
|
|
||||||
|
|
@ -1,30 +1,22 @@
|
||||||
#!/usr/local/bin/ruby
|
#!/usr/local/bin/ruby
|
||||||
|
irb = RUBY_PLATFORM =~ /mswin32/ ? 'irb.bat' : 'irb'
|
||||||
|
|
||||||
if ARGV[0]
|
require 'optparse'
|
||||||
ENV['RAILS_ENV'] = ARGV[0]
|
options = {}
|
||||||
puts "Loading environment..."
|
OptionParser.new do |opt|
|
||||||
exec "irb -r config/environment.rb -r irb/completion --noinspect"
|
opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |options[:sandbox]| }
|
||||||
|
opt.parse!(ARGV)
|
||||||
|
end
|
||||||
|
|
||||||
|
libs = " -r #{File.dirname(__FILE__)}/../config/environment"
|
||||||
|
libs << " -r #{File.dirname(__FILE__)}/console_sandbox" if options[:sandbox]
|
||||||
|
libs << " -r irb/completion"
|
||||||
|
|
||||||
|
ENV['RAILS_ENV'] = ARGV.first || 'development'
|
||||||
|
if options[:sandbox]
|
||||||
|
puts "Loading #{ENV['RAILS_ENV']} environment in sandbox."
|
||||||
|
puts "Any modifications you make will be rolled back on exit."
|
||||||
else
|
else
|
||||||
puts <<-HELP
|
puts "Loading #{ENV['RAILS_ENV']} environment."
|
||||||
|
end
|
||||||
NAME
|
exec "#{irb} #{libs}"
|
||||||
console - interact with the domain model through a environment console (on IRB)
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
console [environment]
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
Starts an environment console using IRB that lets you manipulate and interrogate
|
|
||||||
the domain model or even trigger controller actions. The database connection and
|
|
||||||
configuration available to the web application is already setup.
|
|
||||||
|
|
||||||
Tab completion is available to see classes and methods on individual objects.
|
|
||||||
|
|
||||||
EXAMPLE
|
|
||||||
console production
|
|
||||||
|
|
||||||
This will initialize the production environment (as setup in config/database.yml
|
|
||||||
and config/environments/production.rb). You would now be ready to start requiring
|
|
||||||
models using require_dependency.
|
|
||||||
HELP
|
|
||||||
end
|
|
||||||
|
|
|
||||||
7
tracks/script/console_sandbox.rb
Executable file
7
tracks/script/console_sandbox.rb
Executable file
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/local/bin/ruby
|
||||||
|
ActiveRecord::Base.lock_mutex
|
||||||
|
ActiveRecord::Base.connection.begin_db_transaction
|
||||||
|
at_exit do
|
||||||
|
ActiveRecord::Base.connection.rollback_db_transaction
|
||||||
|
ActiveRecord::Base.unlock_mutex
|
||||||
|
end
|
||||||
5
tracks/script/destroy
Executable file
5
tracks/script/destroy
Executable file
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/usr/local/bin/ruby
|
||||||
|
require File.dirname(__FILE__) + '/../config/environment'
|
||||||
|
require 'rails_generator'
|
||||||
|
require 'rails_generator/scripts/destroy'
|
||||||
|
Rails::Generator::Scripts::Destroy.new.run(ARGV)
|
||||||
|
|
@ -1,69 +1,5 @@
|
||||||
#!/usr/local/bin/ruby
|
#!/usr/local/bin/ruby
|
||||||
require File.dirname(__FILE__) + '/../config/environment'
|
require File.dirname(__FILE__) + '/../config/environment'
|
||||||
require 'rails_generator'
|
require 'rails_generator'
|
||||||
|
require 'rails_generator/scripts/generate'
|
||||||
ARGV.shift unless ARGV.empty? or not ['--help', '-h'].include?(ARGV[0])
|
Rails::Generator::Scripts::Generate.new.run(ARGV)
|
||||||
|
|
||||||
def find_synonyms(word)
|
|
||||||
require 'open-uri'
|
|
||||||
uri = "http://wordnet.princeton.edu/cgi-bin/webwn2.0?stage=2" +
|
|
||||||
"&word=%s&posnumber=1&searchtypenumber=2&senses=&showglosses=1"
|
|
||||||
|
|
||||||
open(uri % word) do |stream|
|
|
||||||
data = stream.read.gsub(" ", " ").gsub("<BR>", "")
|
|
||||||
data.scan(/^Sense \d+\n.+?\n\n/m)
|
|
||||||
end
|
|
||||||
rescue Exception
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
unless ARGV.empty?
|
|
||||||
begin
|
|
||||||
name = ARGV.shift
|
|
||||||
generator = Rails::Generator.instance(name, ARGV)
|
|
||||||
|
|
||||||
if msg = generator.collision_with_builtin? then
|
|
||||||
$stderr.puts msg
|
|
||||||
|
|
||||||
if synonyms = find_synonyms(generator.class_name) then
|
|
||||||
$stderr.puts(
|
|
||||||
"", "Here are a few synonyms from WordNet. Maybe they will help you find an alternative name.",
|
|
||||||
"", synonyms
|
|
||||||
)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
generator.generate
|
|
||||||
end
|
|
||||||
rescue Rails::Generator::UsageError => e
|
|
||||||
puts e.message
|
|
||||||
end
|
|
||||||
else
|
|
||||||
builtin_generators = Rails::Generator.builtin_generators.join(', ')
|
|
||||||
contrib_generators = Rails::Generator.contrib_generators.join(', ')
|
|
||||||
|
|
||||||
$stderr.puts <<end_usage
|
|
||||||
#{$0} generator [args]
|
|
||||||
|
|
||||||
Rails comes with #{builtin_generators} generators.
|
|
||||||
#{$0} controller Login login logout
|
|
||||||
#{$0} model Account
|
|
||||||
#{$0} mailer AccountMailer
|
|
||||||
#{$0} scaffold Account action another_action
|
|
||||||
|
|
||||||
end_usage
|
|
||||||
|
|
||||||
unless contrib_generators.empty?
|
|
||||||
$stderr.puts " Installed generators (in #{RAILS_ROOT}/script/generators):"
|
|
||||||
$stderr.puts " #{contrib_generators}"
|
|
||||||
$stderr.puts
|
|
||||||
end
|
|
||||||
|
|
||||||
$stderr.puts <<end_usage
|
|
||||||
More generators are available at http://rubyonrails.org/show/Generators
|
|
||||||
1. Download, for example, login_generator.tar.gz
|
|
||||||
2. Unzip to directory #{RAILS_ROOT}/script/generators/login
|
|
||||||
3. Generate without args for usage information
|
|
||||||
#{$0} login
|
|
||||||
end_usage
|
|
||||||
exit 0
|
|
||||||
end
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ require 'optparse'
|
||||||
|
|
||||||
OPTIONS = {
|
OPTIONS = {
|
||||||
:port => 3000,
|
:port => 3000,
|
||||||
:ip => "127.0.0.1",
|
:ip => "0.0.0.0",
|
||||||
:environment => "development",
|
:environment => "development",
|
||||||
:server_root => File.expand_path(File.dirname(__FILE__) + "/../public/"),
|
:server_root => File.expand_path(File.dirname(__FILE__) + "/../public/"),
|
||||||
:server_type => WEBrick::SimpleServer
|
:server_type => WEBrick::SimpleServer
|
||||||
|
|
@ -45,5 +45,7 @@ ENV["RAILS_ENV"] = OPTIONS[:environment]
|
||||||
require File.dirname(__FILE__) + "/../config/environment"
|
require File.dirname(__FILE__) + "/../config/environment"
|
||||||
require 'webrick_server'
|
require 'webrick_server'
|
||||||
|
|
||||||
|
OPTIONS['working_directory'] = File.expand_path(RAILS_ROOT)
|
||||||
|
|
||||||
puts "=> Rails application started on http://#{OPTIONS[:ip]}:#{OPTIONS[:port]}"
|
puts "=> Rails application started on http://#{OPTIONS[:ip]}:#{OPTIONS[:port]}"
|
||||||
DispatchServlet.dispatch(OPTIONS)
|
DispatchServlet.dispatch(OPTIONS)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
ENV["RAILS_ENV"] ||= "test"
|
ENV["RAILS_ENV"] = "test"
|
||||||
require File.dirname(__FILE__) + "/../config/environment"
|
require File.dirname(__FILE__) + "/../config/environment"
|
||||||
require 'application'
|
require 'application'
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue