vanilla 1.14.1 → 1.15
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -2
- data/bin/vanilla +35 -6
- data/lib/vanilla/app.rb +6 -1
- data/lib/vanilla/console.rb +17 -6
- data/lib/vanilla.rb +1 -1
- data/pristine_app/Gemfile +3 -0
- data/pristine_app/Gemfile.lock +32 -0
- data/pristine_app/README +36 -0
- data/pristine_app/config.ru +26 -0
- data/pristine_app/public/vanilla.css +15 -0
- data/pristine_app/soups/base/layout.snip +18 -0
- data/pristine_app/soups/base/start.snip +19 -0
- data/pristine_app/soups/dynasnips/current_snip.rb +29 -0
- data/{lib/vanilla → pristine_app/soups}/dynasnips/debug.rb +5 -3
- data/{lib/vanilla → pristine_app/soups}/dynasnips/index.rb +2 -0
- data/{lib/vanilla → pristine_app/soups}/dynasnips/link_to.rb +2 -0
- data/pristine_app/soups/dynasnips/link_to_current_snip.rb +14 -0
- data/pristine_app/soups/dynasnips/page_title.rb +9 -0
- data/{lib/vanilla → pristine_app/soups}/dynasnips/pre.rb +6 -4
- data/{lib/vanilla → pristine_app/soups}/dynasnips/raw.rb +8 -5
- data/{lib/vanilla/dynasnips → pristine_app/soups/extras}/comments.rb +3 -1
- data/{lib/vanilla/dynasnips → pristine_app/soups/extras}/kind.rb +0 -0
- data/{lib/vanilla/dynasnips → pristine_app/soups/extras}/rand.rb +2 -0
- data/{lib/vanilla/dynasnips → pristine_app/soups/extras}/url_to.rb +0 -0
- data/{lib/vanilla/snips → pristine_app/soups}/tutorial/bad_dynasnip.snip +0 -0
- data/{lib/vanilla/snips → pristine_app/soups}/tutorial/hello_world.snip +0 -0
- data/{lib/vanilla/snips → pristine_app/soups}/tutorial/markdown_example.snip +0 -0
- data/{lib/vanilla/snips → pristine_app/soups}/tutorial/snip.snip +0 -0
- data/{lib/vanilla/snips → pristine_app/soups}/tutorial/soup.snip +1 -3
- data/{lib/vanilla/snips → pristine_app/soups}/tutorial/test.snip +0 -0
- data/{lib/vanilla/snips → pristine_app/soups}/tutorial/textile_example.snip +0 -0
- data/{lib/vanilla/snips → pristine_app/soups}/tutorial/tutorial-another-snip.snip +0 -0
- data/{lib/vanilla/snips → pristine_app/soups}/tutorial/tutorial-basic-snip-inclusion.snip +0 -0
- data/pristine_app/soups/tutorial/tutorial-dynasnips.snip.markdown +56 -0
- data/pristine_app/soups/tutorial/tutorial-layout.snip +56 -0
- data/pristine_app/soups/tutorial/tutorial-links.snip +4 -0
- data/pristine_app/soups/tutorial/tutorial-renderers.snip.markdown +77 -0
- data/{lib/vanilla/snips/tutorial/vanilla-rb-tutorial.snip → pristine_app/soups/tutorial/tutorial.snip.markdown} +17 -21
- data/{lib/vanilla/snips → pristine_app/soups}/tutorial/vanilla-rb.snip +0 -0
- data/{lib/vanilla/snips → pristine_app/soups}/tutorial/vanilla.snip +0 -0
- data/pristine_app/tmp/restart.txt +0 -0
- data/test/test_helper.rb +1 -1
- data/test/vanilla_app_test.rb +3 -3
- data/test/vanilla_presenting_test.rb +9 -2
- metadata +76 -73
- data/README_FOR_APP +0 -38
- data/config.example.yml +0 -7
- data/config.ru +0 -11
- data/lib/tasks/vanilla.rake +0 -75
- data/lib/vanilla/dynasnips/current_snip.rb +0 -32
- data/lib/vanilla/dynasnips/link_to_current_snip.rb +0 -16
- data/lib/vanilla/dynasnips/title.rb +0 -7
- data/lib/vanilla/snips/system/layout.snip +0 -19
- data/lib/vanilla/snips/system/start.snip +0 -25
- data/lib/vanilla/snips/system/system.snip +0 -17
- data/public/hatch.png +0 -0
@@ -0,0 +1,77 @@
|
|
1
|
+
{tutorial-links}
|
2
|
+
|
3
|
+
Renderers
|
4
|
+
=========
|
5
|
+
|
6
|
+
As well as the flexibility to combine pieces of content, another reason {link_to vanilla-rb} is more *interesting* than simpler wiki-ish software is that each piece of content can be processed by arbitrarily complex software before it is composed.
|
7
|
+
|
8
|
+
In its simplest form, this means that some content can be written in one format (say, raw HTML) whereas other content can be written in different formats (like Textile or Markdown for richer content). You could write one blog post in Textile, and the next one in Markdown, without any issues, depending on what best suits your purpose.
|
9
|
+
|
10
|
+
This is one of the principle drivers behind {link_to vanilla-rb}; you shouldn't have to make an upfront decision about how best to structure your all of your content.
|
11
|
+
|
12
|
+
This has been covered generally in the {link_to tutorial, main tutorial}, but here we'll go into a bit more detail.
|
13
|
+
|
14
|
+
Defining a renderer for a snip
|
15
|
+
-------------------
|
16
|
+
|
17
|
+
The renderer used for a snip is determined in the following manner
|
18
|
+
|
19
|
+
1. Using the snip `extension` attribute
|
20
|
+
2. Using the snip `render_as` attribute
|
21
|
+
3. Using the default renderer
|
22
|
+
|
23
|
+
The snip `extension` is an attribute generated by the {link_to soup} library, which roughly corresponds to the file extension of the snip itself. So, if your snip is stored in a file called `my-schnip.markdown`, the `extension` property will be `markdown`. If the filename is `my-schnip.snip.markdown`, the `extension` is still just `markdown`.
|
24
|
+
|
25
|
+
To determine the actual renderer from this attributes, a lookup hash is used, mapping these strings onto Ruby classes. The default is something like this:
|
26
|
+
|
27
|
+
{
|
28
|
+
"base" => Vanilla::Renderers::Base,
|
29
|
+
"markdown" => Vanilla::Renderers::Markdown,
|
30
|
+
"bold" => Vanilla::Renderers::Bold,
|
31
|
+
"erb" => Vanilla::Renderers::Erb,
|
32
|
+
"rb" => Vanilla::Renderers::Ruby,
|
33
|
+
"ruby" => Vanilla::Renderers::Ruby,
|
34
|
+
"haml" => Vanilla::Renderers::Haml,
|
35
|
+
"raw" => Vanilla::Renderers::Raw,
|
36
|
+
"textile" => Vanilla::Renderers::Textile
|
37
|
+
}
|
38
|
+
|
39
|
+
|
40
|
+
Adding renderers
|
41
|
+
----------------
|
42
|
+
|
43
|
+
New renderers can be added as part of the application configuration:
|
44
|
+
|
45
|
+
Vanilla::App.new(:renderers => {
|
46
|
+
"rdoc" => MyRenderers::RDoc
|
47
|
+
})
|
48
|
+
|
49
|
+
These will be added to the lookup, and can also used to override the defaults (changing the renderer for "markdown" snips to use RDiscount, or Redcarpet, for example).
|
50
|
+
|
51
|
+
|
52
|
+
Writing new renderers
|
53
|
+
---------------------
|
54
|
+
|
55
|
+
The simplest renderer inherits from `Vanilla::Renderers::Base`, and reimplement the `process_text` method:
|
56
|
+
|
57
|
+
module Vanilla::Renderers
|
58
|
+
class Bold < Base
|
59
|
+
def process_text(content)
|
60
|
+
"<b>#{content}</b>"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
It is passed a string (either the selected snip's "content" attribute, or some other explicitly requested attribute), and should return that content in its rendered form. The `Vanilla::Renderers::Markdown` renderer shows this more clearly:
|
66
|
+
|
67
|
+
module Vanilla::Renderers
|
68
|
+
class Markdown < Base
|
69
|
+
def process_text(content)
|
70
|
+
BlueCloth.new(content).to_html
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
There are a number of other methods which can be overridden by custom renderers, but these are beyond the scope of this tutorial; the best way to learn is to look at the set of provided renderers (such as the Erb and Haml ones) and work from there.
|
76
|
+
|
77
|
+
{tutorial-links}
|
@@ -1,24 +1,26 @@
|
|
1
|
-
|
1
|
+
{tutorial-links}
|
2
|
+
|
3
|
+
Snips - the basic concept
|
2
4
|
------------
|
3
5
|
|
4
|
-
Firstly, open the raw contents of this snip - either in your
|
6
|
+
Firstly, open the raw contents of this snip - either in your editor (search for `vanilla-rb-tutorial.snip`), or by opening <a href="{current_snip name}.raw">this snip in raw format</a> in a new window or tab. Ready? OK.
|
5
7
|
|
6
8
|
Every piece of information displayed here is stored as a {link_to snip}. Snips, within their contents, can also reference other snips. When you request a snip, it will render into a page (or another kind of response), and also render any snips that it internally references.
|
7
9
|
|
8
10
|
For example, consider the snip {link_to tutorial-basic-snip-inclusion}:
|
9
11
|
|
10
|
-
{raw tutorial-basic-snip-inclusion}
|
12
|
+
{raw tutorial-basic-snip-inclusion}
|
11
13
|
|
12
14
|
When this snip is rendered, it appears like this:
|
13
15
|
|
14
|
-
{tutorial-basic-snip-inclusion}
|
16
|
+
> {tutorial-basic-snip-inclusion}
|
15
17
|
|
16
|
-
Notice the use of curly brackets to reference one snip from inside another.
|
18
|
+
Notice the use of curly brackets to reference one snip from inside another. {link_to vanilla-rb} finds these references to snips, then renders that snip and replaces it in the first snip. Neat!
|
17
19
|
|
18
20
|
Renderers
|
19
21
|
--------
|
20
22
|
|
21
|
-
The way that a snip is rendered depends on whether or not it has a `render_as` attribute set. For instance, the `render_as` property of
|
23
|
+
The way that a snip is rendered depends on whether or not it has an extension, or a `render_as` attribute set. For instance, the extention of this snip is `{current_snip extension}`, and the `render_as` property of `markdown_example` is `Markdown`. Scroll to the bottom of the raw markdown_example snip in your editor, and you'll see this being declared.
|
22
24
|
|
23
25
|
This means that the `content` of this snip will be passed through `Vanilla::Renderers::Markdown` before it is then rendered to the page. There are several different renders provided by Vanilla.rb at the moment:
|
24
26
|
|
@@ -29,6 +31,8 @@ This means that the `content` of this snip will be passed through `Vanilla::Rend
|
|
29
31
|
* Erb - passes the snip contents through Ruby's `Erb` library. It also makes some information available for use by ruby code within the snip's contents
|
30
32
|
* Ruby - parses the snips content as Ruby itself.
|
31
33
|
|
34
|
+
You can see a lot of these renderers being exercised in the {link_to test} snip.
|
35
|
+
|
32
36
|
It's using this last renderer that a second concept of Vanilla is implemented - dynasnips.
|
33
37
|
|
34
38
|
|
@@ -37,37 +41,29 @@ Dynasnips
|
|
37
41
|
|
38
42
|
Because the curly braces simply cause a snip to be rendered, we can use this in conjunction with the Ruby renderer to run actual code. For instance, in the snip above:
|
39
43
|
|
40
|
-
{raw tutorial-basic-snip-inclusion}
|
44
|
+
{raw tutorial-basic-snip-inclusion}
|
41
45
|
|
42
46
|
we can see a reference to the `link_to` snip - <tt>{link\_to snip}</tt>.
|
43
47
|
|
44
48
|
Lets look at the raw content of `link_to`:
|
45
49
|
|
46
|
-
{raw link_to}
|
50
|
+
{raw link_to}
|
47
51
|
|
48
52
|
As you can see, it simply refers to the Ruby class `LinkTo`, which is contained within the vanilla-rb codebase. When the Ruby renderer is called, expects the given code to evaulate to a Ruby class. It then instantiates the class, and calls a `handle` method on the instance, passing it any other arguments from the snip inclusion. So, in the case of <tt>{link\_to snip}</tt>, the only argument is `snip`.
|
49
53
|
|
54
|
+
### Included Dynasnips
|
55
|
+
|
50
56
|
Vanilla.rb includes a number of dynasnips by default. Here are a couple:
|
51
57
|
|
52
|
-
* `rand`, which generates a random number (a silly demo really); {link_to rand}, or an example: {rand}
|
53
58
|
* `link_to`, to produce a link to another snip
|
54
|
-
* `kind`, which selects and renders sets of snips based on their `kind` attribute (this is how the blog is currently implemented)
|
55
59
|
* `raw`, which displays the raw contents of a snip
|
56
60
|
* `index`, which shows all of the available snips: {link_to index}
|
57
61
|
* ... and several others.
|
58
62
|
|
59
|
-
While dynasnip classes can be provided as part of the vanilla codebase, it's envisioned that much of these will be created by end users in their own sites, either by refering to local classes, or defining the classes directly as the content. Here's an example of that, as the raw content of hello_world:
|
60
|
-
|
61
|
-
{raw hello_world}
|
62
63
|
|
63
|
-
|
64
|
-
|
65
|
-
{hello_world}
|
66
|
-
|
67
|
-
Note that the `handle` method can take one (optional) argument. Lets try including it with <tt>{hello\_world Dave}</tt>:
|
64
|
+
Anyway - that should be enough to get you started.
|
68
65
|
|
69
|
-
{
|
66
|
+
{tutorial-links}
|
70
67
|
|
71
|
-
Anyway - that should be enough to get you started.
|
72
68
|
|
73
|
-
:
|
69
|
+
:updated_at: 2011-04-28 16:21:00 +01:00
|
File without changes
|
File without changes
|
File without changes
|
data/test/test_helper.rb
CHANGED
@@ -14,7 +14,7 @@ module Vanilla
|
|
14
14
|
clean_environment
|
15
15
|
@app = Vanilla::App.new(:soup => soup_path)
|
16
16
|
|
17
|
-
require "
|
17
|
+
require File.expand_path("../../pristine_app/soups/dynasnips/current_snip", __FILE__)
|
18
18
|
@app.soup << CurrentSnip.snip_attributes
|
19
19
|
create_snip :name => "layout", :content => "{current_snip}"
|
20
20
|
end
|
data/test/vanilla_app_test.rb
CHANGED
@@ -28,7 +28,7 @@ describe Vanilla::App do
|
|
28
28
|
|
29
29
|
context "when detecting the snip renderer" do
|
30
30
|
setup do
|
31
|
-
@app = Vanilla::App.new
|
31
|
+
@app = Vanilla::App.new(:soup => soup_path)
|
32
32
|
end
|
33
33
|
|
34
34
|
should "return the constant refered to in the render_as property of the snip" do
|
@@ -52,7 +52,7 @@ describe Vanilla::App do
|
|
52
52
|
end
|
53
53
|
|
54
54
|
should "respect snip renderers passed in the config" do
|
55
|
-
app = Vanilla::App.new(:renderers => {"markdown" => "Vanilla::Renderers::Bold"})
|
55
|
+
app = Vanilla::App.new(:soup => soup_path, :renderers => {"markdown" => "Vanilla::Renderers::Bold"})
|
56
56
|
snip = create_snip(:name => "blah", :extension => "markdown")
|
57
57
|
assert_equal Vanilla::Renderers::Bold, app.renderer_for(snip)
|
58
58
|
end
|
@@ -75,7 +75,7 @@ describe Vanilla::App do
|
|
75
75
|
should "load constants presented as a string" do
|
76
76
|
class ::MyRenderer
|
77
77
|
end
|
78
|
-
app = Vanilla::App.new(:renderers => {"my_renderer" => "MyRenderer"})
|
78
|
+
app = Vanilla::App.new(:soup => soup_path, :renderers => {"my_renderer" => "MyRenderer"})
|
79
79
|
snip = create_snip(:name => "blah", :render_as => "my_renderer")
|
80
80
|
assert_equal MyRenderer, app.renderer_for(snip)
|
81
81
|
end
|
@@ -2,6 +2,7 @@ require "test_helper"
|
|
2
2
|
|
3
3
|
context "When presenting" do
|
4
4
|
setup do
|
5
|
+
require File.expand_path("../../pristine_app/soups/dynasnips/link_to", __FILE__)
|
5
6
|
@app.soup << LinkTo.snip_attributes
|
6
7
|
set_main_template "<tag>{current_snip}</tag>"
|
7
8
|
create_snip :name => "test", :content => "blah {other_snip}", :part => 'part content'
|
@@ -27,6 +28,10 @@ context "When presenting" do
|
|
27
28
|
assert_equal 200, response_code_for("/test/part")
|
28
29
|
assert_equal 200, response_code_for("/test/part.html")
|
29
30
|
end
|
31
|
+
|
32
|
+
should "not allow rendering of the layout to produce infinite recursion" do
|
33
|
+
assert_response_body "Rendering of the current layout would result in infinite recursion.", "/layout"
|
34
|
+
end
|
30
35
|
end
|
31
36
|
|
32
37
|
context "as text" do
|
@@ -97,7 +102,9 @@ context "When presenting" do
|
|
97
102
|
|
98
103
|
context "and a custom default renderer has been provided" do
|
99
104
|
should "use that renderer" do
|
100
|
-
@app = Vanilla::App.new(:default_renderer => ::Vanilla::Renderers::Bold)
|
105
|
+
@app = Vanilla::App.new(:soup => soup_path, :default_renderer => ::Vanilla::Renderers::Bold)
|
106
|
+
require File.expand_path("../../pristine_app/soups/dynasnips/current_snip", __FILE__)
|
107
|
+
@app.soup << CurrentSnip.snip_attributes
|
101
108
|
create_snip :name => "layout", :content => "{current_snip}", :render_as => "base"
|
102
109
|
create_snip :name => "test", :content => "test"
|
103
110
|
assert_response_body "<b>test</b>", "/test"
|
@@ -106,7 +113,7 @@ context "When presenting" do
|
|
106
113
|
|
107
114
|
context "and a missing snip is requested" do
|
108
115
|
should "render missing snip content in the main template" do
|
109
|
-
assert_response_body
|
116
|
+
assert_response_body %{<tag>Couldn't find snip "missing_snip"</tag>}, "/missing_snip"
|
110
117
|
end
|
111
118
|
|
112
119
|
should "have a 404 response code" do
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vanilla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
|
10
|
-
version: 1.14.1
|
8
|
+
- 15
|
9
|
+
version: "1.15"
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- James Adam
|
@@ -15,13 +14,11 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2011-04-
|
17
|
+
date: 2011-04-28 00:00:00 +01:00
|
19
18
|
default_executable:
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
23
|
-
prerelease: false
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
21
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
22
|
none: false
|
26
23
|
requirements:
|
27
24
|
- - ">="
|
@@ -32,12 +29,12 @@ dependencies:
|
|
32
29
|
- 9
|
33
30
|
- 1
|
34
31
|
version: 0.9.1
|
32
|
+
requirement: *id001
|
33
|
+
prerelease: false
|
34
|
+
name: rack
|
35
35
|
type: :runtime
|
36
|
-
version_requirements: *id001
|
37
36
|
- !ruby/object:Gem::Dependency
|
38
|
-
|
39
|
-
prerelease: false
|
40
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
37
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
41
38
|
none: false
|
42
39
|
requirements:
|
43
40
|
- - ">="
|
@@ -48,12 +45,12 @@ dependencies:
|
|
48
45
|
- 0
|
49
46
|
- 6
|
50
47
|
version: 1.0.6
|
48
|
+
requirement: *id002
|
49
|
+
prerelease: false
|
50
|
+
name: soup
|
51
51
|
type: :runtime
|
52
|
-
version_requirements: *id002
|
53
52
|
- !ruby/object:Gem::Dependency
|
54
|
-
|
55
|
-
prerelease: false
|
56
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
57
54
|
none: false
|
58
55
|
requirements:
|
59
56
|
- - ">="
|
@@ -64,12 +61,12 @@ dependencies:
|
|
64
61
|
- 3
|
65
62
|
- 5
|
66
63
|
version: 0.3.5
|
64
|
+
requirement: *id003
|
65
|
+
prerelease: false
|
66
|
+
name: ratom
|
67
67
|
type: :runtime
|
68
|
-
version_requirements: *id003
|
69
68
|
- !ruby/object:Gem::Dependency
|
70
|
-
|
71
|
-
prerelease: false
|
72
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
69
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
73
70
|
none: false
|
74
71
|
requirements:
|
75
72
|
- - ">="
|
@@ -80,12 +77,12 @@ dependencies:
|
|
80
77
|
- 1
|
81
78
|
- 1
|
82
79
|
version: 4.1.1
|
80
|
+
requirement: *id004
|
81
|
+
prerelease: false
|
82
|
+
name: RedCloth
|
83
83
|
type: :runtime
|
84
|
-
version_requirements: *id004
|
85
84
|
- !ruby/object:Gem::Dependency
|
86
|
-
|
87
|
-
prerelease: false
|
88
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
85
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
89
86
|
none: false
|
90
87
|
requirements:
|
91
88
|
- - ">="
|
@@ -96,12 +93,12 @@ dependencies:
|
|
96
93
|
- 0
|
97
94
|
- 0
|
98
95
|
version: 1.0.0
|
96
|
+
requirement: *id005
|
97
|
+
prerelease: false
|
98
|
+
name: BlueCloth
|
99
99
|
type: :runtime
|
100
|
-
version_requirements: *id005
|
101
100
|
- !ruby/object:Gem::Dependency
|
102
|
-
|
103
|
-
prerelease: false
|
104
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
101
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
105
102
|
none: false
|
106
103
|
requirements:
|
107
104
|
- - ">="
|
@@ -112,12 +109,12 @@ dependencies:
|
|
112
109
|
- 4
|
113
110
|
- 1
|
114
111
|
version: 1.4.1
|
112
|
+
requirement: *id006
|
113
|
+
prerelease: false
|
114
|
+
name: treetop
|
115
115
|
type: :runtime
|
116
|
-
version_requirements: *id006
|
117
116
|
- !ruby/object:Gem::Dependency
|
118
|
-
|
119
|
-
prerelease: false
|
120
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
117
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
121
118
|
none: false
|
122
119
|
requirements:
|
123
120
|
- - ">="
|
@@ -126,12 +123,12 @@ dependencies:
|
|
126
123
|
segments:
|
127
124
|
- 0
|
128
125
|
version: "0"
|
126
|
+
requirement: *id007
|
127
|
+
prerelease: false
|
128
|
+
name: haml
|
129
129
|
type: :runtime
|
130
|
-
version_requirements: *id007
|
131
130
|
- !ruby/object:Gem::Dependency
|
132
|
-
|
133
|
-
prerelease: false
|
134
|
-
requirement: &id008 !ruby/object:Gem::Requirement
|
131
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
135
132
|
none: false
|
136
133
|
requirements:
|
137
134
|
- - ">="
|
@@ -142,12 +139,12 @@ dependencies:
|
|
142
139
|
- 1
|
143
140
|
- 5
|
144
141
|
version: 0.1.5
|
142
|
+
requirement: *id008
|
143
|
+
prerelease: false
|
144
|
+
name: kintama
|
145
145
|
type: :development
|
146
|
-
version_requirements: *id008
|
147
146
|
- !ruby/object:Gem::Dependency
|
148
|
-
|
149
|
-
prerelease: false
|
150
|
-
requirement: &id009 !ruby/object:Gem::Requirement
|
147
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
151
148
|
none: false
|
152
149
|
requirements:
|
153
150
|
- - ">="
|
@@ -156,8 +153,10 @@ dependencies:
|
|
156
153
|
segments:
|
157
154
|
- 0
|
158
155
|
version: "0"
|
156
|
+
requirement: *id009
|
157
|
+
prerelease: false
|
158
|
+
name: mocha
|
159
159
|
type: :development
|
160
|
-
version_requirements: *id009
|
161
160
|
description:
|
162
161
|
email: james@lazyatom.com.com
|
163
162
|
executables:
|
@@ -167,11 +166,8 @@ extensions: []
|
|
167
166
|
extra_rdoc_files:
|
168
167
|
- README
|
169
168
|
files:
|
170
|
-
- config.example.yml
|
171
|
-
- config.ru
|
172
169
|
- Rakefile
|
173
170
|
- README
|
174
|
-
- README_FOR_APP
|
175
171
|
- test/base_renderer_test.rb
|
176
172
|
- test/dynasnip_test.rb
|
177
173
|
- test/erb_renderer_test.rb
|
@@ -195,22 +191,9 @@ files:
|
|
195
191
|
- test/vanilla_app_test.rb
|
196
192
|
- test/vanilla_presenting_test.rb
|
197
193
|
- test/vanilla_request_test.rb
|
198
|
-
- lib/tasks/vanilla.rake
|
199
194
|
- lib/vanilla/app.rb
|
200
195
|
- lib/vanilla/console.rb
|
201
196
|
- lib/vanilla/dynasnip.rb
|
202
|
-
- lib/vanilla/dynasnips/comments.rb
|
203
|
-
- lib/vanilla/dynasnips/current_snip.rb
|
204
|
-
- lib/vanilla/dynasnips/debug.rb
|
205
|
-
- lib/vanilla/dynasnips/index.rb
|
206
|
-
- lib/vanilla/dynasnips/kind.rb
|
207
|
-
- lib/vanilla/dynasnips/link_to.rb
|
208
|
-
- lib/vanilla/dynasnips/link_to_current_snip.rb
|
209
|
-
- lib/vanilla/dynasnips/pre.rb
|
210
|
-
- lib/vanilla/dynasnips/rand.rb
|
211
|
-
- lib/vanilla/dynasnips/raw.rb
|
212
|
-
- lib/vanilla/dynasnips/title.rb
|
213
|
-
- lib/vanilla/dynasnips/url_to.rb
|
214
197
|
- lib/vanilla/renderers/base.rb
|
215
198
|
- lib/vanilla/renderers/bold.rb
|
216
199
|
- lib/vanilla/renderers/erb.rb
|
@@ -225,25 +208,45 @@ files:
|
|
225
208
|
- lib/vanilla/snip_reference.rb
|
226
209
|
- lib/vanilla/snip_reference.treetop
|
227
210
|
- lib/vanilla/snip_reference_parser.rb
|
228
|
-
- lib/vanilla/snips/system/layout.snip
|
229
|
-
- lib/vanilla/snips/system/start.snip
|
230
|
-
- lib/vanilla/snips/system/system.snip
|
231
|
-
- lib/vanilla/snips/tutorial/bad_dynasnip.snip
|
232
|
-
- lib/vanilla/snips/tutorial/hello_world.snip
|
233
|
-
- lib/vanilla/snips/tutorial/markdown_example.snip
|
234
|
-
- lib/vanilla/snips/tutorial/snip.snip
|
235
|
-
- lib/vanilla/snips/tutorial/soup.snip
|
236
|
-
- lib/vanilla/snips/tutorial/test.snip
|
237
|
-
- lib/vanilla/snips/tutorial/textile_example.snip
|
238
|
-
- lib/vanilla/snips/tutorial/tutorial-another-snip.snip
|
239
|
-
- lib/vanilla/snips/tutorial/tutorial-basic-snip-inclusion.snip
|
240
|
-
- lib/vanilla/snips/tutorial/vanilla-rb-tutorial.snip
|
241
|
-
- lib/vanilla/snips/tutorial/vanilla-rb.snip
|
242
|
-
- lib/vanilla/snips/tutorial/vanilla.snip
|
243
211
|
- lib/vanilla/static.rb
|
244
212
|
- lib/vanilla.rb
|
245
213
|
- bin/vanilla
|
246
|
-
-
|
214
|
+
- pristine_app/config.ru
|
215
|
+
- pristine_app/Gemfile
|
216
|
+
- pristine_app/Gemfile.lock
|
217
|
+
- pristine_app/public/vanilla.css
|
218
|
+
- pristine_app/README
|
219
|
+
- pristine_app/soups/base/layout.snip
|
220
|
+
- pristine_app/soups/base/start.snip
|
221
|
+
- pristine_app/soups/dynasnips/current_snip.rb
|
222
|
+
- pristine_app/soups/dynasnips/debug.rb
|
223
|
+
- pristine_app/soups/dynasnips/index.rb
|
224
|
+
- pristine_app/soups/dynasnips/link_to.rb
|
225
|
+
- pristine_app/soups/dynasnips/link_to_current_snip.rb
|
226
|
+
- pristine_app/soups/dynasnips/page_title.rb
|
227
|
+
- pristine_app/soups/dynasnips/pre.rb
|
228
|
+
- pristine_app/soups/dynasnips/raw.rb
|
229
|
+
- pristine_app/soups/extras/comments.rb
|
230
|
+
- pristine_app/soups/extras/kind.rb
|
231
|
+
- pristine_app/soups/extras/rand.rb
|
232
|
+
- pristine_app/soups/extras/url_to.rb
|
233
|
+
- pristine_app/soups/tutorial/bad_dynasnip.snip
|
234
|
+
- pristine_app/soups/tutorial/hello_world.snip
|
235
|
+
- pristine_app/soups/tutorial/markdown_example.snip
|
236
|
+
- pristine_app/soups/tutorial/snip.snip
|
237
|
+
- pristine_app/soups/tutorial/soup.snip
|
238
|
+
- pristine_app/soups/tutorial/test.snip
|
239
|
+
- pristine_app/soups/tutorial/textile_example.snip
|
240
|
+
- pristine_app/soups/tutorial/tutorial-another-snip.snip
|
241
|
+
- pristine_app/soups/tutorial/tutorial-basic-snip-inclusion.snip
|
242
|
+
- pristine_app/soups/tutorial/tutorial-dynasnips.snip.markdown
|
243
|
+
- pristine_app/soups/tutorial/tutorial-layout.snip
|
244
|
+
- pristine_app/soups/tutorial/tutorial-links.snip
|
245
|
+
- pristine_app/soups/tutorial/tutorial-renderers.snip.markdown
|
246
|
+
- pristine_app/soups/tutorial/tutorial.snip.markdown
|
247
|
+
- pristine_app/soups/tutorial/vanilla-rb.snip
|
248
|
+
- pristine_app/soups/tutorial/vanilla.snip
|
249
|
+
- pristine_app/tmp/restart.txt
|
247
250
|
has_rdoc: true
|
248
251
|
homepage: http://github.com/lazyatom/vanilla-rb
|
249
252
|
licenses: []
|
data/README_FOR_APP
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
WELCOME IN VANILLA
|
2
|
-
VANILLA
|
3
|
-
VANILLA
|
4
|
-
VANILLA
|
5
|
-
What you've got:
|
6
|
-
|
7
|
-
config.ru - this is the rack configuration, which is used to start
|
8
|
-
the application by your webserver
|
9
|
-
config.yml - the configuration; by default it specifies the directory
|
10
|
-
which contains the soup(s)
|
11
|
-
soup/ - the default soup directory, where your snips are stored
|
12
|
-
|
13
|
-
|
14
|
-
For an overview of vanilla, start your site and look at the tutorial:
|
15
|
-
|
16
|
-
$ rackup # then open http://localhost:9292/vanilla-rb-tutorial
|
17
|
-
|
18
|
-
|
19
|
-
You can edit any file in the soup directory using your favourite editor,
|
20
|
-
and the changes will be reflected automatically. The snip files are
|
21
|
-
slightly modified YAML files. Here's one describing Soup itself, in
|
22
|
-
soup/system/tutorial/soup.snip:
|
23
|
-
|
24
|
-
Soup is a data store supporting the {link_to snip}-space that {link_to vanilla-rb} expects.
|
25
|
-
|
26
|
-
It's hosted on github [here][github].
|
27
|
-
|
28
|
-
[github]: http://github.com/lazyatom/soup
|
29
|
-
|
30
|
-
:name: soup
|
31
|
-
:created_at: 2009-09-27 14:14:16.096231 +01:00
|
32
|
-
:updated_at: 2009-09-27 14:14:16.096232 +01:00
|
33
|
-
:render_as: Markdown
|
34
|
-
|
35
|
-
The 'content' of the snip is at the top of the file, followed by the
|
36
|
-
rest of the snip attributes. Again, see the online tutorial for information
|
37
|
-
about what each attribute signifies.
|
38
|
-
|
data/config.example.yml
DELETED
data/config.ru
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler/setup'
|
3
|
-
$:.unshift File.join(File.dirname(__FILE__), *%w[lib])
|
4
|
-
|
5
|
-
require 'vanilla'
|
6
|
-
require 'vanilla/static'
|
7
|
-
|
8
|
-
config = YAML.parse_file(ENV['VANILLA_CONFIG']) rescue {}
|
9
|
-
app = Vanilla::App.new(config)
|
10
|
-
use Vanilla::Static, File.join(File.dirname(__FILE__), 'public')
|
11
|
-
run app
|
data/lib/tasks/vanilla.rake
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..')))
|
2
|
-
require 'vanilla'
|
3
|
-
|
4
|
-
namespace :vanilla do
|
5
|
-
desc "Open an irb session preloaded with this library"
|
6
|
-
task :console do
|
7
|
-
sh "irb -Ilib -rubygems -rbundler/setup -rvanilla -rvanilla/console"
|
8
|
-
end
|
9
|
-
|
10
|
-
desc 'Upgrade dynasnips and system snips'
|
11
|
-
task :upgrade do
|
12
|
-
# TODO
|
13
|
-
puts "TODO, but should be easier thanks to multi-space soup."
|
14
|
-
end
|
15
|
-
|
16
|
-
desc 'Prepare a new vanilla.rb installation'
|
17
|
-
task :setup do
|
18
|
-
puts <<-EOM
|
19
|
-
____________________.c( Vanilla.rb )o._____________________
|
20
|
-
|
21
|
-
Congratulations! You have elected to try out the weirdest web
|
22
|
-
thing ever. Lets get started.
|
23
|
-
|
24
|
-
EOM
|
25
|
-
Rake::Task['vanilla:setup:prepare_files'].invoke
|
26
|
-
Rake::Task['vanilla:setup:load_snips'].invoke
|
27
|
-
|
28
|
-
puts <<-EOM
|
29
|
-
|
30
|
-
___________________.c( You Are Ready )o.___________________
|
31
|
-
|
32
|
-
#{File.readlines('README')[0,16].join}
|
33
|
-
EOM
|
34
|
-
end
|
35
|
-
|
36
|
-
namespace :setup do
|
37
|
-
desc 'Prepare standard files to run Vanilla'
|
38
|
-
task :prepare_files do
|
39
|
-
cp File.expand_path(File.join(File.dirname(__FILE__), *%w[.. .. config.ru])), 'config.ru'
|
40
|
-
cp File.expand_path(File.join(File.dirname(__FILE__), *%w[.. .. config.example.yml])), 'config.yml'
|
41
|
-
cp File.expand_path(File.join(File.dirname(__FILE__), *%w[.. .. README_FOR_APP])), 'README'
|
42
|
-
cp_r File.expand_path(File.join(File.dirname(__FILE__), *%w[.. .. public])), 'public'
|
43
|
-
mkdir 'tmp'
|
44
|
-
File.open("Rakefile", "w") do |f|
|
45
|
-
rakefile =<<-EOF
|
46
|
-
require 'vanilla'
|
47
|
-
load 'tasks/vanilla.rake'
|
48
|
-
|
49
|
-
# Add any other tasks here.
|
50
|
-
EOF
|
51
|
-
f.write rakefile.strip
|
52
|
-
end
|
53
|
-
File.open("Gemfile", "w") do |f|
|
54
|
-
gemfile =<<-EOF
|
55
|
-
source :rubygems
|
56
|
-
|
57
|
-
gem "vanilla", #{Vanilla::VERSION.inspect}
|
58
|
-
EOF
|
59
|
-
f.write gemfile.strip
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
task :load_snips do
|
64
|
-
print "Preparing soup... "
|
65
|
-
|
66
|
-
mkdir_p "soup/system"
|
67
|
-
FileUtils.cp_r(File.join(File.dirname(__FILE__), '..', 'vanilla', 'snips', 'system'), "soup")
|
68
|
-
FileUtils.cp_r(File.join(File.dirname(__FILE__), '..', 'vanilla', 'snips', 'tutorial'), "soup")
|
69
|
-
|
70
|
-
dynasnip_soup = ::Soup.new(::Soup::Backends::FileBackend.new("soup/system/dynasnips"))
|
71
|
-
Dynasnip.all.each { |ds| dynasnip_soup << ds.snip_attributes }
|
72
|
-
puts "the soup is simmering."
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|