railties 3.0.0.beta4 → 3.0.0.rc
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +24 -6
- data/README.rdoc +25 -0
- data/guides/assets/javascripts/code_highlighter.js +0 -0
- data/guides/assets/javascripts/guides.js +0 -0
- data/guides/assets/stylesheets/print.css +0 -0
- data/guides/assets/stylesheets/reset.css +0 -0
- data/guides/assets/stylesheets/style.css +0 -0
- data/guides/source/3_0_release_notes.textile +5 -3
- data/guides/source/action_controller_overview.textile +19 -0
- data/guides/source/active_record_basics.textile +27 -21
- data/guides/source/active_record_querying.textile +39 -37
- data/guides/source/{activerecord_validations_callbacks.textile → active_record_validations_callbacks.textile} +30 -29
- data/guides/source/active_support_core_extensions.textile +232 -107
- data/guides/source/api_documentation_guidelines.textile +187 -0
- data/guides/source/association_basics.textile +45 -1
- data/guides/source/configuring.textile +7 -7
- data/guides/source/contributing_to_rails.textile +42 -15
- data/guides/source/form_helpers.textile +1 -1
- data/guides/source/generators.textile +37 -37
- data/guides/source/getting_started.textile +11 -11
- data/guides/source/i18n.textile +1 -1
- data/guides/source/index.html.erb +14 -6
- data/guides/source/initialization.textile +130 -124
- data/guides/source/layout.html.erb +5 -2
- data/guides/source/layouts_and_rendering.textile +2 -2
- data/guides/source/migrations.textile +4 -3
- data/guides/source/plugins.textile +15 -15
- data/guides/source/rails_application_templates.textile +2 -2
- data/guides/source/routing.textile +83 -62
- data/guides/source/security.textile +2 -2
- data/guides/w3c_validator.rb +30 -6
- data/lib/rails.rb +3 -3
- data/lib/rails/application.rb +43 -19
- data/lib/rails/application/bootstrap.rb +2 -0
- data/lib/rails/application/configuration.rb +3 -3
- data/lib/rails/application/finisher.rb +6 -6
- data/lib/rails/cli.rb +1 -19
- data/lib/rails/commands.rb +5 -5
- data/lib/rails/commands/application.rb +1 -1
- data/lib/rails/commands/console.rb +1 -4
- data/lib/rails/commands/generate.rb +0 -0
- data/lib/rails/commands/plugin.rb +57 -52
- data/lib/rails/commands/runner.rb +2 -1
- data/lib/rails/commands/server.rb +6 -2
- data/lib/rails/configuration.rb +2 -3
- data/lib/rails/console/app.rb +0 -2
- data/lib/rails/engine.rb +14 -15
- data/lib/rails/engine/configuration.rb +5 -5
- data/lib/rails/generators.rb +2 -3
- data/lib/rails/generators/actions.rb +4 -4
- data/lib/rails/generators/base.rb +1 -1
- data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +1 -6
- data/lib/rails/generators/erb/scaffold/templates/_form.html.erb +4 -4
- data/lib/rails/generators/erb/scaffold/templates/edit.html.erb +3 -3
- data/lib/rails/generators/erb/scaffold/templates/index.html.erb +7 -7
- data/lib/rails/generators/erb/scaffold/templates/new.html.erb +2 -2
- data/lib/rails/generators/erb/scaffold/templates/show.html.erb +3 -3
- data/lib/rails/generators/generated_attribute.rb +2 -1
- data/lib/rails/generators/named_base.rb +24 -0
- data/lib/rails/generators/rails/app/app_generator.rb +10 -9
- data/lib/rails/generators/rails/app/templates/Gemfile +4 -3
- data/lib/rails/generators/rails/app/templates/README +6 -31
- data/lib/rails/generators/rails/app/templates/Rakefile +1 -1
- data/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb +0 -1
- data/lib/rails/generators/rails/app/templates/app/mailers/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/config/application.rb +11 -11
- data/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml +36 -24
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml +1 -1
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +3 -0
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +3 -0
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +3 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb +1 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/secret_token.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/routes.rb +1 -1
- data/lib/rails/generators/rails/app/templates/public/index.html +0 -17
- data/lib/rails/generators/rails/app/templates/public/javascripts/prototype.js +2027 -900
- data/lib/rails/generators/rails/app/templates/public/javascripts/rails.js +114 -57
- data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +1 -1
- data/lib/rails/generators/rails/model/USAGE +1 -1
- data/lib/rails/generators/rails/resource/resource_generator.rb +4 -14
- data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +0 -2
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +28 -30
- data/lib/rails/generators/resource_helpers.rb +1 -1
- data/lib/rails/generators/test_case.rb +25 -11
- data/lib/rails/generators/test_unit/model/model_generator.rb +1 -1
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +0 -1
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb +13 -15
- data/lib/rails/info.rb +1 -2
- data/lib/rails/info_routes.rb +1 -1
- data/lib/rails/initializable.rb +3 -16
- data/lib/rails/paths.rb +31 -36
- data/lib/rails/plugin.rb +10 -6
- data/lib/rails/rack/logger.rb +11 -13
- data/lib/rails/railtie.rb +14 -42
- data/lib/rails/ruby_version_check.rb +19 -5
- data/lib/rails/script_rails_loader.rb +29 -0
- data/lib/rails/tasks/annotations.rake +2 -2
- data/lib/rails/tasks/documentation.rake +47 -16
- data/lib/rails/tasks/framework.rake +9 -9
- data/lib/rails/tasks/middleware.rake +1 -1
- data/lib/rails/tasks/misc.rake +5 -5
- data/lib/rails/tasks/routes.rake +1 -1
- data/lib/rails/tasks/tmp.rake +5 -5
- data/lib/rails/test_unit/testing.rake +38 -14
- data/lib/rails/version.rb +1 -1
- metadata +29 -17
- data/README +0 -281
- data/lib/rails/application/routes_reloader.rb +0 -46
- data/lib/rails/log_subscriber.rb +0 -115
- data/lib/rails/log_subscriber/test_helper.rb +0 -97
- data/lib/rails/webrick_server.rb +0 -156
@@ -37,13 +37,14 @@ ARGV.delete(code_or_file)
|
|
37
37
|
ENV["RAILS_ENV"] = options[:environment]
|
38
38
|
|
39
39
|
require APP_PATH
|
40
|
-
Rails
|
40
|
+
Rails.application.require_environment!
|
41
41
|
|
42
42
|
begin
|
43
43
|
if code_or_file.nil?
|
44
44
|
$stderr.puts "Run '#{$0} -h' for help."
|
45
45
|
exit 1
|
46
46
|
elsif File.exist?(code_or_file)
|
47
|
+
$0 = code_or_file
|
47
48
|
eval(File.read(code_or_file), nil, code_or_file)
|
48
49
|
else
|
49
50
|
eval(code_or_file)
|
@@ -9,7 +9,7 @@ module Rails
|
|
9
9
|
args, options = args.dup, {}
|
10
10
|
|
11
11
|
opt_parser = OptionParser.new do |opts|
|
12
|
-
opts.banner = "Usage: rails server [options]"
|
12
|
+
opts.banner = "Usage: rails server [mongrel, thin, etc] [options]"
|
13
13
|
opts.on("-p", "--port=port", Integer,
|
14
14
|
"Runs Rails on the specified port.", "Default: 3000") { |v| options[:Port] = v }
|
15
15
|
opts.on("-b", "--binding=ip", String,
|
@@ -21,6 +21,9 @@ module Rails
|
|
21
21
|
opts.on("-e", "--environment=name", String,
|
22
22
|
"Specifies the environment to run this server under (test/development/production).",
|
23
23
|
"Default: development") { |v| options[:environment] = v }
|
24
|
+
opts.on("-P","--pid=pid",String,
|
25
|
+
"Specifies the PID file.",
|
26
|
+
"Default: tmp/pids/server.pid") { |v| options[:pid] = v }
|
24
27
|
|
25
28
|
opts.separator ""
|
26
29
|
|
@@ -83,7 +86,8 @@ module Rails
|
|
83
86
|
:environment => (ENV['RAILS_ENV'] || "development").dup,
|
84
87
|
:daemonize => false,
|
85
88
|
:debugger => false,
|
86
|
-
:pid => "tmp/pids/server.pid"
|
89
|
+
:pid => File.expand_path("tmp/pids/server.pid"),
|
90
|
+
:config => File.expand_path("config.ru")
|
87
91
|
})
|
88
92
|
end
|
89
93
|
end
|
data/lib/rails/configuration.rb
CHANGED
@@ -56,12 +56,11 @@ module Rails
|
|
56
56
|
|
57
57
|
return @options[method] if args.empty?
|
58
58
|
|
59
|
-
if method == :rails
|
60
|
-
namespace, configuration = :rails, args.shift
|
61
|
-
elsif args.first.is_a?(Hash)
|
59
|
+
if method == :rails || args.first.is_a?(Hash)
|
62
60
|
namespace, configuration = method, args.shift
|
63
61
|
else
|
64
62
|
namespace, configuration = args.shift, args.shift
|
63
|
+
namespace = namespace.to_sym if namespace.respond_to?(:to_sym)
|
65
64
|
@options[:rails][method] = namespace
|
66
65
|
end
|
67
66
|
|
data/lib/rails/console/app.rb
CHANGED
data/lib/rails/engine.rb
CHANGED
@@ -32,14 +32,14 @@ module Rails
|
|
32
32
|
# == Configuration
|
33
33
|
#
|
34
34
|
# Besides the Railtie configuration which is shared across the application, in a
|
35
|
-
# Rails::Engine you can access
|
35
|
+
# Rails::Engine you can access autoload_paths, eager_load_paths and autoload_once_paths,
|
36
36
|
# which differently from a Railtie, are scoped to the current Engine.
|
37
37
|
#
|
38
38
|
# Example:
|
39
39
|
#
|
40
40
|
# class MyEngine < Rails::Engine
|
41
41
|
# # Add a load path for this specific Engine
|
42
|
-
# config.
|
42
|
+
# config.autoload_paths << File.expand_path("../lib/some/path", __FILE__)
|
43
43
|
#
|
44
44
|
# initializer "my_engine.add_middleware" do |app|
|
45
45
|
# app.middleware.use MyEngine::Middleware
|
@@ -142,7 +142,7 @@ module Rails
|
|
142
142
|
|
143
143
|
# Add configured load paths to ruby load paths and remove duplicates.
|
144
144
|
initializer :set_load_path, :before => :bootstrap_hook do
|
145
|
-
|
145
|
+
_all_load_paths.reverse_each do |path|
|
146
146
|
$LOAD_PATH.unshift(path) if File.directory?(path)
|
147
147
|
end
|
148
148
|
$LOAD_PATH.uniq!
|
@@ -154,17 +154,13 @@ module Rails
|
|
154
154
|
# This needs to be an initializer, since it needs to run once
|
155
155
|
# per engine and get the engine as a block parameter
|
156
156
|
initializer :set_autoload_paths, :before => :bootstrap_hook do |app|
|
157
|
-
ActiveSupport::Dependencies.
|
158
|
-
|
159
|
-
if reloadable?(app)
|
160
|
-
ActiveSupport::Dependencies.load_once_paths.unshift(*config.load_once_paths)
|
161
|
-
else
|
162
|
-
ActiveSupport::Dependencies.load_once_paths.unshift(*config.load_paths)
|
163
|
-
end
|
157
|
+
ActiveSupport::Dependencies.autoload_paths.unshift(*_all_autoload_paths)
|
158
|
+
ActiveSupport::Dependencies.autoload_once_paths.unshift(*config.autoload_once_paths)
|
164
159
|
|
165
160
|
# Freeze so future modifications will fail rather than do nothing mysteriously
|
166
|
-
config.
|
167
|
-
config.
|
161
|
+
config.autoload_paths.freeze
|
162
|
+
config.eager_load_paths.freeze
|
163
|
+
config.autoload_once_paths.freeze
|
168
164
|
end
|
169
165
|
|
170
166
|
initializer :add_routing_paths do |app|
|
@@ -195,7 +191,6 @@ module Rails
|
|
195
191
|
ActiveSupport.on_load(:action_controller) do
|
196
192
|
prepend_view_path(views)
|
197
193
|
end
|
198
|
-
|
199
194
|
ActiveSupport.on_load(:action_mailer) do
|
200
195
|
prepend_view_path(views)
|
201
196
|
end
|
@@ -214,8 +209,12 @@ module Rails
|
|
214
209
|
|
215
210
|
protected
|
216
211
|
|
217
|
-
def
|
218
|
-
|
212
|
+
def _all_autoload_paths
|
213
|
+
@_all_autoload_paths ||= (config.autoload_paths + config.eager_load_paths + config.autoload_once_paths).uniq
|
214
|
+
end
|
215
|
+
|
216
|
+
def _all_load_paths
|
217
|
+
@_all_load_paths ||= (config.paths.load_paths + _all_autoload_paths).uniq
|
219
218
|
end
|
220
219
|
end
|
221
220
|
end
|
@@ -4,7 +4,7 @@ module Rails
|
|
4
4
|
class Engine
|
5
5
|
class Configuration < ::Rails::Railtie::Configuration
|
6
6
|
attr_reader :root
|
7
|
-
attr_writer :eager_load_paths, :
|
7
|
+
attr_writer :eager_load_paths, :autoload_once_paths, :autoload_paths
|
8
8
|
|
9
9
|
def initialize(root=nil)
|
10
10
|
super()
|
@@ -41,12 +41,12 @@ module Rails
|
|
41
41
|
@eager_load_paths ||= paths.eager_load
|
42
42
|
end
|
43
43
|
|
44
|
-
def
|
45
|
-
@
|
44
|
+
def autoload_once_paths
|
45
|
+
@autoload_once_paths ||= paths.autoload_once
|
46
46
|
end
|
47
47
|
|
48
|
-
def
|
49
|
-
@
|
48
|
+
def autoload_paths
|
49
|
+
@autoload_paths ||= paths.autoload_paths
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
data/lib/rails/generators.rb
CHANGED
@@ -50,7 +50,6 @@ module Rails
|
|
50
50
|
:performance_tool => nil,
|
51
51
|
:resource_controller => :controller,
|
52
52
|
:scaffold_controller => :scaffold_controller,
|
53
|
-
:singleton => false,
|
54
53
|
:stylesheets => true,
|
55
54
|
:test_framework => nil,
|
56
55
|
:template_engine => :erb
|
@@ -327,11 +326,11 @@ module Rails
|
|
327
326
|
paths = []
|
328
327
|
namespaces.each do |namespace|
|
329
328
|
pieces = namespace.split(":")
|
330
|
-
paths << pieces.dup.push(pieces.last).join("/")
|
329
|
+
paths << pieces.dup.push(pieces.last).join("/")
|
331
330
|
paths << pieces.join("/")
|
332
331
|
end
|
333
332
|
paths.uniq!
|
334
333
|
paths
|
335
334
|
end
|
336
335
|
end
|
337
|
-
end
|
336
|
+
end
|
@@ -40,7 +40,7 @@ module Rails
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
# Adds an entry into
|
43
|
+
# Adds an entry into Gemfile for the supplied gem. If env
|
44
44
|
# is specified, add the gem to the given environment.
|
45
45
|
#
|
46
46
|
# ==== Example
|
@@ -100,7 +100,7 @@ module Rails
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
-
# Adds a line inside the
|
103
|
+
# Adds a line inside the Application class for config/application.rb.
|
104
104
|
#
|
105
105
|
# If options :env is specified, the line is appended to the corresponding
|
106
106
|
# file in config/environments.
|
@@ -267,7 +267,7 @@ module Rails
|
|
267
267
|
ActiveSupport::Deprecation.warn "freeze! is deprecated since your rails app now comes bundled with Rails by default, please check your Gemfile"
|
268
268
|
end
|
269
269
|
|
270
|
-
# Make an entry in Rails routing file
|
270
|
+
# Make an entry in Rails routing file config/routes.rb
|
271
271
|
#
|
272
272
|
# === Example
|
273
273
|
#
|
@@ -275,7 +275,7 @@ module Rails
|
|
275
275
|
#
|
276
276
|
def route(routing_code)
|
277
277
|
log :route, routing_code
|
278
|
-
sentinel =
|
278
|
+
sentinel = /\.routes\.draw do(\s*\|map\|)?\s*$/
|
279
279
|
|
280
280
|
in_root do
|
281
281
|
inject_into_file 'config/routes.rb', "\n #{routing_code}\n", { :after => sentinel, :verbose => false }
|
@@ -3,7 +3,7 @@ begin
|
|
3
3
|
rescue LoadError
|
4
4
|
puts "Thor is not available.\nIf you ran this command from a git checkout " \
|
5
5
|
"of Rails, please make sure thor is installed,\nand run this command " \
|
6
|
-
"as `ruby
|
6
|
+
"as `ruby #{$0} #{ARGV.join(" ")} --dev`"
|
7
7
|
exit
|
8
8
|
end
|
9
9
|
|
@@ -8,17 +8,12 @@ module Erb
|
|
8
8
|
|
9
9
|
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
|
10
10
|
|
11
|
-
class_option :singleton, :type => :boolean, :desc => "Supply to skip index view"
|
12
|
-
|
13
11
|
def create_root_folder
|
14
12
|
empty_directory File.join("app/views", controller_file_path)
|
15
13
|
end
|
16
14
|
|
17
15
|
def copy_view_files
|
18
|
-
|
19
|
-
views.delete("index") if options[:singleton]
|
20
|
-
|
21
|
-
views.each do |view|
|
16
|
+
available_views.each do |view|
|
22
17
|
filename = filename_with_extensions(view)
|
23
18
|
template filename, File.join("app/views", controller_file_path, filename)
|
24
19
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
<%%= form_for(@<%=
|
2
|
-
<%% if @<%=
|
1
|
+
<%%= form_for(@<%= singular_table_name %>) do |f| %>
|
2
|
+
<%% if @<%= singular_table_name %>.errors.any? %>
|
3
3
|
<div id="error_explanation">
|
4
|
-
<h2><%%= pluralize(@<%=
|
4
|
+
<h2><%%= pluralize(@<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h2>
|
5
5
|
|
6
6
|
<ul>
|
7
|
-
<%% @<%=
|
7
|
+
<%% @<%= singular_table_name %>.errors.full_messages.each do |msg| %>
|
8
8
|
<li><%%= msg %></li>
|
9
9
|
<%% end %>
|
10
10
|
</ul>
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<h1>Editing <%=
|
1
|
+
<h1>Editing <%= singular_table_name %></h1>
|
2
2
|
|
3
3
|
<%%= render 'form' %>
|
4
4
|
|
5
|
-
<%%= link_to 'Show', @<%=
|
6
|
-
<%%= link_to 'Back', <%=
|
5
|
+
<%%= link_to 'Show', @<%= singular_table_name %> %> |
|
6
|
+
<%%= link_to 'Back', <%= index_helper %>_path %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<h1>Listing <%=
|
1
|
+
<h1>Listing <%= plural_table_name %></h1>
|
2
2
|
|
3
3
|
<table>
|
4
4
|
<tr>
|
@@ -10,18 +10,18 @@
|
|
10
10
|
<th></th>
|
11
11
|
</tr>
|
12
12
|
|
13
|
-
<%% @<%=
|
13
|
+
<%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
|
14
14
|
<tr>
|
15
15
|
<% for attribute in attributes -%>
|
16
|
-
<td><%%= <%=
|
16
|
+
<td><%%= <%= singular_table_name %>.<%= attribute.name %> %></td>
|
17
17
|
<% end -%>
|
18
|
-
<td><%%= link_to 'Show', <%=
|
19
|
-
<td><%%= link_to 'Edit', edit_<%=
|
20
|
-
<td><%%= link_to 'Destroy', <%=
|
18
|
+
<td><%%= link_to 'Show', <%= singular_table_name %> %></td>
|
19
|
+
<td><%%= link_to 'Edit', edit_<%= singular_table_name %>_path(<%= singular_table_name %>) %></td>
|
20
|
+
<td><%%= link_to 'Destroy', <%= singular_table_name %>, :confirm => 'Are you sure?', :method => :delete %></td>
|
21
21
|
</tr>
|
22
22
|
<%% end %>
|
23
23
|
</table>
|
24
24
|
|
25
25
|
<br />
|
26
26
|
|
27
|
-
<%%= link_to 'New <%= human_name %>', new_<%=
|
27
|
+
<%%= link_to 'New <%= human_name %>', new_<%= singular_table_name %>_path %>
|
@@ -3,10 +3,10 @@
|
|
3
3
|
<% for attribute in attributes -%>
|
4
4
|
<p>
|
5
5
|
<b><%= attribute.human_name %>:</b>
|
6
|
-
<%%= @<%=
|
6
|
+
<%%= @<%= singular_table_name %>.<%= attribute.name %> %>
|
7
7
|
</p>
|
8
8
|
|
9
9
|
<% end -%>
|
10
10
|
|
11
|
-
<%%= link_to 'Edit', edit_<%=
|
12
|
-
<%%= link_to 'Back', <%=
|
11
|
+
<%%= link_to 'Edit', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>) %> |
|
12
|
+
<%%= link_to 'Back', <%= index_helper %>_path %>
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'active_support/time'
|
2
|
+
|
1
3
|
module Rails
|
2
4
|
module Generators
|
3
5
|
class GeneratedAttribute
|
@@ -13,7 +15,6 @@ module Rails
|
|
13
15
|
when :time then :time_select
|
14
16
|
when :datetime, :timestamp then :datetime_select
|
15
17
|
when :date then :date_select
|
16
|
-
when :string then :text_field
|
17
18
|
when :text then :text_area
|
18
19
|
when :boolean then :check_box
|
19
20
|
else
|
@@ -46,6 +46,30 @@ module Rails
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
def uncountable?
|
50
|
+
singular_name == plural_name
|
51
|
+
end
|
52
|
+
|
53
|
+
def index_helper
|
54
|
+
uncountable? ? "#{plural_table_name}_index" : plural_table_name
|
55
|
+
end
|
56
|
+
|
57
|
+
def singular_table_name
|
58
|
+
@singular_table_name ||= table_name.singularize
|
59
|
+
end
|
60
|
+
|
61
|
+
def plural_table_name
|
62
|
+
@plural_table_name ||= table_name.pluralize
|
63
|
+
end
|
64
|
+
|
65
|
+
def plural_file_name
|
66
|
+
@plural_file_name ||= file_name.pluralize
|
67
|
+
end
|
68
|
+
|
69
|
+
def route_url
|
70
|
+
@route_url ||= class_path.collect{|dname| "/" + dname }.join('') + "/" + plural_file_name
|
71
|
+
end
|
72
|
+
|
49
73
|
# Tries to retrieve the application name or simple return application.
|
50
74
|
def application_name
|
51
75
|
if defined?(Rails) && Rails.application
|
@@ -115,6 +115,7 @@ module Rails
|
|
115
115
|
directory "public/javascripts"
|
116
116
|
else
|
117
117
|
empty_directory_with_gitkeep "public/javascripts"
|
118
|
+
create_file "public/javascripts/application.js"
|
118
119
|
end
|
119
120
|
end
|
120
121
|
|
@@ -167,7 +168,7 @@ module Rails
|
|
167
168
|
:desc => "Path to an application builder (can be a filesystem path or URL)"
|
168
169
|
|
169
170
|
class_option :template, :type => :string, :aliases => "-m",
|
170
|
-
:desc => "Path to an application template (can be a filesystem path or URL)
|
171
|
+
:desc => "Path to an application template (can be a filesystem path or URL)"
|
171
172
|
|
172
173
|
class_option :dev, :type => :boolean, :default => false,
|
173
174
|
:desc => "Setup the application with Gemfile pointing to your Rails checkout"
|
@@ -178,11 +179,11 @@ module Rails
|
|
178
179
|
class_option :skip_gemfile, :type => :boolean, :default => false,
|
179
180
|
:desc => "Don't create a Gemfile"
|
180
181
|
|
181
|
-
class_option :
|
182
|
-
:desc => "Skip
|
182
|
+
class_option :skip_active_record, :type => :boolean, :aliases => "-O", :default => false,
|
183
|
+
:desc => "Skip Active Record files"
|
183
184
|
|
184
|
-
class_option :
|
185
|
-
:desc => "Skip
|
185
|
+
class_option :skip_test_unit, :type => :boolean, :aliases => "-T", :default => false,
|
186
|
+
:desc => "Skip Test::Unit files"
|
186
187
|
|
187
188
|
class_option :skip_prototype, :type => :boolean, :aliases => "-J", :default => false,
|
188
189
|
:desc => "Skip Prototype files"
|
@@ -204,7 +205,7 @@ module Rails
|
|
204
205
|
|
205
206
|
super
|
206
207
|
|
207
|
-
if !options[:
|
208
|
+
if !options[:skip_active_record] && !DATABASES.include?(options[:database])
|
208
209
|
raise Error, "Invalid value for --database option. Supported for preconfiguration are: #{DATABASES.join(", ")}."
|
209
210
|
end
|
210
211
|
end
|
@@ -238,8 +239,8 @@ module Rails
|
|
238
239
|
template "config/boot.rb"
|
239
240
|
end
|
240
241
|
|
241
|
-
def
|
242
|
-
return if options[:
|
242
|
+
def create_active_record_files
|
243
|
+
return if options[:skip_active_record]
|
243
244
|
build(:database_yml)
|
244
245
|
end
|
245
246
|
|
@@ -280,7 +281,7 @@ module Rails
|
|
280
281
|
end
|
281
282
|
|
282
283
|
def create_test_files
|
283
|
-
build(:test) unless options[:
|
284
|
+
build(:test) unless options[:skip_test_unit]
|
284
285
|
end
|
285
286
|
|
286
287
|
def create_tmp_files
|
@@ -32,8 +32,9 @@ gem '<%= gem_for_database %>'<% if require_for_database %>, :require => '<%= req
|
|
32
32
|
# gem 'sqlite3-ruby', :require => 'sqlite3'
|
33
33
|
# gem 'aws-s3', :require => 'aws/s3'
|
34
34
|
|
35
|
-
# Bundle gems for
|
36
|
-
#
|
37
|
-
#
|
35
|
+
# Bundle gems for the local environment. Make sure to
|
36
|
+
# put test-only gems in this group so their generators
|
37
|
+
# and rake tasks are available in development mode:
|
38
|
+
# group :development, :test do
|
38
39
|
# gem 'webrat'
|
39
40
|
# end
|