mirror of
https://github.com/github/rails.git
synced 2026-01-13 00:28:26 -05:00
Compare commits
129 Commits
2-3-github
...
v1.1.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14f11a73ed | ||
|
|
bd01d408a6 | ||
|
|
c53ae000bf | ||
|
|
51f3283ef3 | ||
|
|
0c516b370b | ||
|
|
755ff58d56 | ||
|
|
83af5feefa | ||
|
|
5b8b77e07e | ||
|
|
4e2dcbfb15 | ||
|
|
a12aabc450 | ||
|
|
bf150f0c3a | ||
|
|
a9ad634dbc | ||
|
|
982d187691 | ||
|
|
8118c486bc | ||
|
|
4363bd0239 | ||
|
|
2ebad525e0 | ||
|
|
b5c3570ff1 | ||
|
|
8382493551 | ||
|
|
a60ecc1571 | ||
|
|
2120651dde | ||
|
|
e1deb6acca | ||
|
|
2f4093690b | ||
|
|
ec20838381 | ||
|
|
fba571a50a | ||
|
|
c049ccd786 | ||
|
|
f13ddd3eb8 | ||
|
|
4ae6f74612 | ||
|
|
f999ab089d | ||
|
|
16a31ccd7d | ||
|
|
cf448036b6 | ||
|
|
37e0d5de89 | ||
|
|
e8c7d7af48 | ||
|
|
cad37c3eaf | ||
|
|
da66198fcd | ||
|
|
2670371690 | ||
|
|
5da86f8c27 | ||
|
|
11598ac77b | ||
|
|
eeb00ea334 | ||
|
|
d5bfd181d7 | ||
|
|
921c5a7fdc | ||
|
|
4ef417cf96 | ||
|
|
65e93a523f | ||
|
|
2018b2a8d2 | ||
|
|
596fe49697 | ||
|
|
4e2e1a1bc6 | ||
|
|
36619f2084 | ||
|
|
d2b0cc7bf4 | ||
|
|
eb79743b13 | ||
|
|
256d28d330 | ||
|
|
1b4470c82f | ||
|
|
69e4c3c474 | ||
|
|
94a25200a1 | ||
|
|
93bd3b00e1 | ||
|
|
57e992dc0f | ||
|
|
a9f4205b21 | ||
|
|
8a19d148b7 | ||
|
|
bd9b27df8b | ||
|
|
c6120acc00 | ||
|
|
60d68aab53 | ||
|
|
67cbb0f04c | ||
|
|
0bb6521649 | ||
|
|
966b027c71 | ||
|
|
2c5d342809 | ||
|
|
d45ca84858 | ||
|
|
142304b79d | ||
|
|
2deefbade0 | ||
|
|
66cd1330a5 | ||
|
|
cf656ec1f7 | ||
|
|
1c86c6f4d9 | ||
|
|
14c2334c84 | ||
|
|
50c5b2817f | ||
|
|
786726692f | ||
|
|
b762e0141c | ||
|
|
6865b66621 | ||
|
|
1dc4783707 | ||
|
|
98811479f0 | ||
|
|
2b4dd8c6e7 | ||
|
|
3fcec37473 | ||
|
|
15839d56d0 | ||
|
|
9c05146f4b | ||
|
|
a766ae6d84 | ||
|
|
cc4deb1610 | ||
|
|
b87294c671 | ||
|
|
7d6e3d0857 | ||
|
|
4906b32450 | ||
|
|
541da098f0 | ||
|
|
7bf86f2c57 | ||
|
|
81f3a923d7 | ||
|
|
4a9847f987 | ||
|
|
743fb60a8a | ||
|
|
6329724293 | ||
|
|
78e95faec5 | ||
|
|
371fa97ccc | ||
|
|
1aac21ca24 | ||
|
|
54977e0364 | ||
|
|
3f2541b4ff | ||
|
|
bed4fec60e | ||
|
|
fe09fa278e | ||
|
|
d4039f5246 | ||
|
|
b8ea04f8e8 | ||
|
|
beddd9680e | ||
|
|
dcaa871695 | ||
|
|
9796a587b8 | ||
|
|
de5980289c | ||
|
|
0023cb1b8c | ||
|
|
37664eb90c | ||
|
|
d212f03093 | ||
|
|
afcd3ebcbb | ||
|
|
b35d05f594 | ||
|
|
1ec7fb609d | ||
|
|
113c815c6a | ||
|
|
9decb1a46f | ||
|
|
49de64e0a4 | ||
|
|
58c7f2a744 | ||
|
|
e24096d616 | ||
|
|
902cb21124 | ||
|
|
e01febbe68 | ||
|
|
364f6d645a | ||
|
|
971b40f59f | ||
|
|
af0ad4d50b | ||
|
|
f0b5630dce | ||
|
|
532d4e8782 | ||
|
|
b970d2055a | ||
|
|
9403f471b4 | ||
|
|
17836f4819 | ||
|
|
e823ef8336 | ||
|
|
ce6545e574 | ||
|
|
e8086859c5 | ||
|
|
e0ef631055 |
@@ -1,3 +1,13 @@
|
||||
*1.2.3* (June 29th, 2006)
|
||||
|
||||
* Depend on Action Pack 1.12.3
|
||||
|
||||
|
||||
*1.2.2* (June 27th, 2006)
|
||||
|
||||
* Depend on Action Pack 1.12.2
|
||||
|
||||
|
||||
*1.2.1* (April 6th, 2005)
|
||||
|
||||
* Be part of Rails 1.1.1
|
||||
|
||||
@@ -54,7 +54,7 @@ spec = Gem::Specification.new do |s|
|
||||
s.rubyforge_project = "actionmailer"
|
||||
s.homepage = "http://www.rubyonrails.org"
|
||||
|
||||
s.add_dependency('actionpack', '= 1.12.1' + PKG_BUILD)
|
||||
s.add_dependency('actionpack', '= 1.12.3' + PKG_BUILD)
|
||||
|
||||
s.has_rdoc = true
|
||||
s.requirements << 'none'
|
||||
@@ -84,116 +84,12 @@ task :pdoc => [:rdoc] do
|
||||
end
|
||||
|
||||
desc "Publish the release files to RubyForge."
|
||||
task :release => [:package] do
|
||||
files = ["gem", "tgz", "zip"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" }
|
||||
task :release => [ :package ] do
|
||||
`rubyforge login`
|
||||
|
||||
if RUBY_FORGE_PROJECT then
|
||||
require 'net/http'
|
||||
require 'open-uri'
|
||||
|
||||
project_uri = "http://rubyforge.org/projects/#{RUBY_FORGE_PROJECT}/"
|
||||
project_data = open(project_uri) { |data| data.read }
|
||||
group_id = project_data[/[?&]group_id=(\d+)/, 1]
|
||||
raise "Couldn't get group id" unless group_id
|
||||
|
||||
# This echos password to shell which is a bit sucky
|
||||
if ENV["RUBY_FORGE_PASSWORD"]
|
||||
password = ENV["RUBY_FORGE_PASSWORD"]
|
||||
else
|
||||
print "#{RUBY_FORGE_USER}@rubyforge.org's password: "
|
||||
password = STDIN.gets.chomp
|
||||
end
|
||||
|
||||
login_response = Net::HTTP.start("rubyforge.org", 80) do |http|
|
||||
data = [
|
||||
"login=1",
|
||||
"form_loginname=#{RUBY_FORGE_USER}",
|
||||
"form_pw=#{password}"
|
||||
].join("&")
|
||||
http.post("/account/login.php", data)
|
||||
end
|
||||
|
||||
cookie = login_response["set-cookie"]
|
||||
raise "Login failed" unless cookie
|
||||
headers = { "Cookie" => cookie }
|
||||
|
||||
release_uri = "http://rubyforge.org/frs/admin/?group_id=#{group_id}"
|
||||
release_data = open(release_uri, headers) { |data| data.read }
|
||||
package_id = release_data[/[?&]package_id=(\d+)/, 1]
|
||||
raise "Couldn't get package id" unless package_id
|
||||
|
||||
first_file = true
|
||||
release_id = ""
|
||||
|
||||
files.each do |filename|
|
||||
basename = File.basename(filename)
|
||||
file_ext = File.extname(filename)
|
||||
file_data = File.open(filename, "rb") { |file| file.read }
|
||||
|
||||
puts "Releasing #{basename}..."
|
||||
|
||||
release_response = Net::HTTP.start("rubyforge.org", 80) do |http|
|
||||
release_date = Time.now.strftime("%Y-%m-%d %H:%M")
|
||||
type_map = {
|
||||
".zip" => "3000",
|
||||
".tgz" => "3110",
|
||||
".gz" => "3110",
|
||||
".gem" => "1400"
|
||||
}; type_map.default = "9999"
|
||||
type = type_map[file_ext]
|
||||
boundary = "rubyqMY6QN9bp6e4kS21H4y0zxcvoor"
|
||||
|
||||
query_hash = if first_file then
|
||||
{
|
||||
"group_id" => group_id,
|
||||
"package_id" => package_id,
|
||||
"release_name" => RELEASE_NAME,
|
||||
"release_date" => release_date,
|
||||
"type_id" => type,
|
||||
"processor_id" => "8000", # Any
|
||||
"release_notes" => "",
|
||||
"release_changes" => "",
|
||||
"preformatted" => "1",
|
||||
"submit" => "1"
|
||||
}
|
||||
else
|
||||
{
|
||||
"group_id" => group_id,
|
||||
"release_id" => release_id,
|
||||
"package_id" => package_id,
|
||||
"step2" => "1",
|
||||
"type_id" => type,
|
||||
"processor_id" => "8000", # Any
|
||||
"submit" => "Add This File"
|
||||
}
|
||||
end
|
||||
|
||||
query = "?" + query_hash.map do |(name, value)|
|
||||
[name, URI.encode(value)].join("=")
|
||||
end.join("&")
|
||||
|
||||
data = [
|
||||
"--" + boundary,
|
||||
"Content-Disposition: form-data; name=\"userfile\"; filename=\"#{basename}\"",
|
||||
"Content-Type: application/octet-stream",
|
||||
"Content-Transfer-Encoding: binary",
|
||||
"", file_data, ""
|
||||
].join("\x0D\x0A")
|
||||
|
||||
release_headers = headers.merge(
|
||||
"Content-Type" => "multipart/form-data; boundary=#{boundary}"
|
||||
)
|
||||
|
||||
target = first_file ? "/frs/admin/qrs.php" : "/frs/admin/editrelease.php"
|
||||
http.post(target + query, data, release_headers)
|
||||
end
|
||||
|
||||
if first_file then
|
||||
release_id = release_response.body[/release_id=(\d+)/, 1]
|
||||
raise("Couldn't get release id") unless release_id
|
||||
end
|
||||
|
||||
first_file = false
|
||||
end
|
||||
for ext in %w( gem tgz zip )
|
||||
release_command = "rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}"
|
||||
puts release_command
|
||||
system(release_command)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -2,7 +2,7 @@ module ActionMailer
|
||||
module VERSION #:nodoc:
|
||||
MAJOR = 1
|
||||
MINOR = 2
|
||||
TINY = 1
|
||||
TINY = 3
|
||||
|
||||
STRING = [MAJOR, MINOR, TINY].join('.')
|
||||
end
|
||||
|
||||
@@ -1,4 +1,20 @@
|
||||
*1.12.1* (April 6th, 2005)
|
||||
*1.12.3* (June 28th, 2006)
|
||||
|
||||
* Fix broken traverse_to_controller. We now:
|
||||
Look for a _controller.rb file under RAILS_ROOT to load.
|
||||
If we find it, we require_dependency it and return the controller it defined. (If none was defined we stop looking.)
|
||||
If we don't find it, we look for a .rb file under RAILS_ROOT to load. If we find it, and it loads a constant we keep looking.
|
||||
Otherwise we check to see if a directory of the same name exists, and if it does we create a module for it.
|
||||
|
||||
|
||||
*1.12.2* (June 27th, 2006)
|
||||
|
||||
* Refinement to avoid exceptions in traverse_to_controller.
|
||||
|
||||
* (Hackish) Fix loading of arbitrary files in Ruby's load path by traverse_to_controller. [Nicholas Seckar]
|
||||
|
||||
|
||||
*1.12.1* (April 6th, 2006)
|
||||
|
||||
* Fixed that template extensions would be cached development mode #4624 [Stefan Kaes]
|
||||
|
||||
@@ -30,7 +46,7 @@
|
||||
This can be used by deployment managers to set the asset id by application revision
|
||||
|
||||
|
||||
*1.12.0* (March 27th, 2005)
|
||||
*1.12.0* (March 27th, 2006)
|
||||
|
||||
* Add documentation for respond_to. [Jamis Buck]
|
||||
|
||||
|
||||
@@ -136,116 +136,12 @@ task :pdoc => [:rdoc] do
|
||||
end
|
||||
|
||||
desc "Publish the release files to RubyForge."
|
||||
task :release => [:package] do
|
||||
files = ["gem", "tgz", "zip"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" }
|
||||
task :release => [ :package ] do
|
||||
`rubyforge login`
|
||||
|
||||
if RUBY_FORGE_PROJECT then
|
||||
require 'net/http'
|
||||
require 'open-uri'
|
||||
|
||||
project_uri = "http://rubyforge.org/projects/#{RUBY_FORGE_PROJECT}/"
|
||||
project_data = open(project_uri) { |data| data.read }
|
||||
group_id = project_data[/[?&]group_id=(\d+)/, 1]
|
||||
raise "Couldn't get group id" unless group_id
|
||||
|
||||
# This echos password to shell which is a bit sucky
|
||||
if ENV["RUBY_FORGE_PASSWORD"]
|
||||
password = ENV["RUBY_FORGE_PASSWORD"]
|
||||
else
|
||||
print "#{RUBY_FORGE_USER}@rubyforge.org's password: "
|
||||
password = STDIN.gets.chomp
|
||||
end
|
||||
|
||||
login_response = Net::HTTP.start("rubyforge.org", 80) do |http|
|
||||
data = [
|
||||
"login=1",
|
||||
"form_loginname=#{RUBY_FORGE_USER}",
|
||||
"form_pw=#{password}"
|
||||
].join("&")
|
||||
http.post("/account/login.php", data)
|
||||
end
|
||||
|
||||
cookie = login_response["set-cookie"]
|
||||
raise "Login failed" unless cookie
|
||||
headers = { "Cookie" => cookie }
|
||||
|
||||
release_uri = "http://rubyforge.org/frs/admin/?group_id=#{group_id}"
|
||||
release_data = open(release_uri, headers) { |data| data.read }
|
||||
package_id = release_data[/[?&]package_id=(\d+)/, 1]
|
||||
raise "Couldn't get package id" unless package_id
|
||||
|
||||
first_file = true
|
||||
release_id = ""
|
||||
|
||||
files.each do |filename|
|
||||
basename = File.basename(filename)
|
||||
file_ext = File.extname(filename)
|
||||
file_data = File.open(filename, "rb") { |file| file.read }
|
||||
|
||||
puts "Releasing #{basename}..."
|
||||
|
||||
release_response = Net::HTTP.start("rubyforge.org", 80) do |http|
|
||||
release_date = Time.now.strftime("%Y-%m-%d %H:%M")
|
||||
type_map = {
|
||||
".zip" => "3000",
|
||||
".tgz" => "3110",
|
||||
".gz" => "3110",
|
||||
".gem" => "1400"
|
||||
}; type_map.default = "9999"
|
||||
type = type_map[file_ext]
|
||||
boundary = "rubyqMY6QN9bp6e4kS21H4y0zxcvoor"
|
||||
|
||||
query_hash = if first_file then
|
||||
{
|
||||
"group_id" => group_id,
|
||||
"package_id" => package_id,
|
||||
"release_name" => RELEASE_NAME,
|
||||
"release_date" => release_date,
|
||||
"type_id" => type,
|
||||
"processor_id" => "8000", # Any
|
||||
"release_notes" => "",
|
||||
"release_changes" => "",
|
||||
"preformatted" => "1",
|
||||
"submit" => "1"
|
||||
}
|
||||
else
|
||||
{
|
||||
"group_id" => group_id,
|
||||
"release_id" => release_id,
|
||||
"package_id" => package_id,
|
||||
"step2" => "1",
|
||||
"type_id" => type,
|
||||
"processor_id" => "8000", # Any
|
||||
"submit" => "Add This File"
|
||||
}
|
||||
end
|
||||
|
||||
query = "?" + query_hash.map do |(name, value)|
|
||||
[name, URI.encode(value)].join("=")
|
||||
end.join("&")
|
||||
|
||||
data = [
|
||||
"--" + boundary,
|
||||
"Content-Disposition: form-data; name=\"userfile\"; filename=\"#{basename}\"",
|
||||
"Content-Type: application/octet-stream",
|
||||
"Content-Transfer-Encoding: binary",
|
||||
"", file_data, ""
|
||||
].join("\x0D\x0A")
|
||||
|
||||
release_headers = headers.merge(
|
||||
"Content-Type" => "multipart/form-data; boundary=#{boundary}"
|
||||
)
|
||||
|
||||
target = first_file ? "/frs/admin/qrs.php" : "/frs/admin/editrelease.php"
|
||||
http.post(target + query, data, release_headers)
|
||||
end
|
||||
|
||||
if first_file then
|
||||
release_id = release_response.body[/release_id=(\d+)/, 1]
|
||||
raise("Couldn't get release id") unless release_id
|
||||
end
|
||||
|
||||
first_file = false
|
||||
end
|
||||
for ext in %w( gem tgz zip )
|
||||
release_command = "rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}"
|
||||
puts release_command
|
||||
system(release_command)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -224,37 +224,70 @@ module ActionController
|
||||
length = segments.length
|
||||
index = start_at
|
||||
mod_name = controller_name = segment = nil
|
||||
|
||||
while index < length
|
||||
return nil unless /^[A-Za-z][A-Za-z\d_]*$/ =~ (segment = segments[index])
|
||||
return nil unless /\A[A-Za-z][A-Za-z\d_]*\Z/ =~ (segment = segments[index])
|
||||
index += 1
|
||||
|
||||
mod_name = segment.camelize
|
||||
controller_name = "#{mod_name}Controller"
|
||||
path_suffix = File.join(segments[start_at..(index - 1)])
|
||||
next_mod = nil
|
||||
|
||||
begin
|
||||
# We use eval instead of const_get to avoid obtaining values from parent modules.
|
||||
controller = eval("mod::#{controller_name}", nil, __FILE__, __LINE__)
|
||||
expected_name = "#{mod.name}::#{controller_name}"
|
||||
|
||||
# Detect the case when const_get returns an object from a parent namespace.
|
||||
if controller.is_a?(Class) && controller.ancestors.include?(ActionController::Base) && (mod == Object || controller.name == expected_name)
|
||||
return controller, (index - start_at)
|
||||
# If the controller is already present, or if we load it, return it.
|
||||
if mod.const_defined?(controller_name) || attempt_load(mod, controller_name, path_suffix + "_controller") == :defined
|
||||
controller = mod.const_get(controller_name)
|
||||
return nil unless controller.is_a?(Class) && controller.ancestors.include?(ActionController::Base) # it's not really a controller?
|
||||
return [controller, (index - start_at)]
|
||||
end
|
||||
|
||||
# No controller? Look for the module
|
||||
if mod.const_defined? mod_name
|
||||
next_mod = mod.send(:const_get, mod_name)
|
||||
next_mod = nil unless next_mod.is_a?(Module)
|
||||
else
|
||||
# Try to load a file that defines the module we want.
|
||||
case attempt_load(mod, mod_name, path_suffix)
|
||||
when :defined then next_mod = mod.const_get mod_name
|
||||
when :dir then # We didn't find a file, but there's a dir.
|
||||
next_mod = Module.new # So create a module for the directory
|
||||
mod.send :const_set, mod_name, next_mod
|
||||
else
|
||||
return nil
|
||||
end
|
||||
rescue NameError => e
|
||||
raise unless /^uninitialized constant .*#{controller_name}$/ =~ e.message
|
||||
end
|
||||
mod = next_mod
|
||||
|
||||
begin
|
||||
next_mod = eval("mod::#{mod_name}", nil, __FILE__, __LINE__)
|
||||
# Check that we didn't get a module from a parent namespace
|
||||
mod = (mod == Object || next_mod.name == "#{mod.name}::#{mod_name}") ? next_mod : nil
|
||||
rescue NameError => e
|
||||
raise unless /^uninitialized constant .*#{mod_name}$/ =~ e.message
|
||||
end
|
||||
|
||||
return nil unless mod
|
||||
return nil unless mod && mod.is_a?(Module)
|
||||
end
|
||||
nil
|
||||
end
|
||||
|
||||
protected
|
||||
def safe_load_paths #:nodoc:
|
||||
if defined?(RAILS_ROOT)
|
||||
$LOAD_PATH.select do |base|
|
||||
base = File.expand_path(base)
|
||||
extended_root = File.expand_path(RAILS_ROOT)
|
||||
base[0, extended_root.length] == extended_root || base =~ %r{rails-[\d.]+/builtin}
|
||||
end
|
||||
else
|
||||
$LOAD_PATH
|
||||
end
|
||||
end
|
||||
|
||||
def attempt_load(mod, const_name, path)
|
||||
has_dir = false
|
||||
safe_load_paths.each do |load_path|
|
||||
full_path = File.join(load_path, path)
|
||||
file_path = full_path + '.rb'
|
||||
if File.file?(file_path) # Found a .rb file? Load it up
|
||||
require_dependency(file_path)
|
||||
return :defined if mod.const_defined? const_name
|
||||
else
|
||||
has_dir ||= File.directory?(full_path)
|
||||
end
|
||||
end
|
||||
return (has_dir ? :dir : nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@ module ActionPack #:nodoc:
|
||||
module VERSION #:nodoc:
|
||||
MAJOR = 1
|
||||
MINOR = 12
|
||||
TINY = 1
|
||||
TINY = 3
|
||||
|
||||
STRING = [MAJOR, MINOR, TINY].join('.')
|
||||
end
|
||||
|
||||
@@ -6,6 +6,7 @@ class NotAController
|
||||
end
|
||||
module Admin
|
||||
class << self; alias_method :const_available?, :const_defined?; end
|
||||
SomeConstant = 10
|
||||
class UserController < Class.new(ActionController::Base); end
|
||||
class NewsFeedController < Class.new(ActionController::Base); end
|
||||
end
|
||||
|
||||
@@ -535,7 +535,6 @@ end
|
||||
|
||||
class RouteTests < Test::Unit::TestCase
|
||||
|
||||
|
||||
def route(*args)
|
||||
@route = ::ActionController::Routing::Route.new(*args) unless args.empty?
|
||||
return @route
|
||||
@@ -972,4 +971,79 @@ class RouteSetTests < Test::Unit::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
class ControllerComponentTest < Test::Unit::TestCase
|
||||
|
||||
def test_traverse_to_controller_should_not_load_arbitrary_files
|
||||
load_path = $:.dup
|
||||
base = File.dirname(File.dirname(File.expand_path(__FILE__)))
|
||||
$: << File.join(base, 'fixtures')
|
||||
Object.send :const_set, :RAILS_ROOT, File.join(base, 'fixtures/application_root')
|
||||
assert_equal nil, ActionController::Routing::ControllerComponent.traverse_to_controller(%w(dont_load pretty please))
|
||||
ensure
|
||||
$:[0..-1] = load_path
|
||||
Object.send :remove_const, :RAILS_ROOT
|
||||
end
|
||||
|
||||
def test_traverse_should_not_trip_on_non_module_constants
|
||||
assert_equal nil, ActionController::Routing::ControllerComponent.traverse_to_controller(%w(admin some_constant a))
|
||||
end
|
||||
|
||||
# This is evil, but people do it.
|
||||
def test_traverse_to_controller_should_pass_thru_classes
|
||||
load_path = $:.dup
|
||||
base = File.dirname(File.dirname(File.expand_path(__FILE__)))
|
||||
$: << File.join(base, 'fixtures')
|
||||
$: << File.join(base, 'fixtures/application_root/app/controllers')
|
||||
$: << File.join(base, 'fixtures/application_root/app/models')
|
||||
Object.send :const_set, :RAILS_ROOT, File.join(base, 'fixtures/application_root')
|
||||
pair = ActionController::Routing::ControllerComponent.traverse_to_controller(%w(a_class_that_contains_a_controller poorly_placed))
|
||||
|
||||
# Make sure the container class was loaded properly
|
||||
assert defined?(AClassThatContainsAController)
|
||||
assert_kind_of Class, AClassThatContainsAController
|
||||
assert_equal :you_know_it, AClassThatContainsAController.is_special?
|
||||
|
||||
# Make sure the controller was too
|
||||
assert_kind_of Array, pair
|
||||
assert_equal 2, pair[1]
|
||||
klass = pair.first
|
||||
assert_kind_of Class, klass
|
||||
assert_equal :decidedly_so, klass.is_evil?
|
||||
assert klass.ancestors.include?(ActionController::Base)
|
||||
assert defined?(AClassThatContainsAController::PoorlyPlacedController)
|
||||
assert_equal klass, AClassThatContainsAController::PoorlyPlacedController
|
||||
ensure
|
||||
$:[0..-1] = load_path
|
||||
Object.send :remove_const, :RAILS_ROOT
|
||||
end
|
||||
|
||||
def test_traverse_to_nested_controller
|
||||
load_path = $:.dup
|
||||
base = File.dirname(File.dirname(File.expand_path(__FILE__)))
|
||||
$: << File.join(base, 'fixtures')
|
||||
$: << File.join(base, 'fixtures/application_root/app/controllers')
|
||||
Object.send :const_set, :RAILS_ROOT, File.join(base, 'fixtures/application_root')
|
||||
pair = ActionController::Routing::ControllerComponent.traverse_to_controller(%w(module_that_holds_controllers nested))
|
||||
|
||||
assert_not_equal nil, pair
|
||||
|
||||
# Make sure that we created a module for the dir
|
||||
assert defined?(ModuleThatHoldsControllers)
|
||||
assert_kind_of Module, ModuleThatHoldsControllers
|
||||
|
||||
# Make sure the controller is ok
|
||||
assert_kind_of Array, pair
|
||||
assert_equal 2, pair[1]
|
||||
klass = pair.first
|
||||
assert_kind_of Class, klass
|
||||
assert klass.ancestors.include?(ActionController::Base)
|
||||
assert defined?(ModuleThatHoldsControllers::NestedController)
|
||||
assert_equal klass, ModuleThatHoldsControllers::NestedController
|
||||
ensure
|
||||
$:[0..-1] = load_path
|
||||
Object.send :remove_const, :RAILS_ROOT
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
class AClassThatContainsAController::PoorlyPlacedController < ActionController::Base
|
||||
|
||||
def self.is_evil?
|
||||
:decidedly_so
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
class ModuleThatHoldsControllers::NestedController < ActionController::Base
|
||||
|
||||
end
|
||||
7
actionpack/test/fixtures/application_root/app/models/a_class_that_contains_a_controller.rb
vendored
Normal file
7
actionpack/test/fixtures/application_root/app/models/a_class_that_contains_a_controller.rb
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
class AClassThatContainsAController #often < ActiveRecord::Base
|
||||
|
||||
def self.is_special?
|
||||
:you_know_it
|
||||
end
|
||||
|
||||
end
|
||||
3
actionpack/test/fixtures/dont_load.rb
vendored
Normal file
3
actionpack/test/fixtures/dont_load.rb
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# see routing/controller component tests
|
||||
|
||||
raise Exception, "I should never be loaded"
|
||||
@@ -1,3 +1,18 @@
|
||||
*1.1.4* (June 29th, 2006)
|
||||
|
||||
* Rely on Action Pack 1.12.3
|
||||
|
||||
|
||||
*1.1.3* (June 27th, 2006)
|
||||
|
||||
* Rely on Action Pack 1.12.2 and Active Record 1.14.3
|
||||
|
||||
|
||||
*1.1.2* (April 9th, 2005)
|
||||
|
||||
* Rely on Active Record 1.14.2
|
||||
|
||||
|
||||
*1.1.1* (April 6th, 2005)
|
||||
|
||||
* Do not convert driver options to strings (#4499)
|
||||
|
||||
@@ -71,8 +71,8 @@ spec = Gem::Specification.new do |s|
|
||||
s.rubyforge_project = "aws"
|
||||
s.homepage = "http://www.rubyonrails.org"
|
||||
|
||||
s.add_dependency('actionpack', '= 1.12.1' + PKG_BUILD)
|
||||
s.add_dependency('activerecord', '= 1.14.1' + PKG_BUILD)
|
||||
s.add_dependency('actionpack', '= 1.12.3' + PKG_BUILD)
|
||||
s.add_dependency('activerecord', '= 1.14.3' + PKG_BUILD)
|
||||
|
||||
s.has_rdoc = true
|
||||
s.requirements << 'none'
|
||||
@@ -160,116 +160,12 @@ task :lines do
|
||||
end
|
||||
|
||||
desc "Publish the release files to RubyForge."
|
||||
task :release => [:package] do
|
||||
files = ["gem", "tgz", "zip"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" }
|
||||
task :release => [ :package ] do
|
||||
`rubyforge login`
|
||||
|
||||
if RUBY_FORGE_PROJECT then
|
||||
require 'net/http'
|
||||
require 'open-uri'
|
||||
|
||||
project_uri = "http://rubyforge.org/projects/#{RUBY_FORGE_PROJECT}/"
|
||||
project_data = open(project_uri) { |data| data.read }
|
||||
group_id = project_data[/[?&]group_id=(\d+)/, 1]
|
||||
raise "Couldn't get group id" unless group_id
|
||||
|
||||
# This echos password to shell which is a bit sucky
|
||||
if ENV["RUBY_FORGE_PASSWORD"]
|
||||
password = ENV["RUBY_FORGE_PASSWORD"]
|
||||
else
|
||||
print "#{RUBY_FORGE_USER}@rubyforge.org's password: "
|
||||
password = STDIN.gets.chomp
|
||||
end
|
||||
|
||||
login_response = Net::HTTP.start("rubyforge.org", 80) do |http|
|
||||
data = [
|
||||
"login=1",
|
||||
"form_loginname=#{RUBY_FORGE_USER}",
|
||||
"form_pw=#{password}"
|
||||
].join("&")
|
||||
http.post("/account/login.php", data)
|
||||
end
|
||||
|
||||
cookie = login_response["set-cookie"]
|
||||
raise "Login failed" unless cookie
|
||||
headers = { "Cookie" => cookie }
|
||||
|
||||
release_uri = "http://rubyforge.org/frs/admin/?group_id=#{group_id}"
|
||||
release_data = open(release_uri, headers) { |data| data.read }
|
||||
package_id = release_data[/[?&]package_id=(\d+)/, 1]
|
||||
raise "Couldn't get package id" unless package_id
|
||||
|
||||
first_file = true
|
||||
release_id = ""
|
||||
|
||||
files.each do |filename|
|
||||
basename = File.basename(filename)
|
||||
file_ext = File.extname(filename)
|
||||
file_data = File.open(filename, "rb") { |file| file.read }
|
||||
|
||||
puts "Releasing #{basename}..."
|
||||
|
||||
release_response = Net::HTTP.start("rubyforge.org", 80) do |http|
|
||||
release_date = Time.now.strftime("%Y-%m-%d %H:%M")
|
||||
type_map = {
|
||||
".zip" => "3000",
|
||||
".tgz" => "3110",
|
||||
".gz" => "3110",
|
||||
".gem" => "1400"
|
||||
}; type_map.default = "9999"
|
||||
type = type_map[file_ext]
|
||||
boundary = "rubyqMY6QN9bp6e4kS21H4y0zxcvoor"
|
||||
|
||||
query_hash = if first_file then
|
||||
{
|
||||
"group_id" => group_id,
|
||||
"package_id" => package_id,
|
||||
"release_name" => RELEASE_NAME,
|
||||
"release_date" => release_date,
|
||||
"type_id" => type,
|
||||
"processor_id" => "8000", # Any
|
||||
"release_notes" => "",
|
||||
"release_changes" => "",
|
||||
"preformatted" => "1",
|
||||
"submit" => "1"
|
||||
}
|
||||
else
|
||||
{
|
||||
"group_id" => group_id,
|
||||
"release_id" => release_id,
|
||||
"package_id" => package_id,
|
||||
"step2" => "1",
|
||||
"type_id" => type,
|
||||
"processor_id" => "8000", # Any
|
||||
"submit" => "Add This File"
|
||||
}
|
||||
end
|
||||
|
||||
query = "?" + query_hash.map do |(name, value)|
|
||||
[name, URI.encode(value)].join("=")
|
||||
end.join("&")
|
||||
|
||||
data = [
|
||||
"--" + boundary,
|
||||
"Content-Disposition: form-data; name=\"userfile\"; filename=\"#{basename}\"",
|
||||
"Content-Type: application/octet-stream",
|
||||
"Content-Transfer-Encoding: binary",
|
||||
"", file_data, ""
|
||||
].join("\x0D\x0A")
|
||||
|
||||
release_headers = headers.merge(
|
||||
"Content-Type" => "multipart/form-data; boundary=#{boundary}"
|
||||
)
|
||||
|
||||
target = first_file ? "/frs/admin/qrs.php" : "/frs/admin/editrelease.php"
|
||||
http.post(target + query, data, release_headers)
|
||||
end
|
||||
|
||||
if first_file then
|
||||
release_id = release_response.body[/release_id=(\d+)/, 1]
|
||||
raise("Couldn't get release id") unless release_id
|
||||
end
|
||||
|
||||
first_file = false
|
||||
end
|
||||
for ext in %w( gem tgz zip )
|
||||
release_command = "rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}"
|
||||
puts release_command
|
||||
system(release_command)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -2,7 +2,7 @@ module ActionWebService
|
||||
module VERSION #:nodoc:
|
||||
MAJOR = 1
|
||||
MINOR = 1
|
||||
TINY = 1
|
||||
TINY = 4
|
||||
|
||||
STRING = [MAJOR, MINOR, TINY].join('.')
|
||||
end
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
*1.14.1* (April 6th, 2005)
|
||||
*1.14.3* (June 27th, 2006)
|
||||
|
||||
* Properly quote index names in migrations (closes #4764) [John Long]
|
||||
|
||||
* Ensure that Associations#include_eager_conditions? checks both scoped and explicit conditions [Rick]
|
||||
|
||||
* Associations#select_limited_ids_list adds the ORDER BY columns to the SELECT DISTINCT List for postgresql. [Rick]
|
||||
|
||||
|
||||
*1.14.2* (April 9th, 2006)
|
||||
|
||||
* Fixed calculations for the Oracle Adapter (closes #4626) [Michael Schoen]
|
||||
|
||||
|
||||
*1.14.1* (April 6th, 2006)
|
||||
|
||||
* Fix type_name_with_module to handle type names that begin with '::'. Closes #4614. [Nicholas Seckar]
|
||||
|
||||
@@ -53,7 +67,7 @@
|
||||
* Fixed broken OCIAdapter #4457 [schoenm@earthlink.net]
|
||||
|
||||
|
||||
*1.14.0* (March 27th, 2005)
|
||||
*1.14.0* (March 27th, 2006)
|
||||
|
||||
* Replace 'rescue Object' with a finer grained rescue. Closes #4431. [Nicholas Seckar]
|
||||
|
||||
@@ -473,6 +487,7 @@
|
||||
|
||||
* Fixed :through relations when using STI inherited classes would use the inherited class's name as foreign key on the join model [Tobias Luetke]
|
||||
|
||||
|
||||
*1.13.2* (December 13th, 2005)
|
||||
|
||||
* Become part of Rails 1.0
|
||||
|
||||
@@ -170,116 +170,12 @@ task :pdoc => [:rdoc] do
|
||||
end
|
||||
|
||||
desc "Publish the release files to RubyForge."
|
||||
task :release => [:package] do
|
||||
files = ["gem", "tgz", "zip"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" }
|
||||
task :release => [ :package ] do
|
||||
`rubyforge login`
|
||||
|
||||
if RUBY_FORGE_PROJECT then
|
||||
require 'net/http'
|
||||
require 'open-uri'
|
||||
|
||||
project_uri = "http://rubyforge.org/projects/#{RUBY_FORGE_PROJECT}/"
|
||||
project_data = open(project_uri) { |data| data.read }
|
||||
group_id = project_data[/[?&]group_id=(\d+)/, 1]
|
||||
raise "Couldn't get group id" unless group_id
|
||||
|
||||
# This echos password to shell which is a bit sucky
|
||||
if ENV["RUBY_FORGE_PASSWORD"]
|
||||
password = ENV["RUBY_FORGE_PASSWORD"]
|
||||
else
|
||||
print "#{RUBY_FORGE_USER}@rubyforge.org's password: "
|
||||
password = STDIN.gets.chomp
|
||||
end
|
||||
|
||||
login_response = Net::HTTP.start("rubyforge.org", 80) do |http|
|
||||
data = [
|
||||
"login=1",
|
||||
"form_loginname=#{RUBY_FORGE_USER}",
|
||||
"form_pw=#{password}"
|
||||
].join("&")
|
||||
http.post("/account/login.php", data)
|
||||
end
|
||||
|
||||
cookie = login_response["set-cookie"]
|
||||
raise "Login failed" unless cookie
|
||||
headers = { "Cookie" => cookie }
|
||||
|
||||
release_uri = "http://rubyforge.org/frs/admin/?group_id=#{group_id}"
|
||||
release_data = open(release_uri, headers) { |data| data.read }
|
||||
package_id = release_data[/[?&]package_id=(\d+)/, 1]
|
||||
raise "Couldn't get package id" unless package_id
|
||||
|
||||
first_file = true
|
||||
release_id = ""
|
||||
|
||||
files.each do |filename|
|
||||
basename = File.basename(filename)
|
||||
file_ext = File.extname(filename)
|
||||
file_data = File.open(filename, "rb") { |file| file.read }
|
||||
|
||||
puts "Releasing #{basename}..."
|
||||
|
||||
release_response = Net::HTTP.start("rubyforge.org", 80) do |http|
|
||||
release_date = Time.now.strftime("%Y-%m-%d %H:%M")
|
||||
type_map = {
|
||||
".zip" => "3000",
|
||||
".tgz" => "3110",
|
||||
".gz" => "3110",
|
||||
".gem" => "1400"
|
||||
}; type_map.default = "9999"
|
||||
type = type_map[file_ext]
|
||||
boundary = "rubyqMY6QN9bp6e4kS21H4y0zxcvoor"
|
||||
|
||||
query_hash = if first_file then
|
||||
{
|
||||
"group_id" => group_id,
|
||||
"package_id" => package_id,
|
||||
"release_name" => RELEASE_NAME,
|
||||
"release_date" => release_date,
|
||||
"type_id" => type,
|
||||
"processor_id" => "8000", # Any
|
||||
"release_notes" => "",
|
||||
"release_changes" => "",
|
||||
"preformatted" => "1",
|
||||
"submit" => "1"
|
||||
}
|
||||
else
|
||||
{
|
||||
"group_id" => group_id,
|
||||
"release_id" => release_id,
|
||||
"package_id" => package_id,
|
||||
"step2" => "1",
|
||||
"type_id" => type,
|
||||
"processor_id" => "8000", # Any
|
||||
"submit" => "Add This File"
|
||||
}
|
||||
end
|
||||
|
||||
query = "?" + query_hash.map do |(name, value)|
|
||||
[name, URI.encode(value)].join("=")
|
||||
end.join("&")
|
||||
|
||||
data = [
|
||||
"--" + boundary,
|
||||
"Content-Disposition: form-data; name=\"userfile\"; filename=\"#{basename}\"",
|
||||
"Content-Type: application/octet-stream",
|
||||
"Content-Transfer-Encoding: binary",
|
||||
"", file_data, ""
|
||||
].join("\x0D\x0A")
|
||||
|
||||
release_headers = headers.merge(
|
||||
"Content-Type" => "multipart/form-data; boundary=#{boundary}"
|
||||
)
|
||||
|
||||
target = first_file ? "/frs/admin/qrs.php" : "/frs/admin/editrelease.php"
|
||||
http.post(target + query, data, release_headers)
|
||||
end
|
||||
|
||||
if first_file then
|
||||
release_id = release_response.body[/release_id=(\d+)/, 1]
|
||||
raise("Couldn't get release id") unless release_id
|
||||
end
|
||||
|
||||
first_file = false
|
||||
end
|
||||
for ext in %w( gem tgz zip )
|
||||
release_command = "rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}"
|
||||
puts release_command
|
||||
system(release_command)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1163,18 +1163,19 @@ module ActiveRecord
|
||||
end
|
||||
|
||||
def select_limited_ids_list(options, join_dependency)
|
||||
connection.select_values(
|
||||
connection.select_all(
|
||||
construct_finder_sql_for_association_limiting(options, join_dependency),
|
||||
"#{name} Load IDs For Limited Eager Loading"
|
||||
).collect { |id| connection.quote(id) }.join(", ")
|
||||
).collect { |row| connection.quote(row[primary_key]) }.join(", ")
|
||||
end
|
||||
|
||||
def construct_finder_sql_for_association_limiting(options, join_dependency)
|
||||
scope = scope(:find)
|
||||
#sql = "SELECT DISTINCT #{table_name}.#{primary_key} FROM #{table_name} "
|
||||
sql = "SELECT "
|
||||
sql << "DISTINCT #{table_name}." if include_eager_conditions?(options) || include_eager_order?(options)
|
||||
sql << "#{primary_key} FROM #{table_name} "
|
||||
sql << primary_key
|
||||
sql << ", #{options[:order].split(',').collect { |s| s.split.first } * ', '}" if options[:order] && (include_eager_conditions?(options) || include_eager_order?(options))
|
||||
sql << " FROM #{table_name} "
|
||||
|
||||
if include_eager_conditions?(options) || include_eager_order?(options)
|
||||
sql << join_dependency.join_associations.collect{|join| join.association_join }.join
|
||||
@@ -1186,16 +1187,24 @@ module ActiveRecord
|
||||
add_limit!(sql, options, scope)
|
||||
return sanitize_sql(sql)
|
||||
end
|
||||
|
||||
|
||||
# Checks if the conditions reference a table other than the current model table
|
||||
def include_eager_conditions?(options)
|
||||
conditions = scope(:find, :conditions) || options[:conditions]
|
||||
return false unless conditions
|
||||
conditions = conditions.first if conditions.is_a?(Array)
|
||||
conditions.scan(/(\w+)\.\w+/).flatten.any? do |condition_table_name|
|
||||
# look in both sets of conditions
|
||||
conditions = [scope(:find, :conditions), options[:conditions]].inject([]) do |all, cond|
|
||||
case cond
|
||||
when nil then all
|
||||
when Array then all << cond.first
|
||||
else all << cond
|
||||
end
|
||||
end
|
||||
return false unless conditions.any?
|
||||
conditions.join(' ').scan(/(\w+)\.\w+/).flatten.any? do |condition_table_name|
|
||||
condition_table_name != table_name
|
||||
end
|
||||
end
|
||||
|
||||
# Checks if the query order references a table other than the current model's table.
|
||||
def include_eager_order?(options)
|
||||
order = options[:order]
|
||||
return false unless order
|
||||
|
||||
@@ -42,26 +42,29 @@ module ActiveRecord
|
||||
#
|
||||
# Note: Person.count(:all) will not work because it will use :all as the condition. Use Person.count instead.
|
||||
def count(*args)
|
||||
options = {}
|
||||
|
||||
#For backwards compatibility, we need to handle both count(conditions=nil, joins=nil) or count(options={}).
|
||||
if args.size >= 0 and args.size <= 2
|
||||
options = {}
|
||||
column_name = :all
|
||||
# For backwards compatibility, we need to handle both count(conditions=nil, joins=nil) or count(options={}) or count(column_name=:all, options={}).
|
||||
if args.size >= 0 && args.size <= 2
|
||||
if args.first.is_a?(Hash)
|
||||
options = args.first
|
||||
#should we verify the options hash???
|
||||
options = args.first
|
||||
elsif args[1].is_a?(Hash)
|
||||
options = args[1]
|
||||
column_name = args.first
|
||||
options = args[1]
|
||||
else
|
||||
# Handle legacy paramter options: def count(conditions=nil, joins=nil)
|
||||
# Handle legacy paramter options: def count(conditions=nil, joins=nil)
|
||||
options.merge!(:conditions => args[0]) if args.length > 0
|
||||
options.merge!(:joins => args[1]) if args.length > 1
|
||||
options.merge!(:joins => args[1]) if args.length > 1
|
||||
end
|
||||
else
|
||||
raise(ArgumentError, "Unexpected parameters passed to count(*args): expected either count(conditions=nil, joins=nil) or count(options={})")
|
||||
end
|
||||
|
||||
(scope(:find, :include) || options[:include]) ? count_with_associations(options) : calculate(:count, :all, options)
|
||||
if options[:include] || scope(:find, :include)
|
||||
count_with_associations(options)
|
||||
else
|
||||
calculate(:count, column_name, options)
|
||||
end
|
||||
end
|
||||
|
||||
# Calculates average value on a given column. The value is returned as a float. See #calculate for examples with options.
|
||||
|
||||
@@ -119,7 +119,7 @@ module ActiveRecord
|
||||
# Adds a new column to the named table.
|
||||
# See TableDefinition#column for details of the options you can use.
|
||||
def add_column(table_name, column_name, type, options = {})
|
||||
add_column_sql = "ALTER TABLE #{table_name} ADD #{column_name} #{type_to_sql(type, options[:limit])}"
|
||||
add_column_sql = "ALTER TABLE #{table_name} ADD #{quote_column_name(column_name)} #{type_to_sql(type, options[:limit])}"
|
||||
add_column_options!(add_column_sql, options)
|
||||
execute(add_column_sql)
|
||||
end
|
||||
@@ -128,7 +128,7 @@ module ActiveRecord
|
||||
# ===== Examples
|
||||
# remove_column(:suppliers, :qualification)
|
||||
def remove_column(table_name, column_name)
|
||||
execute "ALTER TABLE #{table_name} DROP #{column_name}"
|
||||
execute "ALTER TABLE #{table_name} DROP #{quote_column_name(column_name)}"
|
||||
end
|
||||
|
||||
# Changes the column's definition according to the new options.
|
||||
@@ -184,7 +184,8 @@ module ActiveRecord
|
||||
# generates
|
||||
# CREATE UNIQUE INDEX by_branch_party ON accounts(branch_id, party_id)
|
||||
def add_index(table_name, column_name, options = {})
|
||||
index_name = "#{table_name}_#{Array(column_name).first}_index"
|
||||
column_names = Array(column_name)
|
||||
index_name = index_name(table_name, :column => column_names.first)
|
||||
|
||||
if Hash === options # legacy support, since this param was a string
|
||||
index_type = options[:unique] ? "UNIQUE" : ""
|
||||
@@ -192,8 +193,8 @@ module ActiveRecord
|
||||
else
|
||||
index_type = options
|
||||
end
|
||||
|
||||
execute "CREATE #{index_type} INDEX #{index_name} ON #{table_name} (#{Array(column_name).join(", ")})"
|
||||
quoted_column_names = column_names.map { |e| quote_column_name(e) }.join(", ")
|
||||
execute "CREATE #{index_type} INDEX #{quote_column_name(index_name)} ON #{table_name} (#{quoted_column_names})"
|
||||
end
|
||||
|
||||
# Remove the given index from the table.
|
||||
@@ -209,7 +210,7 @@ module ActiveRecord
|
||||
# add_index :accounts, [:username, :password]
|
||||
# remove_index :accounts, :username
|
||||
def remove_index(table_name, options = {})
|
||||
execute "DROP INDEX #{index_name(table_name, options)} ON #{table_name}"
|
||||
execute "DROP INDEX #{quote_column_name(index_name(table_name, options))} ON #{table_name}"
|
||||
end
|
||||
|
||||
def index_name(table_name, options) #:nodoc:
|
||||
|
||||
@@ -18,7 +18,6 @@ module ActiveRecord
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
config = config.symbolize_keys
|
||||
host = config[:host]
|
||||
port = config[:port]
|
||||
|
||||
@@ -337,8 +337,7 @@ module ActiveRecord
|
||||
|
||||
def remove_index(table_name, options) #:nodoc:
|
||||
execute "DROP INDEX #{index_name(table_name, options)}"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
BYTEA_COLUMN_TYPE_OID = 17
|
||||
|
||||
@@ -213,13 +213,7 @@ module ActiveRecord
|
||||
end
|
||||
|
||||
def remove_index(table_name, options={}) #:nodoc:
|
||||
if Hash === options
|
||||
index_name = options[:name]
|
||||
else
|
||||
index_name = "#{table_name}_#{options}_index"
|
||||
end
|
||||
|
||||
execute "DROP INDEX #{index_name}"
|
||||
execute "DROP INDEX #{quote_column_name(index_name(table_name, options))}"
|
||||
end
|
||||
|
||||
def rename_table(name, new_name)
|
||||
|
||||
@@ -2,7 +2,7 @@ module ActiveRecord
|
||||
module VERSION #:nodoc:
|
||||
MAJOR = 1
|
||||
MINOR = 14
|
||||
TINY = 1
|
||||
TINY = 3
|
||||
|
||||
STRING = [MAJOR, MINOR, TINY].join('.')
|
||||
end
|
||||
|
||||
@@ -179,6 +179,42 @@ class EagerAssociationTest < Test::Unit::TestCase
|
||||
assert_equal count, posts.size
|
||||
end
|
||||
|
||||
def test_eager_with_has_many_and_limit_and_scoped_conditions_on_the_eagers
|
||||
posts = nil
|
||||
Post.with_scope(:find => {
|
||||
:include => :comments,
|
||||
:conditions => "comments.body like 'Normal%' OR comments.#{QUOTED_TYPE}= 'SpecialComment'"
|
||||
}) do
|
||||
posts = authors(:david).posts.find(:all, :limit => 2)
|
||||
assert_equal 2, posts.size
|
||||
end
|
||||
|
||||
Post.with_scope(:find => {
|
||||
:include => [ :comments, :author ],
|
||||
:conditions => "authors.name = 'David' AND (comments.body like 'Normal%' OR comments.#{QUOTED_TYPE}= 'SpecialComment')"
|
||||
}) do
|
||||
count = Post.count(:limit => 2)
|
||||
assert_equal count, posts.size
|
||||
end
|
||||
end
|
||||
|
||||
def test_eager_with_has_many_and_limit_and_scoped_and_explicit_conditions_on_the_eagers
|
||||
Post.with_scope(:find => { :conditions => "1=1" }) do
|
||||
posts = authors(:david).posts.find(:all,
|
||||
:include => :comments,
|
||||
:conditions => "comments.body like 'Normal%' OR comments.#{QUOTED_TYPE}= 'SpecialComment'",
|
||||
:limit => 2
|
||||
)
|
||||
assert_equal 2, posts.size
|
||||
|
||||
count = Post.count(
|
||||
:include => [ :comments, :author ],
|
||||
:conditions => "authors.name = 'David' AND (comments.body like 'Normal%' OR comments.#{QUOTED_TYPE}= 'SpecialComment')",
|
||||
:limit => 2
|
||||
)
|
||||
assert_equal count, posts.size
|
||||
end
|
||||
end
|
||||
def test_eager_association_loading_with_habtm
|
||||
posts = Post.find(:all, :include => :categories, :order => "posts.id")
|
||||
assert_equal 2, posts[0].categories.size
|
||||
|
||||
@@ -34,6 +34,7 @@ if ActiveRecord::Base.connection.supports_migrations?
|
||||
Reminder.reset_column_information
|
||||
|
||||
Person.connection.remove_column("people", "last_name") rescue nil
|
||||
Person.connection.remove_column("people", "key") rescue nil
|
||||
Person.connection.remove_column("people", "bio") rescue nil
|
||||
Person.connection.remove_column("people", "age") rescue nil
|
||||
Person.connection.remove_column("people", "height") rescue nil
|
||||
@@ -47,12 +48,17 @@ if ActiveRecord::Base.connection.supports_migrations?
|
||||
def test_add_index
|
||||
Person.connection.add_column "people", "last_name", :string
|
||||
Person.connection.add_column "people", "administrator", :boolean
|
||||
Person.connection.add_column "people", "key", :string
|
||||
|
||||
assert_nothing_raised { Person.connection.add_index("people", "last_name") }
|
||||
assert_nothing_raised { Person.connection.remove_index("people", "last_name") }
|
||||
|
||||
assert_nothing_raised { Person.connection.add_index("people", ["last_name", "first_name"]) }
|
||||
assert_nothing_raised { Person.connection.remove_index("people", "last_name") }
|
||||
|
||||
# quoting
|
||||
assert_nothing_raised { Person.connection.add_index("people", ["key"], :name => "key", :unique => true) }
|
||||
assert_nothing_raised { Person.connection.remove_index("people", :name => "key") }
|
||||
|
||||
# Sybase adapter does not support indexes on :boolean columns
|
||||
unless current_adapter?(:SybaseAdapter)
|
||||
|
||||
@@ -71,116 +71,12 @@ task :pdoc => [:rdoc] do
|
||||
end
|
||||
|
||||
desc "Publish the release files to RubyForge."
|
||||
task :release => [:package] do
|
||||
files = ["gem", "tgz", "zip"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" }
|
||||
task :release => [ :package ] do
|
||||
`rubyforge login`
|
||||
|
||||
if RUBY_FORGE_PROJECT then
|
||||
require 'net/http'
|
||||
require 'open-uri'
|
||||
|
||||
project_uri = "http://rubyforge.org/projects/#{RUBY_FORGE_PROJECT}/"
|
||||
project_data = open(project_uri) { |data| data.read }
|
||||
group_id = project_data[/[?&]group_id=(\d+)/, 1]
|
||||
raise "Couldn't get group id" unless group_id
|
||||
|
||||
# This echos password to shell which is a bit sucky
|
||||
if ENV["RUBY_FORGE_PASSWORD"]
|
||||
password = ENV["RUBY_FORGE_PASSWORD"]
|
||||
else
|
||||
print "#{RUBY_FORGE_USER}@rubyforge.org's password: "
|
||||
password = STDIN.gets.chomp
|
||||
end
|
||||
|
||||
login_response = Net::HTTP.start("rubyforge.org", 80) do |http|
|
||||
data = [
|
||||
"login=1",
|
||||
"form_loginname=#{RUBY_FORGE_USER}",
|
||||
"form_pw=#{password}"
|
||||
].join("&")
|
||||
http.post("/account/login.php", data)
|
||||
end
|
||||
|
||||
cookie = login_response["set-cookie"]
|
||||
raise "Login failed" unless cookie
|
||||
headers = { "Cookie" => cookie }
|
||||
|
||||
release_uri = "http://rubyforge.org/frs/admin/?group_id=#{group_id}"
|
||||
release_data = open(release_uri, headers) { |data| data.read }
|
||||
package_id = release_data[/[?&]package_id=(\d+)/, 1]
|
||||
raise "Couldn't get package id" unless package_id
|
||||
|
||||
first_file = true
|
||||
release_id = ""
|
||||
|
||||
files.each do |filename|
|
||||
basename = File.basename(filename)
|
||||
file_ext = File.extname(filename)
|
||||
file_data = File.open(filename, "rb") { |file| file.read }
|
||||
|
||||
puts "Releasing #{basename}..."
|
||||
|
||||
release_response = Net::HTTP.start("rubyforge.org", 80) do |http|
|
||||
release_date = Time.now.strftime("%Y-%m-%d %H:%M")
|
||||
type_map = {
|
||||
".zip" => "3000",
|
||||
".tgz" => "3110",
|
||||
".gz" => "3110",
|
||||
".gem" => "1400"
|
||||
}; type_map.default = "9999"
|
||||
type = type_map[file_ext]
|
||||
boundary = "rubyqMY6QN9bp6e4kS21H4y0zxcvoor"
|
||||
|
||||
query_hash = if first_file then
|
||||
{
|
||||
"group_id" => group_id,
|
||||
"package_id" => package_id,
|
||||
"release_name" => RELEASE_NAME,
|
||||
"release_date" => release_date,
|
||||
"type_id" => type,
|
||||
"processor_id" => "8000", # Any
|
||||
"release_notes" => "",
|
||||
"release_changes" => "",
|
||||
"preformatted" => "1",
|
||||
"submit" => "1"
|
||||
}
|
||||
else
|
||||
{
|
||||
"group_id" => group_id,
|
||||
"release_id" => release_id,
|
||||
"package_id" => package_id,
|
||||
"step2" => "1",
|
||||
"type_id" => type,
|
||||
"processor_id" => "8000", # Any
|
||||
"submit" => "Add This File"
|
||||
}
|
||||
end
|
||||
|
||||
query = "?" + query_hash.map do |(name, value)|
|
||||
[name, URI.encode(value)].join("=")
|
||||
end.join("&")
|
||||
|
||||
data = [
|
||||
"--" + boundary,
|
||||
"Content-Disposition: form-data; name=\"userfile\"; filename=\"#{basename}\"",
|
||||
"Content-Type: application/octet-stream",
|
||||
"Content-Transfer-Encoding: binary",
|
||||
"", file_data, ""
|
||||
].join("\x0D\x0A")
|
||||
|
||||
release_headers = headers.merge(
|
||||
"Content-Type" => "multipart/form-data; boundary=#{boundary}"
|
||||
)
|
||||
|
||||
target = first_file ? "/frs/admin/qrs.php" : "/frs/admin/editrelease.php"
|
||||
http.post(target + query, data, release_headers)
|
||||
end
|
||||
|
||||
if first_file then
|
||||
release_id = release_response.body[/release_id=(\d+)/, 1]
|
||||
raise("Couldn't get release id") unless release_id
|
||||
end
|
||||
|
||||
first_file = false
|
||||
end
|
||||
for ext in %w( gem tgz zip )
|
||||
release_command = "rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}"
|
||||
puts release_command
|
||||
system(release_command)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,4 +1,23 @@
|
||||
*1.1.1* (April 6th, 2005)
|
||||
*1.1.4* (June 29th, 2006)
|
||||
|
||||
* Remove use of opts.on { |options[:name] } style hash assignment. References #4440. [headius@headius.com]
|
||||
|
||||
* Updated to Action Pack 1.12.3, ActionWebService 1.1.4, ActionMailer 1.2.3
|
||||
|
||||
|
||||
*1.1.3* (June 27th, 2006)
|
||||
|
||||
* Updated to Active Record 1.14.3, Action Pack 1.12.2, ActionWebService 1.1.3, ActionMailer 1.2.2
|
||||
|
||||
|
||||
*1.1.2* (April 9th, 2006)
|
||||
|
||||
* Added rake rails:update:configs to update config/boot.rb from the latest (also included in rake rails:update) [DHH]
|
||||
|
||||
* Fixed that boot.rb would set RAILS_GEM_VERSION twice, not respect an uncommented RAILS_GEM_VERSION line, and not use require_gem [DHH]
|
||||
|
||||
|
||||
*1.1.1* (April 6th, 2006)
|
||||
|
||||
* Enhances plugin#discover allowing it to discover svn:// like URIs (closes #4565) [ruben.nine@gmail.com]
|
||||
|
||||
@@ -37,7 +56,7 @@
|
||||
* Avoid passing escapeHTML non-string in Rails' info controller [Nicholas Seckar]
|
||||
|
||||
|
||||
*1.1.0* (March 27th, 2005)
|
||||
*1.1.0* (March 27th, 2006)
|
||||
|
||||
* Allow db:fixtures:load to load a subset of the applications fixtures. [Chad Fowler]
|
||||
|
||||
@@ -178,6 +197,7 @@
|
||||
|
||||
* Honor ActiveRecord::Base.pluralize_table_names when creating and destroying session store table. #3204. [rails@bencurtis.com, Marcel Molina Jr.]
|
||||
|
||||
|
||||
*1.0.0* (December 13th, 2005)
|
||||
|
||||
* Update instructions on how to find and install generators. #3172. [Chad Fowler]
|
||||
|
||||
@@ -279,10 +279,10 @@ spec = Gem::Specification.new do |s|
|
||||
|
||||
s.add_dependency('rake', '>= 0.7.1')
|
||||
s.add_dependency('activesupport', '= 1.3.1' + PKG_BUILD)
|
||||
s.add_dependency('activerecord', '= 1.14.1' + PKG_BUILD)
|
||||
s.add_dependency('actionpack', '= 1.12.1' + PKG_BUILD)
|
||||
s.add_dependency('actionmailer', '= 1.2.1' + PKG_BUILD)
|
||||
s.add_dependency('actionwebservice', '= 1.1.1' + PKG_BUILD)
|
||||
s.add_dependency('activerecord', '= 1.14.3' + PKG_BUILD)
|
||||
s.add_dependency('actionpack', '= 1.12.3' + PKG_BUILD)
|
||||
s.add_dependency('actionmailer', '= 1.2.3' + PKG_BUILD)
|
||||
s.add_dependency('actionwebservice', '= 1.1.4' + PKG_BUILD)
|
||||
|
||||
s.rdoc_options << '--exclude' << '.'
|
||||
s.has_rdoc = false
|
||||
@@ -312,116 +312,9 @@ task :pgem => [:gem] do
|
||||
end
|
||||
|
||||
desc "Publish the release files to RubyForge."
|
||||
task :release => [:gem] do
|
||||
files = ["gem"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" }
|
||||
|
||||
if RUBY_FORGE_PROJECT then
|
||||
require 'net/http'
|
||||
require 'open-uri'
|
||||
|
||||
project_uri = "http://rubyforge.org/projects/#{RUBY_FORGE_PROJECT}/"
|
||||
project_data = open(project_uri) { |data| data.read }
|
||||
group_id = project_data[/[?&]group_id=(\d+)/, 1]
|
||||
raise "Couldn't get group id" unless group_id
|
||||
|
||||
# This echos password to shell which is a bit sucky
|
||||
if ENV["RUBY_FORGE_PASSWORD"]
|
||||
password = ENV["RUBY_FORGE_PASSWORD"]
|
||||
else
|
||||
print "#{RUBY_FORGE_USER}@rubyforge.org's password: "
|
||||
password = STDIN.gets.chomp
|
||||
end
|
||||
|
||||
login_response = Net::HTTP.start("rubyforge.org", 80) do |http|
|
||||
data = [
|
||||
"login=1",
|
||||
"form_loginname=#{RUBY_FORGE_USER}",
|
||||
"form_pw=#{password}"
|
||||
].join("&")
|
||||
http.post("/account/login.php", data)
|
||||
end
|
||||
|
||||
cookie = login_response["set-cookie"]
|
||||
raise "Login failed" unless cookie
|
||||
headers = { "Cookie" => cookie }
|
||||
|
||||
release_uri = "http://rubyforge.org/frs/admin/?group_id=#{group_id}"
|
||||
release_data = open(release_uri, headers) { |data| data.read }
|
||||
package_id = release_data[/[?&]package_id=(\d+)/, 1]
|
||||
raise "Couldn't get package id" unless package_id
|
||||
|
||||
first_file = true
|
||||
release_id = ""
|
||||
|
||||
files.each do |filename|
|
||||
basename = File.basename(filename)
|
||||
file_ext = File.extname(filename)
|
||||
file_data = File.open(filename, "rb") { |file| file.read }
|
||||
|
||||
puts "Releasing #{basename}..."
|
||||
|
||||
release_response = Net::HTTP.start("rubyforge.org", 80) do |http|
|
||||
release_date = Time.now.strftime("%Y-%m-%d %H:%M")
|
||||
type_map = {
|
||||
".zip" => "3000",
|
||||
".tgz" => "3110",
|
||||
".gz" => "3110",
|
||||
".gem" => "1400"
|
||||
}; type_map.default = "9999"
|
||||
type = type_map[file_ext]
|
||||
boundary = "rubyqMY6QN9bp6e4kS21H4y0zxcvoor"
|
||||
|
||||
query_hash = if first_file then
|
||||
{
|
||||
"group_id" => group_id,
|
||||
"package_id" => package_id,
|
||||
"release_name" => RELEASE_NAME,
|
||||
"release_date" => release_date,
|
||||
"type_id" => type,
|
||||
"processor_id" => "8000", # Any
|
||||
"release_notes" => "",
|
||||
"release_changes" => "",
|
||||
"preformatted" => "1",
|
||||
"submit" => "1"
|
||||
}
|
||||
else
|
||||
{
|
||||
"group_id" => group_id,
|
||||
"release_id" => release_id,
|
||||
"package_id" => package_id,
|
||||
"step2" => "1",
|
||||
"type_id" => type,
|
||||
"processor_id" => "8000", # Any
|
||||
"submit" => "Add This File"
|
||||
}
|
||||
end
|
||||
|
||||
query = "?" + query_hash.map do |(name, value)|
|
||||
[name, URI.encode(value)].join("=")
|
||||
end.join("&")
|
||||
|
||||
data = [
|
||||
"--" + boundary,
|
||||
"Content-Disposition: form-data; name=\"userfile\"; filename=\"#{basename}\"",
|
||||
"Content-Type: application/octet-stream",
|
||||
"Content-Transfer-Encoding: binary",
|
||||
"", file_data, ""
|
||||
].join("\x0D\x0A")
|
||||
|
||||
release_headers = headers.merge(
|
||||
"Content-Type" => "multipart/form-data; boundary=#{boundary}"
|
||||
)
|
||||
|
||||
target = first_file ? "/frs/admin/qrs.php" : "/frs/admin/editrelease.php"
|
||||
http.post(target + query, data, release_headers)
|
||||
end
|
||||
|
||||
if first_file then
|
||||
release_id = release_response.body[/release_id=(\d+)/, 1]
|
||||
raise("Couldn't get release id") unless release_id
|
||||
end
|
||||
|
||||
first_file = false
|
||||
end
|
||||
end
|
||||
end
|
||||
task :release => [ :gem ] do
|
||||
`rubyforge login`
|
||||
release_command = "rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.gem"
|
||||
puts release_command
|
||||
system(release_command)
|
||||
end
|
||||
@@ -2,37 +2,43 @@
|
||||
|
||||
unless defined?(RAILS_ROOT)
|
||||
root_path = File.join(File.dirname(__FILE__), '..')
|
||||
|
||||
unless RUBY_PLATFORM =~ /mswin32/
|
||||
require 'pathname'
|
||||
root_path = Pathname.new(root_path).cleanpath(true).to_s
|
||||
end
|
||||
|
||||
RAILS_ROOT = root_path
|
||||
end
|
||||
|
||||
if File.directory?("#{RAILS_ROOT}/vendor/rails")
|
||||
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
||||
else
|
||||
require 'rubygems'
|
||||
|
||||
if !defined?(RAILS_GEM_VERSION) && File.read(File.dirname(__FILE__) + '/environment.rb') =~ /RAILS_GEM_VERSION = '([\d.]+)'/
|
||||
RAILS_GEM_VERSION = $1
|
||||
end
|
||||
|
||||
if defined?(RAILS_GEM_VERSION)
|
||||
rails_gem = Gem.cache.search('rails', "=#{RAILS_GEM_VERSION}").first
|
||||
|
||||
if rails_gem
|
||||
require rails_gem.full_gem_path + '/lib/initializer'
|
||||
else
|
||||
STDERR.puts %(Cannot find gem for Rails =#{RAILS_GEM_VERSION}:
|
||||
Install the missing gem with 'gem install -v=#{RAILS_GEM_VERSION} rails', or
|
||||
change environment.rb to define RAILS_GEM_VERSION with your desired version.
|
||||
)
|
||||
exit 1
|
||||
end
|
||||
unless defined?(Rails::Initializer)
|
||||
if File.directory?("#{RAILS_ROOT}/vendor/rails")
|
||||
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
||||
else
|
||||
require 'initializer'
|
||||
end
|
||||
end
|
||||
require 'rubygems'
|
||||
|
||||
Rails::Initializer.run(:set_load_path)
|
||||
environment_without_comments = IO.readlines(File.dirname(__FILE__) + '/environment.rb').reject { |l| l =~ /^#/ }.join
|
||||
environment_without_comments =~ /[^#]RAILS_GEM_VERSION = '([\d.]+)'/
|
||||
rails_gem_version = $1
|
||||
|
||||
if version = defined?(RAILS_GEM_VERSION) ? RAILS_GEM_VERSION : rails_gem_version
|
||||
rails_gem = Gem.cache.search('rails', "=#{version}").first
|
||||
|
||||
if rails_gem
|
||||
require_gem "rails", "=#{version}"
|
||||
require rails_gem.full_gem_path + '/lib/initializer'
|
||||
else
|
||||
STDERR.puts %(Cannot find gem for Rails =#{version}:
|
||||
Install the missing gem with 'gem install -v=#{version} rails', or
|
||||
change environment.rb to define RAILS_GEM_VERSION with your desired version.
|
||||
)
|
||||
exit 1
|
||||
end
|
||||
else
|
||||
require_gem "rails"
|
||||
require 'initializer'
|
||||
end
|
||||
end
|
||||
|
||||
Rails::Initializer.run(:set_load_path)
|
||||
end
|
||||
@@ -4,8 +4,8 @@ require 'optparse'
|
||||
options = { :sandbox => false, :irb => irb }
|
||||
OptionParser.new do |opt|
|
||||
opt.banner = "Usage: console [environment] [options]"
|
||||
opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |options[:sandbox]| }
|
||||
opt.on("--irb=[#{irb}]", 'Invoke a different irb.') { |options[:irb]| }
|
||||
opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |v| options[:sandbox] = v }
|
||||
opt.on("--irb=[#{irb}]", 'Invoke a different irb.') { |v| options[:irb] = v }
|
||||
opt.parse!(ARGV)
|
||||
end
|
||||
|
||||
|
||||
@@ -117,8 +117,8 @@ ARGV.options do |opts|
|
||||
|
||||
opts.on(" Options:")
|
||||
|
||||
opts.on("-a", "--action=name", "reload|graceful|kill (default: #{OPTIONS[:action]})", String) { |OPTIONS[:action]| }
|
||||
opts.on("-d", "--dispatcher=path", "default: #{OPTIONS[:dispatcher]}", String) { |OPTIONS[:dispatcher]| }
|
||||
opts.on("-a", "--action=name", "reload|graceful|kill (default: #{OPTIONS[:action]})", String) { |v| OPTIONS[:action] = v }
|
||||
opts.on("-d", "--dispatcher=path", "default: #{OPTIONS[:dispatcher]}", String) { |v| OPTIONS[:dispatcher] = v }
|
||||
|
||||
opts.separator ""
|
||||
|
||||
|
||||
@@ -65,11 +65,11 @@ ARGV.options do |opts|
|
||||
|
||||
opts.on(" Options:")
|
||||
|
||||
opts.on("-p", "--port=number", Integer, "Starting port number (default: #{OPTIONS[:port]})") { |OPTIONS[:port]| }
|
||||
opts.on("-i", "--instances=number", Integer, "Number of instances (default: #{OPTIONS[:instances]})") { |OPTIONS[:instances]| }
|
||||
opts.on("-r", "--repeat=seconds", Integer, "Repeat spawn attempts every n seconds (default: off)") { |OPTIONS[:repeat]| }
|
||||
opts.on("-e", "--environment=name", String, "test|development|production (default: #{OPTIONS[:environment]})") { |OPTIONS[:environment]| }
|
||||
opts.on("-s", "--spawner=path", String, "default: #{OPTIONS[:spawner]}") { |OPTIONS[:spawner]| }
|
||||
opts.on("-p", "--port=number", Integer, "Starting port number (default: #{OPTIONS[:port]})") { |v| OPTIONS[:port] = v }
|
||||
opts.on("-i", "--instances=number", Integer, "Number of instances (default: #{OPTIONS[:instances]})") { |v| OPTIONS[:instances] = v }
|
||||
opts.on("-r", "--repeat=seconds", Integer, "Repeat spawn attempts every n seconds (default: off)") { |v| OPTIONS[:repeat] = v }
|
||||
opts.on("-e", "--environment=name", String, "test|development|production (default: #{OPTIONS[:environment]})") { |v| OPTIONS[:environment] = v }
|
||||
opts.on("-s", "--spawner=path", String, "default: #{OPTIONS[:spawner]}") { |v| OPTIONS[:spawner] = v }
|
||||
opts.on("-d", "--dispatcher=path", String, "default: #{OPTIONS[:dispatcher]}") { |dispatcher| OPTIONS[:dispatcher] = File.expand_path(dispatcher) }
|
||||
|
||||
opts.separator ""
|
||||
|
||||
@@ -36,9 +36,9 @@ ARGV.options do |opts|
|
||||
|
||||
opts.on(" Options:")
|
||||
|
||||
opts.on("-c", "--command=path", String) { |OPTIONS[:command]| }
|
||||
opts.on("-i", "--interval=seconds", Float) { |OPTIONS[:interval]| }
|
||||
opts.on("-d", "--daemon") { |OPTIONS[:daemon]| }
|
||||
opts.on("-c", "--command=path", String) { |v| OPTIONS[:command] = v }
|
||||
opts.on("-i", "--interval=seconds", Float) { |v| OPTIONS[:interval] = v }
|
||||
opts.on("-d", "--daemon") { |v| OPTIONS[:daemon] = v }
|
||||
|
||||
opts.separator ""
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ ARGV.options do |opts|
|
||||
|
||||
opts.on("-e", "--environment=name", String,
|
||||
"Specifies the environment for the runner to operate under (test/development/production).",
|
||||
"Default: development") { |options[:environment]| }
|
||||
"Default: development") { |v| options[:environment] = v }
|
||||
|
||||
opts.separator ""
|
||||
|
||||
|
||||
@@ -19,13 +19,13 @@ ARGV.options do |opts|
|
||||
|
||||
opts.on("-p", "--port=port", Integer,
|
||||
"Runs Rails on the specified port.",
|
||||
"Default: 3000") { |OPTIONS[:port]| }
|
||||
"Default: 3000") { |v| OPTIONS[:port] = v }
|
||||
opts.on("-b", "--binding=ip", String,
|
||||
"Binds Rails to the specified ip.",
|
||||
"Default: 0.0.0.0") { |OPTIONS[:ip]| }
|
||||
"Default: 0.0.0.0") { |v| OPTIONS[:ip] = v }
|
||||
opts.on("-e", "--environment=name", String,
|
||||
"Specifies the environment to run this server under (test/development/production).",
|
||||
"Default: development") { |OPTIONS[:environment]| }
|
||||
"Default: development") { |v| OPTIONS[:environment] = v }
|
||||
opts.on("-m", "--mime-types=filename", String,
|
||||
"Specifies an Apache style mime.types configuration file to be used for mime types",
|
||||
"Default: none") { |mime_types_file| OPTIONS[:mime_types] = WEBrick::HTTPUtils::load_mime_types(mime_types_file) }
|
||||
@@ -36,7 +36,7 @@ ARGV.options do |opts|
|
||||
|
||||
opts.on("-c", "--charset=charset", String,
|
||||
"Set default charset for output.",
|
||||
"Default: UTF-8") { |OPTIONS[:charset]| }
|
||||
"Default: UTF-8") { |v| OPTIONS[:charset] = v }
|
||||
|
||||
opts.separator ""
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ module Rails
|
||||
module VERSION #:nodoc:
|
||||
MAJOR = 1
|
||||
MINOR = 1
|
||||
TINY = 1
|
||||
TINY = 4
|
||||
|
||||
STRING = [MAJOR, MINOR, TINY].join('.')
|
||||
end
|
||||
|
||||
@@ -96,15 +96,15 @@ class AppGenerator < Rails::Generator::Base
|
||||
opt.separator 'Options:'
|
||||
opt.on("-r", "--ruby=path", String,
|
||||
"Path to the Ruby binary of your choice (otherwise scripts use env, dispatchers current path).",
|
||||
"Default: #{DEFAULT_SHEBANG}") { |options[:shebang]| }
|
||||
"Default: #{DEFAULT_SHEBANG}") { |v| options[:shebang] = v }
|
||||
|
||||
opt.on("-d", "--database=name", String,
|
||||
"Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite2/sqlite3).",
|
||||
"Default: mysql") { |options[:db]| }
|
||||
"Default: mysql") { |v| options[:db] = v }
|
||||
|
||||
opt.on("-f", "--freeze",
|
||||
"Freeze Rails in vendor/rails from the gems generating the skeleton",
|
||||
"Default: false") { |options[:freeze]| }
|
||||
"Default: false") { |v| options[:freeze] = v }
|
||||
end
|
||||
|
||||
def mysql_socket_location
|
||||
|
||||
@@ -29,6 +29,6 @@ class ModelGenerator < Rails::Generator::NamedBase
|
||||
opt.separator ''
|
||||
opt.separator 'Options:'
|
||||
opt.on("--skip-migration",
|
||||
"Don't generate a migration file for this model") { |options[:skip_migration]| }
|
||||
"Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -121,12 +121,12 @@ module Rails
|
||||
opt.separator ''
|
||||
opt.separator 'General Options:'
|
||||
|
||||
opt.on('-p', '--pretend', 'Run but do not make any changes.') { |options[:pretend]| }
|
||||
opt.on('-p', '--pretend', 'Run but do not make any changes.') { |v| options[:pretend] = v }
|
||||
opt.on('-f', '--force', 'Overwrite files that already exist.') { options[:collision] = :force }
|
||||
opt.on('-s', '--skip', 'Skip files that already exist.') { options[:collision] = :skip }
|
||||
opt.on('-q', '--quiet', 'Suppress normal output.') { |options[:quiet]| }
|
||||
opt.on('-t', '--backtrace', 'Debugging: show backtrace on errors.') { |options[:backtrace]| }
|
||||
opt.on('-h', '--help', 'Show this help message.') { |options[:help]| }
|
||||
opt.on('-q', '--quiet', 'Suppress normal output.') { |v| options[:quiet] = v }
|
||||
opt.on('-t', '--backtrace', 'Debugging: show backtrace on errors.') { |v| options[:backtrace] = v }
|
||||
opt.on('-h', '--help', 'Show this help message.') { |v| options[:help] = v }
|
||||
opt.on('-c', '--svn', 'Modify files with subversion. (Note: svn must be in path)') do
|
||||
options[:svn] = `svn status`.inject({}) do |opt, e|
|
||||
opt[e.chomp[7..-1]] = true
|
||||
|
||||
@@ -71,8 +71,8 @@ namespace :rails do
|
||||
rm_rf "vendor/rails"
|
||||
end
|
||||
|
||||
desc "Update both scripts and public/javascripts from Rails"
|
||||
task :update => [ "update:scripts", "update:javascripts" ]
|
||||
desc "Update both configs, scripts and public/javascripts from Rails"
|
||||
task :update => [ "update:scripts", "update:javascripts", "update:configs" ]
|
||||
|
||||
namespace :update do
|
||||
desc "Add new scripts to the application script/ directory"
|
||||
@@ -102,5 +102,13 @@ namespace :rails do
|
||||
scripts.reject!{|s| File.basename(s) == 'application.js'} if File.exists?(project_dir + 'application.js')
|
||||
FileUtils.cp(scripts, project_dir)
|
||||
end
|
||||
|
||||
desc "Update boot/config.rb from your current rails install"
|
||||
task :configs do
|
||||
require 'railties_path'
|
||||
project_dir = RAILS_ROOT + '/public/javascripts/'
|
||||
scripts = Dir[RAILTIES_PATH + '/html/javascripts/*.js']
|
||||
FileUtils.cp(RAILTIES_PATH + '/environments/boot.rb', RAILS_ROOT + '/config/boot.rb')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
18
release.rb
18
release.rb
@@ -1,29 +1,25 @@
|
||||
#!/usr/local/bin/ruby
|
||||
|
||||
VERSION = ARGV.first
|
||||
PACKAGES = %w( activesupport activerecord actionpack actionmailer actionwebservice )
|
||||
|
||||
unless ruby_forge_password = ARGV.first
|
||||
print "rubyforge.org's password: "
|
||||
ruby_forge_password = STDIN.gets.chomp
|
||||
end
|
||||
|
||||
# Checkout source
|
||||
`rm -rf release && svn export http://dev.rubyonrails.org/svn/rails/trunk release`
|
||||
`rm -rf release && svn export http://dev.rubyonrails.org/svn/rails/branches/stable release`
|
||||
|
||||
# Create Rails packages
|
||||
`cd release/railties && rake template=jamis package`
|
||||
|
||||
# Upload documentation
|
||||
`cd release/rails/doc/api && scp -r * davidhh@wrath.rubyonrails.com:public_html/rails`
|
||||
PACKAGES.each do |p|
|
||||
`cd release/#{p} && echo "Publishing documentation for #{p}" && rake template=jamis pdoc`
|
||||
end
|
||||
`cd release/rails/doc/api && scp -r * davidhh@wrath.rubyonrails.com:public_html/api`
|
||||
|
||||
# Upload packages
|
||||
(PACKAGES + %w(railties)).each do |p|
|
||||
`cd release/#{p} && echo "Releasing #{p}" && RUBY_FORGE_PASSWORD=#{ruby_forge_password} rake release`
|
||||
`cd release/#{p} && echo "Releasing #{p}" && rake release`
|
||||
end
|
||||
|
||||
# Upload rails tgz/zip
|
||||
`rubyforge add_release rails rails 'REL #{VERSION}' rails-#{VERSION}.tgz`
|
||||
`rubyforge add_release rails rails 'REL #{VERSION}' rails-#{VERSION}.zip`
|
||||
|
||||
# Create SVN tag
|
||||
puts "Remeber to create SVN tag"
|
||||
|
||||
Reference in New Issue
Block a user