railties 4.2.2 → 4.2.3.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -1
- data/lib/rails/app_rails_loader.rb +1 -1
- data/lib/rails/application.rb +1 -1
- data/lib/rails/code_statistics.rb +2 -4
- data/lib/rails/commands/dbconsole.rb +1 -1
- data/lib/rails/gem_version.rb +2 -2
- data/lib/rails/generators.rb +1 -3
- data/lib/rails/generators/test_unit/controller/templates/functional_test.rb +6 -0
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +9 -0
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb +4 -1
- data/lib/rails/generators/testing/assertions.rb +1 -1
- data/lib/rails/mailers_controller.rb +13 -11
- data/lib/rails/templates/rails/mailers/email.html.erb +13 -2
- data/lib/rails/templates/rails/mailers/index.html.erb +2 -2
- data/lib/rails/templates/rails/mailers/mailer.html.erb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe8408f8da8762ff76cfd6349462f400e492d87b
|
4
|
+
data.tar.gz: ed185c48cbf54a6cb78e04f94a861ec1ad3807fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50683454a5d5731a211b79564e0fbfb9e549bf1b5acd8e4713352e14ca2fcaca8de06f9947747890d5bb3e656357a78e988f16f6d5098e08ddc8d675ee2de2af
|
7
|
+
data.tar.gz: a184e2c1dfca9747b29791484d06e7893c04a01f7a71250ab9926ecd87c39b5ddcbe0fb4cfd59d2aa6cbf2aae74df0e8e1621167014a1b7cd8d788e70fbc45a6
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,37 @@
|
|
1
|
+
## Rails 4.2.3 (June 22, 2015) ##
|
2
|
+
|
3
|
+
* `assert_file` understands paths with special characters
|
4
|
+
(eg. `v0.1.4~alpha+nightly`).
|
5
|
+
|
6
|
+
*Diego Carrion*
|
7
|
+
|
8
|
+
* Make generated scaffold functional tests work inside engines.
|
9
|
+
|
10
|
+
*Yuji Yaginuma*
|
11
|
+
|
12
|
+
* Add support for inline images in mailer previews by using an interceptor
|
13
|
+
class to convert cid: urls in image src attributes to data urls. The
|
14
|
+
interceptor is not enabled by default but can be done in an initializer:
|
15
|
+
|
16
|
+
# config/initializer/preview_interceptors.rb
|
17
|
+
ActionMailer::Base.register_preview_interceptor(ActionMailer::InlinePreviewInterceptor)
|
18
|
+
|
19
|
+
*Andrew White*
|
20
|
+
|
21
|
+
* Fix mailer previews with attachments by using the mail gem's own API to
|
22
|
+
locate the first part of the correct mime type.
|
23
|
+
|
24
|
+
Fixes #14435.
|
25
|
+
|
26
|
+
*Andrew White*
|
27
|
+
|
28
|
+
|
1
29
|
## Rails 4.2.2 (June 16, 2015) ##
|
2
30
|
|
3
31
|
* No Changes *
|
4
32
|
|
5
33
|
|
6
|
-
## Rails 4.2.1 (March 19,
|
34
|
+
## Rails 4.2.1 (March 19, 2015) ##
|
7
35
|
|
8
36
|
* Add a new-line to the end of route method generated code.
|
9
37
|
|
data/lib/rails/application.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'fileutils'
|
2
|
+
require 'yaml'
|
2
3
|
require 'active_support/core_ext/hash/keys'
|
3
4
|
require 'active_support/core_ext/object/blank'
|
4
5
|
require 'active_support/key_generator'
|
@@ -227,7 +228,6 @@ module Rails
|
|
227
228
|
yaml = Pathname.new("#{paths["config"].existent.first}/#{name}.yml")
|
228
229
|
|
229
230
|
if yaml.exist?
|
230
|
-
require "yaml"
|
231
231
|
require "erb"
|
232
232
|
(YAML.load(ERB.new(yaml.read).result) || {})[Rails.env] || {}
|
233
233
|
else
|
@@ -43,11 +43,9 @@ class CodeStatistics #:nodoc:
|
|
43
43
|
|
44
44
|
if File.directory?(path) && (/^\./ !~ file_name)
|
45
45
|
stats.add(calculate_directory_statistics(path, pattern))
|
46
|
+
elsif file_name =~ pattern
|
47
|
+
stats.add_by_file_path(path)
|
46
48
|
end
|
47
|
-
|
48
|
-
next unless file_name =~ pattern
|
49
|
-
|
50
|
-
stats.add_by_file_path(path)
|
51
49
|
end
|
52
50
|
|
53
51
|
stats
|
data/lib/rails/gem_version.rb
CHANGED
data/lib/rails/generators.rb
CHANGED
@@ -159,7 +159,7 @@ module Rails
|
|
159
159
|
options = sorted_groups.map(&:last).flatten
|
160
160
|
suggestions = options.sort_by {|suggested| levenshtein_distance(namespace.to_s, suggested) }.first(3)
|
161
161
|
msg = "Could not find generator '#{namespace}'. "
|
162
|
-
msg << "Maybe you meant #{ suggestions.map {|s| "'#{s}'"}.
|
162
|
+
msg << "Maybe you meant #{ suggestions.map {|s| "'#{s}'"}.to_sentence(last_word_connector: " or ") }\n"
|
163
163
|
msg << "Run `rails generate --help` for more options."
|
164
164
|
puts msg
|
165
165
|
end
|
@@ -260,11 +260,9 @@ module Rails
|
|
260
260
|
t = str2
|
261
261
|
n = s.length
|
262
262
|
m = t.length
|
263
|
-
max = n/2
|
264
263
|
|
265
264
|
return m if (0 == n)
|
266
265
|
return n if (0 == m)
|
267
|
-
return n if (n - m).abs > max
|
268
266
|
|
269
267
|
d = (0..m).to_a
|
270
268
|
x = nil
|
@@ -2,6 +2,12 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
<% module_namespacing do -%>
|
4
4
|
class <%= class_name %>ControllerTest < ActionController::TestCase
|
5
|
+
<% if defined?(ENGINE_ROOT) -%>
|
6
|
+
setup do
|
7
|
+
@routes = Engine.routes
|
8
|
+
end
|
9
|
+
|
10
|
+
<% end -%>
|
5
11
|
<% if actions.empty? -%>
|
6
12
|
# test "the truth" do
|
7
13
|
# assert true
|
@@ -15,6 +15,15 @@ module TestUnit # :nodoc:
|
|
15
15
|
File.join("test/controllers", controller_class_path, "#{controller_file_name}_controller_test.rb")
|
16
16
|
end
|
17
17
|
|
18
|
+
def fixture_name
|
19
|
+
@fixture_name ||=
|
20
|
+
if defined?(ENGINE_ROOT)
|
21
|
+
"%s_%s" % [namespaced_path, table_name]
|
22
|
+
else
|
23
|
+
table_name
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
18
27
|
private
|
19
28
|
|
20
29
|
def attributes_hash
|
@@ -3,7 +3,10 @@ require 'test_helper'
|
|
3
3
|
<% module_namespacing do -%>
|
4
4
|
class <%= controller_class_name %>ControllerTest < ActionController::TestCase
|
5
5
|
setup do
|
6
|
-
@<%= singular_table_name %> = <%=
|
6
|
+
@<%= singular_table_name %> = <%= fixture_name %>(:one)
|
7
|
+
<% if defined?(ENGINE_ROOT) -%>
|
8
|
+
@routes = Engine.routes
|
9
|
+
<% end -%>
|
7
10
|
end
|
8
11
|
|
9
12
|
test "should get index" do
|
@@ -23,7 +23,7 @@ module Rails
|
|
23
23
|
# end
|
24
24
|
# end
|
25
25
|
def assert_file(relative, *contents)
|
26
|
-
absolute = File.expand_path(relative, destination_root)
|
26
|
+
absolute = File.expand_path(relative, destination_root)
|
27
27
|
assert File.exist?(absolute), "Expected file #{relative.inspect} to exist, but does not"
|
28
28
|
|
29
29
|
read = File.read(absolute) if block_given? || !contents.empty?
|
@@ -16,10 +16,10 @@ class Rails::MailersController < Rails::ApplicationController # :nodoc:
|
|
16
16
|
@page_title = "Mailer Previews for #{@preview.preview_name}"
|
17
17
|
render action: 'mailer'
|
18
18
|
else
|
19
|
-
|
19
|
+
@email_action = File.basename(params[:path])
|
20
20
|
|
21
|
-
if @preview.email_exists?(
|
22
|
-
@email = @preview.call(
|
21
|
+
if @preview.email_exists?(@email_action)
|
22
|
+
@email = @preview.call(@email_action)
|
23
23
|
|
24
24
|
if params[:part]
|
25
25
|
part_type = Mime::Type.lookup(params[:part])
|
@@ -28,14 +28,14 @@ class Rails::MailersController < Rails::ApplicationController # :nodoc:
|
|
28
28
|
response.content_type = part_type
|
29
29
|
render text: part.respond_to?(:decoded) ? part.decoded : part
|
30
30
|
else
|
31
|
-
raise AbstractController::ActionNotFound, "Email part '#{part_type}' not found in #{@preview.name}##{
|
31
|
+
raise AbstractController::ActionNotFound, "Email part '#{part_type}' not found in #{@preview.name}##{@email_action}"
|
32
32
|
end
|
33
33
|
else
|
34
34
|
@part = find_preferred_part(request.format, Mime::HTML, Mime::TEXT)
|
35
35
|
render action: 'email', layout: false, formats: %w[html]
|
36
36
|
end
|
37
37
|
else
|
38
|
-
raise AbstractController::ActionNotFound, "Email '#{
|
38
|
+
raise AbstractController::ActionNotFound, "Email '#{@email_action}' not found in #{@preview.name}"
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
@@ -54,18 +54,20 @@ class Rails::MailersController < Rails::ApplicationController # :nodoc:
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def find_preferred_part(*formats)
|
57
|
-
|
58
|
-
|
59
|
-
return
|
57
|
+
formats.each do |format|
|
58
|
+
if part = @email.find_first_mime_type(format)
|
59
|
+
return part
|
60
60
|
end
|
61
|
-
|
61
|
+
end
|
62
|
+
|
63
|
+
if formats.any?{ |f| @email.mime_type == f }
|
62
64
|
@email
|
63
65
|
end
|
64
66
|
end
|
65
67
|
|
66
68
|
def find_part(format)
|
67
|
-
if @email.
|
68
|
-
|
69
|
+
if part = @email.find_first_mime_type(format)
|
70
|
+
part
|
69
71
|
elsif @email.mime_type == format
|
70
72
|
@email
|
71
73
|
end
|
@@ -39,6 +39,10 @@
|
|
39
39
|
padding: 1px;
|
40
40
|
}
|
41
41
|
|
42
|
+
dd:empty:before {
|
43
|
+
content: "\00a0"; //
|
44
|
+
}
|
45
|
+
|
42
46
|
iframe {
|
43
47
|
border: 0;
|
44
48
|
width: 100%;
|
@@ -84,7 +88,7 @@
|
|
84
88
|
<% unless @email.attachments.nil? || @email.attachments.empty? %>
|
85
89
|
<dt>Attachments:</dt>
|
86
90
|
<dd>
|
87
|
-
<%= @email.attachments.map { |a| a.respond_to?(:original_filename) ? a.original_filename : a.filename }.
|
91
|
+
<%= @email.attachments.map { |a| a.respond_to?(:original_filename) ? a.original_filename : a.filename }.join(', ') %>
|
88
92
|
</dd>
|
89
93
|
<% end %>
|
90
94
|
|
@@ -99,7 +103,14 @@
|
|
99
103
|
</dl>
|
100
104
|
</header>
|
101
105
|
|
102
|
-
|
106
|
+
<% if @part && @part.mime_type %>
|
107
|
+
<iframe seamless name="messageBody" src="?part=<%= Rack::Utils.escape(@part.mime_type) %>"></iframe>
|
108
|
+
<% else %>
|
109
|
+
<p>
|
110
|
+
You are trying to preview an email that does not have any content.
|
111
|
+
This is probably because the <em>mail</em> method has not been called in <em><%= @preview.preview_name %>#<%= @email_action %></em>.
|
112
|
+
</p>
|
113
|
+
<% end %>
|
103
114
|
|
104
115
|
</body>
|
105
116
|
</html>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<% @previews.each do |preview| %>
|
2
|
-
<h3><%= link_to preview.preview_name.titleize, "
|
2
|
+
<h3><%= link_to preview.preview_name.titleize, url_for(controller: "rails/mailers", action: "preview", path: preview.preview_name) %></h3>
|
3
3
|
<ul>
|
4
4
|
<% preview.emails.each do |email| %>
|
5
|
-
<li><%= link_to email, "
|
5
|
+
<li><%= link_to email, url_for(controller: "rails/mailers", action: "preview", path: "#{preview.preview_name}/#{email}") %></li>
|
6
6
|
<% end %>
|
7
7
|
</ul>
|
8
8
|
<% end %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<h3><%= @preview.preview_name.titleize %></h3>
|
2
2
|
<ul>
|
3
3
|
<% @preview.emails.each do |email| %>
|
4
|
-
<li><%= link_to email, "
|
4
|
+
<li><%= link_to email, url_for(controller: "rails/mailers", action: "preview", path: "#{@preview.preview_name}/#{email}") %></li>
|
5
5
|
<% end %>
|
6
6
|
</ul>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: railties
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.3.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.2.
|
19
|
+
version: 4.2.3.rc1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.2.
|
26
|
+
version: 4.2.3.rc1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: actionpack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 4.2.
|
33
|
+
version: 4.2.3.rc1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 4.2.
|
40
|
+
version: 4.2.3.rc1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -78,14 +78,14 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - '='
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 4.2.
|
81
|
+
version: 4.2.3.rc1
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - '='
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: 4.2.
|
88
|
+
version: 4.2.3.rc1
|
89
89
|
description: 'Rails internals: application bootup, plugins, generators, and rake tasks.'
|
90
90
|
email: david@loudthinking.com
|
91
91
|
executables:
|
@@ -352,9 +352,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
352
352
|
version: 1.9.3
|
353
353
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
354
354
|
requirements:
|
355
|
-
- - "
|
355
|
+
- - ">"
|
356
356
|
- !ruby/object:Gem::Version
|
357
|
-
version:
|
357
|
+
version: 1.3.1
|
358
358
|
requirements: []
|
359
359
|
rubyforge_project:
|
360
360
|
rubygems_version: 2.4.5
|