railties 3.2.13 → 3.2.14.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +19 -3
- data/guides/source/action_mailer_basics.textile +1 -1
- data/guides/source/caching_with_rails.textile +5 -5
- data/guides/source/getting_started.textile +2 -0
- data/guides/source/initialization.textile +1 -1
- data/guides/source/layout.html.erb +5 -5
- data/lib/rails/application.rb +12 -1
- data/lib/rails/commands/benchmarker.rb +2 -2
- data/lib/rails/commands/profiler.rb +1 -0
- data/lib/rails/commands/runner.rb +1 -0
- data/lib/rails/engine.rb +5 -0
- data/lib/rails/generators/app_base.rb.orig +300 -0
- data/lib/rails/generators/rails/app/templates/app/mailers/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/app/models/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/public/stylesheets/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/test/fixtures/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/test/functional/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/test/integration/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/test/unit/.empty_directory +0 -0
- data/lib/rails/generators/rails/generator/templates/templates/.empty_directory +0 -0
- data/lib/rails/generators/rails/plugin_new/templates/Gemfile +1 -1
- data/lib/rails/generators/rails/plugin_new/templates/app/mailers/.empty_directory +0 -0
- data/lib/rails/generators/rails/plugin_new/templates/app/models/.empty_directory +0 -0
- data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +2 -0
- data/lib/rails/generators/rails/scaffold/scaffold_generator.rb.orig +30 -0
- data/lib/rails/railtie.rb +10 -0
- data/lib/rails/test_unit/testing.rake +5 -2
- data/lib/rails/version.rb +2 -2
- metadata +151 -96
- checksums.yaml +0 -7
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,25 @@
|
|
1
|
-
##
|
1
|
+
## Rails 3.2.14.rc1 (Jul 8, 2013) ##
|
2
2
|
|
3
|
-
*
|
3
|
+
* Fix bugs that crashed `rake test:benchmark`, `rails profiler` and
|
4
|
+
`rails benchmarker`.
|
5
|
+
Fixes #4938.
|
6
|
+
Backport rails/rails-perftest#2.
|
7
|
+
|
8
|
+
*Dmitry Vorotilin + Yves Senn*
|
9
|
+
|
10
|
+
* Add support for runner hook.
|
11
|
+
|
12
|
+
Backport #7695.
|
13
|
+
|
14
|
+
*Ben Holley*
|
15
|
+
|
16
|
+
* Fixes bug with scaffold generator with `--assets=false --resource-route=false`.
|
17
|
+
Fixes #9525.
|
18
|
+
|
19
|
+
*Arun Agrawal*
|
4
20
|
|
5
21
|
|
6
|
-
## Rails 3.2.13 (
|
22
|
+
## Rails 3.2.13 (Mar 18, 2013) ##
|
7
23
|
|
8
24
|
* No changes.
|
9
25
|
|
@@ -480,7 +480,7 @@ As Action Mailer now uses the Mail gem, this becomes as simple as adding to your
|
|
480
480
|
<ruby>
|
481
481
|
config.action_mailer.delivery_method = :smtp
|
482
482
|
config.action_mailer.smtp_settings = {
|
483
|
-
:address =>
|
483
|
+
:address => 'smtp.gmail.com',
|
484
484
|
:port => 587,
|
485
485
|
:domain => 'baci.lindsaar.net',
|
486
486
|
:user_name => '<username>',
|
@@ -86,9 +86,9 @@ Or, you can set custom gzip compression level (level names are taken from +Zlib+
|
|
86
86
|
caches_page :image, :gzip => :best_speed
|
87
87
|
</ruby>
|
88
88
|
|
89
|
-
NOTE: Page caching ignores all parameters. For example +/products?page=1+ will be written out to the filesystem as +products.html+ with no reference to the +page+ parameter. Thus, if someone requests +/products?page=2+ later, they will get the cached first page. A workaround for this limitation is to include the parameters in the
|
89
|
+
NOTE: Page caching ignores all parameters. For example +/products?page=1+ will be written out to the filesystem as +products.html+ with no reference to the +page+ parameter. Thus, if someone requests +/products?page=2+ later, they will get the cached first page. A workaround for this limitation is to include the parameters in the products's path, e.g. +/products/page/1+.
|
90
90
|
|
91
|
-
INFO: Page caching runs
|
91
|
+
INFO: Page caching runs as an after filter. Thus, invalid requests won't generate spurious cache entries as long as you halt them. Typically, a redirection in some before filter that checks request preconditions does the job.
|
92
92
|
|
93
93
|
h4. Action Caching
|
94
94
|
|
@@ -301,8 +301,6 @@ config.cache_store = :memory_store, :size => 64.megabytes
|
|
301
301
|
|
302
302
|
If you're running multiple Ruby on Rails server processes (which is the case if you're using mongrel_cluster or Phusion Passenger), then your Rails server process instances won't be able to share cache data with each other. This cache store is not appropriate for large application deployments, but can work well for small, low traffic sites with only a couple of server processes or for development and test environments.
|
303
303
|
|
304
|
-
This is the default cache store implementation.
|
305
|
-
|
306
304
|
h4. ActiveSupport::Cache::FileStore
|
307
305
|
|
308
306
|
This cache store uses the file system to store entries. The path to the directory where the store files will be stored must be specified when initializing the cache.
|
@@ -315,6 +313,8 @@ With this cache store, multiple server processes on the same host can share a ca
|
|
315
313
|
|
316
314
|
Note that the cache will grow until the disk is full unless you periodically clear out old entries.
|
317
315
|
|
316
|
+
This is the default cache store if config.cache_store is not defined and tmp/cache is writable.
|
317
|
+
|
318
318
|
h4. ActiveSupport::Cache::MemCacheStore
|
319
319
|
|
320
320
|
This cache store uses Danga's +memcached+ server to provide a centralized cache for your application. Rails uses the bundled +memcache-client+ gem by default. This is currently the most popular cache store for production websites. It can be used to provide a single, shared cache cluster with very a high performance and redundancy.
|
@@ -434,4 +434,4 @@ end
|
|
434
434
|
|
435
435
|
h3. Further reading
|
436
436
|
|
437
|
-
* "Scaling Rails Screencasts":
|
437
|
+
* "Scaling Rails Screencasts":https://www.youtube.com/playlist?list=PLuVcDOUVjW2ePvFapFSHBZ71ya2fLHZS5
|
@@ -1153,6 +1153,7 @@ First, take a look at +comment.rb+:
|
|
1153
1153
|
|
1154
1154
|
<ruby>
|
1155
1155
|
class Comment < ActiveRecord::Base
|
1156
|
+
attr_accesssible :body, :commenter, :post
|
1156
1157
|
belongs_to :post
|
1157
1158
|
end
|
1158
1159
|
</ruby>
|
@@ -1215,6 +1216,7 @@ makes each comment belong to a Post:
|
|
1215
1216
|
|
1216
1217
|
<ruby>
|
1217
1218
|
class Comment < ActiveRecord::Base
|
1219
|
+
attr_accessible :body, :commenter, :post
|
1218
1220
|
belongs_to :post
|
1219
1221
|
end
|
1220
1222
|
</ruby>
|
@@ -383,7 +383,7 @@ ensure
|
|
383
383
|
end
|
384
384
|
</ruby>
|
385
385
|
|
386
|
-
This is where the first output of the Rails initialization happens. This method creates a trap for +INT+ signals, so if you
|
386
|
+
This is where the first output of the Rails initialization happens. This method creates a trap for +INT+ signals, so if you <tt>CTRL+C</tt> the server, it will exit the process. As we can see from the code here, it will create the +tmp/cache+, +tmp/pids+, +tmp/sessions+ and +tmp/sockets+ directories if they don't already exist prior to calling +super+. The +super+ method will call +Rack::Server.start+ which begins its definition like this:
|
387
387
|
|
388
388
|
<ruby>
|
389
389
|
def start
|
@@ -81,11 +81,11 @@
|
|
81
81
|
</p>
|
82
82
|
<p>
|
83
83
|
If you see any typos or factual errors you are confident to
|
84
|
-
patch, please clone <%= link_to '
|
85
|
-
and
|
86
|
-
|
87
|
-
|
88
|
-
cross-merged with master periodically.
|
84
|
+
patch, please clone the <%= link_to 'rails', 'https://github.com/rails/rails' %>
|
85
|
+
repository and open a new pull request. You can also ask for commit rights on
|
86
|
+
<%= link_to 'docrails', 'https://github.com/rails/docrails' %> if you plan to submit
|
87
|
+
several patches. Commits are reviewed, but that happens after you've submitted your
|
88
|
+
contribution. This repository is cross-merged with master periodically.
|
89
89
|
</p>
|
90
90
|
<p>
|
91
91
|
You may also find incomplete content, or stuff that is not up to date.
|
data/lib/rails/application.rb
CHANGED
@@ -154,6 +154,14 @@ module Rails
|
|
154
154
|
self
|
155
155
|
end
|
156
156
|
|
157
|
+
# Load the application runner and invoke the registered hooks.
|
158
|
+
# Check <tt>Rails::Railtie.runner</tt> for more info.
|
159
|
+
def load_runner(app=self)
|
160
|
+
initialize_runner
|
161
|
+
super
|
162
|
+
self
|
163
|
+
end
|
164
|
+
|
157
165
|
# Rails.application.env_config stores some of the Rails initial environment parameters.
|
158
166
|
# Currently stores:
|
159
167
|
#
|
@@ -167,7 +175,7 @@ module Rails
|
|
167
175
|
# These parameters will be used by middlewares and engines to configure themselves.
|
168
176
|
#
|
169
177
|
def env_config
|
170
|
-
@
|
178
|
+
@app_env_config ||= super.merge({
|
171
179
|
"action_dispatch.parameter_filter" => config.filter_parameters,
|
172
180
|
"action_dispatch.secret_token" => config.secret_token,
|
173
181
|
"action_dispatch.show_exceptions" => config.action_dispatch.show_exceptions,
|
@@ -305,6 +313,9 @@ module Rails
|
|
305
313
|
require "rails/console/helpers"
|
306
314
|
end
|
307
315
|
|
316
|
+
def initialize_runner #:nodoc:
|
317
|
+
end
|
318
|
+
|
308
319
|
def build_original_fullpath(env)
|
309
320
|
path_info = env["PATH_INFO"]
|
310
321
|
query_string = env["QUERY_STRING"]
|
@@ -2,9 +2,8 @@ require 'optparse'
|
|
2
2
|
require 'rails/test_help'
|
3
3
|
require 'rails/performance_test_help'
|
4
4
|
|
5
|
-
|
5
|
+
ENV["BENCHMARK_TESTS"] = '1'
|
6
6
|
require 'active_support/testing/performance'
|
7
|
-
ARGV.pop
|
8
7
|
|
9
8
|
def options
|
10
9
|
options = {}
|
@@ -31,4 +30,5 @@ class BenchmarkerTest < ActionDispatch::PerformanceTest #:nodoc:
|
|
31
30
|
end
|
32
31
|
RUBY
|
33
32
|
end
|
33
|
+
ARGV.clear
|
34
34
|
end
|
data/lib/rails/engine.rb
CHANGED
@@ -0,0 +1,300 @@
|
|
1
|
+
require 'digest/md5'
|
2
|
+
require 'securerandom'
|
3
|
+
require 'active_support/core_ext/string/strip'
|
4
|
+
require 'rails/version' unless defined?(Rails::VERSION)
|
5
|
+
require 'rbconfig'
|
6
|
+
require 'open-uri'
|
7
|
+
require 'uri'
|
8
|
+
|
9
|
+
module Rails
|
10
|
+
module Generators
|
11
|
+
class AppBase < Base # :nodoc:
|
12
|
+
DATABASES = %w( mysql oracle postgresql sqlite3 frontbase ibm_db sqlserver )
|
13
|
+
JDBC_DATABASES = %w( jdbcmysql jdbcsqlite3 jdbcpostgresql jdbc )
|
14
|
+
DATABASES.concat(JDBC_DATABASES)
|
15
|
+
|
16
|
+
attr_accessor :rails_template
|
17
|
+
add_shebang_option!
|
18
|
+
|
19
|
+
argument :app_path, type: :string
|
20
|
+
|
21
|
+
def self.add_shared_options_for(name)
|
22
|
+
class_option :template, type: :string, aliases: '-m',
|
23
|
+
desc: "Path to some #{name} template (can be a filesystem path or URL)"
|
24
|
+
|
25
|
+
class_option :skip_gemfile, type: :boolean, default: false,
|
26
|
+
desc: "Don't create a Gemfile"
|
27
|
+
|
28
|
+
class_option :skip_bundle, type: :boolean, aliases: '-B', default: false,
|
29
|
+
desc: "Don't run bundle install"
|
30
|
+
|
31
|
+
class_option :skip_git, type: :boolean, aliases: '-G', default: false,
|
32
|
+
desc: 'Skip .gitignore file'
|
33
|
+
|
34
|
+
class_option :skip_keeps, type: :boolean, default: false,
|
35
|
+
desc: 'Skip source control .keep files'
|
36
|
+
|
37
|
+
class_option :skip_active_record, type: :boolean, aliases: '-O', default: false,
|
38
|
+
desc: 'Skip Active Record files'
|
39
|
+
|
40
|
+
class_option :skip_sprockets, type: :boolean, aliases: '-S', default: false,
|
41
|
+
desc: 'Skip Sprockets files'
|
42
|
+
|
43
|
+
class_option :database, type: :string, aliases: '-d', default: 'sqlite3',
|
44
|
+
desc: "Preconfigure for selected database (options: #{DATABASES.join('/')})"
|
45
|
+
|
46
|
+
class_option :javascript, type: :string, aliases: '-j', default: 'jquery',
|
47
|
+
desc: 'Preconfigure for selected JavaScript library'
|
48
|
+
|
49
|
+
class_option :skip_javascript, type: :boolean, aliases: '-J', default: false,
|
50
|
+
desc: 'Skip JavaScript files'
|
51
|
+
|
52
|
+
class_option :dev, type: :boolean, default: false,
|
53
|
+
desc: "Setup the #{name} with Gemfile pointing to your Rails checkout"
|
54
|
+
|
55
|
+
class_option :edge, type: :boolean, default: false,
|
56
|
+
desc: "Setup the #{name} with Gemfile pointing to Rails repository"
|
57
|
+
|
58
|
+
class_option :skip_test_unit, type: :boolean, aliases: '-T', default: false,
|
59
|
+
desc: 'Skip Test::Unit files'
|
60
|
+
|
61
|
+
class_option :rc, type: :string, default: false,
|
62
|
+
desc: "Path to file containing extra configuration options for rails command"
|
63
|
+
|
64
|
+
class_option :no_rc, type: :boolean, default: false,
|
65
|
+
desc: 'Skip loading of extra configuration options from .railsrc file'
|
66
|
+
|
67
|
+
class_option :help, type: :boolean, aliases: '-h', group: :rails,
|
68
|
+
desc: 'Show this help message and quit'
|
69
|
+
end
|
70
|
+
|
71
|
+
def initialize(*args)
|
72
|
+
@original_wd = Dir.pwd
|
73
|
+
super
|
74
|
+
convert_database_option_for_jruby
|
75
|
+
end
|
76
|
+
|
77
|
+
protected
|
78
|
+
|
79
|
+
def builder
|
80
|
+
@builder ||= begin
|
81
|
+
builder_class = get_builder_class
|
82
|
+
builder_class.send(:include, ActionMethods)
|
83
|
+
builder_class.new(self)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def build(meth, *args)
|
88
|
+
builder.send(meth, *args) if builder.respond_to?(meth)
|
89
|
+
end
|
90
|
+
|
91
|
+
def create_root
|
92
|
+
self.destination_root = File.expand_path(app_path, destination_root)
|
93
|
+
valid_const?
|
94
|
+
|
95
|
+
empty_directory '.'
|
96
|
+
set_default_accessors!
|
97
|
+
FileUtils.cd(destination_root) unless options[:pretend]
|
98
|
+
end
|
99
|
+
|
100
|
+
def apply_rails_template
|
101
|
+
apply rails_template if rails_template
|
102
|
+
rescue Thor::Error, LoadError, Errno::ENOENT => e
|
103
|
+
raise Error, "The template [#{rails_template}] could not be loaded. Error: #{e}"
|
104
|
+
end
|
105
|
+
|
106
|
+
def set_default_accessors!
|
107
|
+
self.rails_template = case options[:template]
|
108
|
+
when /^https?:\/\//
|
109
|
+
options[:template]
|
110
|
+
when String
|
111
|
+
File.expand_path(options[:template], Dir.pwd)
|
112
|
+
else
|
113
|
+
options[:template]
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def database_gemfile_entry
|
118
|
+
options[:skip_active_record] ? "" :
|
119
|
+
<<-GEMFILE.strip_heredoc.chomp
|
120
|
+
# Use #{options[:database]} as the database for ActiveRecord
|
121
|
+
gem '#{gem_for_database}'
|
122
|
+
GEMFILE
|
123
|
+
end
|
124
|
+
|
125
|
+
def include_all_railties?
|
126
|
+
!options[:skip_active_record] && !options[:skip_test_unit] && !options[:skip_sprockets]
|
127
|
+
end
|
128
|
+
|
129
|
+
def comment_if(value)
|
130
|
+
options[value] ? '# ' : ''
|
131
|
+
end
|
132
|
+
|
133
|
+
def rails_gemfile_entry
|
134
|
+
if options.dev?
|
135
|
+
<<-GEMFILE.strip_heredoc
|
136
|
+
gem 'rails', path: '#{Rails::Generators::RAILS_DEV_PATH}'
|
137
|
+
gem 'arel', github: 'rails/arel'
|
138
|
+
GEMFILE
|
139
|
+
elsif options.edge?
|
140
|
+
<<-GEMFILE.strip_heredoc
|
141
|
+
gem 'rails', github: 'rails/rails'
|
142
|
+
gem 'arel', github: 'rails/arel'
|
143
|
+
GEMFILE
|
144
|
+
else
|
145
|
+
<<-GEMFILE.strip_heredoc
|
146
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
147
|
+
gem 'rails', '#{Rails::VERSION::STRING}'
|
148
|
+
GEMFILE
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
def gem_for_database
|
153
|
+
# %w( mysql oracle postgresql sqlite3 frontbase ibm_db sqlserver jdbcmysql jdbcsqlite3 jdbcpostgresql )
|
154
|
+
case options[:database]
|
155
|
+
when "oracle" then "ruby-oci8"
|
156
|
+
when "postgresql" then "pg"
|
157
|
+
when "frontbase" then "ruby-frontbase"
|
158
|
+
when "mysql" then "mysql2"
|
159
|
+
when "sqlserver" then "activerecord-sqlserver-adapter"
|
160
|
+
when "jdbcmysql" then "activerecord-jdbcmysql-adapter"
|
161
|
+
when "jdbcsqlite3" then "activerecord-jdbcsqlite3-adapter"
|
162
|
+
when "jdbcpostgresql" then "activerecord-jdbcpostgresql-adapter"
|
163
|
+
when "jdbc" then "activerecord-jdbc-adapter"
|
164
|
+
else options[:database]
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
def convert_database_option_for_jruby
|
169
|
+
if defined?(JRUBY_VERSION)
|
170
|
+
case options[:database]
|
171
|
+
when "oracle" then options[:database].replace "jdbc"
|
172
|
+
when "postgresql" then options[:database].replace "jdbcpostgresql"
|
173
|
+
when "mysql" then options[:database].replace "jdbcmysql"
|
174
|
+
when "sqlite3" then options[:database].replace "jdbcsqlite3"
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
def assets_gemfile_entry
|
180
|
+
return if options[:skip_sprockets]
|
181
|
+
|
182
|
+
gemfile = if options.dev? || options.edge?
|
183
|
+
<<-GEMFILE.strip_heredoc
|
184
|
+
# Use edge version of sprockets-rails
|
185
|
+
gem 'sprockets-rails', github: 'rails/sprockets-rails'
|
186
|
+
|
187
|
+
# Use SCSS for stylesheets
|
188
|
+
gem 'sass-rails', github: 'rails/sass-rails'
|
189
|
+
|
190
|
+
<<<<<<< HEAD
|
191
|
+
# Use Uglifier as compressor for JavaScript assets
|
192
|
+
gem 'uglifier', '~> 1.3'
|
193
|
+
=======
|
194
|
+
# To use Uglifier as compressor for JavaScript assets
|
195
|
+
gem 'uglifier', '>= 1.3.0'
|
196
|
+
>>>>>>> parent of 5758387... sprockets 2.9.x doesn't work with uglifier 2.0 yet.
|
197
|
+
GEMFILE
|
198
|
+
else
|
199
|
+
<<-GEMFILE.strip_heredoc
|
200
|
+
# Use SCSS for stylesheets
|
201
|
+
gem 'sass-rails', '~> 4.0.0.beta1'
|
202
|
+
|
203
|
+
<<<<<<< HEAD
|
204
|
+
# Use Uglifier as compressor for JavaScript assets
|
205
|
+
gem 'uglifier', '~> 1.3'
|
206
|
+
=======
|
207
|
+
# To use Uglifier as compressor for JavaScript assets
|
208
|
+
gem 'uglifier', '>= 1.3.0'
|
209
|
+
>>>>>>> parent of 5758387... sprockets 2.9.x doesn't work with uglifier 2.0 yet.
|
210
|
+
GEMFILE
|
211
|
+
end
|
212
|
+
|
213
|
+
if options[:skip_javascript]
|
214
|
+
gemfile += <<-GEMFILE
|
215
|
+
#{coffee_gemfile_entry}
|
216
|
+
#{javascript_runtime_gemfile_entry}
|
217
|
+
GEMFILE
|
218
|
+
end
|
219
|
+
|
220
|
+
gemfile.gsub(/^[ \t]+/, '')
|
221
|
+
end
|
222
|
+
|
223
|
+
def coffee_gemfile_entry
|
224
|
+
if options.dev? || options.edge?
|
225
|
+
<<-GEMFILE
|
226
|
+
# Use CoffeeScript for .js.coffee assets and views
|
227
|
+
gem 'coffee-rails', github: 'rails/coffee-rails'
|
228
|
+
GEMFILE
|
229
|
+
else
|
230
|
+
<<-GEMFILE
|
231
|
+
# Use CoffeeScript for .js.coffee assets and views
|
232
|
+
gem 'coffee-rails', '~> 4.0.0.beta1'
|
233
|
+
GEMFILE
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
def javascript_gemfile_entry
|
238
|
+
unless options[:skip_javascript]
|
239
|
+
<<-GEMFILE.gsub(/^[ \t]+/, '')
|
240
|
+
#{coffee_gemfile_entry}
|
241
|
+
#{javascript_runtime_gemfile_entry}
|
242
|
+
# Use #{options[:javascript]} as the JavaScript library
|
243
|
+
gem '#{options[:javascript]}-rails'
|
244
|
+
|
245
|
+
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
|
246
|
+
gem 'turbolinks'
|
247
|
+
GEMFILE
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
def javascript_runtime_gemfile_entry
|
252
|
+
runtime = if defined?(JRUBY_VERSION)
|
253
|
+
"gem 'therubyrhino'"
|
254
|
+
else
|
255
|
+
"# gem 'therubyracer', platforms: :ruby"
|
256
|
+
end
|
257
|
+
<<-GEMFILE
|
258
|
+
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
259
|
+
#{runtime}
|
260
|
+
GEMFILE
|
261
|
+
end
|
262
|
+
|
263
|
+
def bundle_command(command)
|
264
|
+
say_status :run, "bundle #{command}"
|
265
|
+
|
266
|
+
# We are going to shell out rather than invoking Bundler::CLI.new(command)
|
267
|
+
# because `rails new` loads the Thor gem and on the other hand bundler uses
|
268
|
+
# its own vendored Thor, which could be a different version. Running both
|
269
|
+
# things in the same process is a recipe for a night with paracetamol.
|
270
|
+
#
|
271
|
+
# We use backticks and #print here instead of vanilla #system because it
|
272
|
+
# is easier to silence stdout in the existing test suite this way. The
|
273
|
+
# end-user gets the bundler commands called anyway, so no big deal.
|
274
|
+
#
|
275
|
+
# We unset temporary bundler variables to load proper bundler and Gemfile.
|
276
|
+
#
|
277
|
+
# Thanks to James Tucker for the Gem tricks involved in this call.
|
278
|
+
_bundle_command = Gem.bin_path('bundler', 'bundle')
|
279
|
+
|
280
|
+
require 'bundler'
|
281
|
+
Bundler.with_clean_env do
|
282
|
+
print `"#{Gem.ruby}" "#{_bundle_command}" #{command}`
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
def run_bundle
|
287
|
+
bundle_command('install') unless options[:skip_gemfile] || options[:skip_bundle] || options[:pretend]
|
288
|
+
end
|
289
|
+
|
290
|
+
def empty_directory_with_keep_file(destination, config = {})
|
291
|
+
empty_directory(destination, config)
|
292
|
+
keep_file(destination)
|
293
|
+
end
|
294
|
+
|
295
|
+
def keep_file(destination)
|
296
|
+
create_file("#{destination}/.keep") unless options[:skip_keeps]
|
297
|
+
end
|
298
|
+
end
|
299
|
+
end
|
300
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -8,6 +8,8 @@ module Rails
|
|
8
8
|
|
9
9
|
class_option :stylesheets, :type => :boolean, :desc => "Generate Stylesheets"
|
10
10
|
class_option :stylesheet_engine, :desc => "Engine for Stylesheets"
|
11
|
+
class_option :assets, :type => :boolean
|
12
|
+
class_option :resource_route, :type => :boolean
|
11
13
|
|
12
14
|
hook_for :scaffold_controller, :required => true
|
13
15
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'rails/generators/rails/resource/resource_generator'
|
2
|
+
|
3
|
+
module Rails
|
4
|
+
module Generators
|
5
|
+
class ScaffoldGenerator < ResourceGenerator #metagenerator
|
6
|
+
remove_hook_for :resource_controller
|
7
|
+
remove_class_option :actions
|
8
|
+
|
9
|
+
<<<<<<< HEAD
|
10
|
+
class_option :stylesheets, :type => :boolean, :desc => "Generate Stylesheets"
|
11
|
+
class_option :stylesheet_engine, :desc => "Engine for Stylesheets"
|
12
|
+
=======
|
13
|
+
class_option :stylesheets, type: :boolean, desc: "Generate Stylesheets"
|
14
|
+
class_option :stylesheet_engine, desc: "Engine for Stylesheets"
|
15
|
+
class_option :assets, :type => :boolean
|
16
|
+
class_option :resource_route, :type => :boolean
|
17
|
+
>>>>>>> d664409... Merge pull request #10448 from arunagw/bug-fix-scaffold-generator-master
|
18
|
+
|
19
|
+
hook_for :scaffold_controller, :required => true
|
20
|
+
|
21
|
+
hook_for :assets do |assets|
|
22
|
+
invoke assets, [controller_name]
|
23
|
+
end
|
24
|
+
|
25
|
+
hook_for :stylesheet_engine do |stylesheet_engine|
|
26
|
+
invoke stylesheet_engine, [controller_name] if options[:stylesheets] && behavior == :invoke
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/rails/railtie.rb
CHANGED
@@ -145,6 +145,12 @@ module Rails
|
|
145
145
|
@load_console
|
146
146
|
end
|
147
147
|
|
148
|
+
def runner(&blk)
|
149
|
+
@load_runner ||= []
|
150
|
+
@load_runner << blk if blk
|
151
|
+
@load_runner
|
152
|
+
end
|
153
|
+
|
148
154
|
def generators(&blk)
|
149
155
|
@generators ||= []
|
150
156
|
@generators << blk if blk
|
@@ -179,6 +185,10 @@ module Rails
|
|
179
185
|
self.class.console.each { |block| block.call(app) }
|
180
186
|
end
|
181
187
|
|
188
|
+
def load_runner(app=self)
|
189
|
+
self.class.runner.each { |block| block.call(app) }
|
190
|
+
end
|
191
|
+
|
182
192
|
def load_tasks(app=self)
|
183
193
|
extend Rake::DSL if defined? Rake::DSL
|
184
194
|
self.class.rake_tasks.each { |block| self.instance_exec(app, &block) }
|
@@ -123,10 +123,13 @@ namespace :test do
|
|
123
123
|
t.pattern = 'test/integration/**/*_test.rb'
|
124
124
|
end
|
125
125
|
|
126
|
-
|
126
|
+
task 'test:benchmark_mode' do
|
127
|
+
ENV["BENCHMARK_TESTS"] = '1'
|
128
|
+
end
|
129
|
+
|
130
|
+
Rails::SubTestTask.new(:benchmark => ['test:prepare', 'test:benchmark_mode']) do |t|
|
127
131
|
t.libs << 'test'
|
128
132
|
t.pattern = 'test/performance/**/*_test.rb'
|
129
|
-
t.options = '-- --benchmark'
|
130
133
|
end
|
131
134
|
|
132
135
|
Rails::SubTestTask.new(:profile => 'test:prepare') do |t|
|
data/lib/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,112 +1,140 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: railties
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 3193552829
|
5
|
+
prerelease: 7
|
6
|
+
segments:
|
7
|
+
- 3
|
8
|
+
- 2
|
9
|
+
- 14
|
10
|
+
- rc
|
11
|
+
- 1
|
12
|
+
version: 3.2.14.rc1
|
5
13
|
platform: ruby
|
6
|
-
authors:
|
14
|
+
authors:
|
7
15
|
- David Heinemeier Hansson
|
8
16
|
autorequire:
|
9
17
|
bindir: bin
|
10
18
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
+
|
20
|
+
date: 2013-07-12 00:00:00 -03:00
|
21
|
+
default_executable:
|
22
|
+
dependencies:
|
23
|
+
- !ruby/object:Gem::Dependency
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 49
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 8
|
33
|
+
- 7
|
19
34
|
version: 0.8.7
|
20
35
|
type: :runtime
|
36
|
+
name: rake
|
37
|
+
version_requirements: *id001
|
21
38
|
prerelease: false
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
version: 0.8.7
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rack-ssl
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
39
|
+
- !ruby/object:Gem::Dependency
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
31
43
|
- - ~>
|
32
|
-
- !ruby/object:Gem::Version
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 31
|
46
|
+
segments:
|
47
|
+
- 1
|
48
|
+
- 3
|
49
|
+
- 2
|
33
50
|
version: 1.3.2
|
34
51
|
type: :runtime
|
52
|
+
name: rack-ssl
|
53
|
+
version_requirements: *id002
|
35
54
|
prerelease: false
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
- !ruby/object:Gem::
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 43
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
- 14
|
65
|
+
- 6
|
47
66
|
version: 0.14.6
|
48
67
|
- - <
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
hash: 3
|
70
|
+
segments:
|
71
|
+
- 2
|
72
|
+
- 0
|
73
|
+
version: "2.0"
|
51
74
|
type: :runtime
|
75
|
+
name: thor
|
76
|
+
version_requirements: *id003
|
52
77
|
prerelease: false
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
version: 0.14.6
|
58
|
-
- - <
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '2.0'
|
61
|
-
- !ruby/object:Gem::Dependency
|
62
|
-
name: rdoc
|
63
|
-
requirement: !ruby/object:Gem::Requirement
|
64
|
-
requirements:
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
65
82
|
- - ~>
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
hash: 15
|
85
|
+
segments:
|
86
|
+
- 3
|
87
|
+
- 4
|
88
|
+
version: "3.4"
|
68
89
|
type: :runtime
|
90
|
+
name: rdoc
|
91
|
+
version_requirements: *id004
|
69
92
|
prerelease: false
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
- !ruby/object:Gem::
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - "="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
hash: 3193552829
|
100
|
+
segments:
|
101
|
+
- 3
|
102
|
+
- 2
|
103
|
+
- 14
|
104
|
+
- rc
|
105
|
+
- 1
|
106
|
+
version: 3.2.14.rc1
|
82
107
|
type: :runtime
|
108
|
+
name: activesupport
|
109
|
+
version_requirements: *id005
|
83
110
|
prerelease: false
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
- !ruby/object:Gem::
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - "="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
hash: 3193552829
|
118
|
+
segments:
|
119
|
+
- 3
|
120
|
+
- 2
|
121
|
+
- 14
|
122
|
+
- rc
|
123
|
+
- 1
|
124
|
+
version: 3.2.14.rc1
|
96
125
|
type: :runtime
|
126
|
+
name: actionpack
|
127
|
+
version_requirements: *id006
|
97
128
|
prerelease: false
|
98
|
-
|
99
|
-
requirements:
|
100
|
-
- - '='
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: 3.2.13
|
103
|
-
description: 'Rails internals: application bootup, plugins, generators, and rake tasks.'
|
129
|
+
description: "Rails internals: application bootup, plugins, generators, and rake tasks."
|
104
130
|
email: david@loudthinking.com
|
105
|
-
executables:
|
131
|
+
executables:
|
106
132
|
- rails
|
107
133
|
extensions: []
|
134
|
+
|
108
135
|
extra_rdoc_files: []
|
109
|
-
|
136
|
+
|
137
|
+
files:
|
110
138
|
- CHANGELOG.md
|
111
139
|
- README.rdoc
|
112
140
|
- bin/rails
|
@@ -402,6 +430,7 @@ files:
|
|
402
430
|
- lib/rails/generators/actions.rb
|
403
431
|
- lib/rails/generators/active_model.rb
|
404
432
|
- lib/rails/generators/app_base.rb
|
433
|
+
- lib/rails/generators/app_base.rb.orig
|
405
434
|
- lib/rails/generators/base.rb
|
406
435
|
- lib/rails/generators/css/assets/assets_generator.rb
|
407
436
|
- lib/rails/generators/css/assets/templates/stylesheet.css
|
@@ -521,6 +550,7 @@ files:
|
|
521
550
|
- lib/rails/generators/rails/resource/USAGE
|
522
551
|
- lib/rails/generators/rails/resource_route/resource_route_generator.rb
|
523
552
|
- lib/rails/generators/rails/scaffold/scaffold_generator.rb
|
553
|
+
- lib/rails/generators/rails/scaffold/scaffold_generator.rb.orig
|
524
554
|
- lib/rails/generators/rails/scaffold/templates/scaffold.css
|
525
555
|
- lib/rails/generators/rails/scaffold/USAGE
|
526
556
|
- lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb
|
@@ -589,29 +619,54 @@ files:
|
|
589
619
|
- lib/rails/test_unit/testing.rake
|
590
620
|
- lib/rails/version.rb
|
591
621
|
- lib/rails.rb
|
622
|
+
- lib/rails/generators/rails/app/templates/app/mailers/.empty_directory
|
623
|
+
- lib/rails/generators/rails/app/templates/app/models/.empty_directory
|
624
|
+
- lib/rails/generators/rails/app/templates/public/stylesheets/.empty_directory
|
625
|
+
- lib/rails/generators/rails/app/templates/test/fixtures/.empty_directory
|
626
|
+
- lib/rails/generators/rails/app/templates/test/functional/.empty_directory
|
627
|
+
- lib/rails/generators/rails/app/templates/test/integration/.empty_directory
|
628
|
+
- lib/rails/generators/rails/app/templates/test/unit/.empty_directory
|
629
|
+
- lib/rails/generators/rails/generator/templates/templates/.empty_directory
|
630
|
+
- lib/rails/generators/rails/plugin_new/templates/app/mailers/.empty_directory
|
631
|
+
- lib/rails/generators/rails/plugin_new/templates/app/models/.empty_directory
|
632
|
+
has_rdoc: true
|
592
633
|
homepage: http://www.rubyonrails.org
|
593
|
-
licenses:
|
594
|
-
|
634
|
+
licenses:
|
635
|
+
- MIT
|
595
636
|
post_install_message:
|
596
|
-
rdoc_options:
|
637
|
+
rdoc_options:
|
597
638
|
- --exclude
|
598
639
|
- .
|
599
|
-
require_paths:
|
640
|
+
require_paths:
|
600
641
|
- lib
|
601
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
602
|
-
|
603
|
-
|
604
|
-
|
642
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
643
|
+
none: false
|
644
|
+
requirements:
|
645
|
+
- - ">="
|
646
|
+
- !ruby/object:Gem::Version
|
647
|
+
hash: 57
|
648
|
+
segments:
|
649
|
+
- 1
|
650
|
+
- 8
|
651
|
+
- 7
|
605
652
|
version: 1.8.7
|
606
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
653
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
654
|
+
none: false
|
655
|
+
requirements:
|
656
|
+
- - ">"
|
657
|
+
- !ruby/object:Gem::Version
|
658
|
+
hash: 25
|
659
|
+
segments:
|
660
|
+
- 1
|
661
|
+
- 3
|
662
|
+
- 1
|
663
|
+
version: 1.3.1
|
611
664
|
requirements: []
|
665
|
+
|
612
666
|
rubyforge_project:
|
613
|
-
rubygems_version:
|
667
|
+
rubygems_version: 1.6.2
|
614
668
|
signing_key:
|
615
|
-
specification_version:
|
669
|
+
specification_version: 3
|
616
670
|
summary: Tools for creating, working with, and running Rails applications.
|
617
671
|
test_files: []
|
672
|
+
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 27669ce6f8d0d1fb81944bd7e2da44438a32110c
|
4
|
-
data.tar.gz: 42050e5bd14752da87d84cee611603dbb4ac205c
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 56e217902b4c56d87b6531fb8310ea5bce2722b19c90cc1af61c3e8e672e792b4a99148be3db9272f5d22fee5ed0b9b2e79602aa9b84744fdcc31057ef849b1b
|
7
|
-
data.tar.gz: 692ab9f18abec5aed529b5f71267c7a2325b5e827eec485ba1a63f2f211312a78271e3a7106dd7b2a54039e82953349d4d47d926536f1bac821d3d634947180c
|