vanilla 1.0.2 → 1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +112 -109
- data/bin/vanilla +35 -6
- data/lib/vanilla.rb +10 -14
- data/lib/vanilla/app.rb +109 -41
- data/lib/vanilla/console.rb +22 -2
- data/lib/vanilla/dynasnip.rb +4 -36
- data/lib/vanilla/renderers.rb +12 -0
- data/lib/vanilla/renderers/base.rb +58 -34
- data/lib/vanilla/renderers/bold.rb +0 -2
- data/lib/vanilla/renderers/erb.rb +1 -3
- data/lib/vanilla/renderers/haml.rb +13 -0
- data/lib/vanilla/renderers/markdown.rb +0 -2
- data/lib/vanilla/renderers/raw.rb +0 -2
- data/lib/vanilla/renderers/ruby.rb +12 -6
- data/lib/vanilla/renderers/textile.rb +0 -2
- data/lib/vanilla/request.rb +19 -17
- data/lib/vanilla/routes.rb +9 -20
- data/lib/vanilla/snip_reference_parser.rb +94 -0
- data/lib/vanilla/static.rb +28 -0
- data/pristine_app/Gemfile +3 -0
- data/pristine_app/Gemfile.lock +32 -0
- data/pristine_app/README +47 -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/pristine_app/soups/dynasnips/index.rb +12 -0
- data/{lib/vanilla → pristine_app/soups}/dynasnips/link_to.rb +4 -2
- 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 +7 -5
- data/{lib/vanilla → pristine_app/soups}/dynasnips/raw.rb +8 -5
- data/pristine_app/soups/extras/comments.rb +78 -0
- data/{lib/vanilla/dynasnips → pristine_app/soups/extras}/kind.rb +19 -17
- data/{lib/vanilla/dynasnips → pristine_app/soups/extras}/rand.rb +2 -0
- data/pristine_app/soups/extras/url_to.rb +7 -0
- data/pristine_app/soups/tutorial/bad_dynasnip.snip +8 -0
- data/pristine_app/soups/tutorial/hello_world.snip +20 -0
- data/pristine_app/soups/tutorial/markdown_example.snip +13 -0
- data/pristine_app/soups/tutorial/snip.snip +9 -0
- data/pristine_app/soups/tutorial/soup.snip +3 -0
- data/pristine_app/soups/tutorial/test.snip +30 -0
- data/pristine_app/soups/tutorial/textile_example.snip +11 -0
- data/pristine_app/soups/tutorial/tutorial-another-snip.snip +1 -0
- data/pristine_app/soups/tutorial/tutorial-basic-snip-inclusion.snip +1 -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/pristine_app/soups/tutorial/tutorial.snip.markdown +69 -0
- data/pristine_app/soups/tutorial/vanilla-rb.snip +16 -0
- data/pristine_app/soups/tutorial/vanilla.snip +8 -0
- data/test/dynasnip_test.rb +42 -0
- data/test/dynasnips/link_to_current_snip_test.rb +19 -0
- data/test/dynasnips/link_to_test.rb +27 -0
- data/test/dynasnips/page_title_test.rb +19 -0
- data/test/renderers/base_renderer_test.rb +43 -0
- data/test/renderers/erb_renderer_test.rb +29 -0
- data/test/renderers/haml_renderer_test.rb +35 -0
- data/test/renderers/markdown_renderer_test.rb +31 -0
- data/test/renderers/raw_renderer_test.rb +23 -0
- data/test/renderers/ruby_renderer_test.rb +59 -0
- data/test/snip_inclusion_test.rb +56 -0
- data/test/snip_reference_parser_test.rb +123 -0
- data/test/test_helper.rb +75 -0
- data/test/vanilla_app_test.rb +83 -0
- data/test/vanilla_presenting_test.rb +125 -0
- data/test/vanilla_request_test.rb +87 -0
- metadata +179 -78
- data/config.example.yml +0 -5
- data/config.ru +0 -9
- data/lib/defensio.rb +0 -59
- data/lib/tasks/vanilla.rake +0 -177
- data/lib/vanilla/dynasnips/comments.rb +0 -108
- data/lib/vanilla/dynasnips/current_snip.rb +0 -32
- data/lib/vanilla/dynasnips/edit.rb +0 -63
- data/lib/vanilla/dynasnips/edit_link.rb +0 -24
- data/lib/vanilla/dynasnips/index.rb +0 -11
- data/lib/vanilla/dynasnips/link_to_current_snip.rb +0 -16
- data/lib/vanilla/dynasnips/login.rb +0 -56
- data/lib/vanilla/dynasnips/new.rb +0 -14
- data/lib/vanilla/dynasnips/notes.rb +0 -42
- data/lib/vanilla/dynasnips/url_to.rb +0 -7
- data/lib/vanilla/snip_handling.rb +0 -33
- data/lib/vanilla/snips/start.rb +0 -27
- data/lib/vanilla/snips/system.rb +0 -76
- data/lib/vanilla/snips/tutorial.rb +0 -157
- data/lib/vanilla/test_snips.rb +0 -85
- data/public/hatch.png +0 -0
- data/public/javascripts/jquery.js +0 -3549
- data/public/javascripts/vanilla.js +0 -21
- data/spec/dynasnip_spec.rb +0 -31
- data/spec/renderers/base_renderer_spec.rb +0 -40
- data/spec/renderers/erb_renderer_spec.rb +0 -27
- data/spec/renderers/markdown_renderer_spec.rb +0 -29
- data/spec/renderers/raw_renderer_spec.rb +0 -21
- data/spec/renderers/ruby_renderer_spec.rb +0 -42
- data/spec/renderers/vanilla_app_detecting_renderer_spec.rb +0 -35
- data/spec/spec_helper.rb +0 -64
- data/spec/vanilla_app_spec.rb +0 -38
- data/spec/vanilla_presenting_spec.rb +0 -84
- data/spec/vanilla_request_spec.rb +0 -73
- data/spec/vanilla_snip_finding_spec.rb +0 -28
@@ -1,73 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "spec_helper")
|
2
|
-
|
3
|
-
describe Vanilla::Request, "when requesting urls" do
|
4
|
-
before(:each) { @request = Vanilla::Request.new(mock_env_for_url("/snip")) }
|
5
|
-
|
6
|
-
it "should use the first segement as the snip name" do
|
7
|
-
@request.snip_name.should == "snip"
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should try to load the snip based on the snip name" do
|
11
|
-
Vanilla.should_receive(:snip).with('snip').and_return(:snip)
|
12
|
-
@request.snip.should == :snip
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should have no part if the url contains only a single segment" do
|
16
|
-
@request.part.should == nil
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should have a default format of html" do
|
20
|
-
@request.format.should == 'html'
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should determine the request method" do
|
24
|
-
@request.method.should == 'get'
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe Vanilla::Request, "when requesting a snip part" do
|
29
|
-
before(:each) { @request = Vanilla::Request.new(mock_env_for_url("/snip/part")) }
|
30
|
-
|
31
|
-
it "should use the first segment as the snip, and the second segment as the part" do
|
32
|
-
@request.snip_name.should == "snip"
|
33
|
-
@request.part.should == "part"
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should have a default format of html" do
|
37
|
-
@request.format.should == "html"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe Vanilla::Request, "when requesting a snip with a format" do
|
42
|
-
before(:each) { @request = Vanilla::Request.new(mock_env_for_url("/snip.raw")) }
|
43
|
-
|
44
|
-
it "should use the extension as the format" do
|
45
|
-
@request.format.should == "raw"
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should retain the filename part of the path as the snip" do
|
49
|
-
@request.snip_name.should == "snip"
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe Vanilla::Request, "when requesting a snip part with a format" do
|
54
|
-
before(:each) { @request = Vanilla::Request.new(mock_env_for_url("/snip/part.raw")) }
|
55
|
-
|
56
|
-
it "should use the extension as the format" do
|
57
|
-
@request.format.should == "raw"
|
58
|
-
end
|
59
|
-
|
60
|
-
it "should retain the first segment of the path as the snip" do
|
61
|
-
@request.snip_name.should == "snip"
|
62
|
-
end
|
63
|
-
|
64
|
-
it "should use the filename part of the second segment as the snip part" do
|
65
|
-
@request.part.should == "part"
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
describe Vanilla::Request, "when requested with a _method paramter" do
|
70
|
-
it "should return the method using the parameter" do
|
71
|
-
Vanilla::Request.new(mock_env_for_url("/snip?_method=put")).method.should == 'put'
|
72
|
-
end
|
73
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'spec_helper')
|
2
|
-
|
3
|
-
describe Vanilla, "when loading a snip" do
|
4
|
-
it "should delegate to Soup" do
|
5
|
-
snip = :snip
|
6
|
-
Soup.should_receive(:[]).with('name').and_return(snip)
|
7
|
-
Vanilla.snip('name').should == :snip
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should return nil if the snip cannot be found" do
|
11
|
-
Vanilla.snip('missing').should be_nil
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should raise an exception if the snip cannot be when calling snip!" do
|
15
|
-
lambda { Vanilla.snip!('missing') }.should raise_error(Vanilla::MissingSnipException)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe Vanilla, "when checking a snip exists" do
|
20
|
-
it "should return true if the snip exists" do
|
21
|
-
create_snip(:name => 'blah')
|
22
|
-
Vanilla.snip_exists?('blah').should be_true
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should return false if the snip does not exist" do
|
26
|
-
Vanilla.snip_exists?('missing').should be_false
|
27
|
-
end
|
28
|
-
end
|