racksh 0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.markdown +52 -0
  2. data/VERSION +1 -0
  3. data/bin/racksh +8 -0
  4. data/lib/racksh.rb +20 -0
  5. metadata +58 -0
data/README.markdown ADDED
@@ -0,0 +1,52 @@
1
+ racksh
2
+ ======
3
+
4
+ About
5
+ -----
6
+
7
+ **racksh** (Rack::Shell) is a console for Rack based ruby web applications.
8
+
9
+ 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 environment for Rails, Merb, Sinatra, Camping, Ramaze or your own framework provided there is _config.ru_ file in app's root directory.
10
+
11
+ It's purpose is to allow developer to introspect his application and/or make some initial setup, ie. running _DataMapper.auto_migrate!_. It's mainly aimed at apps that don't have similar facility (like Sinatra) but can be used without problems with Merb or Rails apps.
12
+
13
+ How it works?
14
+ -------------
15
+
16
+ It loads whole application environment like Rack web server, but it doesn't run the app. Simply, methods like _use_ or _run_ which are normally invoked on Rack::Builder instance are being stubbed.
17
+
18
+ Installation
19
+ ------------
20
+
21
+ gem install racksh -s http://gemcutter.org
22
+
23
+ Usage
24
+ -----
25
+
26
+ To open console run following inside rack application directory (containing config.ru file):
27
+
28
+ racksh
29
+
30
+ Specifying location of config.ru:
31
+
32
+ CONFIG_RU=~/projects/foobar/config.ru racksh
33
+
34
+ Executing ruby code inside application environment and printing results:
35
+
36
+ racksh Order.all
37
+ racksh "Order.first :created_at => Date.today"
38
+
39
+ Specifying Rack environment (default is development):
40
+
41
+ RACK_ENV=production racksh
42
+
43
+ Bugs & feature requests
44
+ ---------------------------------
45
+
46
+ Please report bugs and/or feature requests on the github issue tracker for the project located [here](http://github.com/sickill/racksh/issues).
47
+
48
+ Authors
49
+ -------
50
+
51
+ * Marcin Kulik - [sickill.net](http://sickill.net/)
52
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.9
data/bin/racksh ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ if ARGV.empty?
4
+ exec "irb -r racksh"
5
+ else
6
+ require 'racksh'
7
+ p eval(ARGV.join(" "))
8
+ end
data/lib/racksh.rb ADDED
@@ -0,0 +1,20 @@
1
+ ENV['RACK_ENV'] ||= 'development'
2
+
3
+ def use(*args, &blk); end
4
+ def run(*args, &blk); end
5
+ def map(*args, &blk); end
6
+
7
+ config_ru = ENV['CONFIG_RU'] || 'config.ru'
8
+
9
+ begin
10
+ load config_ru
11
+ version = File.read(File.join(File.dirname(__FILE__), '..', 'VERSION'))
12
+ puts "Rack::Shell v#{version} started." if ARGV.empty?
13
+ rescue LoadError => e
14
+ if e.message =~ /config\.ru$/
15
+ puts "Rack::Shell couldn't find #{config_ru}"
16
+ exit(1)
17
+ else
18
+ raise e
19
+ end
20
+ end
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: racksh
3
+ version: !ruby/object:Gem::Version
4
+ version: "0.9"
5
+ platform: ruby
6
+ authors:
7
+ - Marcin Kulik
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-11-15 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: marcin.kulik@gmail.com
18
+ executables:
19
+ - racksh
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - bin/racksh
26
+ - lib/racksh.rb
27
+ - VERSION
28
+ - README.markdown
29
+ has_rdoc: true
30
+ homepage: http://github.com/sickill/racksh
31
+ licenses: []
32
+
33
+ post_install_message:
34
+ rdoc_options: []
35
+
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: "0"
43
+ version:
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: "0"
49
+ version:
50
+ requirements: []
51
+
52
+ rubyforge_project:
53
+ rubygems_version: 1.3.5
54
+ signing_key:
55
+ specification_version: 3
56
+ summary: Console for any Rack based ruby web app
57
+ test_files: []
58
+