rails 0.9.4 → 0.9.4.1
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 +9 -0
- data/Rakefile +4 -4
- data/bin/generate +9 -5
- data/lib/binding_of_caller.rb +72 -68
- metadata +5 -5
data/CHANGELOG
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
*0.9.4.1* (January 18th, 2005)
|
2
|
+
|
3
|
+
* Added 5-second timeout to WordNet alternatives on creating reserved-word models #501 [Marcel Molina]
|
4
|
+
|
5
|
+
* Fixed binding of caller #496 [Alexey]
|
6
|
+
|
7
|
+
* Upgraded to Active Record 1.5.1, Action Pack 1.3.1, Action Mailer 0.6.1
|
8
|
+
|
9
|
+
|
1
10
|
*0.9.4* (January 17th, 2005)
|
2
11
|
|
3
12
|
* Added that ApplicationController will catch a ControllerNotFound exception if someone attempts to access a url pointing to an unexisting controller [Tobias Luetke]
|
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ require 'rbconfig'
|
|
9
9
|
|
10
10
|
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
|
11
11
|
PKG_NAME = 'rails'
|
12
|
-
PKG_VERSION = '0.9.4' + PKG_BUILD
|
12
|
+
PKG_VERSION = '0.9.4.1' + PKG_BUILD
|
13
13
|
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
14
14
|
PKG_DESTINATION = ENV["RAILS_PKG_DESTINATION"] || "../#{PKG_NAME}"
|
15
15
|
|
@@ -245,9 +245,9 @@ spec = Gem::Specification.new do |s|
|
|
245
245
|
EOF
|
246
246
|
|
247
247
|
s.add_dependency('rake', '>= 0.4.15')
|
248
|
-
s.add_dependency('activerecord', '>= 1.5.
|
249
|
-
s.add_dependency('actionpack', '>= 1.3.
|
250
|
-
s.add_dependency('actionmailer', '>= 0.6.
|
248
|
+
s.add_dependency('activerecord', '>= 1.5.1')
|
249
|
+
s.add_dependency('actionpack', '>= 1.3.1')
|
250
|
+
s.add_dependency('actionmailer', '>= 0.6.1')
|
251
251
|
|
252
252
|
s.has_rdoc = false
|
253
253
|
|
data/bin/generate
CHANGED
@@ -6,14 +6,18 @@ ARGV.shift unless ARGV.empty? or not ['--help', '-h'].include?(ARGV[0])
|
|
6
6
|
|
7
7
|
def find_synonyms(word)
|
8
8
|
require 'open-uri'
|
9
|
+
require 'timeout'
|
10
|
+
|
9
11
|
uri = "http://wordnet.princeton.edu/cgi-bin/webwn2.0?stage=2" +
|
10
12
|
"&word=%s&posnumber=1&searchtypenumber=2&senses=&showglosses=1"
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
-
|
14
|
+
timeout(5) do
|
15
|
+
open(uri % word) do |stream|
|
16
|
+
data = stream.read.gsub(" ", " ").gsub("<BR>", "")
|
17
|
+
data.scan(/^Sense \d+\n.+?\n\n/m)
|
18
|
+
end
|
15
19
|
end
|
16
|
-
rescue Exception
|
20
|
+
rescue Timeout::Error, Exception
|
17
21
|
return nil
|
18
22
|
end
|
19
23
|
|
@@ -66,4 +70,4 @@ end_usage
|
|
66
70
|
#{$0} login
|
67
71
|
end_usage
|
68
72
|
exit 0
|
69
|
-
end
|
73
|
+
end
|
data/lib/binding_of_caller.rb
CHANGED
@@ -1,81 +1,85 @@
|
|
1
1
|
begin
|
2
2
|
require 'simplecc'
|
3
3
|
rescue LoadError
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
class Continuation #:nodoc:
|
5
|
+
def self.create(*args, &block)
|
6
|
+
cc = nil; result = callcc {|c| cc = c; block.call(cc) if block and args.empty?}
|
7
|
+
result ||= args
|
8
|
+
return *[cc, *result]
|
9
|
+
end
|
8
10
|
end
|
9
11
|
end
|
10
12
|
|
11
|
-
|
12
|
-
# method
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
# #
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
13
|
+
class Binding #:nodoc:
|
14
|
+
# This method returns the binding of the method that called your
|
15
|
+
# method. It will raise an Exception when you're not inside a method.
|
16
|
+
#
|
17
|
+
# It's used like this:
|
18
|
+
# def inc_counter(amount = 1)
|
19
|
+
# Binding.of_caller do |binding|
|
20
|
+
# # Create a lambda that will increase the variable 'counter'
|
21
|
+
# # in the caller of this method when called.
|
22
|
+
# inc = eval("lambda { |arg| counter += arg }", binding)
|
23
|
+
# # We can refer to amount from inside this block safely.
|
24
|
+
# inc.call(amount)
|
25
|
+
# end
|
26
|
+
# # No other statements can go here. Put them inside the block.
|
27
|
+
# end
|
28
|
+
# counter = 0
|
29
|
+
# 2.times { inc_counter }
|
30
|
+
# counter # => 2
|
31
|
+
#
|
32
|
+
# Binding.of_caller must be the last statement in the method.
|
33
|
+
# This means that you will have to put everything you want to
|
34
|
+
# do after the call to Binding.of_caller into the block of it.
|
35
|
+
# This should be no problem however, because Ruby has closures.
|
36
|
+
# If you don't do this an Exception will be raised. Because of
|
37
|
+
# the way that Binding.of_caller is implemented it has to be
|
38
|
+
# done this way.
|
39
|
+
def self.of_caller(&block)
|
40
|
+
old_critical = Thread.critical
|
41
|
+
Thread.critical = true
|
42
|
+
count = 0
|
43
|
+
cc, result, error, extra_data = Continuation.create(nil, nil)
|
44
|
+
error.call if error
|
42
45
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
46
|
+
tracer = lambda do |*args|
|
47
|
+
type, context, extra_data = args[0], args[4], args
|
48
|
+
if type == "return"
|
49
|
+
count += 1
|
50
|
+
# First this method and then calling one will return --
|
51
|
+
# the trace event of the second event gets the context
|
52
|
+
# of the method which called the method that called this
|
53
|
+
# method.
|
54
|
+
if count == 2
|
55
|
+
# It would be nice if we could restore the trace_func
|
56
|
+
# that was set before we swapped in our own one, but
|
57
|
+
# this is impossible without overloading set_trace_func
|
58
|
+
# in current Ruby.
|
59
|
+
set_trace_func(nil)
|
60
|
+
cc.call(eval("binding", context), nil, extra_data)
|
61
|
+
end
|
62
|
+
elsif type == "line" then
|
63
|
+
nil
|
64
|
+
elsif type == "c-return" and extra_data[3] == :set_trace_func then
|
65
|
+
nil
|
66
|
+
else
|
56
67
|
set_trace_func(nil)
|
57
|
-
|
68
|
+
error_msg = "Binding.of_caller used in non-method context or " +
|
69
|
+
"trailing statements of method using it aren't in the block."
|
70
|
+
cc.call(nil, lambda { raise(ArgumentError, error_msg) }, nil)
|
58
71
|
end
|
59
|
-
elsif type == "line" then
|
60
|
-
nil
|
61
|
-
elsif type == "c-return" and extra_data[3] == :set_trace_func then
|
62
|
-
nil
|
63
|
-
else
|
64
|
-
set_trace_func(nil)
|
65
|
-
error_msg = "Binding.of_caller used in non-method context or " +
|
66
|
-
"trailing statements of method using it aren't in the block."
|
67
|
-
cc.call(nil, lambda { raise(ArgumentError, error_msg) }, nil)
|
68
72
|
end
|
69
|
-
end
|
70
73
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
74
|
+
unless result
|
75
|
+
set_trace_func(tracer)
|
76
|
+
return nil
|
77
|
+
else
|
78
|
+
Thread.critical = old_critical
|
79
|
+
case block.arity
|
80
|
+
when 1 then yield(result)
|
81
|
+
else yield(result, extra_data)
|
82
|
+
end
|
79
83
|
end
|
80
84
|
end
|
81
|
-
end
|
85
|
+
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: rails
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.9.4
|
7
|
-
date: 2005-01-
|
6
|
+
version: 0.9.4.1
|
7
|
+
date: 2005-01-18
|
8
8
|
summary: "Web-application framework with template engine, control-flow layer, and ORM."
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -138,7 +138,7 @@ dependencies:
|
|
138
138
|
-
|
139
139
|
- ">="
|
140
140
|
- !ruby/object:Gem::Version
|
141
|
-
version: 1.5.
|
141
|
+
version: 1.5.1
|
142
142
|
version:
|
143
143
|
- !ruby/object:Gem::Dependency
|
144
144
|
name: actionpack
|
@@ -148,7 +148,7 @@ dependencies:
|
|
148
148
|
-
|
149
149
|
- ">="
|
150
150
|
- !ruby/object:Gem::Version
|
151
|
-
version: 1.3.
|
151
|
+
version: 1.3.1
|
152
152
|
version:
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: actionmailer
|
@@ -158,5 +158,5 @@ dependencies:
|
|
158
158
|
-
|
159
159
|
- ">="
|
160
160
|
- !ruby/object:Gem::Version
|
161
|
-
version: 0.6.
|
161
|
+
version: 0.6.1
|
162
162
|
version:
|