Commit 3ae2d76675b7837e52518a7ca60882b98111a4ec

Authored by Pius Uzamere
1 parent faf12f6b

New Heroku Suspenders app

app/views/layouts/application.html.erb
... ... @@ -3,8 +3,8 @@
3 3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4 4 <head>
5 5 <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
6   - <title>CHANGETITLE</title>
7   - <%= stylesheet_link_tag :flutie, 'CHANGEME', :cache => true %>
  6 + <title>Rebirth</title>
  7 + <%= stylesheet_link_tag :flutie, 'rebirth', :cache => true %>
8 8 </head>
9 9 <body class="<%= body_class %>">
10 10 <div class="content">
... ...
config/environment.rb
1 1 # Be sure to restart your server when you modify this file
2 2  
3 3 # Specifies gem version of Rails to use when vendor/rails is not present
4   -RAILS_GEM_VERSION = '2.3.3' unless defined? RAILS_GEM_VERSION
  4 +RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION
5 5  
6 6 # Bootstrap the Rails environment, frameworks, and default configuration
7 7 require File.join(File.dirname(__FILE__), 'boot')
... ...
config/environments/production.rb
... ... @@ -22,5 +22,5 @@ config.gem &quot;rubaidh-google_analytics&quot;,
22 22 :version => "1.1.4",
23 23 :source => "http://gems.github.com"
24 24  
25   -HOST = "CHANGEME.heroku.com"
  25 +HOST = "rebirth.heroku.com"
26 26  
... ...
config/environments/staging.rb
... ... @@ -11,5 +11,5 @@ config.action_controller.perform_caching = true
11 11 # Disable delivery errors if you bad email addresses should just be ignored
12 12 config.action_mailer.raise_delivery_errors = false
13 13  
14   -HOST = "CHANGEME.heroku.com"
  14 +HOST = "rebirth.heroku.com"
15 15  
... ...
config/initializers/session_store.rb
... ... @@ -5,8 +5,8 @@
5 5 # Make sure the secret is at least 30 characters and all random,
6 6 # no regular words or you'll be exposed to dictionary attacks.
7 7 ActionController::Base.session = {
8   - :session_key => "_CHANGEME_session",
9   - :secret => "CHANGESESSION"
  8 + :session_key => "_rebirth_session",
  9 + :secret => "f86c832870682bd056afe09e8b328b1b"
10 10 }
11 11  
12 12 # Use the database for sessions instead of the cookie-based default,
... ...
public/stylesheets/rebirth.css 0 → 100644
... ... @@ -0,0 +1,40 @@
  1 +body {
  2 + background-color: #dadada; }
  3 +
  4 +.content {
  5 + background: #fff;
  6 + padding: 40px;
  7 + margin: 40px auto;
  8 + width: 880px;
  9 + -moz-border-radius: 24px;
  10 + -webkit-border-radius: 24px; }
  11 +
  12 +/* flash color */
  13 +
  14 +#flash_success {
  15 + background: seagreen; }
  16 +#flash_failure {
  17 + color: beige;
  18 + background: firebrick; }
  19 +#flash_notice {
  20 + color: snow;
  21 + background: dimgray; }
  22 +
  23 +/* flashes spacing */
  24 +
  25 +#flash {
  26 + margin-bottom: 0.6em; }
  27 +
  28 +#flash_notice, #flash_success, #flash_failure, #errorExplanation ul li {
  29 + padding: 0.6em; }
  30 +
  31 +/* flash scale */
  32 +
  33 +#flash_notice, #flash_success, #flash_failure, #errorExplanation ul li {
  34 + font-size: 1.6em; }
  35 +
  36 +/* flash weighting */
  37 +
  38 +#flash_notice, #flash_success, #flash_failure, #errorExplanation ul li {
  39 + font-weight: bold; }
  40 +
... ...
public/stylesheets/screen.css
... ... @@ -1,40 +0,0 @@
1   -body {
2   - background-color: #dadada; }
3   -
4   -.content {
5   - background: #fff;
6   - padding: 40px;
7   - margin: 40px auto;
8   - width: 880px;
9   - -moz-border-radius: 24px;
10   - -webkit-border-radius: 24px; }
11   -
12   -/* flash color */
13   -
14   -#flash_success {
15   - background: seagreen; }
16   -#flash_failure {
17   - color: beige;
18   - background: firebrick; }
19   -#flash_notice {
20   - color: snow;
21   - background: dimgray; }
22   -
23   -/* flashes spacing */
24   -
25   -#flash {
26   - margin-bottom: 0.6em; }
27   -
28   -#flash_notice, #flash_success, #flash_failure, #errorExplanation ul li {
29   - padding: 0.6em; }
30   -
31   -/* flash scale */
32   -
33   -#flash_notice, #flash_success, #flash_failure, #errorExplanation ul li {
34   - font-size: 1.6em; }
35   -
36   -/* flash weighting */
37   -
38   -#flash_notice, #flash_success, #flash_failure, #errorExplanation ul li {
39   - font-weight: bold; }
40   -
script/create_project
... ... @@ -14,9 +14,9 @@ project_directory = base_directory + project_name
14 14 fail("Project directory (#{project_directory}) already exists") if project_directory.exist?
15 15  
16 16 template_url = "git://github.com/dancroak/heroku_suspenders.git"
17   -changeme = "CHANGEME"
  17 +changeme = "rebirth"
18 18 changesession = "CHANGESESSION"
19   -changetitle = "CHANGETITLE"
  19 +changetitle = "Rebirth"
20 20  
21 21 def run(cmd)
22 22 puts "Running '#{cmd}'"
... ...
vendor/gems/activemerchant-1.4.2/test/extra/binding_of_caller.rb
1   -class Continuation # :nodoc:
2   - def self.create(*args, &block) # :nodoc:
3   - cc = nil; result = callcc {|c| cc = c; block.call(cc) if block and args.empty?}
4   - result ||= args
5   - return *[cc, *result]
6   - end
7   -end
8   -
9   -class Binding; end # for RDoc
10   -# This method returns the binding of the method that called your
11   -# method. It will raise an Exception when you're not inside a method.
12   -#
13   -# It's used like this:
14   -# def inc_counter(amount = 1)
15   -# Binding.of_caller do |binding|
16   -# # Create a lambda that will increase the variable 'counter'
17   -# # in the caller of this method when called.
18   -# inc = eval("lambda { |arg| counter += arg }", binding)
19   -# # We can refer to amount from inside this block safely.
20   -# inc.call(amount)
21   -# end
22   -# # No other statements can go here. Put them inside the block.
23   -# end
24   -# counter = 0
25   -# 2.times { inc_counter }
26   -# counter # => 2
27   -#
28   -# Binding.of_caller must be the last statement in the method.
29   -# This means that you will have to put everything you want to
30   -# do after the call to Binding.of_caller into the block of it.
31   -# This should be no problem however, because Ruby has closures.
32   -# If you don't do this an Exception will be raised. Because of
33   -# the way that Binding.of_caller is implemented it has to be
34   -# done this way.
35   -def Binding.of_caller(&block)
36   - old_critical = Thread.critical
37   - Thread.critical = true
38   - count = 0
39   - cc, result, error, extra_data = Continuation.create(nil, nil)
40   - error.call if error
41   -
42   - tracer = lambda do |*args|
43   - type, context, extra_data = args[0], args[4], args
44   - if type == "return"
45   - count += 1
46   - # First this method and then calling one will return --
47   - # the trace event of the second event gets the context
48   - # of the method which called the method that called this
49   - # method.
50   - if count == 2
51   - # It would be nice if we could restore the trace_func
52   - # that was set before we swapped in our own one, but
53   - # this is impossible without overloading set_trace_func
54   - # in current Ruby.
55   - set_trace_func(nil)
56   - cc.call(eval("binding", context), nil, extra_data)
57   - end
58   - elsif type == "line" then
59   - nil
60   - elsif type == "c-return" and extra_data[3] == :set_trace_func then
61   - nil
62   - else
63   - set_trace_func(nil)
64   - error_msg = "Binding.of_caller used in non-method context or " +
65   - "trailing statements of method using it aren't in the block."
66   - cc.call(nil, lambda { raise(ArgumentError, error_msg) }, nil)
67   - end
68   - end
69   -
70   - unless result
71   - set_trace_func(tracer)
72   - return nil
73   - else
74   - Thread.critical = old_critical
75   - case block.arity
76   - when 1 then yield(result)
77   - else yield(result, extra_data)
78   - end
79   - end
80   -end
  1 +class Continuation # :nodoc:
  2 + def self.create(*args, &block) # :nodoc:
  3 + cc = nil; result = callcc {|c| cc = c; block.call(cc) if block and args.empty?}
  4 + result ||= args
  5 + return *[cc, *result]
  6 + end
  7 +end
  8 +
  9 +class Binding; end # for RDoc
  10 +# This method returns the binding of the method that called your
  11 +# method. It will raise an Exception when you're not inside a method.
  12 +#
  13 +# It's used like this:
  14 +# def inc_counter(amount = 1)
  15 +# Binding.of_caller do |binding|
  16 +# # Create a lambda that will increase the variable 'counter'
  17 +# # in the caller of this method when called.
  18 +# inc = eval("lambda { |arg| counter += arg }", binding)
  19 +# # We can refer to amount from inside this block safely.
  20 +# inc.call(amount)
  21 +# end
  22 +# # No other statements can go here. Put them inside the block.
  23 +# end
  24 +# counter = 0
  25 +# 2.times { inc_counter }
  26 +# counter # => 2
  27 +#
  28 +# Binding.of_caller must be the last statement in the method.
  29 +# This means that you will have to put everything you want to
  30 +# do after the call to Binding.of_caller into the block of it.
  31 +# This should be no problem however, because Ruby has closures.
  32 +# If you don't do this an Exception will be raised. Because of
  33 +# the way that Binding.of_caller is implemented it has to be
  34 +# done this way.
  35 +def Binding.of_caller(&block)
  36 + old_critical = Thread.critical
  37 + Thread.critical = true
  38 + count = 0
  39 + cc, result, error, extra_data = Continuation.create(nil, nil)
  40 + error.call if error
  41 +
  42 + tracer = lambda do |*args|
  43 + type, context, extra_data = args[0], args[4], args
  44 + if type == "return"
  45 + count += 1
  46 + # First this method and then calling one will return --
  47 + # the trace event of the second event gets the context
  48 + # of the method which called the method that called this
  49 + # method.
  50 + if count == 2
  51 + # It would be nice if we could restore the trace_func
  52 + # that was set before we swapped in our own one, but
  53 + # this is impossible without overloading set_trace_func
  54 + # in current Ruby.
  55 + set_trace_func(nil)
  56 + cc.call(eval("binding", context), nil, extra_data)
  57 + end
  58 + elsif type == "line" then
  59 + nil
  60 + elsif type == "c-return" and extra_data[3] == :set_trace_func then
  61 + nil
  62 + else
  63 + set_trace_func(nil)
  64 + error_msg = "Binding.of_caller used in non-method context or " +
  65 + "trailing statements of method using it aren't in the block."
  66 + cc.call(nil, lambda { raise(ArgumentError, error_msg) }, nil)
  67 + end
  68 + end
  69 +
  70 + unless result
  71 + set_trace_func(tracer)
  72 + return nil
  73 + else
  74 + Thread.critical = old_critical
  75 + case block.arity
  76 + when 1 then yield(result)
  77 + else yield(result, extra_data)
  78 + end
  79 + end
  80 +end
... ...
vendor/gems/activemerchant-1.4.2/test/extra/breakpoint.rb
1   -# The Breakpoint library provides the convenience of
2   -# being able to inspect and modify state, diagnose
3   -# bugs all via IRB by simply setting breakpoints in
4   -# your applications by the call of a method.
5   -#
6   -# This library was written and is supported by me,
7   -# Florian Gross. I can be reached at flgr@ccan.de
8   -# and enjoy getting feedback about my libraries.
9   -#
10   -# The whole library (including breakpoint_client.rb
11   -# and binding_of_caller.rb) is licensed under the
12   -# same license that Ruby uses. (Which is currently
13   -# either the GNU General Public License or a custom
14   -# one that allows for commercial usage.) If you for
15   -# some good reason need to use this under another
16   -# license please contact me.
17   -
18   -require 'irb'
19   -require 'binding_of_caller'
20   -require 'drb'
21   -require 'drb/acl'
22   -require 'thread'
23   -
24   -module Breakpoint
25   - id = %q$Id: breakpoint.rb 52 2005-02-26 19:43:19Z flgr $
26   - current_version = id.split(" ")[2]
27   - unless defined?(Version)
28   - # The Version of ruby-breakpoint you are using as String of the
29   - # 1.2.3 form where the digits stand for release, major and minor
30   - # version respectively.
31   - Version = "0.5.0"
32   - end
33   -
34   - extend self
35   -
36   - # This will pop up an interactive ruby session at a
37   - # pre-defined break point in a Ruby application. In
38   - # this session you can examine the environment of
39   - # the break point.
40   - #
41   - # You can get a list of variables in the context using
42   - # local_variables via +local_variables+. You can then
43   - # examine their values by typing their names.
44   - #
45   - # You can have a look at the call stack via +caller+.
46   - #
47   - # The source code around the location where the breakpoint
48   - # was executed can be examined via +source_lines+. Its
49   - # argument specifies how much lines of context to display.
50   - # The default amount of context is 5 lines. Note that
51   - # the call to +source_lines+ can raise an exception when
52   - # it isn't able to read in the source code.
53   - #
54   - # breakpoints can also return a value. They will execute
55   - # a supplied block for getting a default return value.
56   - # A custom value can be returned from the session by doing
57   - # +throw(:debug_return, value)+.
58   - #
59   - # You can also give names to break points which will be
60   - # used in the message that is displayed upon execution
61   - # of them.
62   - #
63   - # Here's a sample of how breakpoints should be placed:
64   - #
65   - # class Person
66   - # def initialize(name, age)
67   - # @name, @age = name, age
68   - # breakpoint("Person#initialize")
69   - # end
70   - #
71   - # attr_reader :age
72   - # def name
73   - # breakpoint("Person#name") { @name }
74   - # end
75   - # end
76   - #
77   - # person = Person.new("Random Person", 23)
78   - # puts "Name: #{person.name}"
79   - #
80   - # And here is a sample debug session:
81   - #
82   - # Executing break point "Person#initialize" at file.rb:4 in `initialize'
83   - # irb(#<Person:0x292fbe8>):001:0> local_variables
84   - # => ["name", "age", "_", "__"]
85   - # irb(#<Person:0x292fbe8>):002:0> [name, age]
86   - # => ["Random Person", 23]
87   - # irb(#<Person:0x292fbe8>):003:0> [@name, @age]
88   - # => ["Random Person", 23]
89   - # irb(#<Person:0x292fbe8>):004:0> self
90   - # => #<Person:0x292fbe8 @age=23, @name="Random Person">
91   - # irb(#<Person:0x292fbe8>):005:0> @age += 1; self
92   - # => #<Person:0x292fbe8 @age=24, @name="Random Person">
93   - # irb(#<Person:0x292fbe8>):006:0> exit
94   - # Executing break point "Person#name" at file.rb:9 in `name'
95   - # irb(#<Person:0x292fbe8>):001:0> throw(:debug_return, "Overriden name")
96   - # Name: Overriden name
97   - #
98   - # Breakpoint sessions will automatically have a few
99   - # convenience methods available. See Breakpoint::CommandBundle
100   - # for a list of them.
101   - #
102   - # Breakpoints can also be used remotely over sockets.
103   - # This is implemented by running part of the IRB session
104   - # in the application and part of it in a special client.
105   - # You have to call Breakpoint.activate_drb to enable
106   - # support for remote breakpoints and then run
107   - # breakpoint_client.rb which is distributed with this
108   - # library. See the documentation of Breakpoint.activate_drb
109   - # for details.
110   - def breakpoint(id = nil, context = nil, &block)
111   - callstack = caller
112   - callstack.slice!(0, 3) if callstack.first["breakpoint"]
113   - file, line, method = *callstack.first.match(/^(.+?):(\d+)(?::in `(.*?)')?/).captures
114   -
115   - message = "Executing break point " + (id ? "#{id.inspect} " : "") +
116   - "at #{file}:#{line}" + (method ? " in `#{method}'" : "")
117   -
118   - if context then
119   - return handle_breakpoint(context, message, file, line, &block)
120   - end
121   -
122   - Binding.of_caller do |binding_context|
123   - handle_breakpoint(binding_context, message, file, line, &block)
124   - end
125   - end
126   -
127   - # These commands are automatically available in all breakpoint shells.
128   - module CommandBundle
129   - # Proxy to a Breakpoint client. Lets you directly execute code
130   - # in the context of the client.
131   - class Client
132   - def initialize(eval_handler) # :nodoc:
133   - eval_handler.untaint
134   - @eval_handler = eval_handler
135   - end
136   -
137   - instance_methods.each do |method|
138   - next if method[/^__.+__$/]
139   - undef_method method
140   - end
141   -
142   - # Executes the specified code at the client.
143   - def eval(code)
144   - @eval_handler.call(code)
145   - end
146   -
147   - # Will execute the specified statement at the client.
148   - def method_missing(method, *args, &block)
149   - if args.empty? and not block
150   - result = eval "#{method}"
151   - else
152   - # This is a bit ugly. The alternative would be using an
153   - # eval context instead of an eval handler for executing
154   - # the code at the client. The problem with that approach
155   - # is that we would have to handle special expressions
156   - # like "self", "nil" or constants ourself which is hard.
157   - remote = eval %{
158   - result = lambda { |block, *args| #{method}(*args, &block) }
159   - def result.call_with_block(*args, &block)
160   - call(block, *args)
161   - end
162   - result
163   - }
164   - remote.call_with_block(*args, &block)
165   - end
166   -
167   - return result
168   - end
169   - end
170   -
171   - # Returns the source code surrounding the location where the
172   - # breakpoint was issued.
173   - def source_lines(context = 5, return_line_numbers = false)
174   - lines = File.readlines(@__bp_file).map { |line| line.chomp }
175   -
176   - break_line = @__bp_line
177   - start_line = [break_line - context, 1].max
178   - end_line = break_line + context
179   -
180   - result = lines[(start_line - 1) .. (end_line - 1)]
181   -
182   - if return_line_numbers then
183   - return [start_line, break_line, result]
184   - else
185   - return result
186   - end
187   - end
188   -
189   - # Lets an object that will forward method calls to the breakpoint
190   - # client. This is useful for outputting longer things at the client
191   - # and so on. You can for example do these things:
192   - #
193   - # client.puts "Hello" # outputs "Hello" at client console
194   - # # outputs "Hello" into the file temp.txt at the client
195   - # client.File.open("temp.txt", "w") { |f| f.puts "Hello" }
196   - def client()
197   - if Breakpoint.use_drb? then
198   - sleep(0.5) until Breakpoint.drb_service.eval_handler
199   - Client.new(Breakpoint.drb_service.eval_handler)
200   - else
201   - Client.new(lambda { |code| eval(code, TOPLEVEL_BINDING) })
202   - end
203   - end
204   - end
205   -
206   - def handle_breakpoint(context, message, file = "", line = "", &block) # :nodoc:
207   - catch(:debug_return) do |value|
208   - eval(%{
209   - @__bp_file = #{file.inspect}
210   - @__bp_line = #{line}
211   - extend Breakpoint::CommandBundle
212   - extend DRbUndumped if self
213   - }, context) rescue nil
214   -
215   - if not use_drb? then
216   - puts message
217   - IRB.start(nil, IRB::WorkSpace.new(context))
218   - else
219   - @drb_service.add_breakpoint(context, message)
220   - end
221   -
222   - block.call if block
223   - end
224   - end
225   -
226   - # These exceptions will be raised on failed asserts
227   - # if Breakpoint.asserts_cause_exceptions is set to
228   - # true.
229   - class FailedAssertError < RuntimeError
230   - end
231   -
232   - # This asserts that the block evaluates to true.
233   - # If it doesn't evaluate to true a breakpoint will
234   - # automatically be created at that execution point.
235   - #
236   - # You can disable assert checking in production
237   - # code by setting Breakpoint.optimize_asserts to
238   - # true. (It will still be enabled when Ruby is run
239   - # via the -d argument.)
240   - #
241   - # Example:
242   - # person_name = "Foobar"
243   - # assert { not person_name.nil? }
244   - #
245   - # Note: If you want to use this method from an
246   - # unit test, you will have to call it by its full
247   - # name, Breakpoint.assert.
248   - def assert(context = nil, &condition)
249   - return if Breakpoint.optimize_asserts and not $DEBUG
250   - return if yield
251   -
252   - callstack = caller
253   - callstack.slice!(0, 3) if callstack.first["assert"]
254   - file, line, method = *callstack.first.match(/^(.+?):(\d+)(?::in `(.*?)')?/).captures
255   -
256   - message = "Assert failed at #{file}:#{line}#{" in `#{method}'" if method}."
257   -
258   - if Breakpoint.asserts_cause_exceptions and not $DEBUG then
259   - raise(Breakpoint::FailedAssertError, message)
260   - end
261   -
262   - message += " Executing implicit breakpoint."
263   -
264   - if context then
265   - return handle_breakpoint(context, message, file, line)
266   - end
267   -
268   - Binding.of_caller do |context|
269   - handle_breakpoint(context, message, file, line)
270   - end
271   - end
272   -
273   - # Whether asserts should be ignored if not in debug mode.
274   - # Debug mode can be enabled by running ruby with the -d
275   - # switch or by setting $DEBUG to true.
276   - attr_accessor :optimize_asserts
277   - self.optimize_asserts = false
278   -
279   - # Whether an Exception should be raised on failed asserts
280   - # in non-$DEBUG code or not. By default this is disabled.
281   - attr_accessor :asserts_cause_exceptions
282   - self.asserts_cause_exceptions = false
283   - @use_drb = false
284   -
285   - attr_reader :drb_service # :nodoc:
286   -
287   - class DRbService # :nodoc:
288   - include DRbUndumped
289   -
290   - def initialize
291   - @handler = @eval_handler = @collision_handler = nil
292   -
293   - IRB.instance_eval { @CONF[:RC] = true }
294   - IRB.run_config
295   - end
296   -
297   - def collision
298   - sleep(0.5) until @collision_handler
299   -
300   - @collision_handler.untaint
301   -
302   - @collision_handler.call
303   - end
304   -
305   - def ping() end
306   -
307   - def add_breakpoint(context, message)
308   - workspace = IRB::WorkSpace.new(context)
309   - workspace.extend(DRbUndumped)
310   -
311   - sleep(0.5) until @handler
312   -
313   - @handler.untaint
314   - @handler.call(workspace, message)
315   - rescue Errno::ECONNREFUSED, DRb::DRbConnError
316   - raise if Breakpoint.use_drb?
317   - end
318   -
319   - attr_accessor :handler, :eval_handler, :collision_handler
320   - end
321   -
322   - # Will run Breakpoint in DRb mode. This will spawn a server
323   - # that can be attached to via the breakpoint-client command
324   - # whenever a breakpoint is executed. This is useful when you
325   - # are debugging CGI applications or other applications where
326   - # you can't access debug sessions via the standard input and
327   - # output of your application.
328   - #
329   - # You can specify an URI where the DRb server will run at.
330   - # This way you can specify the port the server runs on. The
331   - # default URI is druby://localhost:42531.
332   - #
333   - # Please note that breakpoints will be skipped silently in
334   - # case the DRb server can not spawned. (This can happen if
335   - # the port is already used by another instance of your
336   - # application on CGI or another application.)
337   - #
338   - # Also note that by default this will only allow access
339   - # from localhost. You can however specify a list of
340   - # allowed hosts or nil (to allow access from everywhere).
341   - # But that will still not protect you from somebody
342   - # reading the data as it goes through the net.
343   - #
344   - # A good approach for getting security and remote access
345   - # is setting up an SSH tunnel between the DRb service
346   - # and the client. This is usually done like this:
347   - #
348   - # $ ssh -L20000:127.0.0.1:20000 -R10000:127.0.0.1:10000 example.com
349   - # (This will connect port 20000 at the client side to port
350   - # 20000 at the server side, and port 10000 at the server
351   - # side to port 10000 at the client side.)
352   - #
353   - # After that do this on the server side: (the code being debugged)
354   - # Breakpoint.activate_drb("druby://127.0.0.1:20000", "localhost")
355   - #
356   - # And at the client side:
357   - # ruby breakpoint_client.rb -c druby://127.0.0.1:10000 -s druby://127.0.0.1:20000
358   - #
359   - # Running through such a SSH proxy will also let you use
360   - # breakpoint.rb in case you are behind a firewall.
361   - #
362   - # Detailed information about running DRb through firewalls is
363   - # available at http://www.rubygarden.org/ruby?DrbTutorial
364   - #
365   - # == Security considerations
366   - # Usually you will be fine when using the default druby:// URI and the default
367   - # access control list. However, if you are sitting on a machine where there are
368   - # local users that you likely can not trust (this is the case for example on
369   - # most web hosts which have multiple users sitting on the same physical machine)
370   - # you will be better off by doing client/server communication through a unix
371   - # socket. This can be accomplished by calling with a drbunix:/ style URI, e.g.
372   - # <code>Breakpoint.activate_drb('drbunix:/tmp/breakpoint_server')</code>. This
373   - # will only work on Unix based platforms.
374   - def activate_drb(uri = nil, allowed_hosts = ['localhost', '127.0.0.1', '::1'],
375   - ignore_collisions = false)
376   -
377   - return false if @use_drb
378   -
379   - uri ||= 'druby://localhost:42531'
380   -
381   - if allowed_hosts then
382   - acl = ["deny", "all"]
383   -
384   - Array(allowed_hosts).each do |host|
385   - acl += ["allow", host]
386   - end
387   -
388   - DRb.install_acl(ACL.new(acl))
389   - end
390   -
391   - @use_drb = true
392   - @drb_service = DRbService.new
393   - did_collision = false
394   - begin
395   - @service = DRb.start_service(uri, @drb_service)
396   - rescue Errno::EADDRINUSE
397   - if ignore_collisions then
398   - nil
399   - else
400   - # The port is already occupied by another
401   - # Breakpoint service. We will try to tell
402   - # the old service that we want its port.
403   - # It will then forward that request to the
404   - # user and retry.
405   - unless did_collision then
406   - DRbObject.new(nil, uri).collision
407   - did_collision = true
408   - end
409   - sleep(10)
410   - retry
411   - end
412   - end
413   -
414   - return true
415   - end
416   -
417   - # Deactivates a running Breakpoint service.
418   - def deactivate_drb
419   - Thread.exclusive do
420   - @service.stop_service unless @service.nil?
421   - @service = nil
422   - @use_drb = false
423   - @drb_service = nil
424   - end
425   - end
426   -
427   - # Returns true when Breakpoints are used over DRb.
428   - # Breakpoint.activate_drb causes this to be true.
429   - def use_drb?
430   - @use_drb == true
431   - end
432   -end
433   -
434   -module IRB # :nodoc:
435   - class << self; remove_method :start; end
436   - def self.start(ap_path = nil, main_context = nil, workspace = nil)
437   - $0 = File::basename(ap_path, ".rb") if ap_path
438   -
439   - # suppress some warnings about redefined constants
440   - old_verbose, $VERBOSE = $VERBOSE, nil
441   - IRB.setup(ap_path)
442   - $VERBOSE = old_verbose
443   -
444   - if @CONF[:SCRIPT] then
445   - irb = Irb.new(main_context, @CONF[:SCRIPT])
446   - else
447   - irb = Irb.new(main_context)
448   - end
449   -
450   - if workspace then
451   - irb.context.workspace = workspace
452   - end
453   -
454   - @CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC]
455   - @CONF[:MAIN_CONTEXT] = irb.context
456   -
457   - old_sigint = trap("SIGINT") do
458   - begin
459   - irb.signal_handle
460   - rescue RubyLex::TerminateLineInput
461   - # ignored
462   - end
463   - end
464   -
465   - catch(:IRB_EXIT) do
466   - irb.eval_input
467   - end
468   - ensure
469   - trap("SIGINT", old_sigint)
470   - end
471   -
472   - class << self
473   - alias :old_CurrentContext :CurrentContext
474   - remove_method :CurrentContext
475   - remove_method :parse_opts
476   - end
477   -
478   - def IRB.CurrentContext
479   - if old_CurrentContext.nil? and Breakpoint.use_drb? then
480   - result = Object.new
481   - def result.last_value; end
482   - return result
483   - else
484   - old_CurrentContext
485   - end
486   - end
487   - def IRB.parse_opts() end
488   -
489   - class Context # :nodoc:
490   - alias :old_evaluate :evaluate
491   - def evaluate(line, line_no)
492   - if line.chomp == "exit" then
493   - exit
494   - else
495   - old_evaluate(line, line_no)
496   - end
497   - end
498   - end
499   -
500   - class WorkSpace # :nodoc:
501   - alias :old_evaluate :evaluate
502   -
503   - def evaluate(*args)
504   - if Breakpoint.use_drb? then
505   - result = old_evaluate(*args)
506   - if args[0] != :no_proxy and
507   - not [true, false, nil].include?(result)
508   - then
509   - result.extend(DRbUndumped) rescue nil
510   - end
511   - return result
512   - else
513   - old_evaluate(*args)
514   - end
515   - end
516   - end
517   -
518   - module InputCompletor # :nodoc:
519   - def self.eval(code, context, *more)
520   - # Big hack, this assumes that InputCompletor
521   - # will only call eval() when it wants code
522   - # to be executed in the IRB context.
523   - IRB.conf[:MAIN_CONTEXT].workspace.evaluate(:no_proxy, code, *more)
524   - end
525   - end
526   -end
527   -
528   -module DRb # :nodoc:
529   - class DRbObject # :nodoc:
530   - undef :inspect if method_defined?(:inspect)
531   - undef :clone if method_defined?(:clone)
532   - end
533   -end
534   -
535   -# See Breakpoint.breakpoint
536   -def breakpoint(id = nil, &block)
537   - Binding.of_caller do |context|
538   - Breakpoint.breakpoint(id, context, &block)
539   - end
540   -end
541   -
542   -# See Breakpoint.assert
543   -def assert(&block)
544   - Binding.of_caller do |context|
545   - Breakpoint.assert(context, &block)
546   - end
547   -end
  1 +# The Breakpoint library provides the convenience of
  2 +# being able to inspect and modify state, diagnose
  3 +# bugs all via IRB by simply setting breakpoints in
  4 +# your applications by the call of a method.
  5 +#
  6 +# This library was written and is supported by me,
  7 +# Florian Gross. I can be reached at flgr@ccan.de
  8 +# and enjoy getting feedback about my libraries.
  9 +#
  10 +# The whole library (including breakpoint_client.rb
  11 +# and binding_of_caller.rb) is licensed under the
  12 +# same license that Ruby uses. (Which is currently
  13 +# either the GNU General Public License or a custom
  14 +# one that allows for commercial usage.) If you for
  15 +# some good reason need to use this under another
  16 +# license please contact me.
  17 +
  18 +require 'irb'
  19 +require 'binding_of_caller'
  20 +require 'drb'
  21 +require 'drb/acl'
  22 +require 'thread'
  23 +
  24 +module Breakpoint
  25 + id = %q$Id: breakpoint.rb 52 2005-02-26 19:43:19Z flgr $
  26 + current_version = id.split(" ")[2]
  27 + unless defined?(Version)
  28 + # The Version of ruby-breakpoint you are using as String of the
  29 + # 1.2.3 form where the digits stand for release, major and minor
  30 + # version respectively.
  31 + Version = "0.5.0"
  32 + end
  33 +
  34 + extend self
  35 +
  36 + # This will pop up an interactive ruby session at a
  37 + # pre-defined break point in a Ruby application. In
  38 + # this session you can examine the environment of
  39 + # the break point.
  40 + #
  41 + # You can get a list of variables in the context using
  42 + # local_variables via +local_variables+. You can then
  43 + # examine their values by typing their names.
  44 + #
  45 + # You can have a look at the call stack via +caller+.
  46 + #
  47 + # The source code around the location where the breakpoint
  48 + # was executed can be examined via +source_lines+. Its
  49 + # argument specifies how much lines of context to display.
  50 + # The default amount of context is 5 lines. Note that
  51 + # the call to +source_lines+ can raise an exception when
  52 + # it isn't able to read in the source code.
  53 + #
  54 + # breakpoints can also return a value. They will execute
  55 + # a supplied block for getting a default return value.
  56 + # A custom value can be returned from the session by doing
  57 + # +throw(:debug_return, value)+.
  58 + #
  59 + # You can also give names to break points which will be
  60 + # used in the message that is displayed upon execution
  61 + # of them.
  62 + #
  63 + # Here's a sample of how breakpoints should be placed:
  64 + #
  65 + # class Person
  66 + # def initialize(name, age)
  67 + # @name, @age = name, age
  68 + # breakpoint("Person#initialize")
  69 + # end
  70 + #
  71 + # attr_reader :age
  72 + # def name
  73 + # breakpoint("Person#name") { @name }
  74 + # end
  75 + # end
  76 + #
  77 + # person = Person.new("Random Person", 23)
  78 + # puts "Name: #{person.name}"
  79 + #
  80 + # And here is a sample debug session:
  81 + #
  82 + # Executing break point "Person#initialize" at file.rb:4 in `initialize'
  83 + # irb(#<Person:0x292fbe8>):001:0> local_variables
  84 + # => ["name", "age", "_", "__"]
  85 + # irb(#<Person:0x292fbe8>):002:0> [name, age]
  86 + # => ["Random Person", 23]
  87 + # irb(#<Person:0x292fbe8>):003:0> [@name, @age]
  88 + # => ["Random Person", 23]
  89 + # irb(#<Person:0x292fbe8>):004:0> self
  90 + # => #<Person:0x292fbe8 @age=23, @name="Random Person">
  91 + # irb(#<Person:0x292fbe8>):005:0> @age += 1; self
  92 + # => #<Person:0x292fbe8 @age=24, @name="Random Person">
  93 + # irb(#<Person:0x292fbe8>):006:0> exit
  94 + # Executing break point "Person#name" at file.rb:9 in `name'
  95 + # irb(#<Person:0x292fbe8>):001:0> throw(:debug_return, "Overriden name")
  96 + # Name: Overriden name
  97 + #
  98 + # Breakpoint sessions will automatically have a few
  99 + # convenience methods available. See Breakpoint::CommandBundle
  100 + # for a list of them.
  101 + #
  102 + # Breakpoints can also be used remotely over sockets.
  103 + # This is implemented by running part of the IRB session
  104 + # in the application and part of it in a special client.
  105 + # You have to call Breakpoint.activate_drb to enable
  106 + # support for remote breakpoints and then run
  107 + # breakpoint_client.rb which is distributed with this
  108 + # library. See the documentation of Breakpoint.activate_drb
  109 + # for details.
  110 + def breakpoint(id = nil, context = nil, &block)
  111 + callstack = caller
  112 + callstack.slice!(0, 3) if callstack.first["breakpoint"]
  113 + file, line, method = *callstack.first.match(/^(.+?):(\d+)(?::in `(.*?)')?/).captures
  114 +
  115 + message = "Executing break point " + (id ? "#{id.inspect} " : "") +
  116 + "at #{file}:#{line}" + (method ? " in `#{method}'" : "")
  117 +
  118 + if context then
  119 + return handle_breakpoint(context, message, file, line, &block)
  120 + end
  121 +
  122 + Binding.of_caller do |binding_context|
  123 + handle_breakpoint(binding_context, message, file, line, &block)
  124 + end
  125 + end
  126 +
  127 + # These commands are automatically available in all breakpoint shells.
  128 + module CommandBundle
  129 + # Proxy to a Breakpoint client. Lets you directly execute code
  130 + # in the context of the client.
  131 + class Client
  132 + def initialize(eval_handler) # :nodoc:
  133 + eval_handler.untaint
  134 + @eval_handler = eval_handler
  135 + end
  136 +
  137 + instance_methods.each do |method|
  138 + next if method[/^__.+__$/]
  139 + undef_method method
  140 + end
  141 +
  142 + # Executes the specified code at the client.
  143 + def eval(code)
  144 + @eval_handler.call(code)
  145 + end
  146 +
  147 + # Will execute the specified statement at the client.
  148 + def method_missing(method, *args, &block)
  149 + if args.empty? and not block
  150 + result = eval "#{method}"
  151 + else
  152 + # This is a bit ugly. The alternative would be using an
  153 + # eval context instead of an eval handler for executing
  154 + # the code at the client. The problem with that approach
  155 + # is that we would have to handle special expressions
  156 + # like "self", "nil" or constants ourself which is hard.
  157 + remote = eval %{
  158 + result = lambda { |block, *args| #{method}(*args, &block) }
  159 + def result.call_with_block(*args, &block)
  160 + call(block, *args)
  161 + end
  162 + result
  163 + }
  164 + remote.call_with_block(*args, &block)
  165 + end
  166 +
  167 + return result
  168 + end
  169 + end
  170 +
  171 + # Returns the source code surrounding the location where the
  172 + # breakpoint was issued.
  173 + def source_lines(context = 5, return_line_numbers = false)
  174 + lines = File.readlines(@__bp_file).map { |line| line.chomp }
  175 +
  176 + break_line = @__bp_line
  177 + start_line = [break_line - context, 1].max
  178 + end_line = break_line + context
  179 +
  180 + result = lines[(start_line - 1) .. (end_line - 1)]
  181 +
  182 + if return_line_numbers then
  183 + return [start_line, break_line, result]
  184 + else
  185 + return result
  186 + end
  187 + end
  188 +
  189 + # Lets an object that will forward method calls to the breakpoint
  190 + # client. This is useful for outputting longer things at the client
  191 + # and so on. You can for example do these things:
  192 + #
  193 + # client.puts "Hello" # outputs "Hello" at client console
  194 + # # outputs "Hello" into the file temp.txt at the client
  195 + # client.File.open("temp.txt", "w") { |f| f.puts "Hello" }
  196 + def client()
  197 + if Breakpoint.use_drb? then
  198 + sleep(0.5) until Breakpoint.drb_service.eval_handler
  199 + Client.new(Breakpoint.drb_service.eval_handler)
  200 + else
  201 + Client.new(lambda { |code| eval(code, TOPLEVEL_BINDING) })
  202 + end
  203 + end
  204 + end
  205 +
  206 + def handle_breakpoint(context, message, file = "", line = "", &block) # :nodoc:
  207 + catch(:debug_return) do |value|
  208 + eval(%{
  209 + @__bp_file = #{file.inspect}
  210 + @__bp_line = #{line}
  211 + extend Breakpoint::CommandBundle
  212 + extend DRbUndumped if self
  213 + }, context) rescue nil
  214 +
  215 + if not use_drb? then
  216 + puts message
  217 + IRB.start(nil, IRB::WorkSpace.new(context))
  218 + else
  219 + @drb_service.add_breakpoint(context, message)
  220 + end
  221 +
  222 + block.call if block
  223 + end
  224 + end
  225 +
  226 + # These exceptions will be raised on failed asserts
  227 + # if Breakpoint.asserts_cause_exceptions is set to
  228 + # true.
  229 + class FailedAssertError < RuntimeError
  230 + end
  231 +
  232 + # This asserts that the block evaluates to true.
  233 + # If it doesn't evaluate to true a breakpoint will
  234 + # automatically be created at that execution point.
  235 + #
  236 + # You can disable assert checking in production
  237 + # code by setting Breakpoint.optimize_asserts to
  238 + # true. (It will still be enabled when Ruby is run
  239 + # via the -d argument.)
  240 + #
  241 + # Example:
  242 + # person_name = "Foobar"
  243 + # assert { not person_name.nil? }
  244 + #
  245 + # Note: If you want to use this method from an
  246 + # unit test, you will have to call it by its full
  247 + # name, Breakpoint.assert.
  248 + def assert(context = nil, &condition)
  249 + return if Breakpoint.optimize_asserts and not $DEBUG
  250 + return if yield
  251 +
  252 + callstack = caller
  253 + callstack.slice!(0, 3) if callstack.first["assert"]
  254 + file, line, method = *callstack.first.match(/^(.+?):(\d+)(?::in `(.*?)')?/).captures
  255 +
  256 + message = "Assert failed at #{file}:#{line}#{" in `#{method}'" if method}."
  257 +
  258 + if Breakpoint.asserts_cause_exceptions and not $DEBUG then
  259 + raise(Breakpoint::FailedAssertError, message)
  260 + end
  261 +
  262 + message += " Executing implicit breakpoint."
  263 +
  264 + if context then
  265 + return handle_breakpoint(context, message, file, line)
  266 + end
  267 +
  268 + Binding.of_caller do |context|
  269 + handle_breakpoint(context, message, file, line)
  270 + end
  271 + end
  272 +
  273 + # Whether asserts should be ignored if not in debug mode.
  274 + # Debug mode can be enabled by running ruby with the -d
  275 + # switch or by setting $DEBUG to true.
  276 + attr_accessor :optimize_asserts
  277 + self.optimize_asserts = false
  278 +
  279 + # Whether an Exception should be raised on failed asserts
  280 + # in non-$DEBUG code or not. By default this is disabled.
  281 + attr_accessor :asserts_cause_exceptions
  282 + self.asserts_cause_exceptions = false
  283 + @use_drb = false
  284 +
  285 + attr_reader :drb_service # :nodoc:
  286 +
  287 + class DRbService # :nodoc:
  288 + include DRbUndumped
  289 +
  290 + def initialize
  291 + @handler = @eval_handler = @collision_handler = nil
  292 +
  293 + IRB.instance_eval { @CONF[:RC] = true }
  294 + IRB.run_config
  295 + end
  296 +
  297 + def collision
  298 + sleep(0.5) until @collision_handler
  299 +
  300 + @collision_handler.untaint
  301 +
  302 + @collision_handler.call
  303 + end
  304 +
  305 + def ping() end
  306 +
  307 + def add_breakpoint(context, message)
  308 + workspace = IRB::WorkSpace.new(context)
  309 + workspace.extend(DRbUndumped)
  310 +
  311 + sleep(0.5) until @handler
  312 +
  313 + @handler.untaint
  314 + @handler.call(workspace, message)
  315 + rescue Errno::ECONNREFUSED, DRb::DRbConnError
  316 + raise if Breakpoint.use_drb?
  317 + end
  318 +
  319 + attr_accessor :handler, :eval_handler, :collision_handler
  320 + end
  321 +
  322 + # Will run Breakpoint in DRb mode. This will spawn a server
  323 + # that can be attached to via the breakpoint-client command
  324 + # whenever a breakpoint is executed. This is useful when you
  325 + # are debugging CGI applications or other applications where
  326 + # you can't access debug sessions via the standard input and
  327 + # output of your application.
  328 + #
  329 + # You can specify an URI where the DRb server will run at.
  330 + # This way you can specify the port the server runs on. The
  331 + # default URI is druby://localhost:42531.
  332 + #
  333 + # Please note that breakpoints will be skipped silently in
  334 + # case the DRb server can not spawned. (This can happen if
  335 + # the port is already used by another instance of your
  336 + # application on CGI or another application.)
  337 + #
  338 + # Also note that by default this will only allow access
  339 + # from localhost. You can however specify a list of
  340 + # allowed hosts or nil (to allow access from everywhere).
  341 + # But that will still not protect you from somebody
  342 + # reading the data as it goes through the net.
  343 + #
  344 + # A good approach for getting security and remote access
  345 + # is setting up an SSH tunnel between the DRb service
  346 + # and the client. This is usually done like this:
  347 + #
  348 + # $ ssh -L20000:127.0.0.1:20000 -R10000:127.0.0.1:10000 example.com
  349 + # (This will connect port 20000 at the client side to port
  350 + # 20000 at the server side, and port 10000 at the server
  351 + # side to port 10000 at the client side.)
  352 + #
  353 + # After that do this on the server side: (the code being debugged)
  354 + # Breakpoint.activate_drb("druby://127.0.0.1:20000", "localhost")
  355 + #
  356 + # And at the client side:
  357 + # ruby breakpoint_client.rb -c druby://127.0.0.1:10000 -s druby://127.0.0.1:20000
  358 + #
  359 + # Running through such a SSH proxy will also let you use
  360 + # breakpoint.rb in case you are behind a firewall.
  361 + #
  362 + # Detailed information about running DRb through firewalls is
  363 + # available at http://www.rubygarden.org/ruby?DrbTutorial
  364 + #
  365 + # == Security considerations
  366 + # Usually you will be fine when using the default druby:// URI and the default
  367 + # access control list. However, if you are sitting on a machine where there are
  368 + # local users that you likely can not trust (this is the case for example on
  369 + # most web hosts which have multiple users sitting on the same physical machine)
  370 + # you will be better off by doing client/server communication through a unix
  371 + # socket. This can be accomplished by calling with a drbunix:/ style URI, e.g.
  372 + # <code>Breakpoint.activate_drb('drbunix:/tmp/breakpoint_server')</code>. This
  373 + # will only work on Unix based platforms.
  374 + def activate_drb(uri = nil, allowed_hosts = ['localhost', '127.0.0.1', '::1'],
  375 + ignore_collisions = false)
  376 +
  377 + return false if @use_drb
  378 +
  379 + uri ||= 'druby://localhost:42531'
  380 +
  381 + if allowed_hosts then
  382 + acl = ["deny", "all"]
  383 +
  384 + Array(allowed_hosts).each do |host|
  385 + acl += ["allow", host]
  386 + end
  387 +
  388 + DRb.install_acl(ACL.new(acl))
  389 + end
  390 +
  391 + @use_drb = true
  392 + @drb_service = DRbService.new
  393 + did_collision = false
  394 + begin
  395 + @service = DRb.start_service(uri, @drb_service)
  396 + rescue Errno::EADDRINUSE
  397 + if ignore_collisions then
  398 + nil
  399 + else
  400 + # The port is already occupied by another
  401 + # Breakpoint service. We will try to tell
  402 + # the old service that we want its port.
  403 + # It will then forward that request to the
  404 + # user and retry.
  405 + unless did_collision then
  406 + DRbObject.new(nil, uri).collision
  407 + did_collision = true
  408 + end
  409 + sleep(10)
  410 + retry
  411 + end
  412 + end
  413 +
  414 + return true
  415 + end
  416 +
  417 + # Deactivates a running Breakpoint service.
  418 + def deactivate_drb
  419 + Thread.exclusive do
  420 + @service.stop_service unless @service.nil?
  421 + @service = nil
  422 + @use_drb = false
  423 + @drb_service = nil
  424 + end
  425 + end
  426 +
  427 + # Returns true when Breakpoints are used over DRb.
  428 + # Breakpoint.activate_drb causes this to be true.
  429 + def use_drb?
  430 + @use_drb == true
  431 + end
  432 +end
  433 +
  434 +module IRB # :nodoc:
  435 + class << self; remove_method :start; end
  436 + def self.start(ap_path = nil, main_context = nil, workspace = nil)
  437 + $0 = File::basename(ap_path, ".rb") if ap_path
  438 +
  439 + # suppress some warnings about redefined constants
  440 + old_verbose, $VERBOSE = $VERBOSE, nil
  441 + IRB.setup(ap_path)
  442 + $VERBOSE = old_verbose
  443 +
  444 + if @CONF[:SCRIPT] then
  445 + irb = Irb.new(main_context, @CONF[:SCRIPT])
  446 + else
  447 + irb = Irb.new(main_context)
  448 + end
  449 +
  450 + if workspace then
  451 + irb.context.workspace = workspace
  452 + end
  453 +
  454 + @CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC]
  455 + @CONF[:MAIN_CONTEXT] = irb.context
  456 +
  457 + old_sigint = trap("SIGINT") do
  458 + begin
  459 + irb.signal_handle
  460 + rescue RubyLex::TerminateLineInput
  461 + # ignored
  462 + end
  463 + end
  464 +
  465 + catch(:IRB_EXIT) do
  466 + irb.eval_input
  467 + end
  468 + ensure
  469 + trap("SIGINT", old_sigint)
  470 + end
  471 +
  472 + class << self
  473 + alias :old_CurrentContext :CurrentContext
  474 + remove_method :CurrentContext
  475 + remove_method :parse_opts
  476 + end
  477 +
  478 + def IRB.CurrentContext
  479 + if old_CurrentContext.nil? and Breakpoint.use_drb? then
  480 + result = Object.new
  481 + def result.last_value; end
  482 + return result
  483 + else
  484 + old_CurrentContext
  485 + end
  486 + end
  487 + def IRB.parse_opts() end
  488 +
  489 + class Context # :nodoc:
  490 + alias :old_evaluate :evaluate
  491 + def evaluate(line, line_no)
  492 + if line.chomp == "exit" then
  493 + exit
  494 + else
  495 + old_evaluate(line, line_no)
  496 + end
  497 + end
  498 + end
  499 +
  500 + class WorkSpace # :nodoc:
  501 + alias :old_evaluate :evaluate
  502 +
  503 + def evaluate(*args)
  504 + if Breakpoint.use_drb? then
  505 + result = old_evaluate(*args)
  506 + if args[0] != :no_proxy and
  507 + not [true, false, nil].include?(result)
  508 + then
  509 + result.extend(DRbUndumped) rescue nil
  510 + end
  511 + return result
  512 + else
  513 + old_evaluate(*args)
  514 + end
  515 + end
  516 + end
  517 +
  518 + module InputCompletor # :nodoc:
  519 + def self.eval(code, context, *more)
  520 + # Big hack, this assumes that InputCompletor
  521 + # will only call eval() when it wants code
  522 + # to be executed in the IRB context.
  523 + IRB.conf[:MAIN_CONTEXT].workspace.evaluate(:no_proxy, code, *more)
  524 + end
  525 + end
  526 +end
  527 +
  528 +module DRb # :nodoc:
  529 + class DRbObject # :nodoc:
  530 + undef :inspect if method_defined?(:inspect)
  531 + undef :clone if method_defined?(:clone)
  532 + end
  533 +end
  534 +
  535 +# See Breakpoint.breakpoint
  536 +def breakpoint(id = nil, &block)
  537 + Binding.of_caller do |context|
  538 + Breakpoint.breakpoint(id, context, &block)
  539 + end
  540 +end
  541 +
  542 +# See Breakpoint.assert
  543 +def assert(&block)
  544 + Binding.of_caller do |context|
  545 + Breakpoint.assert(context, &block)
  546 + end
  547 +end
... ...
vendor/gems/cucumber-0.3.98/examples/dos_line_endings/features/dos_line_endings.feature
1   -Feature: DOS line endings
2   - In order to have less bug reports
3   - As a windows developer
4   - I want to write features with DOS line endigs
5   -
6   - Scenario: Just lots of DOS
7   - Given I am on DOS
8   - And Any version of Windows is really just DOS
9   - Then Windows still sucks
  1 +Feature: DOS line endings
  2 + In order to have less bug reports
  3 + As a windows developer
  4 + I want to write features with DOS line endigs
  5 +
  6 + Scenario: Just lots of DOS
  7 + Given I am on DOS
  8 + And Any version of Windows is really just DOS
  9 + Then Windows still sucks
... ...
vendor/gems/cucumber-0.3.98/spec/cucumber/treetop_parser/test_dos.feature
1   -Feature: Search
2   - In order to learn cucumber
3   - As an engineer
4   - I want to run some simple tests
5   -
6   - Scenario: 1) Reverse a String
7   - Given a string "abc"
8   - When the string is reversed
9   - Then the string should be "cba"
10   -
11   - More Examples:
12   - |input |output|
13   - |a |a |
14   - |ab |ba |
15   -
16   - Scenario: 2) Upcase a String
17   - Given a string "abc"
18   - When the string is upcased
19   - Then the string should be "ABC"
20   -
21   - Scenario: 3) Combining 2 Methods
22   - Given a string "abc"
23   - When the string is upcased
24   - And the string is reversed
  1 +Feature: Search
  2 + In order to learn cucumber
  3 + As an engineer
  4 + I want to run some simple tests
  5 +
  6 + Scenario: 1) Reverse a String
  7 + Given a string "abc"
  8 + When the string is reversed
  9 + Then the string should be "cba"
  10 +
  11 + More Examples:
  12 + |input |output|
  13 + |a |a |
  14 + |ab |ba |
  15 +
  16 + Scenario: 2) Upcase a String
  17 + Given a string "abc"
  18 + When the string is upcased
  19 + Then the string should be "ABC"
  20 +
  21 + Scenario: 3) Combining 2 Methods
  22 + Given a string "abc"
  23 + When the string is upcased
  24 + And the string is reversed
25 25 Then the string should be "CBA"
26 26 \ No newline at end of file
... ...
vendor/gems/fakeweb-1.2.5/test/fixtures/google_response_from_curl
1   -HTTP/1.1 200 OK
2   -Cache-Control: private, max-age=0
3   -Date: Sun, 01 Feb 2009 02:16:24 GMT
4   -Expires: -1
5   -Content-Type: text/html; charset=ISO-8859-1
6   -Set-Cookie: PREF=ID=a6d9b5f5a4056dfe:TM=1233454584:LM=1233454584:S=U9pSwSu4eQwOPenX; expires=Tue, 01-Feb-2011 02:16:24 GMT; path=/; domain=.google.com
7   -Server: gws
8   -Transfer-Encoding: chunked
9   -
  1 +HTTP/1.1 200 OK
  2 +Cache-Control: private, max-age=0
  3 +Date: Sun, 01 Feb 2009 02:16:24 GMT
  4 +Expires: -1
  5 +Content-Type: text/html; charset=ISO-8859-1
  6 +Set-Cookie: PREF=ID=a6d9b5f5a4056dfe:TM=1233454584:LM=1233454584:S=U9pSwSu4eQwOPenX; expires=Tue, 01-Feb-2011 02:16:24 GMT; path=/; domain=.google.com
  7 +Server: gws
  8 +Transfer-Encoding: chunked
  9 +
10 10 <html><head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><title>Google</title><script>var _gjwl=location;function _gjuc(){var a=_gjwl.hash;if(a.indexOf("&q=")>0||a.indexOf("#q=")>=0){a=a.substring(1);if(a.indexOf("#")==-1){for(var c=0;c<a.length;){var d=c;if(a.charAt(d)=="&")++d;var b=a.indexOf("&",d);if(b==-1)b=a.length;var e=a.substring(d,b);if(e.indexOf("fp=")==0){a=a.substring(0,c)+a.substring(b,a.length);b=c}else if(e=="cad=h")return 0;c=b}_gjwl.href="search?"+a+"&cad=h";return 1}}return 0};
11 11 window._gjuc && location.hash && _gjuc();</script><style>body,td,a,p,.h{font-family:arial,sans-serif}.h{color:#36c;font-size:20px}.q{color:#00c}.ts td{padding:0}.ts{border-collapse:collapse}#gbar{height:22px;padding-left:2px}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}#gbi,#gbs{background:#fff;left:0;position:absolute;top:24px;visibility:hidden;z-index:1000}#gbi{border:1px solid;border-color:#c9d7f1 #36c #36c #a2bae7;z-index:1001}#guser{padding-bottom:7px !important}#gbar,#guser{font-size:13px;padding-top:1px !important}@media all{.gb1,.gb3{height:22px;margin-right:.73em;vertical-align:top}#gbar{float:left}}.gb2{display:block;padding:.2em .5em}a.gb1,a.gb2,a.gb3{color:#00c !important}.gb2,.gb3{text-decoration:none}a.gb2:hover{background:#36c;color:#fff !important}</style><script>window.google={kEI:"-AWFSZ6qFYuUswO9j5HIDQ",kEXPI:"17259,19547",kHL:"en"};
12 12 google.y={};google.x=function(e,g){google.y[e.id]=[e,g];return false};window.gbar={};(function(){var b=window.gbar,f,h;b.qs=function(a){var c=window.encodeURIComponent&&(document.forms[0].q||"").value;if(c)a.href=a.href.replace(/([?&])q=[^&]*|$/,function(i,g){return(g||"&")+"q="+encodeURIComponent(c)})};function j(a,c){a.visibility=h?"hidden":"visible";a.left=c+"px"}b.tg=function(a){a=a||window.event;var c=0,i,g=window.navExtra,d=document.getElementById("gbi"),e=a.target||a.srcElement;a.cancelBubble=true;if(!f){f=document.createElement(Array.every||window.createPopup?"iframe":"div");f.frameBorder="0";f.src="#";d.parentNode.appendChild(f).id="gbs";if(g)for(i in g)d.insertBefore(g[i],d.firstChild).className="gb2";document.onclick=b.close}if(e.className!="gb3")e=e.parentNode;do c+=e.offsetLeft;while(e=e.offsetParent);j(d.style,c);f.style.width=d.offsetWidth+"px";f.style.height=d.offsetHeight+"px";j(f.style,c);h=!h};b.close=function(a){h&&b.tg(a)}})();</script></head><body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000 onload="document.f.q.focus();if(document.images)new Image().src='/images/nav_logo3.png'" topmargin=3 marginheight=3><div id=gbar><nobr><b class=gb1>Web</b> <a href="http://images.google.com/imghp?hl=en&tab=wi" onclick=gbar.qs(this) class=gb1>Images</a> <a href="http://maps.google.com/maps?hl=en&tab=wl" onclick=gbar.qs(this) class=gb1>Maps</a> <a href="http://news.google.com/nwshp?hl=en&tab=wn" onclick=gbar.qs(this) class=gb1>News</a> <a href="http://www.google.com/prdhp?hl=en&tab=wf" onclick=gbar.qs(this) class=gb1>Shopping</a> <a href="http://mail.google.com/mail/?hl=en&tab=wm" class=gb1>Gmail</a> <a href="http://www.google.com/intl/en/options/" onclick="this.blur();gbar.tg(event);return !1" class=gb3><u>more</u> <small>&#9660;</small></a><div id=gbi> <a href="http://video.google.com/?hl=en&tab=wv" onclick=gbar.qs(this) class=gb2>Video</a> <a href="http://groups.google.com/grphp?hl=en&tab=wg" onclick=gbar.qs(this) class=gb2>Groups</a> <a href="http://books.google.com/bkshp?hl=en&tab=wp" onclick=gbar.qs(this) class=gb2>Books</a> <a href="http://scholar.google.com/schhp?hl=en&tab=ws" onclick=gbar.qs(this) class=gb2>Scholar</a> <a href="http://finance.google.com/finance?hl=en&tab=we" onclick=gbar.qs(this) class=gb2>Finance</a> <a href="http://blogsearch.google.com/?hl=en&tab=wb" onclick=gbar.qs(this) class=gb2>Blogs</a> <div class=gb2><div class=gbd></div></div> <a href="http://www.youtube.com/?hl=en&tab=w1" onclick=gbar.qs(this) class=gb2>YouTube</a> <a href="http://www.google.com/calendar/render?hl=en&tab=wc" class=gb2>Calendar</a> <a href="http://picasaweb.google.com/home?hl=en&tab=wq" onclick=gbar.qs(this) class=gb2>Photos</a> <a href="http://docs.google.com/?hl=en&tab=wo" class=gb2>Documents</a> <a href="http://www.google.com/reader/view/?hl=en&tab=wy" class=gb2>Reader</a> <a href="http://sites.google.com/?hl=en&tab=w3" class=gb2>Sites</a> <div class=gb2><div class=gbd></div></div> <a href="http://www.google.com/intl/en/options/" class=gb2>even more &raquo;</a></div> </nobr></div><div class=gbh style=left:0></div><div class=gbh style=right:0></div><div align=right id=guser style="font-size:84%;padding:0 0 4px" width=100%><nobr><a href="/url?sa=p&pref=ig&pval=3&q=http://www.google.com/ig%3Fhl%3Den%26source%3Diglk&usg=AFQjCNFA18XPfgb7dKnXfKz7x7g1GDH1tg">iGoogle</a> | <a href="https://www.google.com/accounts/Login?continue=http://www.google.com/&hl=en">Sign in</a></nobr></div><center><br clear=all id=lgpd><img alt="Google" height=110 src="/intl/en_ALL/images/logo.gif" width=276><br><br><form action="/search" name=f><table cellpadding=0 cellspacing=0><tr valign=top><td width=25%>&nbsp;</td><td align=center nowrap><input name=hl type=hidden value=en><input type=hidden name=ie value="ISO-8859-1"><input autocomplete="off" maxlength=2048 name=q size=55 title="Google Search" value=""><br><input name=btnG type=submit value="Google Search"><input name=btnI type=submit value="I'm Feeling Lucky"></td><td nowrap width=25%><font size=-2>&nbsp;&nbsp;<a href=/advanced_search?hl=en>Advanced Search</a><br>&nbsp;&nbsp;<a href=/preferences?hl=en>Preferences</a><br>&nbsp;&nbsp;<a href=/language_tools?hl=en>Language Tools</a></font></td></tr></table></form><br><font size=-1>Share what you know. <a href="/aclk?sa=L&ai=CYhslHwSFSZH6LIHusAPEsc2eBfv77nqP3YC9CsHZnNkTEAEgwVRQypDftPn_____AWDJBqoECU_QbUVlfOdxZw&num=1&sig=AGiWqtwRgqw8y_kza6RGKxBrCstaXkDJ7A&q=http://knol.google.com">Write a Knol</a>.</font><br><br><br><font size=-1><a href="/intl/en/ads/">Advertising&nbsp;Programs</a> - <a href="/services/">Business Solutions</a> - <a href="/intl/en/about.html">About Google</a></font><p><font size=-2>&copy;2009 - <a href="/intl/en/privacy.html">Privacy</a></font></p></center></body><script>if(google.y)google.y.first=[];window.setTimeout(function(){var xjs=document.createElement('script');xjs.src='/extern_js/f/CgJlbhICdXMgACswCjgVLCswDjgELCswGDgDLA/L3N5xu59nDE.js';document.getElementsByTagName('head')[0].appendChild(xjs)},0);google.y.first.push(function(){google.ac.i(document.f,document.f.q,'','')})</script><script>function _gjp() {!(location.hash && _gjuc()) && setTimeout(_gjp, 500);}window._gjuc && _gjp();</script></html>
13 13 \ No newline at end of file
... ...
vendor/gems/polyglot-0.2.8/Rakefile
1   -require 'config/requirements'
2   -require 'config/hoe' # setup Hoe + all gem configuration
3   -
  1 +require 'config/requirements'
  2 +require 'config/hoe' # setup Hoe + all gem configuration
  3 +
4 4 Dir['tasks/**/*.rake'].each { |rake| load rake }
5 5 \ No newline at end of file
... ...
vendor/gems/thoughtbot-shoulda-2.10.1/MIT-LICENSE
1   -Copyright (c) 2007, Tammer Saleh, Thoughtbot, Inc.
2   -
3   -Permission is hereby granted, free of charge, to any person
4   -obtaining a copy of this software and associated documentation
5   -files (the "Software"), to deal in the Software without
6   -restriction, including without limitation the rights to use,
7   -copy, modify, merge, publish, distribute, sublicense, and/or sell
8   -copies of the Software, and to permit persons to whom the
9   -Software is furnished to do so, subject to the following
10   -conditions:
11   -
12   -The above copyright notice and this permission notice shall be
13   -included in all copies or substantial portions of the Software.
14   -
15   -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16   -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17   -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18   -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19   -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20   -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21   -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22   -OTHER DEALINGS IN THE SOFTWARE.
  1 +Copyright (c) 2007, Tammer Saleh, Thoughtbot, Inc.
  2 +
  3 +Permission is hereby granted, free of charge, to any person
  4 +obtaining a copy of this software and associated documentation
  5 +files (the "Software"), to deal in the Software without
  6 +restriction, including without limitation the rights to use,
  7 +copy, modify, merge, publish, distribute, sublicense, and/or sell
  8 +copies of the Software, and to permit persons to whom the
  9 +Software is furnished to do so, subject to the following
  10 +conditions:
  11 +
  12 +The above copyright notice and this permission notice shall be
  13 +included in all copies or substantial portions of the Software.
  14 +
  15 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  16 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  17 +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  18 +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  19 +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  20 +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  21 +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  22 +OTHER DEALINGS IN THE SOFTWARE.
... ...
vendor/plugins/hoptoad_notifier/MIT-LICENSE
1   -Copyright (c) 2007, Tammer Saleh, Thoughtbot, Inc.
2   -
3   -Permission is hereby granted, free of charge, to any person
4   -obtaining a copy of this software and associated documentation
5   -files (the "Software"), to deal in the Software without
6   -restriction, including without limitation the rights to use,
7   -copy, modify, merge, publish, distribute, sublicense, and/or sell
8   -copies of the Software, and to permit persons to whom the
9   -Software is furnished to do so, subject to the following
10   -conditions:
11   -
12   -The above copyright notice and this permission notice shall be
13   -included in all copies or substantial portions of the Software.
14   -
15   -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16   -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17   -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18   -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19   -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20   -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21   -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22   -OTHER DEALINGS IN THE SOFTWARE.
  1 +Copyright (c) 2007, Tammer Saleh, Thoughtbot, Inc.
  2 +
  3 +Permission is hereby granted, free of charge, to any person
  4 +obtaining a copy of this software and associated documentation
  5 +files (the "Software"), to deal in the Software without
  6 +restriction, including without limitation the rights to use,
  7 +copy, modify, merge, publish, distribute, sublicense, and/or sell
  8 +copies of the Software, and to permit persons to whom the
  9 +Software is furnished to do so, subject to the following
  10 +conditions:
  11 +
  12 +The above copyright notice and this permission notice shall be
  13 +included in all copies or substantial portions of the Software.
  14 +
  15 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  16 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  17 +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  18 +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  19 +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  20 +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  21 +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  22 +OTHER DEALINGS IN THE SOFTWARE.
... ...