action_tree 0.1.0
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/.document +6 -0
- data/.rspec +3 -0
- data/.yardopts +14 -0
- data/LICENSE +20 -0
- data/MANUAL.md +277 -0
- data/README.md +88 -0
- data/Rakefile +45 -0
- data/TODO +32 -0
- data/VERSION +1 -0
- data/lib/action_tree/basic/match.rb +132 -0
- data/lib/action_tree/basic/node.rb +180 -0
- data/lib/action_tree/capture_hash.rb +19 -0
- data/lib/action_tree/dialect_helper.rb +12 -0
- data/lib/action_tree/eval_scope.rb +23 -0
- data/lib/action_tree/plugins/tilt.rb +65 -0
- data/lib/action_tree.rb +47 -0
- data/spec/01_support_lib_spec.rb +41 -0
- data/spec/02_node_spec.rb +149 -0
- data/spec/03_match_spec.rb +120 -0
- data/spec/04_integration_spec.rb +140 -0
- data/spec/fixtures/test.haml +2 -0
- data/spec/fixtures/test_layout.haml +1 -0
- data/spec/log +12 -0
- data/spec/p01_tilt_spec.rb +60 -0
- metadata +105 -0
@@ -0,0 +1 @@
|
|
1
|
+
%body= yield
|
data/spec/log
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
|
2
|
+
require 'action_tree'
|
3
|
+
require 'haml'
|
4
|
+
|
5
|
+
module Templated
|
6
|
+
extend ActionTree::Dialect
|
7
|
+
class Node < ActionTree::Basic::Node; end
|
8
|
+
class Match < ActionTree::Basic::Match; end
|
9
|
+
apply(ActionTree::Plugins::Tilt)
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
describe Templated::Node do
|
14
|
+
|
15
|
+
pending 'still passes normal specs'
|
16
|
+
|
17
|
+
it 'allows setting view path' do
|
18
|
+
subject.view_path('Bahamas')
|
19
|
+
subject.view_path.should == 'Bahamas'
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'inherits view path' do
|
23
|
+
subject.view_path('Brazil')
|
24
|
+
subject.action('/mediocrity') { 'hmm..' }
|
25
|
+
subject.match('/mediocrity').view_path.should == 'Brazil'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'inherits layout path' do
|
29
|
+
subject.layout('Congo')
|
30
|
+
subject.action('Uzbekistan') { }
|
31
|
+
subject.match('Uzbekistan').layout.should == 'Congo'
|
32
|
+
end
|
33
|
+
|
34
|
+
# inherits layouts, independent by namespace
|
35
|
+
|
36
|
+
describe 'renders' do
|
37
|
+
|
38
|
+
it 'haml' do
|
39
|
+
subject.view_path('.')
|
40
|
+
subject.action { render 'spec/fixtures/test.haml' }
|
41
|
+
subject.match.run.should == "<p>Yippee</p>\n"
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'haml within a layout defined by an ancestor' do
|
45
|
+
subject.layout('/spec/fixtures/test_layout.haml')
|
46
|
+
subject.action('hi') { render 'spec/fixtures/test.haml' }
|
47
|
+
subject.match('hi').run.should == "<body><p>Yippee</p></body>\n"
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: action_tree
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- jbe
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-01-31 00:00:00 +01:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: backports
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
type: :runtime
|
32
|
+
version_requirements: *id001
|
33
|
+
description: ActionTree is a router. It provides a compact DSL for defining routes that map paths to actions. It was designed as a router for modern ruby mini-frameworks.
|
34
|
+
email: post@jostein.be
|
35
|
+
executables: []
|
36
|
+
|
37
|
+
extensions: []
|
38
|
+
|
39
|
+
extra_rdoc_files:
|
40
|
+
- LICENSE
|
41
|
+
- README.md
|
42
|
+
- TODO
|
43
|
+
files:
|
44
|
+
- .document
|
45
|
+
- .rspec
|
46
|
+
- .yardopts
|
47
|
+
- LICENSE
|
48
|
+
- MANUAL.md
|
49
|
+
- README.md
|
50
|
+
- Rakefile
|
51
|
+
- TODO
|
52
|
+
- VERSION
|
53
|
+
- lib/action_tree.rb
|
54
|
+
- lib/action_tree/basic/match.rb
|
55
|
+
- lib/action_tree/basic/node.rb
|
56
|
+
- lib/action_tree/capture_hash.rb
|
57
|
+
- lib/action_tree/dialect_helper.rb
|
58
|
+
- lib/action_tree/eval_scope.rb
|
59
|
+
- lib/action_tree/plugins/tilt.rb
|
60
|
+
- spec/01_support_lib_spec.rb
|
61
|
+
- spec/02_node_spec.rb
|
62
|
+
- spec/03_match_spec.rb
|
63
|
+
- spec/04_integration_spec.rb
|
64
|
+
- spec/fixtures/test.haml
|
65
|
+
- spec/fixtures/test_layout.haml
|
66
|
+
- spec/log
|
67
|
+
- spec/p01_tilt_spec.rb
|
68
|
+
has_rdoc: true
|
69
|
+
homepage: http://github.com/jbe/action_tree
|
70
|
+
licenses: []
|
71
|
+
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options: []
|
74
|
+
|
75
|
+
require_paths:
|
76
|
+
- lib
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
segments:
|
83
|
+
- 0
|
84
|
+
version: "0"
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
segments:
|
91
|
+
- 0
|
92
|
+
version: "0"
|
93
|
+
requirements: []
|
94
|
+
|
95
|
+
rubyforge_project:
|
96
|
+
rubygems_version: 1.3.7
|
97
|
+
signing_key:
|
98
|
+
specification_version: 3
|
99
|
+
summary: Versatile routing dry enough to kill cacti.
|
100
|
+
test_files:
|
101
|
+
- spec/01_support_lib_spec.rb
|
102
|
+
- spec/02_node_spec.rb
|
103
|
+
- spec/03_match_spec.rb
|
104
|
+
- spec/04_integration_spec.rb
|
105
|
+
- spec/p01_tilt_spec.rb
|