rails 0.9.5 → 0.10.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 +46 -0
- data/README +36 -8
- data/Rakefile +18 -25
- data/bin/console +17 -30
- data/bin/console_sandbox.rb +6 -0
- data/bin/destroy +5 -0
- data/bin/generate +2 -70
- data/bin/rails +4 -28
- data/bin/server +4 -2
- data/bin/update +5 -0
- data/configs/apache.conf +7 -54
- data/configs/empty.log +0 -0
- data/configs/routes.rb +15 -0
- data/environments/shared.rb +14 -6
- data/environments/shared_for_gem.rb +12 -6
- data/fresh_rakefile +40 -8
- data/html/index.html +70 -1
- data/lib/breakpoint.rb +6 -1
- data/lib/breakpoint_client.rb +196 -193
- data/lib/dispatcher.rb +16 -38
- data/lib/rails_generator.rb +39 -198
- data/lib/rails_generator/base.rb +203 -0
- data/lib/rails_generator/commands.rb +409 -0
- data/lib/rails_generator/generators/applications/app/USAGE +16 -0
- data/lib/rails_generator/generators/applications/app/app_generator.rb +120 -0
- data/lib/rails_generator/generators/components/controller/USAGE +30 -0
- data/lib/rails_generator/generators/components/controller/controller_generator.rb +37 -0
- data/{generators → lib/rails_generator/generators/components}/controller/templates/controller.rb +1 -1
- data/lib/rails_generator/generators/components/controller/templates/functional_test.rb +18 -0
- data/{generators → lib/rails_generator/generators/components}/controller/templates/helper.rb +0 -0
- data/{generators → lib/rails_generator/generators/components}/controller/templates/view.rhtml +0 -0
- data/lib/rails_generator/generators/components/mailer/USAGE +19 -0
- data/lib/rails_generator/generators/components/mailer/mailer_generator.rb +32 -0
- data/{generators → lib/rails_generator/generators/components}/mailer/templates/fixture.rhtml +0 -0
- data/{generators → lib/rails_generator/generators/components}/mailer/templates/mailer.rb +0 -0
- data/{generators → lib/rails_generator/generators/components}/mailer/templates/unit_test.rb +7 -1
- data/{generators → lib/rails_generator/generators/components}/mailer/templates/view.rhtml +0 -0
- data/lib/rails_generator/generators/components/model/USAGE +17 -0
- data/lib/rails_generator/generators/components/model/model_generator.rb +18 -0
- data/{generators/scaffold → lib/rails_generator/generators/components/model}/templates/fixtures.yml +0 -2
- data/{generators → lib/rails_generator/generators/components}/model/templates/model.rb +0 -0
- data/{generators → lib/rails_generator/generators/components}/model/templates/unit_test.rb +5 -1
- data/lib/rails_generator/generators/components/scaffold/USAGE +32 -0
- data/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +178 -0
- data/{generators → lib/rails_generator/generators/components}/scaffold/templates/controller.rb +1 -1
- data/lib/rails_generator/generators/components/scaffold/templates/form.rhtml +5 -0
- data/{generators → lib/rails_generator/generators/components}/scaffold/templates/functional_test.rb +7 -6
- data/lib/rails_generator/generators/components/scaffold/templates/helper.rb +2 -0
- data/{generators → lib/rails_generator/generators/components}/scaffold/templates/layout.rhtml +1 -1
- data/{generators → lib/rails_generator/generators/components}/scaffold/templates/style.css +17 -17
- data/{generators → lib/rails_generator/generators/components}/scaffold/templates/view_edit.rhtml +1 -1
- data/{generators → lib/rails_generator/generators/components}/scaffold/templates/view_list.rhtml +1 -1
- data/{generators → lib/rails_generator/generators/components}/scaffold/templates/view_new.rhtml +1 -1
- data/{generators → lib/rails_generator/generators/components}/scaffold/templates/view_show.rhtml +0 -0
- data/lib/rails_generator/lookup.rb +200 -0
- data/lib/rails_generator/manifest.rb +53 -0
- data/lib/rails_generator/options.rb +134 -0
- data/lib/rails_generator/scripts.rb +83 -0
- data/lib/rails_generator/scripts/destroy.rb +7 -0
- data/lib/rails_generator/scripts/generate.rb +7 -0
- data/lib/rails_generator/scripts/update.rb +12 -0
- data/lib/rails_generator/simple_logger.rb +46 -0
- data/lib/rails_generator/spec.rb +44 -0
- data/lib/webrick_server.rb +15 -65
- metadata +92 -48
- data/doc/apache_protection +0 -3
- data/doc/index.html +0 -70
- data/generators/controller/USAGE +0 -28
- data/generators/controller/controller_generator.rb +0 -26
- data/generators/controller/templates/functional_test.rb +0 -17
- data/generators/mailer/USAGE +0 -27
- data/generators/mailer/mailer_generator.rb +0 -22
- data/generators/model/USAGE +0 -17
- data/generators/model/model_generator.rb +0 -10
- data/generators/model/templates/fixtures.yml +0 -1
- data/generators/scaffold/USAGE +0 -27
- data/generators/scaffold/scaffold_generator.rb +0 -60
data/CHANGELOG
CHANGED
@@ -1,3 +1,49 @@
|
|
1
|
+
*0.10.0* (24th February, 2005)
|
2
|
+
|
3
|
+
* 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]
|
4
|
+
|
5
|
+
* Fixed that script/server -d was broken so daemon mode couldn't be used #687 [Nicholas Seckar]
|
6
|
+
|
7
|
+
* Upgraded to breakpoint 92 which fixes:
|
8
|
+
|
9
|
+
* overload IRB.parse_opts(), fixes #443
|
10
|
+
=> breakpoints in tests work even when running them via rake
|
11
|
+
* untaint handlers, might fix an issue discussed on the Rails ML
|
12
|
+
* added verbose mode to breakpoint_client
|
13
|
+
* less noise caused by breakpoint_client by default
|
14
|
+
* ignored TerminateLineInput exception in signal handler
|
15
|
+
=> quiet exit on Ctrl-C
|
16
|
+
|
17
|
+
* Added support for independent components residing in /components. Example:
|
18
|
+
|
19
|
+
Controller: components/list/items_controller.rb
|
20
|
+
(holds a List::ItemsController class with uses_component_template_root called)
|
21
|
+
|
22
|
+
Model : components/list/item.rb
|
23
|
+
(namespace is still shared, so an Item model in app/models will take precedence)
|
24
|
+
|
25
|
+
Views : components/list/items/show.rhtml
|
26
|
+
|
27
|
+
|
28
|
+
* Added --sandbox option to script/console that'll roll back all changes made to the database when you quit #672 [bitsweat]
|
29
|
+
|
30
|
+
* Added 'recent' as a rake target that'll run tests for files that changed in the last 10 minutes #612 [bitsweat]
|
31
|
+
|
32
|
+
* Changed script/console to default to development environment and drop --no-inspect #650 [bitsweat]
|
33
|
+
|
34
|
+
* Added that the 'fixture :posts' syntax can be used for has_and_belongs_to_many fixtures where a model doesn't exist #572 [bitsweat]
|
35
|
+
|
36
|
+
* Added that running test_units and test_functional now performs the clone_structure_to_test as well #566 [rasputnik]
|
37
|
+
|
38
|
+
* 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]
|
39
|
+
|
40
|
+
* Added Action Web Service as a new add-on framework for Action Pack [Leon Bredt]
|
41
|
+
|
42
|
+
* Added Active Support as an independent utility and standard library extension bundle
|
43
|
+
|
44
|
+
* Upgraded to Active Record 1.7.0, Action Pack 1.5.0, Action Mailer 0.7.0
|
45
|
+
|
46
|
+
|
1
47
|
*0.9.5* (January 25th, 2005)
|
2
48
|
|
3
49
|
* 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.
|
data/README
CHANGED
@@ -32,7 +32,7 @@ link:files/vendor/actionpack/README.html.
|
|
32
32
|
|
33
33
|
== Optionals
|
34
34
|
|
35
|
-
* Apache 1.3.x or 2.x (or any FastCGI-capable webserver with a
|
35
|
+
* Apache 1.3.x or 2.x or lighttpd 1.3.11+ (or any FastCGI-capable webserver with a
|
36
36
|
mod_rewrite-like module)
|
37
37
|
* FastCGI (or mod_ruby) for better performance on Apache
|
38
38
|
|
@@ -49,7 +49,7 @@ link:files/vendor/actionpack/README.html.
|
|
49
49
|
<VirtualHost *:80>
|
50
50
|
ServerName rails
|
51
51
|
DocumentRoot /path/application/public/
|
52
|
-
ErrorLog /path/application/log/
|
52
|
+
ErrorLog /path/application/log/server.log
|
53
53
|
|
54
54
|
<Directory /path/application/public/>
|
55
55
|
Options ExecCGI FollowSymLinks
|
@@ -65,9 +65,36 @@ through CGI, so no Apache restart is necessary for changes. All other requests
|
|
65
65
|
goes through FCGI (or mod_ruby) that requires restart to show changes.
|
66
66
|
|
67
67
|
|
68
|
+
== Example for lighttpd conf (with FastCGI)
|
69
|
+
|
70
|
+
server.port = 8080
|
71
|
+
server.bind = "127.0.0.1"
|
72
|
+
# server.event-handler = "freebsd-kqueue" # needed on OS X
|
73
|
+
|
74
|
+
server.modules = ( "mod_rewrite", "mod_fastcgi" )
|
75
|
+
|
76
|
+
url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" )
|
77
|
+
server.error-handler-404 = "/dispatch.fcgi"
|
78
|
+
|
79
|
+
server.document-root = "/path/application/public"
|
80
|
+
server.errorlog = "/path/application/log/server.log"
|
81
|
+
|
82
|
+
fastcgi.server = ( ".fcgi" =>
|
83
|
+
( "localhost" =>
|
84
|
+
(
|
85
|
+
"min-procs" => 1,
|
86
|
+
"max-procs" => 5,
|
87
|
+
"socket" => "/tmp/application.fcgi.socket",
|
88
|
+
"bin-path" => "/path/application/public/dispatch.fcgi",
|
89
|
+
"bin-environment" => ( "RAILS_ENV" => "development" )
|
90
|
+
)
|
91
|
+
)
|
92
|
+
)
|
93
|
+
|
94
|
+
|
68
95
|
== Debugging Rails
|
69
96
|
|
70
|
-
Have "tail -f" commands running on both the
|
97
|
+
Have "tail -f" commands running on both the server.log, production.log, and
|
71
98
|
test.log files. Rails will automatically display debugging and runtime
|
72
99
|
information to these files. Debugging info will also be shown in the browser
|
73
100
|
on requests from 127.0.0.1.
|
@@ -139,17 +166,18 @@ app/helpers
|
|
139
166
|
Holds view helpers that should be named like weblog_helper.rb.
|
140
167
|
|
141
168
|
config
|
142
|
-
Configuration files for
|
169
|
+
Configuration files for the Rails environment, the routing map, the database, and other dependencies.
|
170
|
+
|
171
|
+
components
|
172
|
+
Self-contained mini-applications that can bundle controllers, models, and views together.
|
143
173
|
|
144
174
|
lib
|
145
175
|
Application specific libraries. Basically, any kind of custom code that doesn't
|
146
176
|
belong controllers, models, or helpers. This directory is in the load path.
|
147
177
|
|
148
178
|
public
|
149
|
-
The directory available for
|
150
|
-
|
151
|
-
actual files in here if you're using CVS and don't want to check in this
|
152
|
-
directory.
|
179
|
+
The directory available for the web server. Contains sub-directories for images, stylesheets,
|
180
|
+
and javascripts. Also contains the dispatchers and the default HTML files.
|
153
181
|
|
154
182
|
script
|
155
183
|
Helper scripts for automation and generation.
|
data/Rakefile
CHANGED
@@ -9,22 +9,21 @@ require 'rbconfig'
|
|
9
9
|
|
10
10
|
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
|
11
11
|
PKG_NAME = 'rails'
|
12
|
-
PKG_VERSION = '0.
|
12
|
+
PKG_VERSION = '0.10.0' + PKG_BUILD
|
13
13
|
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
14
14
|
PKG_DESTINATION = ENV["RAILS_PKG_DESTINATION"] || "../#{PKG_NAME}"
|
15
15
|
|
16
16
|
|
17
|
-
BASE_DIRS = %w( app config/environments db doc log lib public script test vendor )
|
18
|
-
APP_DIRS = %w( models controllers helpers views views/layouts )
|
19
|
-
PUBLIC_DIRS = %w( images javascripts stylesheets
|
17
|
+
BASE_DIRS = %w( app config/environments components db doc log lib public script test vendor )
|
18
|
+
APP_DIRS = %w( apis models controllers helpers views views/layouts )
|
19
|
+
PUBLIC_DIRS = %w( images javascripts stylesheets )
|
20
20
|
TEST_DIRS = %w( fixtures unit functional mocks mocks/development mocks/testing )
|
21
21
|
|
22
|
-
LOG_FILES = %w(
|
22
|
+
LOG_FILES = %w( server.log development.log test.log production.log )
|
23
23
|
HTML_FILES = %w( 404.html 500.html index.html )
|
24
|
-
BIN_FILES = %w( generate breakpointer console server )
|
25
|
-
GENERATORS = %w( controller mailer model scaffold )
|
24
|
+
BIN_FILES = %w( generate destroy breakpointer console server update )
|
26
25
|
|
27
|
-
VENDOR_LIBS = %w( actionpack activerecord actionmailer railties )
|
26
|
+
VENDOR_LIBS = %w( actionpack activerecord actionmailer activesupport actionwebservice railties )
|
28
27
|
|
29
28
|
|
30
29
|
desc "Default Task"
|
@@ -42,6 +41,9 @@ task :fresh_rails_without_docs => [ :clean, :make_dir_structure, :initialize_fil
|
|
42
41
|
desc "Generates a fresh Rails package without documentation (faster)"
|
43
42
|
task :fresh_rails_without_docs_using_links => [ :clean, :make_dir_structure, :initialize_file_stubs, :link_vendor_libraries, :copy_ties_content ]
|
44
43
|
|
44
|
+
desc "Generates minimal Rails package using symlinks"
|
45
|
+
task :dev => [ :clean, :make_dir_structure, :initialize_file_stubs, :link_vendor_libraries, :copy_ties_content ]
|
46
|
+
|
45
47
|
desc "Packages the fresh Rails package with documentation"
|
46
48
|
task :package => [ :clean, :fresh_rails ] do
|
47
49
|
system %{cd ..; tar -czvf #{PKG_NAME}-#{PKG_VERSION}.tgz #{PKG_NAME}}
|
@@ -107,8 +109,7 @@ end
|
|
107
109
|
desc "Make copies of all the default content of ties"
|
108
110
|
task :copy_ties_content => [
|
109
111
|
:copy_rootfiles, :copy_dispatches, :copy_html_files, :copy_application,
|
110
|
-
:copy_configs, :copy_binfiles, :copy_test_helpers, :
|
111
|
-
:copy_app_doc_readme ]
|
112
|
+
:copy_configs, :copy_binfiles, :copy_test_helpers, :copy_app_doc_readme ]
|
112
113
|
|
113
114
|
task :copy_dispatches do
|
114
115
|
copy_with_rewritten_ruby_path("dispatches/dispatch.rb", "#{PKG_DESTINATION}/public/dispatch.rb")
|
@@ -133,6 +134,7 @@ end
|
|
133
134
|
|
134
135
|
task :copy_configs do
|
135
136
|
cp "configs/database.yml", "#{PKG_DESTINATION}/config/database.yml"
|
137
|
+
cp "configs/routes.rb", "#{PKG_DESTINATION}/config/routes.rb"
|
136
138
|
|
137
139
|
cp "configs/apache.conf", "#{PKG_DESTINATION}/public/.htaccess"
|
138
140
|
|
@@ -142,14 +144,6 @@ task :copy_configs do
|
|
142
144
|
cp "environments/test.rb", "#{PKG_DESTINATION}/config/environments/test.rb"
|
143
145
|
end
|
144
146
|
|
145
|
-
task :copy_generators do
|
146
|
-
mkdir_p File.join(PKG_DESTINATION, 'script/generators')
|
147
|
-
|
148
|
-
GENERATORS.each do |dir|
|
149
|
-
cp_r File.join('generators', dir), File.join(PKG_DESTINATION, 'script', 'generators', dir)
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
147
|
task :copy_binfiles do
|
154
148
|
BIN_FILES.each do |file|
|
155
149
|
dest_file = File.join(PKG_DESTINATION, 'script', file)
|
@@ -168,10 +162,6 @@ task :copy_test_helpers do
|
|
168
162
|
cp "helpers/test_helper.rb", "#{PKG_DESTINATION}/test/test_helper.rb"
|
169
163
|
end
|
170
164
|
|
171
|
-
task :copy_docs_in_public do
|
172
|
-
cp "doc/index.html", "#{PKG_DESTINATION}/public/_doc/index.html"
|
173
|
-
end
|
174
|
-
|
175
165
|
task :copy_app_doc_readme do
|
176
166
|
cp "doc/README_FOR_APP", "#{PKG_DESTINATION}/doc/README_FOR_APP"
|
177
167
|
end
|
@@ -247,10 +237,13 @@ spec = Gem::Specification.new do |s|
|
|
247
237
|
EOF
|
248
238
|
|
249
239
|
s.add_dependency('rake', '>= 0.4.15')
|
250
|
-
s.add_dependency('
|
251
|
-
s.add_dependency('
|
252
|
-
s.add_dependency('
|
240
|
+
s.add_dependency('activesupport', '= 1.0.0' + PKG_BUILD)
|
241
|
+
s.add_dependency('activerecord', '= 1.7.0' + PKG_BUILD)
|
242
|
+
s.add_dependency('actionpack', '= 1.5.0' + PKG_BUILD)
|
243
|
+
s.add_dependency('actionmailer', '= 0.7.0' + PKG_BUILD)
|
244
|
+
s.add_dependency('actionwebservice', '= 0.5.0' + PKG_BUILD)
|
253
245
|
|
246
|
+
s.rdoc_options << '--exclude' << '.'
|
254
247
|
s.has_rdoc = false
|
255
248
|
|
256
249
|
s.files = PKG_FILES.to_a.delete_if {|f| f.include?('.svn')}
|
data/bin/console
CHANGED
@@ -1,35 +1,22 @@
|
|
1
1
|
#!/usr/local/bin/ruby
|
2
|
+
irb = RUBY_PLATFORM =~ /mswin32/ ? 'irb.bat' : 'irb'
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
irb_name = 'irb'
|
10
|
-
end
|
11
|
-
exec "#{irb_name} -r config/environment.rb -r irb/completion --noinspect"
|
12
|
-
else
|
13
|
-
puts <<-HELP
|
14
|
-
|
15
|
-
NAME
|
16
|
-
console - interact with the domain model through a environment console (on IRB)
|
4
|
+
require 'optparse'
|
5
|
+
options = {}
|
6
|
+
OptionParser.new do |opt|
|
7
|
+
opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |options[:sandbox]| }
|
8
|
+
opt.parse!(ARGV)
|
9
|
+
end
|
17
10
|
|
18
|
-
|
19
|
-
|
11
|
+
libs = " -r #{File.dirname(__FILE__)}/../config/environment"
|
12
|
+
libs << " -r #{File.dirname(__FILE__)}/console_sandbox" if options[:sandbox]
|
13
|
+
libs << " -r irb/completion"
|
20
14
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
EXAMPLE
|
29
|
-
console production
|
30
|
-
|
31
|
-
This will initialize the production environment (as setup in config/database.yml
|
32
|
-
and config/environments/production.rb). You would now be ready to start requiring
|
33
|
-
models using require_dependency.
|
34
|
-
HELP
|
15
|
+
ENV['RAILS_ENV'] = ARGV.first || 'development'
|
16
|
+
if options[:sandbox]
|
17
|
+
puts "Loading #{ENV['RAILS_ENV']} environment in sandbox."
|
18
|
+
puts "Any modifications you make will be rolled back on exit."
|
19
|
+
else
|
20
|
+
puts "Loading #{ENV['RAILS_ENV']} environment."
|
35
21
|
end
|
22
|
+
exec "#{irb} #{libs}"
|
data/bin/destroy
ADDED
data/bin/generate
CHANGED
@@ -1,73 +1,5 @@
|
|
1
1
|
#!/usr/local/bin/ruby
|
2
2
|
require File.dirname(__FILE__) + '/../config/environment'
|
3
3
|
require 'rails_generator'
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
def find_synonyms(word)
|
8
|
-
require 'open-uri'
|
9
|
-
require 'timeout'
|
10
|
-
|
11
|
-
uri = "http://wordnet.princeton.edu/cgi-bin/webwn2.0?stage=2" +
|
12
|
-
"&word=%s&posnumber=1&searchtypenumber=2&senses=&showglosses=1"
|
13
|
-
|
14
|
-
timeout(5) do
|
15
|
-
open(uri % word) do |stream|
|
16
|
-
data = stream.read.gsub(" ", " ").gsub("<BR>", "")
|
17
|
-
data.scan(/^Sense \d+\n.+?\n\n/m)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
rescue Timeout::Error, Exception
|
21
|
-
return nil
|
22
|
-
end
|
23
|
-
|
24
|
-
unless ARGV.empty?
|
25
|
-
begin
|
26
|
-
name = ARGV.shift
|
27
|
-
generator = Rails::Generator.instance(name, ARGV)
|
28
|
-
|
29
|
-
if msg = generator.collision_with_builtin? then
|
30
|
-
$stderr.puts msg
|
31
|
-
|
32
|
-
if synonyms = find_synonyms(generator.class_name) then
|
33
|
-
$stderr.puts(
|
34
|
-
"", "Here are a few synonyms from WordNet. Maybe they will help you find an alternative name.",
|
35
|
-
"", synonyms
|
36
|
-
)
|
37
|
-
end
|
38
|
-
else
|
39
|
-
generator.generate
|
40
|
-
end
|
41
|
-
rescue Rails::Generator::UsageError => e
|
42
|
-
puts e.message
|
43
|
-
end
|
44
|
-
else
|
45
|
-
builtin_generators = Rails::Generator.builtin_generators.join(', ')
|
46
|
-
contrib_generators = Rails::Generator.contrib_generators.join(', ')
|
47
|
-
|
48
|
-
$stderr.puts <<end_usage
|
49
|
-
#{$0} generator [args]
|
50
|
-
|
51
|
-
Rails comes with #{builtin_generators} generators.
|
52
|
-
#{$0} controller Login login logout
|
53
|
-
#{$0} model Account
|
54
|
-
#{$0} mailer AccountMailer
|
55
|
-
#{$0} scaffold Account action another_action
|
56
|
-
|
57
|
-
end_usage
|
58
|
-
|
59
|
-
unless contrib_generators.empty?
|
60
|
-
$stderr.puts " Installed generators (in #{RAILS_ROOT}/script/generators):"
|
61
|
-
$stderr.puts " #{contrib_generators}"
|
62
|
-
$stderr.puts
|
63
|
-
end
|
64
|
-
|
65
|
-
$stderr.puts <<end_usage
|
66
|
-
More generators are available at http://rubyonrails.org/show/Generators
|
67
|
-
1. Download, for example, login_generator.tar.gz
|
68
|
-
2. Unzip to directory #{RAILS_ROOT}/script/generators/login
|
69
|
-
3. Generate without args for usage information
|
70
|
-
#{$0} login
|
71
|
-
end_usage
|
72
|
-
exit 0
|
73
|
-
end
|
4
|
+
require 'rails_generator/scripts/generate'
|
5
|
+
Rails::Generator::Scripts::Generate.new.run(ARGV)
|
data/bin/rails
CHANGED
@@ -1,28 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
system %{rake.cmd fresh_gem_rails}
|
6
|
-
else
|
7
|
-
system %{ cd #{File.dirname(__FILE__)}; rake fresh_gem_rails }
|
8
|
-
end
|
9
|
-
else
|
10
|
-
puts <<-HELP
|
11
|
-
|
12
|
-
NAME
|
13
|
-
rails - creates a new Rails installation
|
14
|
-
|
15
|
-
SYNOPSIS
|
16
|
-
rails [full path]
|
17
|
-
|
18
|
-
DESCRIPTION
|
19
|
-
This generator will create a suggested directory structure, lots of minor helper
|
20
|
-
files, and a default configuration for creating a new Rails application. Once the
|
21
|
-
generator is done, you're advised to look at the README in the root of the folder.
|
22
|
-
|
23
|
-
EXAMPLE
|
24
|
-
rails ~/Code/Ruby/weblog
|
25
|
-
|
26
|
-
This will generate a new Rails installation in the ~/Code/Ruby/weblog folder.
|
27
|
-
HELP
|
28
|
-
end
|
1
|
+
require File.dirname(__FILE__) + '/../lib/rails_generator'
|
2
|
+
require 'rails_generator/scripts/generate'
|
3
|
+
Rails::Generator::Base.use_application_sources!
|
4
|
+
Rails::Generator::Scripts::Generate.new.run(ARGV, :generator => 'app')
|
data/bin/server
CHANGED
@@ -5,7 +5,7 @@ require 'optparse'
|
|
5
5
|
|
6
6
|
OPTIONS = {
|
7
7
|
:port => 3000,
|
8
|
-
:ip => "
|
8
|
+
:ip => "0.0.0.0",
|
9
9
|
:environment => "development",
|
10
10
|
:server_root => File.expand_path(File.dirname(__FILE__) + "/../public/"),
|
11
11
|
:server_type => WEBrick::SimpleServer
|
@@ -45,5 +45,7 @@ ENV["RAILS_ENV"] = OPTIONS[:environment]
|
|
45
45
|
require File.dirname(__FILE__) + "/../config/environment"
|
46
46
|
require 'webrick_server'
|
47
47
|
|
48
|
+
OPTIONS['working_directory'] = File.expand_path(RAILS_ROOT)
|
49
|
+
|
48
50
|
puts "=> Rails application started on http://#{OPTIONS[:ip]}:#{OPTIONS[:port]}"
|
49
|
-
DispatchServlet.dispatch(OPTIONS)
|
51
|
+
DispatchServlet.dispatch(OPTIONS)
|
data/bin/update
ADDED
data/configs/apache.conf
CHANGED
@@ -3,59 +3,12 @@ AddHandler fastcgi-script .fcgi
|
|
3
3
|
AddHandler cgi-script .cgi
|
4
4
|
Options +FollowSymLinks +ExecCGI
|
5
5
|
|
6
|
-
#
|
6
|
+
# Redirect all requests not available on the filesystem to Rails
|
7
7
|
RewriteEngine On
|
8
|
+
RewriteRule ^$ index.html [QSA]
|
9
|
+
RewriteRule ^([^.]+)$ $1.html [QSA]
|
10
|
+
RewriteCond %{REQUEST_FILENAME} !-f
|
11
|
+
RewriteRule ^(.*)$ /dispatch.cgi?$1 [QSA,L]
|
8
12
|
|
9
|
-
#
|
10
|
-
|
11
|
-
|
12
|
-
# Enable this rewrite rule to point to the controller/action that should serve root.
|
13
|
-
# RewriteRule ^$ /controller/action [R]
|
14
|
-
|
15
|
-
# <caching>
|
16
|
-
# no query string?
|
17
|
-
RewriteCond %{QUERY_STRING} ^$
|
18
|
-
|
19
|
-
# no POST method?
|
20
|
-
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
|
21
|
-
|
22
|
-
# Request filename is a directory?
|
23
|
-
RewriteCond %{REQUEST_FILENAME} -d
|
24
|
-
|
25
|
-
# Request filename + '/index' is a file?
|
26
|
-
RewriteCond %{REQUEST_FILENAME}/index -f
|
27
|
-
|
28
|
-
# Rewrite to request filename + '/index' and finish
|
29
|
-
RewriteRule ^(.*)/?$ $1/index [QSA,L]
|
30
|
-
|
31
|
-
# no query string?
|
32
|
-
RewriteCond %{QUERY_STRING} ^$
|
33
|
-
|
34
|
-
# no POST method?
|
35
|
-
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
|
36
|
-
|
37
|
-
# Request filename is a file?
|
38
|
-
RewriteCond %{REQUEST_FILENAME} -f
|
39
|
-
|
40
|
-
# Finish rewriting
|
41
|
-
RewriteRule .* - [L]
|
42
|
-
|
43
|
-
# Set default type of cached files to text/html
|
44
|
-
DefaultType text/html
|
45
|
-
# </caching>
|
46
|
-
|
47
|
-
# Add missing slash
|
48
|
-
RewriteRule ^([-_a-zA-Z0-9]+)$ /$1/ [R]
|
49
|
-
|
50
|
-
# Default rewriting rules.
|
51
|
-
RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/([0-9]+)$ ?controller=$1&action=$2&id=$3 [QSA,L]
|
52
|
-
RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)$ ?controller=$1&action=$2 [QSA,L]
|
53
|
-
RewriteRule ^([-_a-zA-Z0-9]+)/$ ?controller=$1&action=index [QSA,L]
|
54
|
-
|
55
|
-
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]
|
56
|
-
RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)$ ?module=$1&controller=$2&action=$3 [QSA,L]
|
57
|
-
RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/$ ?module=$1&controller=$2&action=index [QSA,L]
|
58
|
-
|
59
|
-
# You can also point these error messages to a controller/action
|
60
|
-
ErrorDocument 500 /500.html
|
61
|
-
ErrorDocument 404 /404.html
|
13
|
+
# In case Rails experiences terminal errors
|
14
|
+
ErrorDocument 500 /500.html
|