actionpack 3.1.0.rc6 → 3.1.0.rc8

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionpack might be problematic. Click here for more details.

data/CHANGELOG CHANGED
@@ -1,5 +1,7 @@
1
1
  *Rails 3.1.0 (unreleased)*
2
2
 
3
+ * Param values are `paramified` in controller tests. [David Chelimsky]
4
+
3
5
  * x_sendfile_header now defaults to nil and config/environments/production.rb doesn't set a particular value for it. This allows servers to set it through X-Sendfile-Type. [Santiago Pastorino]
4
6
 
5
7
  * The submit form helper does not generate an id "object_name_id" anymore. [fbrusatti]
@@ -63,7 +63,7 @@ module ActionController
63
63
  #
64
64
  # == Sessions
65
65
  #
66
- # Sessions allows you to store objects in between requests. This is useful for objects that are not yet ready to be persisted,
66
+ # Sessions allow you to store objects in between requests. This is useful for objects that are not yet ready to be persisted,
67
67
  # such as a Signup object constructed in a multi-paged process, or objects that don't change much and are needed all the time, such
68
68
  # as a User object for a system that requires login. The session should not be used, however, as a cache for objects where it's likely
69
69
  # they could be changed unknowingly. It's usually too much work to keep it all synchronized -- something databases already excel at.
@@ -9,10 +9,9 @@ module ActionController
9
9
  # Wraps parameters hash into nested hash. This will allow client to submit
10
10
  # POST request without having to specify a root element in it.
11
11
  #
12
- # By default this functionality won't be enabled. You can enable
13
- # it globally by setting +ActionController::Base.wrap_parameters+:
14
- #
15
- # ActionController::Base.wrap_parameters = [:json]
12
+ # This functionality is enabled in +config/initializers/wrap_parameters.rb+
13
+ # and can be customized. If you are upgrading to Rails 3.1, this file will
14
+ # need to be created for the functionality to be enabled.
16
15
  #
17
16
  # You could also turn it on per controller by setting the format array to
18
17
  # non-empty array:
@@ -45,7 +45,7 @@ module ActionController
45
45
  # integer, or a symbol representing the downcased, underscored and symbolized description.
46
46
  # Note that the status code must be a 3xx HTTP code, or redirection will not occur.
47
47
  #
48
- # It is also possible to assign a flash message as part of the redirection. There are two special accessors for commonly used the flash names
48
+ # It is also possible to assign a flash message as part of the redirection. There are two special accessors for the commonly used flash names
49
49
  # +alert+ and +notice+ as well as a general purpose +flash+ bucket.
50
50
  #
51
51
  # Examples:
@@ -18,7 +18,7 @@
18
18
  # @url = root_path # named route from the application.
19
19
  # end
20
20
  # end
21
- # =>
21
+ #
22
22
  module ActionController
23
23
  module UrlFor
24
24
  extend ActiveSupport::Concern
@@ -184,7 +184,7 @@ module ActionController
184
184
  @env.delete_if { |k, v| k =~ /^action_dispatch\.rescue/ }
185
185
  @symbolized_path_params = nil
186
186
  @method = @request_method = nil
187
- @fullpath = @ip = @remote_ip = nil
187
+ @fullpath = @ip = @remote_ip = @protocol = nil
188
188
  @env['action_dispatch.request.query_parameters'] = {}
189
189
  end
190
190
  end
@@ -398,9 +398,7 @@ module ActionController
398
398
  def paramify_values(hash_or_array_or_value)
399
399
  case hash_or_array_or_value
400
400
  when Hash
401
- hash_or_array_or_value.each do |key, value|
402
- hash_or_array_or_value[key] = paramify_values(value)
403
- end
401
+ Hash[hash_or_array_or_value.map{|key, value| [key, paramify_values(value)] }]
404
402
  when Array
405
403
  hash_or_array_or_value.map {|i| paramify_values(i)}
406
404
  when Rack::Test::UploadedFile
@@ -413,7 +411,7 @@ module ActionController
413
411
  def process(action, parameters = nil, session = nil, flash = nil, http_method = 'GET')
414
412
  # Ensure that numbers and symbols passed as params are converted to
415
413
  # proper params, as is the case when engaging rack.
416
- paramify_values(parameters)
414
+ parameters = paramify_values(parameters)
417
415
 
418
416
  # Sanity check for required instance variables so we can give an
419
417
  # understandable error message.
@@ -447,7 +445,7 @@ module ActionController
447
445
  @controller.params.merge!(parameters)
448
446
  build_request_uri(action, parameters)
449
447
  @controller.class.class_eval { include Testing }
450
- @controller.recycle!
448
+ @controller.recycle!
451
449
  @controller.process_with_new_base_test(@request, @response)
452
450
  @assigns = @controller.respond_to?(:view_assigns) ? @controller.view_assigns : {}
453
451
  @request.session.delete('flash') if @request.session['flash'].blank?
@@ -3,7 +3,7 @@ module ActionPack
3
3
  MAJOR = 3
4
4
  MINOR = 1
5
5
  TINY = 0
6
- PRE = "rc6"
6
+ PRE = "rc8"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
9
9
  end
@@ -268,7 +268,7 @@ module ActionView
268
268
  # to change the HTTP verb used to submit the form.
269
269
  #
270
270
  # ==== Options
271
- # The +options+ hash accepts the same options as url_for.
271
+ # The +options+ hash accepts the same options as +url_for+.
272
272
  #
273
273
  # There are a few special +html_options+:
274
274
  # * <tt>:method</tt> - Symbol of HTTP verb. Supported verbs are <tt>:post</tt>, <tt>:get</tt>,
@@ -164,7 +164,7 @@ module ActionView
164
164
  end
165
165
 
166
166
  def escape_entry(entry)
167
- entry.gsub(/(\*|\[|\]|\{|\}|\?)/, "\\\\\\1")
167
+ entry.gsub(/[*?{}\[\]]/, '\\\\\\&')
168
168
  end
169
169
 
170
170
  # Returns the file mtime from the filesystem.
@@ -13,17 +13,43 @@ namespace :assets do
13
13
  # Ensure that action view is loaded and the appropriate sprockets hooks get executed
14
14
  ActionView::Base
15
15
 
16
- assets = Rails.application.config.assets.precompile
17
16
  # Always perform caching so that asset_path appends the timestamps to file references.
18
17
  Rails.application.config.action_controller.perform_caching = true
19
- Rails.application.assets.precompile(*assets)
18
+
19
+ config = Rails.application.config
20
+ env = Rails.application.assets
21
+ target = Rails.root.join("public#{config.assets.prefix}")
22
+
23
+ if env.respond_to?(:each_logical_path)
24
+ config.assets.precompile.each do |path|
25
+ env.each_logical_path do |logical_path|
26
+ if path.is_a?(Regexp)
27
+ next unless path.match(logical_path)
28
+ else
29
+ next unless File.fnmatch(path.to_s, logical_path)
30
+ end
31
+
32
+ if asset = env.find_asset(logical_path)
33
+ filename = target.join(asset.digest_path)
34
+ mkdir_p filename.dirname
35
+ asset.write_to(filename)
36
+ asset.write_to("#{filename}.gz") if filename.to_s =~ /\.(css|js)$/
37
+ end
38
+ end
39
+ end
40
+ else
41
+ # TODO: Remove this once we're depending on sprockets beta 15
42
+ assets = config.assets.precompile.dup
43
+ assets << {:to => target}
44
+ env.precompile(*assets)
45
+ end
20
46
  end
21
47
  end
22
48
 
23
49
  desc "Remove compiled assets"
24
50
  task :clean => [:environment, 'tmp:cache:clear'] do
25
- assets = Rails.application.config.assets
26
- public_asset_path = Rails.public_path + assets.prefix
51
+ config = Rails.application.config
52
+ public_asset_path = File.join(Rails.public_path, config.assets.prefix)
27
53
  rm_rf public_asset_path, :secure => true
28
54
  end
29
55
  end
@@ -43,17 +43,18 @@ module Sprockets
43
43
  options = sources.extract_options!
44
44
  debug = options.key?(:debug) ? options.delete(:debug) : debug_assets?
45
45
  body = options.key?(:body) ? options.delete(:body) : false
46
+ media = options.key?(:media) ? options.delete(:media) : "screen"
46
47
 
47
48
  sources.collect do |source|
48
49
  if debug && asset = asset_paths.asset_for(source, 'css')
49
50
  asset.to_a.map { |dep|
50
- stylesheet_link_tag(dep, :debug => false, :body => true)
51
+ stylesheet_link_tag(dep, :media => media, :debug => false, :body => true)
51
52
  }.join("\n").html_safe
52
53
  else
53
54
  tag_options = {
54
55
  'rel' => "stylesheet",
55
56
  'type' => "text/css",
56
- 'media' => "screen",
57
+ 'media' => media,
57
58
  'href' => asset_path(source, 'css', body, :request)
58
59
  }.merge(options.stringify_keys)
59
60
 
@@ -70,10 +71,10 @@ module Sprockets
70
71
 
71
72
  private
72
73
  def debug_assets?
73
- params[:debug_assets] == '1' ||
74
- params[:debug_assets] == 'true'
75
- rescue NoMethodError
76
- false
74
+ Rails.application.config.assets.allow_debugging &&
75
+ (Rails.application.config.assets.debug ||
76
+ params[:debug_assets] == '1' ||
77
+ params[:debug_assets] == 'true')
77
78
  end
78
79
 
79
80
  # Override to specify an alternative prefix for asset path generation.
@@ -112,11 +113,22 @@ module Sprockets
112
113
  asset_environment[source]
113
114
  end
114
115
 
116
+ def digest_for(logical_path)
117
+ if asset = asset_environment[logical_path]
118
+ return asset.digest_path
119
+ end
120
+
121
+ logical_path
122
+ end
123
+
115
124
  def rewrite_asset_path(source, dir)
116
125
  if source[0] == ?/
117
126
  source
118
127
  else
119
- asset_environment.path(source, performing_caching?, dir)
128
+ source = digest_for(source) if performing_caching?
129
+ source = File.join(dir, source)
130
+ source = "/#{source}" unless source =~ /^\//
131
+ source
120
132
  end
121
133
  end
122
134
 
@@ -18,9 +18,8 @@ module Sprockets
18
18
  require 'sprockets'
19
19
 
20
20
  app.assets = Sprockets::Environment.new(app.root.to_s) do |env|
21
- env.static_root = File.join(app.root.join('public'), config.assets.prefix)
22
- env.logger = ::Rails.logger
23
- env.version = ::Rails.env + "#{'-' + config.assets.version if config.assets.version.present?}"
21
+ env.logger = ::Rails.logger
22
+ env.version = ::Rails.env + "-#{config.assets.version}"
24
23
 
25
24
  if config.assets.cache_store != false
26
25
  env.cache = ActiveSupport::Cache.lookup_store(config.assets.cache_store) || ::Rails.cache
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionpack
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15424105
5
- prerelease: 6
4
+ hash: 977940593
5
+ prerelease: true
6
6
  segments:
7
7
  - 3
8
8
  - 1
9
9
  - 0
10
- - rc
11
- - 6
12
- version: 3.1.0.rc6
10
+ - rc8
11
+ version: 3.1.0.rc8
13
12
  platform: ruby
14
13
  authors:
15
14
  - David Heinemeier Hansson
@@ -17,7 +16,8 @@ autorequire:
17
16
  bindir: bin
18
17
  cert_chain: []
19
18
 
20
- date: 2011-08-16 00:00:00 Z
19
+ date: 2011-08-29 00:00:00 -03:00
20
+ default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: activesupport
@@ -27,14 +27,13 @@ dependencies:
27
27
  requirements:
28
28
  - - "="
29
29
  - !ruby/object:Gem::Version
30
- hash: 15424105
30
+ hash: 977940593
31
31
  segments:
32
32
  - 3
33
33
  - 1
34
34
  - 0
35
- - rc
36
- - 6
37
- version: 3.1.0.rc6
35
+ - rc8
36
+ version: 3.1.0.rc8
38
37
  type: :runtime
39
38
  version_requirements: *id001
40
39
  - !ruby/object:Gem::Dependency
@@ -45,14 +44,13 @@ dependencies:
45
44
  requirements:
46
45
  - - "="
47
46
  - !ruby/object:Gem::Version
48
- hash: 15424105
47
+ hash: 977940593
49
48
  segments:
50
49
  - 3
51
50
  - 1
52
51
  - 0
53
- - rc
54
- - 6
55
- version: 3.1.0.rc6
52
+ - rc8
53
+ version: 3.1.0.rc8
56
54
  type: :runtime
57
55
  version_requirements: *id002
58
56
  - !ruby/object:Gem::Dependency
@@ -63,12 +61,12 @@ dependencies:
63
61
  requirements:
64
62
  - - ~>
65
63
  - !ruby/object:Gem::Version
66
- hash: 19
64
+ hash: 17
67
65
  segments:
68
66
  - 1
69
67
  - 0
70
- - 2
71
- version: 1.0.2
68
+ - 3
69
+ version: 1.0.3
72
70
  type: :runtime
73
71
  version_requirements: *id003
74
72
  - !ruby/object:Gem::Dependency
@@ -126,12 +124,12 @@ dependencies:
126
124
  requirements:
127
125
  - - ~>
128
126
  - !ruby/object:Gem::Version
129
- hash: 7
127
+ hash: 5
130
128
  segments:
131
129
  - 0
132
130
  - 6
133
- - 0
134
- version: 0.6.0
131
+ - 1
132
+ version: 0.6.1
135
133
  type: :runtime
136
134
  version_requirements: *id007
137
135
  - !ruby/object:Gem::Dependency
@@ -142,12 +140,12 @@ dependencies:
142
140
  requirements:
143
141
  - - ~>
144
142
  - !ruby/object:Gem::Version
145
- hash: 61
143
+ hash: 59
146
144
  segments:
147
145
  - 0
148
146
  - 8
149
- - 1
150
- version: 0.8.1
147
+ - 2
148
+ version: 0.8.2
151
149
  type: :runtime
152
150
  version_requirements: *id008
153
151
  - !ruby/object:Gem::Dependency
@@ -158,14 +156,14 @@ dependencies:
158
156
  requirements:
159
157
  - - ~>
160
158
  - !ruby/object:Gem::Version
161
- hash: 62196475
159
+ hash: 62196477
162
160
  segments:
163
161
  - 2
164
162
  - 0
165
163
  - 0
166
164
  - beta
167
- - 12
168
- version: 2.0.0.beta.12
165
+ - 15
166
+ version: 2.0.0.beta.15
169
167
  type: :runtime
170
168
  version_requirements: *id009
171
169
  - !ruby/object:Gem::Dependency
@@ -394,6 +392,7 @@ files:
394
392
  - lib/sprockets/helpers/rails_helper.rb
395
393
  - lib/sprockets/helpers.rb
396
394
  - lib/sprockets/railtie.rb
395
+ has_rdoc: true
397
396
  homepage: http://www.rubyonrails.org
398
397
  licenses: []
399
398
 
@@ -427,7 +426,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
427
426
  requirements:
428
427
  - none
429
428
  rubyforge_project:
430
- rubygems_version: 1.8.8
429
+ rubygems_version: 1.3.7
431
430
  signing_key:
432
431
  specification_version: 3
433
432
  summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).