racksh 0.9.7 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.txt CHANGED
@@ -1,3 +1,10 @@
1
+ === 0.9.8 / 2010-09-03
2
+
3
+ * added option to load racksh into existing irb session
4
+
5
+ === 0.9.7 / ?
6
+ === 0.9.6 / ?
7
+
1
8
  === 0.9.5 / 2010-01-31
2
9
 
3
10
  * added application reloading with "reload!"
@@ -17,11 +24,11 @@
17
24
  === 0.9.2 / 2009-11-15
18
25
 
19
26
  * irb require uses absolute path (for users without rubygems required in their .irbrc)
20
-
27
+
21
28
  === 0.9.1 / 2009-11-15
22
29
 
23
30
  * added showing name of loaded rack env
24
31
 
25
32
  === 0.9 / 2009-11-15
26
33
 
27
- * initial release
34
+ * initial release
data/README.markdown CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  **racksh** (Rack::Shell) is a console for Rack based ruby web applications.
6
6
 
7
- It's like Rails' _script/console_ or Merb's _merb -i_, but for any app built on Rack. You can use it to load application
7
+ It's like _script/console_ in Rails or _merb -i_ in Merb, but for any app built on Rack. You can use it to load application
8
8
  environment for Rails, Merb, Sinatra, Camping, Ramaze or your own framework provided there is _config.ru_ file in app's root
9
9
  directory.
10
10
 
@@ -20,7 +20,7 @@ Additionally it exposes _$rack_ variable which allows you to make simulated HTTP
20
20
 
21
21
  ## Installation
22
22
 
23
- gem install racksh -s http://gemcutter.org
23
+ gem install racksh
24
24
 
25
25
  ## Usage
26
26
 
@@ -29,7 +29,7 @@ Additionally it exposes _$rack_ variable which allows you to make simulated HTTP
29
29
  To start racksh session run following inside rack application directory (containing config.ru file):
30
30
 
31
31
  % racksh
32
- Rack::Shell v0.9.5 started in development environment.
32
+ Rack::Shell v0.9.8 started in development environment.
33
33
  >>
34
34
 
35
35
  Specifying location of config.ru:
@@ -44,13 +44,13 @@ Executing ruby code inside application environment and printing results:
44
44
  Specifying Rack environment (default is development):
45
45
 
46
46
  % RACK_ENV=production racksh
47
- Rack::Shell v0.9.5 started in production environment.
47
+ Rack::Shell v0.9.8 started in production environment.
48
48
  >>
49
49
 
50
50
  ### Making simulated HTTP requests to your app
51
51
 
52
52
  % racksh
53
- Rack::Shell v0.9.5 started in development environment.
53
+ Rack::Shell v0.9.8 started in development environment.
54
54
  >> $rack.get "/"
55
55
  => #<Rack::MockResponse:0xb68fa7bc @body="<html>...", @headers={"Content-Type"=>"text/html", "Content-Length"=>"1812"}, @status=200, ...
56
56
 
@@ -132,6 +132,14 @@ If you've made some changes to your app and you want to reload it type:
132
132
 
133
133
  It will reload (actually restart) whole Rack application in new process.
134
134
 
135
+ ### Loading racksh into existing irb session
136
+
137
+ If you already opened irb and you want racksh functionality just run following:
138
+
139
+ require 'racksh/irb'
140
+
141
+ It will initialize racksh and load rack app. From now on you can use _$rack_.
142
+
135
143
  ## Bugs & feature requests
136
144
 
137
145
  Please report bugs and/or feature requests on the github issue tracker for the project located [here](http://github.com/sickill/racksh/issues).
data/bin/racksh CHANGED
@@ -1,8 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- ENV['RACK_ENV'] ||= 'development'
4
- ENV['CONFIG_RU'] ||= 'config.ru'
5
-
6
3
  require File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "racksh", "init.rb"))
7
4
 
8
5
  # prevent STDOUT & STDERR to be reopened (apps do this to be able to log under Passenger)
data/lib/racksh/init.rb CHANGED
@@ -1,4 +1,8 @@
1
1
  require 'rack'
2
+
3
+ ENV['RACK_ENV'] ||= 'development'
4
+ ENV['CONFIG_RU'] ||= 'config.ru'
5
+
2
6
  dir = File.expand_path(File.dirname(__FILE__))
3
7
  %w(session version init).each { |f| require File.join(dir, f) }
4
8
 
@@ -10,22 +14,22 @@ end
10
14
  module Rack
11
15
  module Shell
12
16
  File = ::File
13
-
17
+
14
18
  def self.init(print_startup_info=true)
15
19
  config_ru = ENV['CONFIG_RU']
16
-
20
+
17
21
  # build Rack app
18
22
  rack_app = Object.class_eval("Rack::Builder.new { #{File.read(config_ru)} }", config_ru)
19
23
  $rack = Rack::Shell::Session.new(rack_app)
20
-
24
+
21
25
  # run ~/.rackshrc
22
26
  rcfile = File.expand_path("~/.rackshrc")
23
27
  eval(File.read(rcfile)) if File.exists?(rcfile)
24
-
28
+
25
29
  # run local .rackshrc (from app dir)
26
30
  rcfile = File.expand_path(File.join(File.dirname(config_ru), ".rackshrc"))
27
31
  eval(File.read(rcfile)) if File.exists?(rcfile)
28
-
32
+
29
33
  # print startup info
30
34
  if print_startup_info
31
35
  if STDOUT.tty? && ENV['TERM'] != 'dumb' # we have color terminal, let's pimp our info!
data/lib/racksh/irb.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'racksh/init'
2
+ Rack::Shell.init(false)
@@ -5,11 +5,11 @@ module Rack
5
5
  class Session
6
6
  include Rack::Test::Methods
7
7
  attr_reader :app
8
-
8
+
9
9
  def initialize(app)
10
10
  @app = app
11
11
  end
12
-
12
+
13
13
  def env
14
14
  ENV['RACK_ENV']
15
15
  end
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module Shell
3
- VERSION = '0.9.7'.freeze
3
+ VERSION = '0.9.8'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: racksh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.7
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 9
8
+ - 8
9
+ version: 0.9.8
5
10
  platform: ruby
6
11
  authors:
7
12
  - Marcin Kulik
@@ -9,29 +14,37 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-02-01 00:00:00 +01:00
17
+ date: 2010-09-03 00:00:00 +02:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: rack
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
20
25
  requirements:
21
26
  - - ">="
22
27
  - !ruby/object:Gem::Version
28
+ segments:
29
+ - 1
30
+ - 0
23
31
  version: "1.0"
24
- version:
32
+ type: :runtime
33
+ version_requirements: *id001
25
34
  - !ruby/object:Gem::Dependency
26
35
  name: rack-test
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
30
39
  requirements:
31
40
  - - ">="
32
41
  - !ruby/object:Gem::Version
42
+ segments:
43
+ - 0
44
+ - 5
33
45
  version: "0.5"
34
- version:
46
+ type: :runtime
47
+ version_requirements: *id002
35
48
  description:
36
49
  email: marcin.kulik@gmail.com
37
50
  executables:
@@ -43,6 +56,7 @@ extra_rdoc_files: []
43
56
  files:
44
57
  - bin/racksh
45
58
  - lib/racksh/version.rb
59
+ - lib/racksh/irb.rb
46
60
  - lib/racksh/session.rb
47
61
  - lib/racksh/init.rb
48
62
  - README.markdown
@@ -57,21 +71,25 @@ rdoc_options: []
57
71
  require_paths:
58
72
  - lib
59
73
  required_ruby_version: !ruby/object:Gem::Requirement
74
+ none: false
60
75
  requirements:
61
76
  - - ">="
62
77
  - !ruby/object:Gem::Version
78
+ segments:
79
+ - 0
63
80
  version: "0"
64
- version:
65
81
  required_rubygems_version: !ruby/object:Gem::Requirement
82
+ none: false
66
83
  requirements:
67
84
  - - ">="
68
85
  - !ruby/object:Gem::Version
86
+ segments:
87
+ - 0
69
88
  version: "0"
70
- version:
71
89
  requirements: []
72
90
 
73
91
  rubyforge_project:
74
- rubygems_version: 1.3.5
92
+ rubygems_version: 1.3.7
75
93
  signing_key:
76
94
  specification_version: 3
77
95
  summary: Console for any Rack based ruby web app