racksh 0.9.4.2 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/bin/racksh CHANGED
@@ -1,12 +1,27 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  ENV['RACK_ENV'] ||= 'development'
4
+ ENV['CONFIG_RU'] ||= 'config.ru'
4
5
 
5
- boot_path = File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "racksh", "boot.rb"))
6
+ require File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "racksh", "init.rb"))
7
+
8
+ # prevent STDOUT & STDERR to be reopened (apps do this to be able to log under Passenger)
9
+ def STDOUT.reopen(*args); end
10
+ def STDERR.reopen(*args); end
6
11
 
7
12
  if ARGV.empty?
8
- exec "irb -r irb/completion -r #{boot_path} --simple-prompt"
13
+ require "irb"
14
+ require "irb/completion"
15
+ loop do
16
+ pid = fork do
17
+ Rack::Shell.init
18
+ IRB.conf[:PROMPT_MODE] = :SIMPLE
19
+ IRB.start
20
+ end
21
+ Process.wait(pid)
22
+ break if $?.exitstatus == 0
23
+ end
9
24
  else
10
- require boot_path
25
+ Rack::Shell.init
11
26
  p eval(ARGV.join(" "))
12
27
  end
@@ -1,16 +1,20 @@
1
1
  require 'rack'
2
+ dir = File.expand_path(File.dirname(__FILE__))
3
+ %w(session version init).each { |f| require File.join(dir, f) }
4
+
5
+ def reload!
6
+ puts "Rack::Shell reloading..."
7
+ Process.exit(1)
8
+ end
2
9
 
3
10
  module Rack
4
11
  module Shell
5
12
  File = ::File
6
13
 
7
- def self.start!
8
- # prevent STDOUT & STDERR to be reopened (apps do this to be able to log under Passenger)
9
- def STDOUT.reopen(*args); end
10
- def STDERR.reopen(*args); end
14
+ def self.init
15
+ config_ru = ENV['CONFIG_RU']
11
16
 
12
17
  # build Rack app
13
- config_ru = ENV['CONFIG_RU'] || 'config.ru'
14
18
  rack_app = Object.class_eval("Rack::Builder.new { #{File.read(config_ru)} }", config_ru)
15
19
  $rack = Rack::Shell::Session.new(rack_app)
16
20
 
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module Shell
3
- VERSION = '0.9.4.2'.freeze
3
+ VERSION = '0.9.5'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: racksh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4.2
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcin Kulik
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-23 00:00:00 +01:00
12
+ date: 2010-01-31 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -42,10 +42,9 @@ extra_rdoc_files: []
42
42
 
43
43
  files:
44
44
  - bin/racksh
45
- - lib/racksh/boot.rb
46
- - lib/racksh/init.rb
47
- - lib/racksh/session.rb
48
45
  - lib/racksh/version.rb
46
+ - lib/racksh/session.rb
47
+ - lib/racksh/init.rb
49
48
  - README.markdown
50
49
  has_rdoc: true
51
50
  homepage: http://github.com/sickill/racksh
@@ -1,3 +0,0 @@
1
- dir = File.expand_path(File.dirname(__FILE__))
2
- %w(session version init).each { |f| require File.join(dir, f) }
3
- Rack::Shell.start!