spiderfw 0.6.34 → 0.6.35

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 4c4bf569cdffcd4f4e64bd82183bbee9d4d10fab
4
- data.tar.gz: 63357be8bf251700de9f892f52fd6b314c8d2414
5
- SHA512:
6
- metadata.gz: b044d2830210abc1e7351259d85d658e2cbe814ec75c9dc6da98a002a6fc704e865aa869cfdf63ba2cf7d35a79d0d69297fa6ef249a564c6cf5d23b8cf07e1b8
7
- data.tar.gz: 7f404687644cbfd20f3ca935def886e8c42827724addd0ff034cf80e8f7885a2ad32eed2402165a432472833c18b2a7d135507242911772b193a76af16d1e3bf
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b4317639c33a989badc6ce0fbd7e070731348691
4
+ data.tar.gz: e9625e7ee5aa4c34fba87c4f4d14800c7d165908
5
+ SHA512:
6
+ metadata.gz: 199d34a00c7535800047109ebaf9d0549a1c5b74d3c477e1072028fc71d78c799ed908fb90b46d50bff575440255d151079eefb1754dd76d1459b28b64f00d4d
7
+ data.tar.gz: ae1b338a781265c0faa2582c18b123f71d4e5b46f60997d3350983fc403693e4b3307dbc0c5dfe5020942c65f4b5e3c2844255dd2e75918fd7f34d138ab5576b
data/CHANGELOG CHANGED
@@ -1,3 +1,28 @@
1
+ == 0.6.35
2
+ * modificata instanziazione CmdParser in base all'ultimo rilascio della gemma CmdParse
3
+ * Aggiunto controllo per files .shtml in respawing e attivato celluloid.thread per Listen
4
+ * modifiche correttive relative all'uso di ByeBug e corretta gestione del respawn con Listen
5
+ * Modifiche per gemma fssm sostituita con listen
6
+ * Usato il parametro HTTP_X_FORWARDED_PROTO nel caso di reverse_proxy con ssl-offloading
7
+ * Modifiche per problemi con respawn, kill dei child_thread e trap
8
+ * Corretto il redirect su login per admin
9
+ * Cambiata pagina di errore con invio mail con nome comune
10
+ * Aggiunto valore di default per site.tech_admin.email con errori@soluzionipa.it
11
+ == 0.6.34
12
+ * modificata logica di gestione delle date in odbc
13
+ * Cambiato http_url con http_s_url e corretto funzioni
14
+ * modificata funzionalità riguardante alias per ordinamento in mssql
15
+ * Rimesso controllo se site.ssl attivo
16
+ * Adeguata https_url con action come http_url in app.rb
17
+ * Modifiche su invio mail multipart per problema con comunicazioni con immagini
18
+ * Aggiunto un controllo se l'elemento non blank in set_loaded_value del base_model
19
+ * Controllo se gia definita la costante per non avere il warning:already initialized constant News/Contents
20
+ * Aggiunta funzione to_bool alla class String
21
+ * Cambiata gestione allegati in send_email del messenger_helper
22
+ * controllo se campo esiste in schema
23
+ * Aggiunto controllo relativo al tipo di assoc_type
24
+ * modificata chiamata rufus perchè non + supportata
25
+ * aggiunto controllo in creazione indice non contemplando eventuali models che sono estensioni di altri
1
26
  == 0.6.33
2
27
  * Modifiche per problemi con accenti e chiamate json
3
28
  * Encode aggiunto su funzione inspect
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.34
1
+ 0.6.35
@@ -15,7 +15,7 @@ module Spider; module Admin
15
15
 
16
16
 
17
17
  def self.default_redirect
18
- AdminController.url
18
+ AdminController.http_s_url
19
19
  end
20
20
 
21
21
  def self.logout_redirect
@@ -9,11 +9,11 @@ module Spider; module Auth
9
9
  layout 'login'
10
10
 
11
11
  def self.default_redirect
12
- nil
12
+ self.http_s_url
13
13
  end
14
14
 
15
15
  def self.logout_redirect
16
- nil
16
+ self.class.http_s_url
17
17
  end
18
18
 
19
19
  def self.users=(val)
@@ -73,8 +73,9 @@ module Spider; module Auth
73
73
  end
74
74
 
75
75
  def success_redirect
76
+
76
77
  if (@request.params['redirect'] && !@request.params['redirect'].empty?)
77
- redir_to = @request.params['redirect']
78
+ redir_to = ((Spider.site && Spider.site.ssl?) ? Spider.site.http_s_url : '')+@request.params['redirect']
78
79
  redirect(redir_to, Spider::HTTP::SEE_OTHER)
79
80
  return true
80
81
  elsif(self.default_redirect)
@@ -9,7 +9,7 @@ require 'ruby-debug'
9
9
  class Cmd
10
10
 
11
11
  def initialize
12
- @cmd = CmdParse::CommandParser.new( true, true )
12
+ @cmd = CmdParse::CommandParser.new({:handle_exceptions => true, :takes_commands => true})
13
13
  @cmd.program_name = "spider-servant"
14
14
  @cmd.options = CmdParse::OptionParserWrapper.new do |opt|
15
15
  opt.separator _("Global options:")
Binary file
@@ -16,7 +16,7 @@ module Spider; module CommandLine
16
16
  class Cmd
17
17
 
18
18
  def initialize
19
- @cmd = CmdParse::CommandParser.new( true, true )
19
+ @cmd = CmdParse::CommandParser.new({:handle_exceptions => true, :takes_commands => true})
20
20
  @cmd.program_name = "spider"
21
21
  @cmd.options = CmdParse::OptionParserWrapper.new do |opt|
22
22
  opt.separator _("Global options:")
@@ -79,9 +79,7 @@ module Spider
79
79
 
80
80
  config_option 'debugger.start', _("Start the debugger"), :type => Spider::DataTypes::Bool,
81
81
  :default => lambda{ ['test', 'devel'].include?(Spider.runmode) ? true : false }
82
- config_option 'debugger.pry', _("User Pry for debugging"), :type => Spider::Bool, :default => lambda{
83
- RUBY_VERSION_PARTS[1] == '9'
84
- }
82
+ config_option 'debugger.pry', _("User Pry for debugging"), :type => Spider::Bool, :default => false
85
83
  config_option 'profiling.enable', _("Enable on-request profiling"), :type => Spider::DataTypes::Bool
86
84
  config_option 'request.mutex', _("Respond to requests sequentially"), :default => false
87
85
 
@@ -163,7 +161,7 @@ module Spider
163
161
  }
164
162
 
165
163
  config_option 'site.admin.name', _("Name of the site administrator")
166
- config_option 'site.admin.email', _("Email of the site administrator")
164
+ config_option 'site.admin.email', _("Email of the site administrator"), :default => 'errori@soluzionipa.it'
167
165
  config_option 'site.tech_admin.email', _("Email of the site technical administrator"),
168
166
  :default => lambda{ Spider.conf.get('site.admin.email') }
169
167
  config_option 'site.domain', _("Main domain name used to access the site")
@@ -253,7 +253,7 @@ module Spider
253
253
 
254
254
  # If the site supports SSL, returns the #https_url; otherwise, the #http_url
255
255
  def self.http_s_url(action=nil)
256
- Spider.site.http_s_url + route_path(action)
256
+ (Spider.site.blank? ? "" : Spider.site.http_s_url) + route_path(action)
257
257
  end
258
258
 
259
259
  # The main controller's execution method. The Controller will dispatch
@@ -53,11 +53,12 @@ module Spider; module ControllerMixins
53
53
  def request_url
54
54
  return request_path unless @request.env['HTTP_HOST']
55
55
  #'http://'+@request.env['HTTP_HOST']+request_path vecchia versione con problemi con https
56
- if @request.env["HTTPS"] == "on"
56
+ if @request.env["HTTPS"] == "on" || @request.env['HTTP_X_FORWARDED_PROTO'] == 'https' # uso anche il parametro HTTP_X_FORWARDED_PROTO per reverse_proxy con ssl_offloading
57
57
  u = "https://#{@request.env['HTTP_HOST']}#{request_path}"
58
58
  else
59
59
  u = "http://#{@request.env['HTTP_HOST']}#{request_path}"
60
60
  end
61
+ u
61
62
  end
62
63
 
63
64
  # @return [String] the request_url with query params, if any
@@ -312,6 +312,8 @@ module Spider; module ControllerMixins
312
312
  exc.extend(UUIDExceptionMessage)
313
313
  @scene.exception_uuid = exc.uuid
314
314
  @scene.email_subject += " (#{exc.uuid})" if @scene.email_subject
315
+ #aggiungo nome del comune su mail di errore - 5/03/2015
316
+ @scene.email_subject += " - #{Spider.conf.get('orgs.default.name')}" if @scene.email_subject && !Spider.conf.get('orgs.default.name').blank?
315
317
  end
316
318
  @scene.admin_email = Spider.conf.get('site.tech_admin.email')
317
319
  if Spider.runmode == 'devel'
@@ -115,13 +115,18 @@ module Spider; module HTTP
115
115
  end
116
116
  end
117
117
  do_shutdown = Proc.new{
118
- Debugger.post_mortem = false if defined?(Debugger)
118
+ case RUBY_VERSION
119
+ when /2/
120
+ Byebug.post_mortem = false if defined?(Byebug)
121
+ else
122
+ Debugger.post_mortem = false if defined?(Debugger)
123
+ end
119
124
  server.shutdown if server
120
125
  ssl_server.shutdown if ssl_server
121
126
 
122
127
  pid_file = File.join(Spider.paths[:var], 'run/server.pid')
123
128
  begin
124
- File.unlink(pid_file)
129
+ FileUtils.rm_f(pid_file)
125
130
  rescue Errno::ENOENT
126
131
  Spider.logger.info "Unlink del pid file non riuscito"
127
132
  end
@@ -152,7 +157,8 @@ module Spider; module HTTP
152
157
  end
153
158
  Process.detach(forked)
154
159
  else
155
- Spider.init_base
160
+ #questo fa Loads configuration, sets up Locale and GetText, sets paths and the default Logger.
161
+ Spider.init_base
156
162
  spawner_started = false
157
163
  if Spider.conf.get('webserver.respawn_on_change')
158
164
  Spider.start_loggers
@@ -172,6 +178,7 @@ module Spider; module HTTP
172
178
  end
173
179
  end
174
180
  unless spawner_started
181
+ #in devel qui non entra
175
182
  Spider.main_process_startup
176
183
  Spider.startup
177
184
  begin
@@ -207,8 +214,9 @@ module Spider; module HTTP
207
214
 
208
215
  unless @already_forked
209
216
  Spider.main_process_startup
210
- exit_spawner = Proc.new{
211
- Spider.logger.debug "Spawner exiting"
217
+ exit_spawner = Proc.new{
218
+ #QUESTO LOG FA COMPARIRE UN MESSAGGIO DI ERRORE IN DEVEL
219
+ #Spider.logger.debug "Spawner exiting"
212
220
  Process.kill 'KILL', @monitor_thread[:spawner_child_pid]
213
221
  }
214
222
  Spider.on_main_process_shutdown(&exit_spawner)
@@ -227,8 +235,17 @@ module Spider; module HTTP
227
235
  else
228
236
  # Child
229
237
  $SPIDER_SPAWNED = true
230
- trap('TERM'){ }
231
- trap('INT'){ }
238
+ Signal.trap("TERM") do
239
+ exit
240
+ end
241
+ Signal.trap("INT") do
242
+ exit
243
+ end
244
+ Signal.trap("HUP") do
245
+ exit
246
+ end
247
+ # trap('TERM'){ }
248
+ # trap('INT'){ }
232
249
  rd.close
233
250
  Spider.spawner = wr
234
251
  return unless @actions[action]
@@ -242,47 +259,73 @@ module Spider; module HTTP
242
259
  end
243
260
 
244
261
  def monitor_fs
245
- require 'fssm'
262
+ require 'fssm' if RUBY_VERSION =~ /1.8/
263
+ require 'listen' if RUBY_VERSION > "1.8.7"
246
264
  spawner = self
247
265
  action = 'spawn'
248
266
  return Thread.new do
249
- fsm_exclude = ['var', 'tmp']
250
- FSSM.monitor do
251
- #Spider.logger.debug("Monitoring #{Spider.paths[:apps]} for changes")
252
- path Spider.paths[:apps] do
253
- glob '**/*.rb'
267
+ #VECCHIA VERSIONE CON FSSM PER RUBY 1.8.7
268
+ if RUBY_VERSION =~ /1.8/
269
+ fsm_exclude = ['var', 'tmp']
270
+ FSSM.monitor do
271
+ #Spider.logger.debug("Monitoring #{Spider.paths[:apps]} for changes")
272
+ path Spider.paths[:apps] do
273
+ glob '**/*.rb'
254
274
 
255
- update { |base, relative|
256
- Spider.logger.debug("#{relative} updated, restarting")
257
- Process.kill 'KILL', Thread.current[:spawner_child_pid]
275
+ update { |base, relative|
276
+ Spider.logger.debug("#{relative} updated, restarting")
277
+ Process.kill 'KILL', spawner.child_pid
278
+ spawner.spawn(action)
279
+ }
280
+ delete { |base, relative|
281
+ Spider.logger.debug("#{relative} deleted, restarting")
282
+ Process.kill 'KILL', spawner.child_pid
283
+ spawner.spawn(action)
284
+ }
285
+ create { |base, relative|
286
+ Spider.logger.debug("#{relative} created, restarting")
287
+ Process.kill 'KILL', spawner.child_pid
288
+ spawner.spawn(action)
289
+ }
290
+ end
291
+ # path Spider.paths[:root] do
292
+ # glob '**/*.shtml'
293
+ #
294
+ # update { |base, relative|
295
+ # puts "Changed #{base}, #{relative}"
296
+ # Spider::Template.cache.invalidate(File.join('ROOT', relative))
297
+ # }
298
+ # end
299
+
300
+ # path '/some/other/directory/' do
301
+ # update {|base, relative|}
302
+ # delete {|base, relative|}
303
+ # create {|base, relative|}
304
+ # end
305
+ end
306
+ else
307
+ listener = Listen.to(Spider.paths[:apps], { :only => /\.rb/ } ) { |modified, added, removed|
308
+
309
+ unless modified.blank?
310
+ Spider.logger.debug("#{modified.first} updated, restarting")
311
+ Process.kill 'KILL', spawner.child_pid
258
312
  spawner.spawn(action)
259
- }
260
- delete { |base, relative|
261
- Spider.logger.debug("#{relative} deleted, restarting")
262
- Process.kill 'KILL', Thread.current[:spawner_child_pid]
313
+ end
314
+ unless added.blank?
315
+ Spider.logger.debug("#{added.first} created, restarting")
316
+ Process.kill 'KILL', spawner.child_pid
263
317
  spawner.spawn(action)
264
- }
265
- create { |base, relative|
266
- Spider.logger.debug("#{relative} created, restarting")
267
- Process.kill 'KILL', Thread.current[:spawner_child_pid]
318
+ end
319
+ unless removed.blank?
320
+ Spider.logger.debug("#{removed.first} deleted, restarting")
321
+ Process.kill 'KILL', spawner.child_pid
268
322
  spawner.spawn(action)
269
- }
270
- end
271
- # path Spider.paths[:root] do
272
- # glob '**/*.shtml'
273
- #
274
- # update { |base, relative|
275
- # puts "Changed #{base}, #{relative}"
276
- # Spider::Template.cache.invalidate(File.join('ROOT', relative))
277
- # }
278
- # end
279
-
280
- # path '/some/other/directory/' do
281
- # update {|base, relative|}
282
- # delete {|base, relative|}
283
- # create {|base, relative|}
284
- # end
323
+ end
324
+ }
325
+ listener.start
326
+ sleep
285
327
  end
328
+
286
329
  end
287
330
 
288
331
  end
@@ -13,7 +13,9 @@ require 'spiderfw/version'
13
13
  require 'timeout'
14
14
 
15
15
  begin
16
- require 'fssm'
16
+ require 'listen' if RUBY_VERSION > "1.8.7"
17
+ require 'fssm' if RUBY_VERSION =~ /1.8/
18
+ require 'rbconfig'
17
19
  rescue LoadError
18
20
  end
19
21
 
@@ -169,7 +171,7 @@ module Spider
169
171
  end
170
172
 
171
173
 
172
- # Creates runtime folders: 'tmp', 'var', 'var/memory' and 'var/data'
174
+ # Creates runtime folders: 'tmp', 'var', 'var/memory', 'var/data' and 'var/sessions'
173
175
  # @return [void]
174
176
  def setup_env
175
177
  unless File.exists?(File.join(Spider.paths[:root], 'init.rb'))
@@ -179,7 +181,10 @@ module Spider
179
181
  FileUtils.mkdir_p(Spider.paths[:var])
180
182
  FileUtils.mkdir_p(File.join(Spider.paths[:var], 'memory'))
181
183
  FileUtils.mkdir_p(File.join(Spider.paths[:var], 'data'))
182
-
184
+ #nuove cartelle aggiunte
185
+ FileUtils.mkdir_p(Spider.paths[:data])
186
+ FileUtils.mkdir_p(File.join(Spider.paths[:var], 'sessions'))
187
+
183
188
  end
184
189
 
185
190
 
@@ -218,42 +223,75 @@ module Spider
218
223
  # Note that in some environments (e.g. Phusion Passenger) there will not be a main process, so
219
224
  # this method will not be called.
220
225
  def main_process_startup
221
- if defined?(FSSM)
222
- monitor = FSSM::Monitor.new
226
+ if RUBY_VERSION =~ /1.8/
227
+ if defined?(FSSM)
228
+ monitor = FSSM::Monitor.new
223
229
 
224
- monitor.path(Spider.paths[:tmp], 'restart.txt') do
225
- create { |base, relative| Process.kill 'HUP', $$ }
226
- update { |base, relative| Process.kill 'HUP', $$ }
227
- end
230
+ monitor.path(Spider.paths[:tmp], 'restart.txt') do
231
+ create { |base, relative| Process.kill 'HUP', $$ }
232
+ update { |base, relative| Process.kill 'HUP', $$ }
233
+ end
228
234
 
229
- if Spider.conf.get('template.cache.use_fssm')
230
- monitor.path(Spider.paths[:root]) do
231
- glob '**/*.shtml'
232
- create { |base, relative| FileUtils.rm_rf(File.join(Spider.paths[:var], 'cache', 'templates')) }
233
- update { |base, relative| FileUtils.rm_rf(File.join(Spider.paths[:var], 'cache', 'templates')) }
235
+ if Spider.conf.get('template.cache.use_fssm')
236
+ monitor.path(Spider.paths[:root]) do
237
+ glob '**/*.shtml'
238
+ create { |base, relative| FileUtils.rm_rf(File.join(Spider.paths[:var], 'cache', 'templates')) }
239
+ update { |base, relative| FileUtils.rm_rf(File.join(Spider.paths[:var], 'cache', 'templates')) }
240
+ end
241
+ monitor.path($SPIDER_PATH) do
242
+ glob '**/*.shtml'
243
+ create { |base, relative| FileUtils.rm_rf(File.join(Spider.paths[:var], 'cache', 'templates')) }
244
+ update { |base, relative| FileUtils.rm_rf(File.join(Spider.paths[:var], 'cache', 'templates')) }
245
+ end
246
+ FileUtils.rm_rf(File.join(Spider.paths[:var], 'cache', 'templates'))
234
247
  end
235
- monitor.path($SPIDER_PATH) do
236
- glob '**/*.shtml'
237
- create { |base, relative| FileUtils.rm_rf(File.join(Spider.paths[:var], 'cache', 'templates')) }
238
- update { |base, relative| FileUtils.rm_rf(File.join(Spider.paths[:var], 'cache', 'templates')) }
248
+
249
+ @fssm_thread = Thread.new do
250
+ monitor.run
251
+ end
252
+ Spider.output("Monitoring restart.txt")
253
+
254
+ else
255
+ Spider.output("FSSM not installed, unable to monitor restart.txt")
256
+ if Spider.conf.get('template.cache.use_fssm')
257
+ raise "Unable to use FSSM for monitoring templates; use template.cache.disable instead"
239
258
  end
240
- FileUtils.rm_rf(File.join(Spider.paths[:var], 'cache', 'templates'))
241
259
  end
260
+ else #VERSIONI > 1.8.7
261
+ if defined?(Listen)
262
+ listener = Listen.to(Spider.paths[:tmp], { :only => /restart.txt$/ } ) { |modified, added, removed|
242
263
 
243
- @fssm_thread = Thread.new do
244
- monitor.run
264
+ unless modified.blank?
265
+ Process.kill 'HUP', $$
266
+ end
267
+ unless added.blank?
268
+ Process.kill 'HUP', $$
269
+ end
270
+ }
271
+ @celluloid_thread = Celluloid::Thread.new do
272
+ listener.start
273
+ end
274
+ else
275
+ Spider.output("Listen gem not installed, unable to monitor restart.txt")
245
276
  end
246
- Spider.output("Monitoring restart.txt")
277
+ end
247
278
 
248
- else
249
- Spider.output("FSSM not installed, unable to monitor restart.txt")
250
- if Spider.conf.get('template.cache.use_fssm')
251
- raise "Unable to use FSSM for monitoring templates; use template.cache.disable instead"
279
+ Signal.trap("TERM") do
280
+ Spider.main_process_shutdown
281
+ exit
282
+ end
283
+ Signal.trap("INT") do
284
+ Spider.main_process_shutdown
285
+ exit
286
+ end
287
+ unless RUBY_PLATFORM =~ /win32|mingw32/
288
+ Signal.trap("HUP") do
289
+ Spider.respawn!
252
290
  end
253
291
  end
254
- trap('TERM'){ Spider.main_process_shutdown; exit }
255
- trap('INT'){ Spider.main_process_shutdown; exit }
256
- trap('HUP'){ Spider.respawn! } unless RUBY_PLATFORM =~ /win32|mingw32/
292
+ # trap('TERM'){ Spider.main_process_shutdown; exit }
293
+ # trap('INT'){ Spider.main_process_shutdown; exit }
294
+ # trap('HUP'){ Spider.respawn! } unless RUBY_PLATFORM =~ /win32|mingw32/
257
295
 
258
296
  if @main_process_startup_blocks
259
297
  @main_process_startup_blocks.each{ |block| block.call }
@@ -283,6 +321,7 @@ module Spider
283
321
  # Invoked when a server is shutdown. Apps may implement the app_shutdown method, that will be called.
284
322
  # @return [void]
285
323
  def shutdown(force=false)
324
+ #Byebug.stop unless defined?(Byebug).blank?
286
325
  unless force
287
326
  #return unless Thread.current == Thread.main
288
327
  return if @shutdown_done
@@ -306,7 +345,13 @@ module Spider
306
345
  end
307
346
  end
308
347
  end
309
- Debugger.post_mortem = false if Object.const_defined?(:Debugger) && Debugger.post_mortem?
348
+
349
+ case RUBY_VERSION
350
+ when /2/
351
+ Byebug.post_mortem = false if Object.const_defined?(:Debugger) && Byebug.post_mortem?
352
+ else
353
+ Debugger.post_mortem = false if Object.const_defined?(:Debugger) && Debugger.post_mortem?
354
+ end
310
355
  @apps.each do |name, mod|
311
356
  mod.app_shutdown if mod.respond_to?(:app_shutdown)
312
357
  end
@@ -1011,10 +1056,10 @@ module Spider
1011
1056
  Thread.critical = crit
1012
1057
  end
1013
1058
 
1059
+ #chiamato al touch tmp/restart in produzione
1014
1060
  # Terminates the current process and starts a new one
1015
1061
  # @return [void]
1016
1062
  def respawn!
1017
- require 'rbconfig'
1018
1063
  Spider.logger.info("Restarting")
1019
1064
  ruby = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']).sub(/.*\s.*/m, '"\&"')
1020
1065
  Spider.main_process_shutdown
@@ -1072,13 +1117,48 @@ module Spider
1072
1117
  # Inits the pry debugger
1073
1118
  # @return [void]
1074
1119
  def init_pry_debug
1075
- require 'pry'
1076
- require 'pry-nav'
1077
- require 'pry-stack_explorer'
1078
- if File.exists?(File.join($SPIDER_RUN_PATH,'tmp', 'debug.txt'))
1079
- require 'pry-remote'
1120
+ begin
1121
+ require 'pry'
1122
+ require 'pry-nav'
1123
+ require 'pry-stack_explorer'
1124
+ if File.exists?(File.join($SPIDER_RUN_PATH,'tmp', 'debug.txt'))
1125
+ require 'pry-remote'
1126
+ end
1127
+ Pry::Commands.alias_command "l=", "whereami"
1128
+ Pry::Commands.alias_command "c", "continue"
1129
+ Pry::Commands.alias_command "n", "next"
1130
+ Pry::Commands.alias_command "s", "step"
1131
+ begin
1132
+ case RUBY_VERSION
1133
+ when /2/
1134
+ require 'byebug'
1135
+ else
1136
+ require 'ruby-debug'
1137
+ end
1138
+ rescue
1139
+ require 'debugger'
1140
+ end
1141
+ case RUBY_VERSION
1142
+ when /2/
1143
+ if File.exists?(File.join($SPIDER_RUN_PATH,'tmp', 'debug.txt'))
1144
+ Byebug.wait_connection = true
1145
+ Byebug.start
1146
+ else
1147
+ Byebug.start
1148
+ end
1149
+ else
1150
+ if File.exists?(File.join($SPIDER_RUN_PATH,'tmp', 'debug.txt'))
1151
+ Debugger.wait_connection = true
1152
+ Debugger.start_remote
1153
+ else
1154
+ Debugger.start
1155
+ end
1156
+ end
1157
+ rescue LoadError, RuntimeError => exc
1158
+ msg = _('Unable to start debugger. Ensure ruby-debug or byebug is installed (or set debugger.start to false).')
1159
+ Spider.output(exc.message)
1160
+ Spider.output(msg)
1080
1161
  end
1081
- Pry::Commands.alias_command "l=", "whereami"
1082
1162
  end
1083
1163
 
1084
1164
  # @private
@@ -1,11 +1,12 @@
1
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2
- "http://www.w3.org/TR/html4/strict.dtd">
1
+ <!DOCTYPE html>
3
2
  <html>
4
3
  <tpl:asset type="css" src="css/error_page.css" />
4
+ <tpl:asset name="jquery" />
5
5
  <tpl:asset sp:if="@devel" type="js" src="js/error_page.js" />
6
+
6
7
  <head>
7
8
  <title>{ @error_msg }</title>
8
- <script sp:if="@devel" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
9
+ <!-- <script sp:if="@devel" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> -->
9
10
  <script sp:each='@assets[:js] |script|' type="text/javascript" src="{ script }"></script>
10
11
  <link sp:each='@assets[:css] |css_file|' rel='stylesheet' href='{ css_file }' />
11
12
  </head>