rails 0.9.1 → 0.9.2

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

Potentially problematic release.


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

data/CHANGELOG CHANGED
@@ -1,3 +1,20 @@
1
+ *0.9.2*
2
+
3
+ * Fixed CTRL-C exists from the Breakpointer to be a clean affair without error dumping [Kent Sibilev]
4
+
5
+ * Fixed "rake stats" to work with sub-directories in models and controllers and to report the code to test ration [Scott Baron]
6
+
7
+ * Added that Active Record associations are now reloaded instead of cleared to work with the new const_missing hook in Active Record.
8
+
9
+ * Added graceful handling of an inaccessible log file by redirecting output to STDERR with a warning #330 [rainmkr]
10
+
11
+ * Added support for a -h/--help parameter in the generator #331 [Ulysses]
12
+
13
+ * Fixed that File.expand_path in config/environment.rb would fail when dealing with symlinked public directories [mjobin]
14
+
15
+ * Upgraded to Action Pack 1.1.0 and Active Record 1.3.0
16
+
17
+
1
18
  *0.9.1*
2
19
 
3
20
  * Upgraded to Action Pack 1.0.1 for important bug fix
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ require 'date'
9
9
 
10
10
  PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
11
11
  PKG_NAME = 'rails'
12
- PKG_VERSION = '0.9.1' + PKG_BUILD
12
+ PKG_VERSION = '0.9.2' + PKG_BUILD
13
13
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
14
14
  PKG_DESTINATION = ENV["RAILS_PKG_DESTINATION"] || "../#{PKG_NAME}"
15
15
 
@@ -153,6 +153,7 @@ end
153
153
  task :copy_rootfiles do
154
154
  cp "fresh_rakefile", "#{PKG_DESTINATION}/Rakefile"
155
155
  cp "README", "#{PKG_DESTINATION}/README"
156
+ cp "CHANGELOG", "#{PKG_DESTINATION}/CHANGELOG"
156
157
  end
157
158
 
158
159
  task :copy_test_helpers do
@@ -220,8 +221,8 @@ spec = Gem::Specification.new do |s|
220
221
  EOF
221
222
 
222
223
  s.add_dependency('rake', '>= 0.4.11')
223
- s.add_dependency('activerecord', '>= 1.2.0')
224
- s.add_dependency('actionpack', '>= 1.0.1')
224
+ s.add_dependency('activerecord', '>= 1.3.0')
225
+ s.add_dependency('actionpack', '>= 1.1.0')
225
226
  s.add_dependency('actionmailer', '>= 0.5.0')
226
227
 
227
228
  s.has_rdoc = false
@@ -2,6 +2,8 @@
2
2
  require File.dirname(__FILE__) + '/../config/environment'
3
3
  require 'rails_generator'
4
4
 
5
+ ARGV.shift unless ARGV.empty? or not ['--help', '-h'].include?(ARGV[0])
6
+
5
7
  unless ARGV.empty?
6
8
  begin
7
9
  name = ARGV.shift
@@ -25,17 +27,17 @@ else
25
27
  end_usage
26
28
 
27
29
  unless contrib_generators.empty?
28
- $stderr.puts " Installed generators (in #{RAILS_ROOT}/generators):"
30
+ $stderr.puts " Installed generators (in #{RAILS_ROOT}/script/generators):"
29
31
  $stderr.puts " #{contrib_generators}"
30
32
  $stderr.puts
31
33
  end
32
34
 
33
35
  $stderr.puts <<end_usage
34
- More generators are available at http://rubyonrails.org
35
- 1. Download, for example, auth_controller.zip
36
- 2. Unzip to directory #{RAILS_ROOT}/generators/auth_controller
36
+ More generators are available at http://rubyonrails.org/show/Generators
37
+ 1. Download, for example, login_generator.tar.gz
38
+ 2. Unzip to directory #{RAILS_ROOT}/script/generators/login
37
39
  3. Generate without args for usage information
38
- #{$0} auth_controller
40
+ #{$0} login
39
41
  end_usage
40
42
  exit 0
41
43
  end
@@ -10,7 +10,7 @@ RewriteEngine On
10
10
  RewriteBase /dispatch.cgi
11
11
 
12
12
  # Enable this rewrite rule to point to the controller/action that should serve root.
13
- # RewriteRule ^$ /controller/action
13
+ # RewriteRule ^$ /controller/action [R]
14
14
 
15
15
  # Add missing slash
16
16
  RewriteRule ^([-_a-zA-Z0-9]+)$ /$1/ [R]
@@ -1,4 +1,4 @@
1
- RAILS_ROOT = File.expand_path(File.dirname(__FILE__) + "/../")
1
+ RAILS_ROOT = File.dirname(__FILE__) + "/../"
2
2
  RAILS_ENV = ENV['RAILS_ENV'] || 'development'
3
3
 
4
4
 
@@ -41,7 +41,17 @@ ActiveRecord::Base.establish_connection
41
41
 
42
42
 
43
43
  # Configure defaults if the included environment did not.
44
- RAILS_DEFAULT_LOGGER = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log")
44
+ begin
45
+ RAILS_DEFAULT_LOGGER = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log")
46
+ rescue StandardError
47
+ RAILS_DEFAULT_LOGGER = Logger.new(STDERR)
48
+ RAILS_DEFAULT_LOGGER.level = Logger::WARN
49
+ RAILS_DEFAULT_LOGGER.warn(
50
+ "Rails Error: Unable to access log file. Please ensure that log/#{RAILS_ENV}.log exists and is chmod 0777. " +
51
+ "The log level has been raised to WARN and the output directed to STDERR until the problem is fixed."
52
+ )
53
+ end
54
+
45
55
  [ActiveRecord::Base, ActionController::Base, ActionMailer::Base].each do |klass|
46
56
  klass.logger ||= RAILS_DEFAULT_LOGGER
47
57
  end
@@ -1,4 +1,4 @@
1
- RAILS_ROOT = File.expand_path(File.dirname(__FILE__) + "/../")
1
+ RAILS_ROOT = File.dirname(__FILE__) + "/../"
2
2
  RAILS_ENV = ENV['RAILS_ENV'] || 'development'
3
3
 
4
4
 
@@ -38,7 +38,17 @@ ActiveRecord::Base.establish_connection
38
38
 
39
39
 
40
40
  # Configure defaults if the included environment did not.
41
- RAILS_DEFAULT_LOGGER = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log")
41
+ begin
42
+ RAILS_DEFAULT_LOGGER = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log")
43
+ rescue StandardError
44
+ RAILS_DEFAULT_LOGGER = Logger.new(STDERR)
45
+ RAILS_DEFAULT_LOGGER.level = Logger::WARN
46
+ RAILS_DEFAULT_LOGGER.warn(
47
+ "Rails Error: Unable to access log file. Please ensure that log/#{RAILS_ENV}.log exists and is chmod 0777. " +
48
+ "The log level has been raised to WARN and the output directed to STDERR until the problem is fixed."
49
+ )
50
+ end
51
+
42
52
  [ActiveRecord::Base, ActionController::Base, ActionMailer::Base].each do |klass|
43
53
  klass.logger ||= RAILS_DEFAULT_LOGGER
44
54
  end
@@ -63,11 +63,11 @@ Rake::RDocTask.new("apidoc") { |rdoc|
63
63
  desc "Report code statistics (KLOCs, etc) from the application"
64
64
  task :stats do
65
65
  CodeStatistics.new(
66
- ["Controllers", "app/controllers"],
67
66
  ["Helpers", "app/helpers"],
67
+ ["Controllers", "app/controllers"],
68
+ ["Functionals", "test/functional"],
68
69
  ["Models", "app/models"],
69
- ["Units", "test/unit"],
70
- ["Functionals", "test/functional"]
70
+ ["Units", "test/unit"]
71
71
  ).to_s
72
72
  end
73
73
 
@@ -103,4 +103,4 @@ task :purge_test_database do
103
103
  `dropdb -U #{ActiveRecord::Base.configurations["test"]["username"]} #{ActiveRecord::Base.configurations["test"]["database"]}`
104
104
  `createdb -U #{ActiveRecord::Base.configurations["test"]["username"]} #{ActiveRecord::Base.configurations["test"]["database"]}`
105
105
  end
106
- end
106
+ end
@@ -62,6 +62,10 @@ end
62
62
 
63
63
  options[:ServerURI] = ARGV[0] if ARGV[0]
64
64
 
65
+ $running = true
66
+
67
+ trap("INT"){$running = false}
68
+
65
69
  puts "Waiting for initial breakpoint..."
66
70
 
67
71
  loop do
@@ -138,7 +142,7 @@ loop do
138
142
 
139
143
  puts "Connection established. Waiting for breakpoint...", "" if options[:Verbose]
140
144
 
141
- loop do
145
+ while $running
142
146
  begin
143
147
  service.ping
144
148
  rescue DRb::DRbConnError => error
@@ -152,6 +156,7 @@ loop do
152
156
  service.unregister_handler
153
157
  end
154
158
  rescue Exception => error
159
+ break unless $running
155
160
  if options[:RetryDelay] > 0 then
156
161
  puts "No connection to breakpoint service at #{options[:ServerURI]}:", " (#{error.inspect})" if options[:Verbose]
157
162
  error.backtrace if $DEBUG
@@ -7,13 +7,15 @@ class CodeStatistics
7
7
 
8
8
  def to_s
9
9
  print_header
10
- @statistics.each{ |k, v| print_line(k, v) }
10
+ @pairs.each { |pair| print_line(pair.first, @statistics[pair.first]) }
11
11
  print_splitter
12
12
 
13
13
  if @total
14
14
  print_line("Total", @total)
15
15
  print_splitter
16
16
  end
17
+
18
+ print_code_test_stats
17
19
  end
18
20
 
19
21
  private
@@ -25,6 +27,11 @@ class CodeStatistics
25
27
  stats = { "lines" => 0, "codelines" => 0, "classes" => 0, "methods" => 0 }
26
28
 
27
29
  Dir.foreach(directory) do |file_name|
30
+ if File.stat(directory + "/" + file_name).directory? and (/^\./ !~ file_name)
31
+ newstats = calculate_directory_statistics(directory + "/" + file_name, pattern)
32
+ stats.each { |k, v| stats[k] += newstats[k] }
33
+ end
34
+
28
35
  next unless file_name =~ pattern
29
36
 
30
37
  f = File.open(directory + "/" + file_name)
@@ -46,6 +53,18 @@ class CodeStatistics
46
53
  total
47
54
  end
48
55
 
56
+ def calculate_code
57
+ code_loc = 0
58
+ @statistics.each { |k, v| code_loc += v['codelines'] unless ['Units', 'Functionals'].include? k }
59
+ code_loc
60
+ end
61
+
62
+ def calculate_tests
63
+ test_loc = 0
64
+ @statistics.each { |k, v| test_loc += v['codelines'] if ['Units', 'Functionals'].include? k }
65
+ test_loc
66
+ end
67
+
49
68
  def print_header
50
69
  print_splitter
51
70
  puts "| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |"
@@ -60,7 +79,13 @@ class CodeStatistics
60
79
  m_over_c = (statistics["methods"] / statistics["classes"]) rescue m_over_c = 0
61
80
  loc_over_m = (statistics["codelines"] / statistics["methods"]) - 2 rescue loc_over_m = 0
62
81
 
63
- puts "| #{name.ljust(20)} " +
82
+ start = if ['Units', 'Functionals'].include? name
83
+ "| #{name.ljust(18)} "
84
+ else
85
+ "| #{name.ljust(20)} "
86
+ end
87
+
88
+ puts start +
64
89
  "| #{statistics["lines"].to_s.rjust(5)} " +
65
90
  "| #{statistics["codelines"].to_s.rjust(5)} " +
66
91
  "| #{statistics["classes"].to_s.rjust(7)} " +
@@ -68,4 +93,12 @@ class CodeStatistics
68
93
  "| #{m_over_c.to_s.rjust(3)} " +
69
94
  "| #{loc_over_m.to_s.rjust(5)} |"
70
95
  end
71
- end
96
+
97
+ def print_code_test_stats
98
+ code = calculate_code
99
+ tests = calculate_tests
100
+
101
+ puts " Code LOC: #{code} Test LOC: #{tests} Code to Test Ratio: #{sprintf("%.1f", code/tests.to_f)}:1"
102
+ puts ""
103
+ end
104
+ end
@@ -43,8 +43,8 @@ class Dispatcher
43
43
  if ActionController::Base.reload_dependencies
44
44
  Object.send(:remove_const, "ApplicationController") if Object.const_defined?(:ApplicationController)
45
45
  Object.send(:remove_const, controller_class_name(controller_name)) if Object.const_defined?(controller_class_name(controller_name))
46
- ActiveRecord::Base.reset_associations_loaded
47
46
  ActiveRecord::Base.reset_column_information_and_inheritable_attributes_for_all_subclasses
47
+ ActiveRecord::Base.reload_associations_loaded
48
48
  end
49
49
 
50
50
  Breakpoint.deactivate_drb if defined?(BREAKPOINT_SERVER_PORT)
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.1
3
3
  specification_version: 1
4
4
  name: rails
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.9.1
7
- date: 2004-12-17
6
+ version: 0.9.2
7
+ date: 2004-12-23
8
8
  summary: "Web-application framework with template engine, control-flow layer, and ORM."
9
9
  require_paths:
10
10
  - lib
@@ -135,7 +135,7 @@ dependencies:
135
135
  -
136
136
  - ">="
137
137
  - !ruby/object:Gem::Version
138
- version: 1.2.0
138
+ version: 1.3.0
139
139
  version:
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: actionpack
@@ -145,7 +145,7 @@ dependencies:
145
145
  -
146
146
  - ">="
147
147
  - !ruby/object:Gem::Version
148
- version: 1.0.1
148
+ version: 1.1.0
149
149
  version:
150
150
  - !ruby/object:Gem::Dependency
151
151
  name: actionmailer