cuba-contrib 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/cuba-contrib.gemspec +1 -1
- data/lib/cuba/contrib.rb +5 -4
- data/lib/cuba/contrib/with.rb +14 -0
- data/test/vars.rb +32 -0
- metadata +10 -8
data/cuba-contrib.gemspec
CHANGED
data/lib/cuba/contrib.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
class Cuba
|
2
2
|
CONTRIB_ROOT = File.expand_path("../../", File.dirname(__FILE__))
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
require "cuba/contrib/prelude"
|
5
|
+
require "cuba/contrib/mote"
|
6
|
+
require "cuba/contrib/text_helpers"
|
7
|
+
require "cuba/contrib/form_helpers"
|
8
|
+
require "cuba/contrib/with"
|
8
9
|
end
|
data/test/vars.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require_relative "helper"
|
2
|
+
|
3
|
+
Cuba.plugin Cuba::With
|
4
|
+
|
5
|
+
class UserPhotos < Cuba
|
6
|
+
define do
|
7
|
+
on root do
|
8
|
+
res.write "uid: %d" % vars[:user_id]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
test do
|
14
|
+
Cuba.define do
|
15
|
+
on "users/:id/photos" do |id|
|
16
|
+
with user_id: id do
|
17
|
+
_, _, body = UserPhotos.call(req.env)
|
18
|
+
|
19
|
+
body.each do |line|
|
20
|
+
res.write line
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
res.write vars.inspect
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
_, _, body = Cuba.call({ "PATH_INFO" => "/users/1001/photos",
|
29
|
+
"SCRIPT_NAME" => "" })
|
30
|
+
|
31
|
+
assert_response body, ["uid: 1001", "{}"]
|
32
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuba-contrib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-04-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cuba
|
16
|
-
requirement: &
|
16
|
+
requirement: &70149650848280 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '3.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70149650848280
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: cutest
|
27
|
-
requirement: &
|
27
|
+
requirement: &70149650847560 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70149650847560
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: capybara
|
38
|
-
requirement: &
|
38
|
+
requirement: &70149650846740 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70149650846740
|
47
47
|
description: Includes various helper tools for Cuba.
|
48
48
|
email:
|
49
49
|
- me@cyrildavid.com
|
@@ -58,11 +58,13 @@ files:
|
|
58
58
|
- lib/cuba/contrib/mote.rb
|
59
59
|
- lib/cuba/contrib/prelude.rb
|
60
60
|
- lib/cuba/contrib/text_helpers.rb
|
61
|
+
- lib/cuba/contrib/with.rb
|
61
62
|
- lib/cuba/contrib.rb
|
62
63
|
- cuba-contrib.gemspec
|
63
64
|
- test/helper.rb
|
64
65
|
- test/mote.rb
|
65
66
|
- test/text_helper.rb
|
67
|
+
- test/vars.rb
|
66
68
|
- views/field.mote
|
67
69
|
- views/file.mote
|
68
70
|
- views/option.mote
|