tux 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemspec +4 -3
- data/CHANGELOG.rdoc +5 -0
- data/README.rdoc +42 -5
- data/bin/tux +2 -2
- data/deps.rip +3 -2
- data/lib/tux.rb +3 -1
- data/lib/tux/commands.rb +0 -3
- data/lib/tux/rack.rb +3 -0
- data/lib/tux/runner.rb +9 -0
- data/lib/tux/version.rb +1 -1
- metadata +30 -13
data/.gemspec
CHANGED
@@ -9,12 +9,13 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.email = "gabriel.horner@gmail.com"
|
10
10
|
s.homepage = "http://github.com/cldwalker/tux"
|
11
11
|
s.summary = "Sinatra dressed for interactive ruby - a sinatra shell"
|
12
|
-
s.description = "Tux dresses up sinatra
|
12
|
+
s.description = "Tux dresses up sinatra in a shell. Use it to interact with your helpers, view rendering and your app's response objects. Tux also gives you commands to view your app's routes and settings."
|
13
13
|
s.required_rubygems_version = ">= 1.3.6"
|
14
14
|
s.rubyforge_project = 'tagaholic'
|
15
15
|
s.executables = ['tux']
|
16
|
-
s.add_dependency 'ripl', '>= 0.3.
|
17
|
-
s.add_dependency 'ripl-rack', '>= 0.
|
16
|
+
s.add_dependency 'ripl', '>= 0.3.5'
|
17
|
+
s.add_dependency 'ripl-rack', '>= 0.2.0'
|
18
|
+
s.add_dependency 'ripl-multi_line', '>= 0.2.4'
|
18
19
|
s.add_dependency 'sinatra', '>= 1.2.1'
|
19
20
|
s.files = Dir.glob(%w[{lib,test}/**/*.rb bin/* [A-Z]*.{txt,rdoc} ext/**/*.{rb,c} **/deps.rip]) + %w{Rakefile .gemspec}
|
20
21
|
s.extra_rdoc_files = ["README.rdoc", "LICENSE.txt"]
|
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
== Description
|
2
|
-
Tux dresses up sinatra
|
2
|
+
Tux dresses up sinatra in a shell. Use it to interact with your helpers, view rendering and
|
3
3
|
your app's response objects. Tux also gives you commands to view your app's routes and settings.
|
4
4
|
|
5
5
|
== Install
|
@@ -9,9 +9,16 @@ Install the gem with:
|
|
9
9
|
|
10
10
|
== Usage
|
11
11
|
|
12
|
+
Start with:
|
13
|
+
|
14
|
+
$ tux
|
15
|
+
|
16
|
+
If your app's config file isn't config.ru, specify with -c
|
17
|
+
|
18
|
+
$ tux -c app.ru
|
19
|
+
|
12
20
|
To interact with your helpers:
|
13
21
|
|
14
|
-
$ tux.uri
|
15
22
|
>> app.my_helper_method
|
16
23
|
...
|
17
24
|
|
@@ -27,7 +34,7 @@ methods:
|
|
27
34
|
=> {"Content-Type"=>"text/html"}
|
28
35
|
|
29
36
|
For the above to work, tux sets up default empty request and response objects. To try the helpers
|
30
|
-
with
|
37
|
+
with custom requests and responses:
|
31
38
|
|
32
39
|
>> app.request = Sinatra::Request.new({})
|
33
40
|
>> app.response = Sinatra::Response.new
|
@@ -37,9 +44,34 @@ To interact with your views:
|
|
37
44
|
>> app.erb :my_template
|
38
45
|
=> 'template rendered'
|
39
46
|
|
47
|
+
# also
|
48
|
+
>> app.haml
|
49
|
+
>> app.markdown
|
50
|
+
...
|
51
|
+
|
52
|
+
Tux let's you you make requests and interact with rack response objects thanks to
|
53
|
+
{rack-test}[https://github.com/brynary/rack-test]:
|
54
|
+
|
55
|
+
>> get '/'
|
56
|
+
=> #<Rack::MockResponse:0x13d452c @headers={"Content-Type"=>"text/html;charset=utf-8",
|
57
|
+
"Content-Length"=>"4"}, @errors="127.0.0.1 - - [05/Apr/2011 02:22:27] \"GET / \" 200 4
|
58
|
+
0.0015\n", @status=200, @original_headers={"Content-Type"=>"text/html;charset=utf-8",
|
59
|
+
"Content-Length"=>"4"}, @body="dude">
|
60
|
+
|
61
|
+
>> puts last_response.body
|
62
|
+
dude
|
63
|
+
|
64
|
+
>> post '/create'
|
65
|
+
...
|
66
|
+
|
67
|
+
To see the full list of rack-test actions you can make
|
68
|
+
|
69
|
+
>> rack.actions
|
70
|
+
=> [:request, :get, :post, :put, :delete, :head, :follow_redirect!, :header, :set_cookie,
|
71
|
+
:clear_cookies, :authorize, :basic_authorize, :digest_authorize, :last_response, :last_request]
|
72
|
+
|
40
73
|
Tux also comes with commands to give you a good overview of your app
|
41
74
|
|
42
|
-
$ tux
|
43
75
|
>> routes
|
44
76
|
HEAD "/"
|
45
77
|
HEAD /book/:id
|
@@ -74,6 +106,11 @@ Tux also comes with commands to give you a good overview of your app
|
|
74
106
|
static true
|
75
107
|
views "/my/path/views"
|
76
108
|
|
109
|
+
== Configure
|
110
|
+
|
111
|
+
Since tux is a {ripl shell}[http://github.com/cldwalker/ripl], tux is highly configurable. You can
|
112
|
+
create tux commands in the format tux-COMMAND and enhance your shell by adding ripl plugins to
|
113
|
+
~/.riplrc. Read {ripl's readme}[http://github.com/cldwalker/ripl#readme] for more.
|
114
|
+
|
77
115
|
== TODO
|
78
|
-
* Better integration with ripl-rack
|
79
116
|
* Tests
|
data/bin/tux
CHANGED
data/deps.rip
CHANGED
data/lib/tux.rb
CHANGED
data/lib/tux/commands.rb
CHANGED
data/lib/tux/rack.rb
ADDED
data/lib/tux/runner.rb
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
module Tux
|
2
2
|
class Runner < Ripl::Runner
|
3
3
|
self.app = 'tux'
|
4
|
+
add_options ['-c, --config FILE', 'Set rack config file i.e. config.ru']
|
5
|
+
|
6
|
+
def self.parse_option(option, argv)
|
7
|
+
if option[/(?:-c|--config)=?(.*)/]
|
8
|
+
ENV['RACK_CONFIG'] = $1.empty? ? argv.shift.to_s : $1
|
9
|
+
else
|
10
|
+
super
|
11
|
+
end
|
12
|
+
end
|
4
13
|
end
|
5
14
|
end
|
data/lib/tux/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tux
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Gabriel Horner
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-04-
|
18
|
+
date: 2011-04-05 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,12 +26,12 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 25
|
30
30
|
segments:
|
31
31
|
- 0
|
32
32
|
- 3
|
33
|
-
-
|
34
|
-
version: 0.3.
|
33
|
+
- 5
|
34
|
+
version: 0.3.5
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
@@ -42,18 +42,34 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
hash:
|
45
|
+
hash: 23
|
46
46
|
segments:
|
47
47
|
- 0
|
48
|
-
-
|
48
|
+
- 2
|
49
49
|
- 0
|
50
|
-
version: 0.
|
50
|
+
version: 0.2.0
|
51
51
|
type: :runtime
|
52
52
|
version_requirements: *id002
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
|
-
name:
|
54
|
+
name: ripl-multi_line
|
55
55
|
prerelease: false
|
56
56
|
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 31
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
- 2
|
65
|
+
- 4
|
66
|
+
version: 0.2.4
|
67
|
+
type: :runtime
|
68
|
+
version_requirements: *id003
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sinatra
|
71
|
+
prerelease: false
|
72
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
57
73
|
none: false
|
58
74
|
requirements:
|
59
75
|
- - ">="
|
@@ -65,8 +81,8 @@ dependencies:
|
|
65
81
|
- 1
|
66
82
|
version: 1.2.1
|
67
83
|
type: :runtime
|
68
|
-
version_requirements: *
|
69
|
-
description: Tux dresses up sinatra
|
84
|
+
version_requirements: *id004
|
85
|
+
description: Tux dresses up sinatra in a shell. Use it to interact with your helpers, view rendering and your app's response objects. Tux also gives you commands to view your app's routes and settings.
|
70
86
|
email: gabriel.horner@gmail.com
|
71
87
|
executables:
|
72
88
|
- tux
|
@@ -77,6 +93,7 @@ extra_rdoc_files:
|
|
77
93
|
- LICENSE.txt
|
78
94
|
files:
|
79
95
|
- lib/tux/commands.rb
|
96
|
+
- lib/tux/rack.rb
|
80
97
|
- lib/tux/runner.rb
|
81
98
|
- lib/tux/version.rb
|
82
99
|
- lib/tux.rb
|