bonsai 1.0.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.
Files changed (61) hide show
  1. data/.document +5 -0
  2. data/.gitignore +23 -0
  3. data/.kick +26 -0
  4. data/LICENSE +20 -0
  5. data/README.md +65 -0
  6. data/Rakefile +64 -0
  7. data/VERSION +1 -0
  8. data/benchmark/associations.rb +51 -0
  9. data/bin/bonsai +69 -0
  10. data/bonsai.gemspec +142 -0
  11. data/lib/bonsai.rb +60 -0
  12. data/lib/bonsai/console.rb +8 -0
  13. data/lib/bonsai/exporter.rb +103 -0
  14. data/lib/bonsai/generate.rb +24 -0
  15. data/lib/bonsai/navigation.rb +7 -0
  16. data/lib/bonsai/page.rb +192 -0
  17. data/lib/bonsai/template.rb +31 -0
  18. data/lib/bonsai/templates/content/index/default.yml +3 -0
  19. data/lib/bonsai/templates/public/.htaccess +28 -0
  20. data/lib/bonsai/templates/public/docs/css/base.less +1 -0
  21. data/lib/bonsai/templates/templates/default.mustache +14 -0
  22. data/lib/bonsai/webserver.rb +19 -0
  23. data/spec/bonsai/console_spec.rb +12 -0
  24. data/spec/bonsai/exporter_spec.rb +142 -0
  25. data/spec/bonsai/generate_spec.rb +40 -0
  26. data/spec/bonsai/navigation_spec.rb +28 -0
  27. data/spec/bonsai/page_spec.rb +225 -0
  28. data/spec/bonsai/template_spec.rb +19 -0
  29. data/spec/bonsai_spec.rb +21 -0
  30. data/spec/spec.opts +1 -0
  31. data/spec/spec_helper.rb +14 -0
  32. data/spec/support/broken/content/broken_page/demo-template.yml +3 -0
  33. data/spec/support/content/1.about-us/1.contact/1.child/a_file_asset.txt +0 -0
  34. data/spec/support/content/1.about-us/1.contact/1.child/demo-template.yml +1 -0
  35. data/spec/support/content/1.about-us/1.contact/demo-template.yml +7 -0
  36. data/spec/support/content/1.about-us/1.contact/images/image001.jpg +0 -0
  37. data/spec/support/content/1.about-us/1.contact/magic/image001.jpg +0 -0
  38. data/spec/support/content/1.about-us/1.contact/magic/image002.jpg +0 -0
  39. data/spec/support/content/1.about-us/demo-template.yml +1 -0
  40. data/spec/support/content/1.about-us/history/a_file_asset.txt +0 -0
  41. data/spec/support/content/1.about-us/history/child/a_file_asset.txt +0 -0
  42. data/spec/support/content/1.about-us/history/child/demo-template.yml +1 -0
  43. data/spec/support/content/1.about-us/history/demo-template.yml +1 -0
  44. data/spec/support/content/1.about-us/history/image001.jpg +0 -0
  45. data/spec/support/content/1.about-us/history/images/image001.jpg +0 -0
  46. data/spec/support/content/1.about-us/history/magic/image001.jpg +0 -0
  47. data/spec/support/content/1.about-us/history/magic/image002.jpg +0 -0
  48. data/spec/support/content/10.many-pages/demo-template.yml +1 -0
  49. data/spec/support/content/2.products/1.product-a/demo-template.yml +1 -0
  50. data/spec/support/content/2.products/2.product-b/demo-template.yml +1 -0
  51. data/spec/support/content/2.products/demo-template.yml +1 -0
  52. data/spec/support/content/index/demo-template.yml +1 -0
  53. data/spec/support/content/legals/terms-and-conditions/demo-template.yml +1 -0
  54. data/spec/support/public/.htaccess +31 -0
  55. data/spec/support/public/js/script.js +19 -0
  56. data/spec/support/public/stylesheets/base.less +2 -0
  57. data/spec/support/public/stylesheets/broken.less +2 -0
  58. data/spec/support/templates/demo-template.mustache +19 -0
  59. data/spec/support/templates/partials/inserted.mustache +1 -0
  60. data/vendor/yui-compressor/yuicompressor-2.4.2.jar +0 -0
  61. metadata +201 -0
@@ -0,0 +1,19 @@
1
+ require "#{File.dirname(__FILE__)}/../spec_helper"
2
+
3
+ describe Bonsai::Template do
4
+ it "should have a path" do
5
+ Bonsai::Template.path.should_not be_nil
6
+ end
7
+
8
+ it "should respond to find" do
9
+ Bonsai::Template.should respond_to(:find)
10
+ Bonsai::Template.find("demo-template").should be_an_instance_of(Bonsai::Template)
11
+ end
12
+
13
+ describe "instance" do
14
+ it "should give the template source" do
15
+ @template = Bonsai::Template.find("demo-template")
16
+ File.read(@template.path).should == "Hello from our template, named {{name}}\n\n{{page_title}}\n\n{{#images}}\n {{path}}\n{{/images}}\n\n{{#children}}\n {{permalink}}\n{{/children}}\n\n{{#magic}}\n {{path}}\n{{/magic}}\n\n{{>partials/inserted}}\n\n{{{body}}}"
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,21 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe Bonsai do
4
+ it "should have a root dir" do
5
+ Bonsai.should respond_to :root_dir
6
+ end
7
+
8
+ it "should set the root dir" do
9
+ Bonsai.root_dir = "spec/support"
10
+ Bonsai.root_dir.should == "spec/support"
11
+ end
12
+
13
+ it "should throw an exception if it doesn't look like a bonsai site" do
14
+ lambda { Bonsai.root_dir = "spec" }.should raise_error
15
+ lambda { Bonsai.root_dir = "spec/support" }.should_not raise_error
16
+ end
17
+
18
+ it "should know the version" do
19
+ Bonsai.version.should =~ /\d+.\d+.\d+/
20
+ end
21
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,14 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'bonsai'
4
+ require 'spec'
5
+ require 'spec/autorun'
6
+
7
+ Spec::Runner.configure do |config|
8
+ Bonsai.configure {|config| config[:enable_logging] = false }
9
+
10
+ BONSAI_PATH = "#{File.dirname(__FILE__)}/support" unless defined? BONSAI_PATH
11
+ Bonsai.root_dir = BONSAI_PATH
12
+ end
13
+
14
+
@@ -0,0 +1,3 @@
1
+ :page_variable: A popular plastic chair that has returned direct from 1971. Casalino was very popular during the 1970’s, however the design become out of vogue during the 1980’s and has not been available since. It wasn’t until the original moulds were rediscovered recently that Casalino has found a new life.
2
+
3
+ A popular plastic chair that has returned direct from 1971. Casalino was very popular during the 1970’s, however the design become out of vogue during the 1980’s and has not been available since. It wasn’t until the original moulds were rediscovered recently that Casalino has found a new life.
@@ -0,0 +1 @@
1
+ :name: the last little child
@@ -0,0 +1,7 @@
1
+ :page_title: Get in touch
2
+ :body: |
3
+ "A designer knows he has achieved perfection
4
+ not when there is nothing left to add,
5
+ but when there is nothing left to take away."
6
+
7
+ – Antoine de Saint-Exupery
@@ -0,0 +1 @@
1
+ :name: The about us page
@@ -0,0 +1 @@
1
+ :name: the last little child
@@ -0,0 +1 @@
1
+ :page_title: About our history
@@ -0,0 +1 @@
1
+ :name: One of many pages
@@ -0,0 +1 @@
1
+ :name: "Product A"
@@ -0,0 +1 @@
1
+ :name: "Product B"
@@ -0,0 +1 @@
1
+ :name: "Products"
@@ -0,0 +1 @@
1
+ :name: The welcome page
@@ -0,0 +1 @@
1
+ :name: The gory stuff
@@ -0,0 +1,31 @@
1
+ Options +FollowSymLinks
2
+ FileETag All
3
+ ErrorDocument 404 /404
4
+
5
+ <IfModule mod_rewrite.c>
6
+ RewriteEngine on
7
+
8
+ RewriteCond %{REQUEST_FILENAME} !-f
9
+ RewriteCond %{REQUEST_FILENAME} !-d
10
+ RewriteRule ^(.*)$ index.php?/$1 [L]
11
+ </IfModule>
12
+
13
+ # Compress all static assets
14
+ <IfModule mod_deflate.c>
15
+ # compress content with type html, text, and css
16
+ AddOutputFilterByType DEFLATE text/css text/html text/javascript application/javascript application/x-javascript text/js text/plain text/xml
17
+
18
+ <IfModule mod_headers.c>
19
+ # properly handle requests coming from behind proxies
20
+ Header append Vary User-Agent
21
+ </IfModule>
22
+ </IfModule>
23
+
24
+ # Cache, aggressively
25
+ <IfModule mod_expires.c>
26
+ ExpiresActive On
27
+ ExpiresDefault "access plus 2 years"
28
+
29
+ # Do not cache dynamically generated pages.
30
+ ExpiresByType text/html "access plus 10 minutes"
31
+ </IfModule>
@@ -0,0 +1,19 @@
1
+ // Dom ready
2
+ $(function () {
3
+ // Search field
4
+ $('.default-value').each(function() {
5
+ var default_value = this.value;
6
+ $(this).focus(function() {
7
+ if(this.value == default_value) {
8
+ this.value = '';
9
+ }
10
+ });
11
+ $(this).blur(function() {
12
+ if(this.value == '') {
13
+ this.value = default_value;
14
+ }
15
+ });
16
+ });
17
+
18
+ $(".details dd:empty").hide().prev("dt").hide();
19
+ });
@@ -0,0 +1,2 @@
1
+ .mymixin { display: block; }
2
+ #content { .mymixin; }
@@ -0,0 +1,2 @@
1
+ .mixin { display:block; }
2
+ #identifier { .mixin } /* missing ; */
@@ -0,0 +1,19 @@
1
+ Hello from our template, named {{name}}
2
+
3
+ {{page_title}}
4
+
5
+ {{#images}}
6
+ {{path}}
7
+ {{/images}}
8
+
9
+ {{#children}}
10
+ {{permalink}}
11
+ {{/children}}
12
+
13
+ {{#magic}}
14
+ {{path}}
15
+ {{/magic}}
16
+
17
+ {{>partials/inserted}}
18
+
19
+ {{{body}}}
@@ -0,0 +1 @@
1
+ This content should be inserted!
metadata ADDED
@@ -0,0 +1,201 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bonsai
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Ben Schwarz
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-01-01 00:00:00 +11:00
13
+ default_executable: bonsai
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.2.9
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: yard
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: tilt
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0.4"
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: mustache
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 0.5.0
54
+ version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: thin
57
+ type: :runtime
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 1.0.0
64
+ version:
65
+ - !ruby/object:Gem::Dependency
66
+ name: watch
67
+ type: :runtime
68
+ version_requirement:
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: 0.1.0
74
+ version:
75
+ - !ruby/object:Gem::Dependency
76
+ name: sinatra
77
+ type: :runtime
78
+ version_requirement:
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: 0.9.4
84
+ version:
85
+ - !ruby/object:Gem::Dependency
86
+ name: rdiscount
87
+ type: :runtime
88
+ version_requirement:
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: 1.5.5
94
+ version:
95
+ description: A static site generator that uses the best toolset available
96
+ email: ben.schwarz@gmail.com
97
+ executables:
98
+ - bonsai
99
+ extensions: []
100
+
101
+ extra_rdoc_files:
102
+ - LICENSE
103
+ - README.md
104
+ files:
105
+ - .document
106
+ - .gitignore
107
+ - .kick
108
+ - LICENSE
109
+ - README.md
110
+ - Rakefile
111
+ - VERSION
112
+ - benchmark/associations.rb
113
+ - bin/bonsai
114
+ - bonsai.gemspec
115
+ - lib/bonsai.rb
116
+ - lib/bonsai/console.rb
117
+ - lib/bonsai/exporter.rb
118
+ - lib/bonsai/generate.rb
119
+ - lib/bonsai/navigation.rb
120
+ - lib/bonsai/page.rb
121
+ - lib/bonsai/template.rb
122
+ - lib/bonsai/templates/content/index/default.yml
123
+ - lib/bonsai/templates/public/.htaccess
124
+ - lib/bonsai/templates/public/docs/css/base.less
125
+ - lib/bonsai/templates/templates/default.mustache
126
+ - lib/bonsai/webserver.rb
127
+ - spec/bonsai/console_spec.rb
128
+ - spec/bonsai/exporter_spec.rb
129
+ - spec/bonsai/generate_spec.rb
130
+ - spec/bonsai/navigation_spec.rb
131
+ - spec/bonsai/page_spec.rb
132
+ - spec/bonsai/template_spec.rb
133
+ - spec/bonsai_spec.rb
134
+ - spec/spec.opts
135
+ - spec/spec_helper.rb
136
+ - spec/support/broken/content/broken_page/demo-template.yml
137
+ - spec/support/content/1.about-us/1.contact/1.child/a_file_asset.txt
138
+ - spec/support/content/1.about-us/1.contact/1.child/demo-template.yml
139
+ - spec/support/content/1.about-us/1.contact/demo-template.yml
140
+ - spec/support/content/1.about-us/1.contact/images/image001.jpg
141
+ - spec/support/content/1.about-us/1.contact/magic/image001.jpg
142
+ - spec/support/content/1.about-us/1.contact/magic/image002.jpg
143
+ - spec/support/content/1.about-us/demo-template.yml
144
+ - spec/support/content/1.about-us/history/a_file_asset.txt
145
+ - spec/support/content/1.about-us/history/child/a_file_asset.txt
146
+ - spec/support/content/1.about-us/history/child/demo-template.yml
147
+ - spec/support/content/1.about-us/history/demo-template.yml
148
+ - spec/support/content/1.about-us/history/image001.jpg
149
+ - spec/support/content/1.about-us/history/images/image001.jpg
150
+ - spec/support/content/1.about-us/history/magic/image001.jpg
151
+ - spec/support/content/1.about-us/history/magic/image002.jpg
152
+ - spec/support/content/10.many-pages/demo-template.yml
153
+ - spec/support/content/2.products/1.product-a/demo-template.yml
154
+ - spec/support/content/2.products/2.product-b/demo-template.yml
155
+ - spec/support/content/2.products/demo-template.yml
156
+ - spec/support/content/index/demo-template.yml
157
+ - spec/support/content/legals/terms-and-conditions/demo-template.yml
158
+ - spec/support/public/.htaccess
159
+ - spec/support/public/js/script.js
160
+ - spec/support/public/stylesheets/base.less
161
+ - spec/support/public/stylesheets/broken.less
162
+ - spec/support/templates/demo-template.mustache
163
+ - spec/support/templates/partials/inserted.mustache
164
+ - vendor/yui-compressor/yuicompressor-2.4.2.jar
165
+ has_rdoc: true
166
+ homepage: http://github.com/benschwarz/bonsai
167
+ licenses: []
168
+
169
+ post_install_message: "\n\n \xE7\x9B\x86\xE6\xA0\xBD\n bonsai, tiny and beautiful\n \n \n \n type `bonsai --help` to get started\n "
170
+ rdoc_options:
171
+ - --charset=UTF-8
172
+ require_paths:
173
+ - lib
174
+ required_ruby_version: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - ">="
177
+ - !ruby/object:Gem::Version
178
+ version: "0"
179
+ version:
180
+ required_rubygems_version: !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - ">="
183
+ - !ruby/object:Gem::Version
184
+ version: "0"
185
+ version:
186
+ requirements: []
187
+
188
+ rubyforge_project:
189
+ rubygems_version: 1.3.5
190
+ signing_key:
191
+ specification_version: 3
192
+ summary: A static site generator that uses the best toolset available
193
+ test_files:
194
+ - spec/bonsai/console_spec.rb
195
+ - spec/bonsai/exporter_spec.rb
196
+ - spec/bonsai/generate_spec.rb
197
+ - spec/bonsai/navigation_spec.rb
198
+ - spec/bonsai/page_spec.rb
199
+ - spec/bonsai/template_spec.rb
200
+ - spec/bonsai_spec.rb
201
+ - spec/spec_helper.rb