actionpack 1.12.1 → 1.12.2

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,4 +1,11 @@
1
- *1.12.1* (April 6th, 2005)
1
+ *1.12.2* (June 27th, 2006)
2
+
3
+ * Refinement to avoid exceptions in traverse_to_controller.
4
+
5
+ * (Hackish) Fix loading of arbitrary files in Ruby's load path by traverse_to_controller. [Nicholas Seckar]
6
+
7
+
8
+ *1.12.1* (April 6th, 2006)
2
9
 
3
10
  * Fixed that template extensions would be cached development mode #4624 [Stefan Kaes]
4
11
 
@@ -30,7 +37,7 @@
30
37
  This can be used by deployment managers to set the asset id by application revision
31
38
 
32
39
 
33
- *1.12.0* (March 27th, 2005)
40
+ *1.12.0* (March 27th, 2006)
34
41
 
35
42
  * Add documentation for respond_to. [Jamis Buck]
36
43
 
@@ -73,7 +73,7 @@ spec = Gem::Specification.new do |s|
73
73
  s.require_path = 'lib'
74
74
  s.autorequire = 'action_controller'
75
75
 
76
- s.files = [ "rakefile", "install.rb", "README", "RUNNING_UNIT_TESTS", "CHANGELOG", "MIT-LICENSE", "examples/.htaccess" ]
76
+ s.files = [ "Rakefile", "install.rb", "README", "RUNNING_UNIT_TESTS", "CHANGELOG", "MIT-LICENSE", "examples/.htaccess" ]
77
77
  dist_dirs.each do |dir|
78
78
  s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
79
79
  end
@@ -136,116 +136,12 @@ task :pdoc => [:rdoc] do
136
136
  end
137
137
 
138
138
  desc "Publish the release files to RubyForge."
139
- task :release => [:package] do
140
- files = ["gem", "tgz", "zip"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" }
141
-
142
- if RUBY_FORGE_PROJECT then
143
- require 'net/http'
144
- require 'open-uri'
145
-
146
- project_uri = "http://rubyforge.org/projects/#{RUBY_FORGE_PROJECT}/"
147
- project_data = open(project_uri) { |data| data.read }
148
- group_id = project_data[/[?&]group_id=(\d+)/, 1]
149
- raise "Couldn't get group id" unless group_id
150
-
151
- # This echos password to shell which is a bit sucky
152
- if ENV["RUBY_FORGE_PASSWORD"]
153
- password = ENV["RUBY_FORGE_PASSWORD"]
154
- else
155
- print "#{RUBY_FORGE_USER}@rubyforge.org's password: "
156
- password = STDIN.gets.chomp
157
- end
158
-
159
- login_response = Net::HTTP.start("rubyforge.org", 80) do |http|
160
- data = [
161
- "login=1",
162
- "form_loginname=#{RUBY_FORGE_USER}",
163
- "form_pw=#{password}"
164
- ].join("&")
165
- http.post("/account/login.php", data)
166
- end
139
+ task :release => [ :package ] do
140
+ `rubyforge login`
167
141
 
168
- cookie = login_response["set-cookie"]
169
- raise "Login failed" unless cookie
170
- headers = { "Cookie" => cookie }
171
-
172
- release_uri = "http://rubyforge.org/frs/admin/?group_id=#{group_id}"
173
- release_data = open(release_uri, headers) { |data| data.read }
174
- package_id = release_data[/[?&]package_id=(\d+)/, 1]
175
- raise "Couldn't get package id" unless package_id
176
-
177
- first_file = true
178
- release_id = ""
179
-
180
- files.each do |filename|
181
- basename = File.basename(filename)
182
- file_ext = File.extname(filename)
183
- file_data = File.open(filename, "rb") { |file| file.read }
184
-
185
- puts "Releasing #{basename}..."
186
-
187
- release_response = Net::HTTP.start("rubyforge.org", 80) do |http|
188
- release_date = Time.now.strftime("%Y-%m-%d %H:%M")
189
- type_map = {
190
- ".zip" => "3000",
191
- ".tgz" => "3110",
192
- ".gz" => "3110",
193
- ".gem" => "1400"
194
- }; type_map.default = "9999"
195
- type = type_map[file_ext]
196
- boundary = "rubyqMY6QN9bp6e4kS21H4y0zxcvoor"
197
-
198
- query_hash = if first_file then
199
- {
200
- "group_id" => group_id,
201
- "package_id" => package_id,
202
- "release_name" => RELEASE_NAME,
203
- "release_date" => release_date,
204
- "type_id" => type,
205
- "processor_id" => "8000", # Any
206
- "release_notes" => "",
207
- "release_changes" => "",
208
- "preformatted" => "1",
209
- "submit" => "1"
210
- }
211
- else
212
- {
213
- "group_id" => group_id,
214
- "release_id" => release_id,
215
- "package_id" => package_id,
216
- "step2" => "1",
217
- "type_id" => type,
218
- "processor_id" => "8000", # Any
219
- "submit" => "Add This File"
220
- }
221
- end
222
-
223
- query = "?" + query_hash.map do |(name, value)|
224
- [name, URI.encode(value)].join("=")
225
- end.join("&")
226
-
227
- data = [
228
- "--" + boundary,
229
- "Content-Disposition: form-data; name=\"userfile\"; filename=\"#{basename}\"",
230
- "Content-Type: application/octet-stream",
231
- "Content-Transfer-Encoding: binary",
232
- "", file_data, ""
233
- ].join("\x0D\x0A")
234
-
235
- release_headers = headers.merge(
236
- "Content-Type" => "multipart/form-data; boundary=#{boundary}"
237
- )
238
-
239
- target = first_file ? "/frs/admin/qrs.php" : "/frs/admin/editrelease.php"
240
- http.post(target + query, data, release_headers)
241
- end
242
-
243
- if first_file then
244
- release_id = release_response.body[/release_id=(\d+)/, 1]
245
- raise("Couldn't get release id") unless release_id
246
- end
247
-
248
- first_file = false
249
- end
142
+ for ext in %w( gem tgz zip )
143
+ release_command = "rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}"
144
+ puts release_command
145
+ system(release_command)
250
146
  end
251
- end
147
+ end
@@ -226,7 +226,7 @@ module ActionController
226
226
  mod_name = controller_name = segment = nil
227
227
 
228
228
  while index < length
229
- return nil unless /^[A-Za-z][A-Za-z\d_]*$/ =~ (segment = segments[index])
229
+ return nil unless /\A[A-Za-z][A-Za-z\d_]*\Z/ =~ (segment = segments[index])
230
230
  index += 1
231
231
 
232
232
  mod_name = segment.camelize
@@ -245,13 +245,20 @@ module ActionController
245
245
  raise unless /^uninitialized constant .*#{controller_name}$/ =~ e.message
246
246
  end
247
247
 
248
- begin
249
- next_mod = eval("mod::#{mod_name}", nil, __FILE__, __LINE__)
250
- # Check that we didn't get a module from a parent namespace
251
- mod = (mod == Object || next_mod.name == "#{mod.name}::#{mod_name}") ? next_mod : nil
252
- rescue NameError => e
253
- raise unless /^uninitialized constant .*#{mod_name}$/ =~ e.message
248
+ if mod.const_defined? mod_name
249
+ next_mod = mod.send(:const_get, mod_name)
250
+ next_mod = nil unless next_mod.is_a?(Module)
251
+ else
252
+ suffix = File.join(segments[start_at..index])
253
+ $:.each do |base|
254
+ path = File.join(base, suffix)
255
+ next unless File.directory? path
256
+ next_mod = Module.new
257
+ mod.send(:const_set, mod_name, next_mod)
258
+ break
259
+ end
254
260
  end
261
+ mod = next_mod
255
262
 
256
263
  return nil unless mod
257
264
  end
@@ -2,7 +2,7 @@ module ActionPack #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 12
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -6,6 +6,7 @@ class NotAController
6
6
  end
7
7
  module Admin
8
8
  class << self; alias_method :const_available?, :const_defined?; end
9
+ SomeConstant = 10
9
10
  class UserController < Class.new(ActionController::Base); end
10
11
  class NewsFeedController < Class.new(ActionController::Base); end
11
12
  end
@@ -535,7 +535,6 @@ end
535
535
 
536
536
  class RouteTests < Test::Unit::TestCase
537
537
 
538
-
539
538
  def route(*args)
540
539
  @route = ::ActionController::Routing::Route.new(*args) unless args.empty?
541
540
  return @route
@@ -972,4 +971,21 @@ class RouteSetTests < Test::Unit::TestCase
972
971
  end
973
972
  end
974
973
 
974
+ class ControllerComponentTest < Test::Unit::TestCase
975
+
976
+ def test_traverse_to_controller_should_not_load_arbitrary_files
977
+ load_path = $:.dup
978
+ base = File.dirname(File.dirname(File.expand_path(__FILE__)))
979
+ $: << File.join(base, 'fixtures')
980
+ assert_equal nil, ActionController::Routing::ControllerComponent.traverse_to_controller(%w(dont_load pretty please))
981
+ ensure
982
+ $:[0..-1] = load_path
983
+ end
984
+
985
+ def test_traverse_should_not_trip_on_non_module_constants
986
+ assert_equal nil, ActionController::Routing::ControllerComponent.traverse_to_controller(%w(admin some_constant a))
987
+ end
988
+
989
+ end
990
+
975
991
  end
@@ -0,0 +1,3 @@
1
+ # see routing/controller component tests
2
+
3
+ raise Exception, "I should never be loaded"
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: actionpack
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.12.1
7
- date: 2006-04-06 00:00:00 -05:00
6
+ version: 1.12.2
7
+ date: 2006-06-27 00:00:00 -05:00
8
8
  summary: Web-flow and rendering framework putting the VC in MVC.
9
9
  require_paths:
10
10
  - lib
@@ -28,7 +28,7 @@ cert_chain:
28
28
  authors:
29
29
  - David Heinemeier Hansson
30
30
  files:
31
- - rakefile
31
+ - Rakefile
32
32
  - install.rb
33
33
  - README
34
34
  - RUNNING_UNIT_TESTS
@@ -186,6 +186,7 @@ files:
186
186
  - test/fixtures/developer.rb
187
187
  - test/fixtures/developers.yml
188
188
  - test/fixtures/developers_projects.yml
189
+ - test/fixtures/dont_load.rb
189
190
  - test/fixtures/fun
190
191
  - test/fixtures/helpers
191
192
  - test/fixtures/layout_tests