rails 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rails might be problematic. Click here for more details.
- data/CHANGELOG +159 -0
- data/MIT-LICENSE +20 -0
- data/README +121 -0
- data/Rakefile +259 -0
- data/bin/rails +28 -0
- data/configs/apache.conf +44 -0
- data/configs/database.yml +13 -0
- data/dispatches/dispatch.fcgi +7 -0
- data/dispatches/dispatch.rb +10 -0
- data/dispatches/dispatch.servlet +45 -0
- data/doc/README_FOR_APP +2 -0
- data/doc/apache_protection +3 -0
- data/doc/index.html +94 -0
- data/environments/production.rb +6 -0
- data/environments/shared.rb +27 -0
- data/environments/shared_for_gem.rb +17 -0
- data/environments/test.rb +6 -0
- data/fresh_rakefile +101 -0
- data/generators/new_controller.rb +118 -0
- data/generators/new_mailer.rb +119 -0
- data/generators/new_model.rb +70 -0
- data/helpers/abstract_application.rb +8 -0
- data/helpers/application_helper.rb +6 -0
- data/helpers/test_helper.rb +9 -0
- data/html/404.html +6 -0
- data/html/500.html +6 -0
- data/html/index.html +1 -0
- data/lib/code_statistics.rb +71 -0
- data/lib/dispatcher.rb +46 -0
- data/lib/webrick_server.rb +158 -0
- metadata +117 -0
data/CHANGELOG
ADDED
@@ -0,0 +1,159 @@
|
|
1
|
+
*0.8.0 (15)*
|
2
|
+
|
3
|
+
* Removed custom_table_name option for new_model now that the Inflector is as powerful as it is
|
4
|
+
|
5
|
+
* Changed the default rake action to just do testing and separate API generation and coding statistics into a "doc" task.
|
6
|
+
|
7
|
+
* Fixed WEBrick dispatcher to handle missing slashes in the URLs gracefully [alexey]
|
8
|
+
|
9
|
+
* Added user option for all postgresql tool calls in the rakefile [elvstone]
|
10
|
+
|
11
|
+
* Fixed problem with running "ruby public/dispatch.servlet" instead of "cd public; ruby dispatch.servlet" [alexey]
|
12
|
+
|
13
|
+
* Fixed WEBrick server so that it no longer hardcodes the ruby interpreter used to "ruby" but will get the one used based
|
14
|
+
on the Ruby runtime configuration. [Marcel Molina Jr.]
|
15
|
+
|
16
|
+
* Fixed Dispatcher so it'll route requests to magic_beans to MagicBeansController/magic_beans_controller.rb [Caio Chassot]
|
17
|
+
|
18
|
+
* "new_controller MagicBeans" and "new_model SubscriptionPayments" will now both behave properly as they use the new Inflector.
|
19
|
+
|
20
|
+
* Fixed problem with MySQL foreign key constraint checks in Rake :clone_production_structure_to_test target [Andreas Schwarz]
|
21
|
+
|
22
|
+
* Changed WEBrick server to by default be auto-reloading, which is slower but makes source changes instant.
|
23
|
+
Class compilation cache can be turned on with "-c" or "--cache-classes".
|
24
|
+
|
25
|
+
* Added "-b/--binding" option to WEBrick dispatcher to bind the server to a specific IP address (default: 127.0.0.1) [Kevin Temp]
|
26
|
+
|
27
|
+
* dispatch.fcgi now DOESN'T set FCGI_PURE_RUBY as it was slowing things down for now reason [Andreas Schwarz]
|
28
|
+
|
29
|
+
* Added new_mailer generator to work with Action Mailer
|
30
|
+
|
31
|
+
* Included new framework: Action Mailer 0.3
|
32
|
+
|
33
|
+
* Upgraded to Action Pack 0.9.0
|
34
|
+
|
35
|
+
* Upgraded to Active Record 1.0.0
|
36
|
+
|
37
|
+
|
38
|
+
*0.7.0*
|
39
|
+
|
40
|
+
* Added an optional second argument to the new_model script that allows the programmer to specify the table name,
|
41
|
+
which will used to generate a custom table_name method in the model and will also be used in the creation of fixtures.
|
42
|
+
[Kevin Radloff]
|
43
|
+
|
44
|
+
* script/new_model now turns AccountHolder into account_holder instead of accountholder [Kevin Radloff]
|
45
|
+
|
46
|
+
* Fixed the faulty handleing of static files with WEBrick [Andreas Schwarz]
|
47
|
+
|
48
|
+
* Unified function_test_helper and unit_test_helper into test_helper
|
49
|
+
|
50
|
+
* Fixed bug with the automated production => test database dropping on PostgreSQL [dhawkins]
|
51
|
+
|
52
|
+
* create_fixtures in both the functional and unit test helper now turns off the log during fixture generation
|
53
|
+
and can generate more than one fixture at a time. Which makes it possible for assignments like:
|
54
|
+
|
55
|
+
@people, @projects, @project_access, @companies, @accounts =
|
56
|
+
create_fixtures "people", "projects", "project_access", "companies", "accounts"
|
57
|
+
|
58
|
+
* Upgraded to Action Pack 0.8.5 (locally-scoped variables, partials, advanced send_file)
|
59
|
+
|
60
|
+
* Upgraded to Active Record 0.9.5 (better table_name guessing, cloning, find_all_in_collection)
|
61
|
+
|
62
|
+
|
63
|
+
*0.6.5*
|
64
|
+
|
65
|
+
* No longer specifies a template for rdoc, so it'll use whatever is default (you can change it in the rakefile)
|
66
|
+
|
67
|
+
* The new_model generator will now use the same rules for plural wordings as Active Record
|
68
|
+
(so Category will give categories, not categorys) [Kevin Radloff]
|
69
|
+
|
70
|
+
* dispatch.fcgi now sets FCGI_PURE_RUBY to true to ensure that it's the Ruby version that's loaded [danp]
|
71
|
+
|
72
|
+
* Made the GEM work with Windows
|
73
|
+
|
74
|
+
* Fixed bug where mod_ruby would "forget" the load paths added when switching between controllers
|
75
|
+
|
76
|
+
* PostgreSQL are now supported for the automated production => test database dropping [Kevin Radloff]
|
77
|
+
|
78
|
+
* Errors thrown by the dispatcher are now properly handled in FCGI.
|
79
|
+
|
80
|
+
* Upgraded to Action Pack 0.8.0 (lots and lots and lots of fixes)
|
81
|
+
|
82
|
+
* Upgraded to Active Record 0.9.4 (a bunch of fixes)
|
83
|
+
|
84
|
+
|
85
|
+
*0.6.0*
|
86
|
+
|
87
|
+
* Added AbstractionApplicationController as a superclass for all controllers generated. This class can be used
|
88
|
+
to carry filters and methods that are to be shared by all. It has an accompanying ApplicationHelper that all
|
89
|
+
controllers will also automatically have available.
|
90
|
+
|
91
|
+
* Added environments that can be included from any script to get the full Active Record and Action Controller
|
92
|
+
context running. This can be used by maintenance scripts or to interact with the model through IRB. Example:
|
93
|
+
|
94
|
+
require 'config/environments/production'
|
95
|
+
|
96
|
+
for account in Account.find_all
|
97
|
+
account.recalculate_interests
|
98
|
+
end
|
99
|
+
|
100
|
+
A short migration script for an account model that had it's interest calculation strategy changed.
|
101
|
+
|
102
|
+
* Accessing the index of a controller with "/weblog" will now redirect to "/weblog/" (only on Apache, not WEBrick)
|
103
|
+
|
104
|
+
* Simplified the default Apache config so even remote requests are served off CGI as a default.
|
105
|
+
You'll now have to do something specific to activate mod_ruby and FCGI (like using the force urls).
|
106
|
+
This should make it easier for new comers that start on an external server.
|
107
|
+
|
108
|
+
* Added more of the necessary Apache options to .htaccess to make it easier to setup
|
109
|
+
|
110
|
+
* Upgraded to Action Pack 0.7.9 (lots of fixes)
|
111
|
+
|
112
|
+
* Upgraded to Active Record 0.9.3 (lots of fixes)
|
113
|
+
|
114
|
+
|
115
|
+
*0.5.7*
|
116
|
+
|
117
|
+
* Fixed bug in the WEBrick dispatcher that prevented it from getting parameters from the URL
|
118
|
+
(through GET requests or otherwise)
|
119
|
+
|
120
|
+
* Added lib in root as a place to store app specific libraries
|
121
|
+
|
122
|
+
* Added lib and vendor to load_path, so anything store within can be loaded directly.
|
123
|
+
Hence lib/redcloth.rb can be loaded with require "redcloth"
|
124
|
+
|
125
|
+
* Upgraded to Action Pack 0.7.8 (lots of fixes)
|
126
|
+
|
127
|
+
* Upgraded to Active Record 0.9.2 (minor upgrade)
|
128
|
+
|
129
|
+
|
130
|
+
*0.5.6*
|
131
|
+
|
132
|
+
* Upgraded to Action Pack 0.7.7 (multipart form fix)
|
133
|
+
|
134
|
+
* Updated the generated template stubs to valid XHTML files
|
135
|
+
|
136
|
+
* Ensure that controllers generated are capitalized, so "new_controller TodoLists"
|
137
|
+
gives the same as "new_controller Todolists" and "new_controller todolists".
|
138
|
+
|
139
|
+
|
140
|
+
*0.5.5*
|
141
|
+
|
142
|
+
* Works on Windows out of the box! (Dropped symlinks)
|
143
|
+
|
144
|
+
* Added webrick dispatcher: Try "ruby public/dispatch.servlet --help" [Florian Gross]
|
145
|
+
|
146
|
+
* Report errors about initialization to browser (instead of attempting to use uninitialized logger)
|
147
|
+
|
148
|
+
* Upgraded to Action Pack 0.7.6
|
149
|
+
|
150
|
+
* Upgraded to Active Record 0.9.1
|
151
|
+
|
152
|
+
* Added distinct 500.html instead of reusing 404.html
|
153
|
+
|
154
|
+
* Added MIT license
|
155
|
+
|
156
|
+
|
157
|
+
*0.5.0*
|
158
|
+
|
159
|
+
* First public release
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2004 David Heinemeier Hansson
|
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.
|
data/README
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
== Welcome to Rails
|
2
|
+
|
3
|
+
Rails is a web-application and persistance framework that includes everything
|
4
|
+
needed to create database-backed web-applications according to the
|
5
|
+
Model-View-Control pattern of separation. This pattern splits the view (also
|
6
|
+
called the presentation) into "dumb" templates that are primarily responsible
|
7
|
+
for inserting pre-build data in between HTML tags. The model contains the
|
8
|
+
"smart" domain objects (such as Account, Product, Person, Post) that holds all
|
9
|
+
the business logic and knows how to persist themselves to a database. The
|
10
|
+
controller handles the incoming requests (such as Save New Account, Update
|
11
|
+
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 a 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/activerecord/README.html.
|
18
|
+
|
19
|
+
The controller and view is 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/actionpack/README.html.
|
26
|
+
|
27
|
+
|
28
|
+
== Requirements
|
29
|
+
|
30
|
+
* Database and driver (MySQL, PostgreSQL, or SQLite)
|
31
|
+
* Rake[http://rake.rubyforge.org] for running tests and the generating documentation
|
32
|
+
|
33
|
+
== Optionals
|
34
|
+
|
35
|
+
* Apache 1.3.x or 2.x (or any FastCGI-capable webserver with a
|
36
|
+
mod_rewrite-like module)
|
37
|
+
* FastCGI (or mod_ruby) for production performance (CGI is used for
|
38
|
+
development)
|
39
|
+
|
40
|
+
== Getting started
|
41
|
+
|
42
|
+
1a. Setup Apache for the Rails application (see "Example for Apache conf")
|
43
|
+
1b. Run the WEBrick servlet: <tt>ruby public/dispatch.servlet --help</tt>
|
44
|
+
2. Go to http://rails/ (or whatever is your ServerName) and check
|
45
|
+
that you get the "Congratulations, you're on Rails!" screen
|
46
|
+
3. Follow the guidelines on the "Congratulations, you're on Rails!" screen
|
47
|
+
|
48
|
+
|
49
|
+
== Example for Apache conf
|
50
|
+
|
51
|
+
<VirtualHost *:80>
|
52
|
+
ServerName rails
|
53
|
+
DocumentRoot /path/tapplication/public/
|
54
|
+
ErrorLog /path/application/log/apache.log
|
55
|
+
|
56
|
+
<Directory /path/application/public/>
|
57
|
+
Options ExecCGI FollowSymLinks
|
58
|
+
AllowOverride all
|
59
|
+
Allow from all
|
60
|
+
Order allow,deny
|
61
|
+
</Directory>
|
62
|
+
</VirtualHost>
|
63
|
+
|
64
|
+
NOTE: Be sure that CGIs can be executed in that directory as well. So ExecCGI
|
65
|
+
should be on and ".cgi" should respond. All requests from 127.0.0.1 goes
|
66
|
+
through CGI, so no Apache restart is necessary for changes. All other requests
|
67
|
+
goes through FCGI (or mod_ruby) that requires restart to show changes.
|
68
|
+
|
69
|
+
|
70
|
+
== Debugging Rails
|
71
|
+
|
72
|
+
Have "tail -f" commands running on both the apache.log, production.log, and
|
73
|
+
test.log files. Rails will automatically display debugging and runtime
|
74
|
+
information to these files. Debugging info will also be shown in the browser
|
75
|
+
on requests from 127.0.0.1.
|
76
|
+
|
77
|
+
|
78
|
+
== Description of contents
|
79
|
+
|
80
|
+
app
|
81
|
+
Holds all the code that's specific to this particular application.
|
82
|
+
|
83
|
+
app/controllers
|
84
|
+
Holds controllers that should be named like weblog_controller.rb for
|
85
|
+
automated URL mapping. All controllers should descent from
|
86
|
+
ActionController::Base.
|
87
|
+
|
88
|
+
app/models
|
89
|
+
Holds models that should be named like post.rb.
|
90
|
+
Most models will descent from ActiveRecord::Base.
|
91
|
+
|
92
|
+
app/views
|
93
|
+
Holds the template files for the view that should be named like
|
94
|
+
weblog/index.rhtml for the WeblogController#index action. All views uses eRuby
|
95
|
+
syntax. This directory can also be used to keep stylesheets, images, and so on
|
96
|
+
that can be symlinked to public.
|
97
|
+
|
98
|
+
app/helpers
|
99
|
+
Holds view helpers that should be named like weblog_helper.rb.
|
100
|
+
|
101
|
+
config
|
102
|
+
Configuration files for Apache, database, and other dependencies.
|
103
|
+
|
104
|
+
lib
|
105
|
+
Application specific libraries. Basically, any kind of custom code that doesn't
|
106
|
+
belong controllers, models, or helpers. This directory is in the load path.
|
107
|
+
|
108
|
+
public
|
109
|
+
The directory available for Apache, which includes symbolic links to other
|
110
|
+
parts of the structure that are to be made available. Refrain from placing
|
111
|
+
actual files in here if you're using CVS and don't want to check in this
|
112
|
+
directory.
|
113
|
+
|
114
|
+
script
|
115
|
+
Helper scripts for automation and generation.
|
116
|
+
|
117
|
+
test
|
118
|
+
Unit and functional tests along with fixtures.
|
119
|
+
|
120
|
+
vendor
|
121
|
+
External libraries that the application depend on. This directory is in the load path.
|
data/Rakefile
ADDED
@@ -0,0 +1,259 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
require 'rake/gempackagetask'
|
5
|
+
|
6
|
+
require 'date'
|
7
|
+
|
8
|
+
PKG_NAME = "rails"
|
9
|
+
PKG_VERSION = "0.8.0"
|
10
|
+
PKG_DESTINATION = ENV["RAILS_PKG_DESTINATION"] || "../#{PKG_NAME}"
|
11
|
+
|
12
|
+
desc "Default Task"
|
13
|
+
task :default => [ :fresh_rails ]
|
14
|
+
|
15
|
+
desc "Generates a fresh Rails package with documentation"
|
16
|
+
task :fresh_rails => [ :make_dir_structure, :initialize_file_stubs, :copy_vendor_libraries, :copy_ties_content, :generate_documentation ]
|
17
|
+
|
18
|
+
desc "Generates a fresh Rails package using GEMs with documentation"
|
19
|
+
task :fresh_gem_rails => [ :make_dir_structure, :initialize_file_stubs, :copy_ties_content, :copy_gem_environment ]
|
20
|
+
|
21
|
+
desc "Generates a fresh Rails package without documentation (faster)"
|
22
|
+
task :fresh_rails_without_docs => [ :make_dir_structure, :initialize_file_stubs, :copy_vendor_libraries, :copy_ties_content ]
|
23
|
+
|
24
|
+
desc "Packages the fresh Rails package with documentation"
|
25
|
+
task :package => [ :clean, :fresh_rails ] do
|
26
|
+
system %{cd ..; tar -czvf #{PKG_NAME}-#{PKG_VERSION}.tgz #{PKG_NAME}}
|
27
|
+
system %{cd ..; zip -r #{PKG_NAME}-#{PKG_VERSION}.zip #{PKG_NAME}}
|
28
|
+
end
|
29
|
+
|
30
|
+
task :clean do
|
31
|
+
File.rm_rf "#{PKG_DESTINATION}"
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
# Make directory structure ----------------------------------------------------------------
|
36
|
+
|
37
|
+
desc "Make the directory structure for the new Rails application"
|
38
|
+
task :make_dir_structure => [ :make_base_dirs, :make_app_dirs, :make_public_dirs, :make_test_dirs ] do
|
39
|
+
end
|
40
|
+
|
41
|
+
task :make_base_dirs do
|
42
|
+
File.rm_rf PKG_DESTINATION
|
43
|
+
File.mkdir "#{PKG_DESTINATION}"
|
44
|
+
File.mkdir "#{PKG_DESTINATION}/app"
|
45
|
+
File.mkdir "#{PKG_DESTINATION}/config"
|
46
|
+
File.mkdir "#{PKG_DESTINATION}/config/environments"
|
47
|
+
File.mkdir "#{PKG_DESTINATION}/db"
|
48
|
+
File.mkdir "#{PKG_DESTINATION}/doc"
|
49
|
+
File.mkdir "#{PKG_DESTINATION}/log"
|
50
|
+
File.mkdir "#{PKG_DESTINATION}/lib"
|
51
|
+
File.mkdir "#{PKG_DESTINATION}/public"
|
52
|
+
File.mkdir "#{PKG_DESTINATION}/script"
|
53
|
+
File.mkdir "#{PKG_DESTINATION}/test"
|
54
|
+
File.mkdir "#{PKG_DESTINATION}/vendor"
|
55
|
+
end
|
56
|
+
|
57
|
+
task :make_app_dirs do
|
58
|
+
File.mkdir "#{PKG_DESTINATION}/app/models"
|
59
|
+
File.mkdir "#{PKG_DESTINATION}/app/controllers"
|
60
|
+
File.mkdir "#{PKG_DESTINATION}/app/helpers"
|
61
|
+
File.mkdir "#{PKG_DESTINATION}/app/views"
|
62
|
+
File.mkdir "#{PKG_DESTINATION}/app/views/layouts"
|
63
|
+
end
|
64
|
+
|
65
|
+
task :make_public_dirs do
|
66
|
+
File.mkdir "#{PKG_DESTINATION}/public/images"
|
67
|
+
File.mkdir "#{PKG_DESTINATION}/public/javascripts"
|
68
|
+
File.mkdir "#{PKG_DESTINATION}/public/stylesheets"
|
69
|
+
File.mkdir "#{PKG_DESTINATION}/public/_doc"
|
70
|
+
end
|
71
|
+
|
72
|
+
task :make_test_dirs do
|
73
|
+
File.mkdir "#{PKG_DESTINATION}/test/fixtures"
|
74
|
+
File.mkdir "#{PKG_DESTINATION}/test/unit"
|
75
|
+
File.mkdir "#{PKG_DESTINATION}/test/functional"
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
# Initialize file stubs -------------------------------------------------------------------
|
80
|
+
|
81
|
+
desc "Initialize empty file stubs (such as for logging)"
|
82
|
+
task :initialize_file_stubs => [ :initialize_log_files ] do
|
83
|
+
end
|
84
|
+
|
85
|
+
task :initialize_log_files do
|
86
|
+
chmod 0777, "#{PKG_DESTINATION}/log"
|
87
|
+
|
88
|
+
File.touch "#{PKG_DESTINATION}/log/apache.log"
|
89
|
+
File.touch "#{PKG_DESTINATION}/log/production.log"
|
90
|
+
|
91
|
+
chmod 0777, "#{PKG_DESTINATION}/log/apache.log"
|
92
|
+
chmod 0777, "#{PKG_DESTINATION}/log/production.log"
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
# Copy Vendors ----------------------------------------------------------------------------
|
97
|
+
|
98
|
+
desc "Copy in all the Rails packages to vendor"
|
99
|
+
task :copy_vendor_libraries => [ :copy_action_pack, :copy_active_record, :copy_ties, :copy_action_mailer ]
|
100
|
+
|
101
|
+
task :copy_action_pack do
|
102
|
+
File.cp_r "../actionpack", "#{PKG_DESTINATION}/vendor/actionpack"
|
103
|
+
end
|
104
|
+
|
105
|
+
task :copy_active_record do
|
106
|
+
File.cp_r "../activerecord", "#{PKG_DESTINATION}/vendor/activerecord"
|
107
|
+
end
|
108
|
+
|
109
|
+
task :copy_action_mailer do
|
110
|
+
File.cp_r "../actionmailer", "#{PKG_DESTINATION}/vendor/actionmailer"
|
111
|
+
end
|
112
|
+
|
113
|
+
task :copy_ties do
|
114
|
+
File.cp_r "../railties", "#{PKG_DESTINATION}/vendor/railties"
|
115
|
+
end
|
116
|
+
|
117
|
+
|
118
|
+
# Copy Ties Content -----------------------------------------------------------------------
|
119
|
+
|
120
|
+
# :link_apache_config
|
121
|
+
desc "Make copies of all the default content of ties"
|
122
|
+
task :copy_ties_content => [
|
123
|
+
:copy_rootfiles, :copy_dispatches, :copy_html_files, :copy_abstract_application,
|
124
|
+
:copy_configs, :copy_generators, :copy_test_helpers, :copy_docs_in_public,
|
125
|
+
:copy_app_doc_readme ] do
|
126
|
+
end
|
127
|
+
|
128
|
+
task :copy_dispatches do
|
129
|
+
File.cp "dispatches/dispatch.rb", "#{PKG_DESTINATION}/public/dispatch.rb"
|
130
|
+
chmod 0755, "#{PKG_DESTINATION}/public/dispatch.rb"
|
131
|
+
|
132
|
+
File.cp "dispatches/dispatch.rb", "#{PKG_DESTINATION}/public/dispatch.cgi"
|
133
|
+
chmod 0755, "#{PKG_DESTINATION}/public/dispatch.cgi"
|
134
|
+
|
135
|
+
File.cp "dispatches/dispatch.fcgi", "#{PKG_DESTINATION}/public/dispatch.fcgi"
|
136
|
+
chmod 0755, "#{PKG_DESTINATION}/public/dispatch.fcgi"
|
137
|
+
|
138
|
+
File.cp "dispatches/dispatch.servlet", "#{PKG_DESTINATION}/public/dispatch.servlet"
|
139
|
+
end
|
140
|
+
|
141
|
+
task :copy_html_files do
|
142
|
+
File.cp "html/404.html", "#{PKG_DESTINATION}/public/404.html"
|
143
|
+
File.cp "html/500.html", "#{PKG_DESTINATION}/public/500.html"
|
144
|
+
File.cp "html/index.html", "#{PKG_DESTINATION}/public/index.html"
|
145
|
+
end
|
146
|
+
|
147
|
+
task :copy_abstract_application do
|
148
|
+
File.cp "helpers/abstract_application.rb", "#{PKG_DESTINATION}/app/controllers/abstract_application.rb"
|
149
|
+
File.cp "helpers/application_helper.rb", "#{PKG_DESTINATION}/app/helpers/application_helper.rb"
|
150
|
+
end
|
151
|
+
|
152
|
+
task :copy_configs do
|
153
|
+
File.cp "configs/database.yml", "#{PKG_DESTINATION}/config/database.yml"
|
154
|
+
|
155
|
+
File.cp "configs/apache.conf", "#{PKG_DESTINATION}/public/.htaccess"
|
156
|
+
|
157
|
+
File.cp "environments/shared.rb", "#{PKG_DESTINATION}/config/environments/shared.rb"
|
158
|
+
File.cp "environments/production.rb", "#{PKG_DESTINATION}/config/environments/production.rb"
|
159
|
+
File.cp "environments/test.rb", "#{PKG_DESTINATION}/config/environments/test.rb"
|
160
|
+
end
|
161
|
+
|
162
|
+
task :copy_generators do
|
163
|
+
File.cp "generators/new_controller.rb", "#{PKG_DESTINATION}/script/new_controller"
|
164
|
+
File.cp "generators/new_model.rb", "#{PKG_DESTINATION}/script/new_model"
|
165
|
+
File.cp "generators/new_mailer.rb", "#{PKG_DESTINATION}/script/new_mailer"
|
166
|
+
chmod 0755, "#{PKG_DESTINATION}/script/new_controller"
|
167
|
+
chmod 0755, "#{PKG_DESTINATION}/script/new_model"
|
168
|
+
chmod 0755, "#{PKG_DESTINATION}/script/new_mailer"
|
169
|
+
end
|
170
|
+
|
171
|
+
task :copy_rootfiles do
|
172
|
+
File.cp "fresh_rakefile", "#{PKG_DESTINATION}/Rakefile"
|
173
|
+
File.cp "README", "#{PKG_DESTINATION}/README"
|
174
|
+
end
|
175
|
+
|
176
|
+
task :copy_test_helpers do
|
177
|
+
File.cp "helpers/test_helper.rb", "#{PKG_DESTINATION}/test/test_helper.rb"
|
178
|
+
end
|
179
|
+
|
180
|
+
task :copy_docs_in_public do
|
181
|
+
File.cp "doc/index.html", "#{PKG_DESTINATION}/public/_doc/index.html"
|
182
|
+
end
|
183
|
+
|
184
|
+
task :copy_app_doc_readme do
|
185
|
+
File.cp "doc/README_FOR_APP", "#{PKG_DESTINATION}/doc/README_FOR_APP"
|
186
|
+
end
|
187
|
+
|
188
|
+
task :link_apache_config do
|
189
|
+
cd "#{PKG_DESTINATION}/config/"
|
190
|
+
ln_s "../public/.htaccess", "apache.conf"
|
191
|
+
cd "../../railties"
|
192
|
+
end
|
193
|
+
|
194
|
+
|
195
|
+
# Generate documentation ------------------------------------------------------------------
|
196
|
+
|
197
|
+
desc "Generate documentation for the framework and for the empty application"
|
198
|
+
task :generate_documentation => [ :generate_app_doc, :generate_rails_framework_doc ] do
|
199
|
+
end
|
200
|
+
|
201
|
+
task :generate_rails_framework_doc do
|
202
|
+
system %{cd #{PKG_DESTINATION}; rake apidoc}
|
203
|
+
end
|
204
|
+
|
205
|
+
task :generate_app_doc do
|
206
|
+
File.cp "doc/README_FOR_APP", "#{PKG_DESTINATION}/doc/README_FOR_APP"
|
207
|
+
system %{cd #{PKG_DESTINATION}; rake appdoc}
|
208
|
+
end
|
209
|
+
|
210
|
+
|
211
|
+
# Generate GEM ----------------------------------------------------------------------------
|
212
|
+
|
213
|
+
task :copy_gem_environment do
|
214
|
+
File.cp "environments/shared_for_gem.rb", "#{PKG_DESTINATION}/config/environments/shared.rb"
|
215
|
+
end
|
216
|
+
|
217
|
+
|
218
|
+
PKG_FILES = FileList[
|
219
|
+
'[a-zA-Z]*',
|
220
|
+
'bin/**/*',
|
221
|
+
'configs/**/*',
|
222
|
+
'doc/**/*',
|
223
|
+
'dispatches/**/*',
|
224
|
+
'environments/**/*',
|
225
|
+
'generators/**/*',
|
226
|
+
'helpers/**/*',
|
227
|
+
'html/**/*',
|
228
|
+
'lib/**/*'
|
229
|
+
]
|
230
|
+
|
231
|
+
spec = Gem::Specification.new do |s|
|
232
|
+
s.name = 'rails'
|
233
|
+
s.version = PKG_VERSION
|
234
|
+
s.summary = "Web-application framework with template engine, control-flow layer, and ORM."
|
235
|
+
s.description = <<-EOF
|
236
|
+
Rails is a framework for building web-application using CGI, FCGI, mod_ruby, or WEBrick
|
237
|
+
on top of either MySQL, PostgreSQL, or SQLite with eRuby-based templates.
|
238
|
+
EOF
|
239
|
+
|
240
|
+
s.add_dependency('rake', '>= 0.4.4')
|
241
|
+
s.add_dependency('activerecord', '>= 1.0.0')
|
242
|
+
s.add_dependency('actionpack', '>= 0.9.0')
|
243
|
+
s.add_dependency('actionmailer', '>= 0.3.0')
|
244
|
+
|
245
|
+
s.files = PKG_FILES.to_a
|
246
|
+
s.require_path = 'lib'
|
247
|
+
|
248
|
+
s.bindir = "bin" # Use these for applications.
|
249
|
+
s.executables = ["rails"]
|
250
|
+
s.default_executable = "rails"
|
251
|
+
|
252
|
+
s.author = "David Heinemeier Hansson"
|
253
|
+
s.email = "david@loudthinking.com"
|
254
|
+
s.homepage = "http://www.rubyonrails.org"
|
255
|
+
s.rubyforge_project = "rails"
|
256
|
+
end
|
257
|
+
|
258
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
259
|
+
end
|