staticmatic 0.9.5 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. data/History.txt +6 -0
  2. data/Manifest.txt +24 -0
  3. data/README.rdoc +48 -0
  4. data/Rakefile +22 -27
  5. data/bin/staticmatic +0 -0
  6. data/lib/staticmatic.rb +12 -4
  7. data/lib/staticmatic/base.rb +30 -242
  8. data/lib/staticmatic/mixins/build.rb +46 -0
  9. data/lib/staticmatic/mixins/helpers.rb +15 -0
  10. data/lib/staticmatic/mixins/render.rb +125 -0
  11. data/lib/staticmatic/mixins/rescue.rb +12 -0
  12. data/lib/staticmatic/mixins/server.rb +6 -0
  13. data/lib/staticmatic/mixins/setup.rb +20 -0
  14. data/lib/staticmatic/template_error.rb +40 -0
  15. data/lib/staticmatic/templates/{application.haml → default/application.haml} +0 -0
  16. data/lib/staticmatic/templates/{application.sass → default/application.sass} +0 -0
  17. data/lib/staticmatic/templates/{index.haml → default/index.haml} +0 -0
  18. data/lib/staticmatic/templates/rescues/default.haml +7 -0
  19. data/lib/staticmatic/templates/rescues/template.haml +18 -0
  20. data/test/test_helper.rb +20 -48
  21. metadata +55 -124
  22. data/CHANGELOG +0 -57
  23. data/LICENSE +0 -21
  24. data/README +0 -56
  25. data/example/site/contact.html +0 -17
  26. data/example/site/index.html +0 -16
  27. data/example/site/javascripts/application.css +0 -2
  28. data/example/src/layouts/application.haml +0 -11
  29. data/example/src/pages/contact.haml +0 -3
  30. data/example/src/pages/index.haml +0 -3
  31. data/example/src/pages/test test/blah.haml +0 -1
  32. data/example/src/stylesheets/application.sass +0 -4
  33. data/lib/staticmatic/version.rb +0 -34
  34. data/test/base_test.rb +0 -60
  35. data/test/helpers_test.rb +0 -296
  36. data/test/sandbox/test_site/configuration.rb +0 -0
  37. data/test/sandbox/test_site/site/index.html +0 -10
  38. data/test/sandbox/test_site/site/stylesheets/application.css +0 -2
  39. data/test/sandbox/test_site/src/helpers/application_helper.rb +0 -5
  40. data/test/sandbox/test_site/src/layouts/alternate_layout.haml +0 -3
  41. data/test/sandbox/test_site/src/layouts/application.haml +0 -7
  42. data/test/sandbox/test_site/src/layouts/projects.haml +0 -1
  43. data/test/sandbox/test_site/src/pages/index.haml +0 -5
  44. data/test/sandbox/test_site/src/pages/layout_test.haml +0 -2
  45. data/test/sandbox/test_site/src/partials/menu.haml +0 -1
  46. data/test/sandbox/test_site/src/stylesheets/application.sass +0 -2
  47. data/test/server_test.rb +0 -12
  48. data/test/test_helper_test.rb +0 -49
  49. data/test/version_test.rb +0 -28
  50. data/website/site/download.html +0 -84
  51. data/website/site/faq.html +0 -101
  52. data/website/site/helper_central/index.html +0 -144
  53. data/website/site/how_to_use.html +0 -307
  54. data/website/site/images/bycurve21.gif +0 -0
  55. data/website/site/images/curve21.jpg +0 -0
  56. data/website/site/images/homepage-build.jpg +0 -0
  57. data/website/site/images/homepage-previewing.jpg +0 -0
  58. data/website/site/images/homepage-templating.jpg +0 -0
  59. data/website/site/index.html +0 -98
  60. data/website/site/releases/0_8_10.html +0 -106
  61. data/website/site/releases/0_8_4.html +0 -101
  62. data/website/site/releases/0_8_8.html +0 -96
  63. data/website/site/releases/0_9_0.html +0 -124
  64. data/website/site/stylesheets/application.css +0 -287
  65. data/website/src/helpers/application_helper.rb +0 -5
  66. data/website/src/layouts/application.haml +0 -43
  67. data/website/src/layouts/test.haml +0 -4
  68. data/website/src/pages/_qa.haml +0 -2
  69. data/website/src/pages/download.haml +0 -15
  70. data/website/src/pages/faq.haml +0 -8
  71. data/website/src/pages/helper_central/_helper.haml +0 -7
  72. data/website/src/pages/helper_central/index.haml +0 -21
  73. data/website/src/pages/how_to_use.haml +0 -270
  74. data/website/src/pages/index.haml +0 -27
  75. data/website/src/pages/releases/0_8_10.haml +0 -22
  76. data/website/src/pages/releases/0_8_4.haml +0 -25
  77. data/website/src/pages/releases/0_8_8.haml +0 -35
  78. data/website/src/pages/releases/0_9_0.haml +0 -34
  79. data/website/src/partials/news.haml +0 -10
@@ -1,5 +0,0 @@
1
- module ApplicationHelper
2
- def greet(name)
3
- "Hello, #{name}"
4
- end
5
- end
@@ -1,43 +0,0 @@
1
- !!!
2
- %html{ :xmlns => "http://www.w3.org/1999/xhtml", :lang => "en", 'xml:lang' => "en" }
3
- %head
4
- %meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}
5
- %title StaticMatic
6
- = stylesheets
7
- = stylesheets :reset, :application, :media => :screen
8
- %body
9
- #container
10
- #header
11
- .bycurve21= link(img("bycurve21.gif"), "http://www.curve21.com")
12
- .title StaticMatic
13
-
14
- #menu
15
-
16
- %ul
17
- %li= link "Home", "/"
18
- %li= link "Download"
19
- %li= link "How to use"
20
- %li= link "FAQ"
21
- %li= link "Community", "http://groups.google.co.uk/group/staticmatic"
22
- %li= link "Helper Central", "helper_central/"
23
- %li= link "Development", "http://rubyforge.org/projects/staticmatic"
24
- #content_wrapper
25
- #side
26
- #news= partial("news")
27
-
28
- #content
29
- = yield
30
-
31
- #footer
32
- %p
33
- Made with StaticMatic
34
- = StaticMatic::VERSION::STRING
35
- \, Hosted by
36
- = link "RubyForge", "http://rubyforge.org"
37
-
38
- %script{:src => "http://www.google-analytics.com/urchin.js", :type => "text/javascript"}
39
- _hamlspace = "";
40
- %script{:type => "text/javascript"}
41
- _uacct = "UA-775359-8";
42
- urchinTracker();
43
-
@@ -1,4 +0,0 @@
1
- !!!
2
- %h1 Blah
3
-
4
- = yield
@@ -1,2 +0,0 @@
1
- %h3= question
2
- %p= answer
@@ -1,15 +0,0 @@
1
- %h1 Download
2
-
3
- %p The simplest way to get StaticMatic is via RubyGems:
4
-
5
- .code gem install staticmatic
6
-
7
- %h3 Source Code
8
-
9
- %p
10
- You can get the source code from
11
- = link "RubyForge", "http://rubyforge.org/projects/staticmatic/"
12
- \:
13
-
14
- .code svn checkout svn://rubyforge.org/var/svn/staticmatic/trunk staticmatic
15
-
@@ -1,8 +0,0 @@
1
- %h1 FAQ
2
-
3
- =partial('qa', :locals => { :question => 'I hate Haml. Can I use a different template language?', :answer => 'No. At least not at the moment. Haml is perfect for our needs so we\'ve had no reason to investigate using other languages. However, StaticMatic is open source so patches are always welcome.' })
4
- =partial('qa', :locals => { :question => 'I found a bug. How do I report it?', :answer => 'At the StaticMatic <a href="http://rubyforge.org/tracker/?func=browse&amp;group_id=3712&amp;atid=14306">Bug Tracker</a>.' })
5
- =partial('qa', :locals => { :question => 'I\'d like a new feature. How do I request it?', :answer => 'At the StaticMatic <a href="http://rubyforge.org/tracker/?atid=14309&amp;group_id=3712&amp;func=browse">Feature Request Tracker</a>.' })
6
- =partial('qa', :locals => { :question => 'I\'ve got a patch for you. How do I submit it?', :answer => 'At the StaticMatic <a href="http://rubyforge.org/tracker/?atid=14308&amp;group_id=3712&amp;func=browse">Patch Tracker</a>.' })
7
- =partial('qa', :locals => { :question => 'How do I find neat helpers that other developers have written?', :answer => 'Go to the StaticMatic <a href="helper_central/">Helper Central</a>.' })
8
- =partial('qa', :locals => { :question => 'I\'ve got a neat helper to share with the world. How do I do it?', :answer => 'Post on the <a href="http://groups.google.co.uk/group/staticmatic">StaticMatic Google Group</a> requesting it be added to the StaticMatic <a href="helper_central/">Helper Central</a>.' })
@@ -1,7 +0,0 @@
1
- %tr{:valign => :top}
2
- %td
3
- %strong= title
4
- %td= description
5
- %td= author
6
- %td
7
- = link "Download", download_link, :id => id, :class => 'download'
@@ -1,21 +0,0 @@
1
- %h1 Helper Central
2
-
3
- %p
4
- This is a place where nifty helpers not accepted into core can be found.
5
- %span.highlight Use them at your own risk. StaticMatic core developers are not responsible for these helpers or their results.
6
- %br
7
- %br
8
- Helpers are listed in alphabetical order.
9
-
10
- %table{:border => '0'}
11
- %tr
12
- %th Name
13
- %th Description
14
- %th Author
15
- %th Download
16
- =partial('helper', :locals => { :title => 'Blueprint Css', :author => 'Brent Beardsley', :description => 'Easily include blueprint css framework files and plugins', :download_link => 'http://staticmatic.rubyforge.org/svn/trunk/contrib/helpers/blueprintcss_helper.rb', :id => 'blueprintcss_helper' })
17
- =partial('helper', :locals => { :title => 'Google Analytics', :author => 'Brent Beardsley', :description => 'Easily include google analytics javascript code using http or https', :download_link => 'http://staticmatic.rubyforge.org/svn/trunk/contrib/helpers/google_analytics_helper.rb', :id => 'google_analytics_helper' })
18
- =partial('helper', :locals => { :title => 'Menubar', :author => 'Brent Beardsley', :description => 'Easily create a menubar using an unordered list', :download_link => 'http://staticmatic.rubyforge.org/svn/trunk/contrib/helpers/menubar_helper.rb', :id => 'menubar_helper' })
19
- =partial('helper', :locals => { :title => 'Navigation', :author => 'Andrew Neil', :description => 'Easily create breadcrumbs, sitemaps, and menus.', :download_link => 'http://staticmatic.rubyforge.org/svn/trunk/contrib/helpers/navigation_helper.rb', :id => 'navigation_helper' })
20
- =partial('helper', :locals => { :title => 'Rss List', :author => 'Brent Beardsley', :description => 'Easily create an unordered list from an rss feed. Special helpers for delicious, flickr, ebay, magnolia, and twitter.', :download_link => 'http://staticmatic.rubyforge.org/svn/trunk/contrib/helpers/rss_list_helper.rb', :id => 'rss_list_helper' })
21
-
@@ -1,270 +0,0 @@
1
- %h1 How to Use
2
-
3
- %p StaticMatic is very easy to work with. It aims to provide just the tools you need and not get in your way.
4
-
5
- %ul
6
- %li= link "Developing a site", "#developing"
7
- %li= link "Configuration", "#configuration"
8
- %li
9
- = link "Templates", "#templates"
10
- %ul
11
- %li= link "Layouts", "#layouts"
12
- %li= link "Helpers", "#helpers"
13
- %li= link "Partials", "#partials"
14
-
15
- %h2{:id => 'developing'} Developing a site with StaticMatic
16
-
17
- %h3 Setting up a site
18
-
19
- %p The first thing to do with a StaticMatic site is to set up the folders and files ready for use. A simple command will create everything you need to get started:
20
-
21
- .code staticmatic setup my_site
22
-
23
- %p This will set up a number of directories:
24
-
25
- %ul
26
- %li site/ - contains your static site and any assets such as images or javascript files
27
- %li
28
- src/ - where you'll work on your templates
29
- %ul
30
- %li
31
- helpers/ - contains any helpers you want to use in your website
32
- (write your own or grab some from
33
- = link_to('Helper Central', '/helper_central/') + ')'
34
- %li layouts/ - contains templates that 'wrap' your main content pages
35
- %li pages/ - contains the actual pages of content
36
- %li partials/ - contains any &quot;partial pages&quot; that can be reused in other pages or layouts
37
- %li
38
- stylesheets/ - contains any
39
- = link 'Sass', 'http://haml.hamptoncatlin.com/docs/sass'
40
- stylesheets you want to create
41
-
42
- %h3 Previewing your site
43
-
44
- %p When you're ready to start working on your site, you can fire up the preview server to see your changes:
45
-
46
- .code staticmatic preview my_site
47
-
48
- %p
49
- This will start a web server on port 3000. Point your web browser to
50
- = link "http://localhost:3000", "http://localhost:3000"
51
- to see your site.
52
-
53
- %h3 Building your site
54
-
55
- %p When you're happy with the website, you can tell StaticMatic to generate the HTML pages:
56
-
57
- .code staticmatic build my_site
58
-
59
- %h2{:id => 'configuration'} Configuration
60
-
61
- %p
62
- You can put a file called configuration.rb in your staticmatic project's basedir/src directory.
63
- In this file, you can set configuration settings or whatever else since it's just a
64
- ruby file.
65
-
66
- %h3 configuration.preview_server_port
67
-
68
- %p
69
- The default is 3000.
70
-
71
- %h3 configuration.preview_server_host
72
-
73
- %p
74
- The default is localhost.
75
-
76
- %h3 configuration.use_extensions_for_page_links
77
-
78
- %p
79
- The default is true. When false .html and index.html will be stripped off
80
- urls generated by the link tag helper.
81
-
82
- %h3 configuration.sass_options
83
-
84
- %p
85
- Default is an empty hash. You can specify any options that
86
- = link 'Sass', 'http://haml.hamptoncatlin.com/docs/sass'
87
- can take like :style => :compact
88
-
89
- %h2{:id => 'templates'} Templates
90
-
91
- %p
92
- %em
93
- For information on how to use Haml itself, please check out the
94
- = link("Haml website", "http://haml.hamptoncatlin.com/docs/haml") + "."
95
-
96
- %h3{:id => 'layouts'} Layouts
97
-
98
- %p
99
- As with web frameworks like
100
- = link("Ruby on Rails", "http://www.rubyonrails.com") + ","
101
- StaticMatic uses layouts to 'wrap' up the content contained within page templates.
102
-
103
- %p A layout typically contains the header and footer code for a page - code that is common to all pages on the site.
104
-
105
- %p The only thing a layout *must* contain is a line that tells StaticMatic where to put the content:
106
-
107
- .code = yield
108
-
109
- %p By default, StaticMatic will look for a template named 'application.haml'. If you have a page that needs to use a different layout, this can be specified in the page itself:
110
-
111
- %em contact_us.haml:
112
- .code - @layout = "contact"
113
-
114
- %p The above code would tell StaticMatic to use the layout called 'contact.haml' when building and previewing the 'contact_us' page.
115
-
116
-
117
- %h3{:id => 'helpers'} Helpers
118
-
119
- %p StaticMatic provides a number of 'helpers' on top of those in Haml to handle common code and reduce code.
120
- %p
121
- %em
122
- Additionally you can write your own helpers and put them in your
123
- staticmatic src/helpers directory. You can checkout the
124
- = link_to 'Helper Central', '/helper_central/'
125
- for some helpers that have already been written by others that
126
- you can drop in your helper directory.
127
-
128
- %h4 Links
129
-
130
- %p
131
- 'link' ('link_to' works too for you
132
- = link_to 'Rails', 'http://www.rubyonrails.com/'
133
- types) can automatically set up hyperlinks for you:
134
-
135
- .code = link "Contact Us"
136
-
137
- produces:
138
-
139
- .code &lt;a href="contact_us.html"&gt;Contact Us&lt;/a&gt;"
140
-
141
- %p It is also possible to specify a relative path in your url:
142
-
143
- .code = link "../Contact Us"
144
-
145
- produces:
146
-
147
- .code &lt;a href="../contact_us.html"&gt;Contact Us&lt;/a&gt;"
148
-
149
- %p You can also specify a URL:
150
-
151
- .code = link "StaticMatic", "http://staticmatic.rubyforge.org"
152
-
153
- %h4 Images
154
-
155
- .code = img "me.jpg"
156
- produces:
157
- .code &lt;img src="/images/me.jpg"/&gt;
158
-
159
- %p It is also possible to specify a relative path in your url:
160
-
161
- .code = img "../me.jpg"
162
- produces:
163
- .code &lt;img src="../me.jpg"/&gt;
164
-
165
- %h4 Stylesheets
166
-
167
- .code = stylesheets
168
-
169
- %p
170
- This will automatically insert links to any
171
- = link 'Sass', 'http://haml.hamptoncatlin.com/docs/sass'
172
- stylesheets in your site source.
173
-
174
- It will also link up any static stylesheets in your site/stylesheets/ directory
175
-
176
- %p
177
- You can also specify the files and the order explicitly along with setting attributes:
178
-
179
- .code = stylesheets :reset, :application, :media => :screen
180
-
181
- produces
182
-
183
- .code
184
- &lt;link href=&quot;stylesheets/reset.css&quot; media=&quot;screen&quot; rel=&quot;stylesheet&quot;/&gt;
185
- %br
186
- &lt;link href=&quot;stylesheets/application.css&quot; media=&quot;screen&quot; rel=&quot;stylesheet&quot;/&gt;
187
-
188
- %h4 Javascript
189
-
190
- .code = javascripts('test', :other)
191
- produces:
192
- .code
193
- &lt;script language=&quot;javascript&quot; src=&quot;/javascripts/test.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
194
- %br
195
- &lt;script language=&quot;javascript&quot; src=&quot;/javascripts/other.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
196
-
197
- %h4 Current page
198
-
199
- %p
200
- It can be very useful to know what page you're on in your layout and helpers
201
- (ie: setting selected style on a menu item).
202
-
203
- For the page src/pages/index.html
204
- .code = current_page # =&gt; &quot;/index.html&quot;
205
- %br
206
- For the page src/pages/subdirectory/other.html
207
- .code = current_page # =&gt; &quot;/subdirectory/other.html&quot;
208
-
209
- %h4 urlify
210
-
211
- %p Will convert a string to be usable in a url
212
-
213
- .code
214
- \= urlify(&quot;We love Haml&quot;) # =&gt; &quot;we_love_haml&quot;
215
- %br
216
- \= urlify(&quot;Elf &amp; Ham&quot;) # =&gt; &quot;elf_and_ham&quot;
217
- %br
218
- \= urlify(&quot;Stephen's gem&quot;) # =&gt; &quot;stephens_gem&quot;
219
- %br
220
- \= urlify(&quot;Test/Link&quot;) # =&gt; &quot;testlink&quot;
221
-
222
- %h4 text_area
223
-
224
- %p Generates a text area field
225
-
226
- .code = text_area 'myname', 'myvalue'
227
- produces:
228
- .code &lt;textarea id=&quot;myname&quot; name=&quot;myname&quot;&gt;myvalue&lt;/textarea&gt;
229
-
230
- %h4 text_field
231
-
232
- %p Generates a text input field
233
-
234
- .code = text_field('first_name', 'bob')
235
- produces:
236
- .code &lt;input name=&quot;first_name&quot; type=&quot;text&quot; value=&quot;bob&quot;/&gt;
237
-
238
-
239
- %h3{:id => 'partials'} Partials
240
-
241
- %p
242
- As with web frameworks like
243
- = link("Ruby on Rails", "http://www.rubyonrails.com") + ","
244
- StaticMatic uses partials to keep things
245
- = link('DRY', 'http://en.wikipedia.org/wiki/DRY') + "."
246
-
247
- .code = partial('mypartial')
248
-
249
- %p
250
- This will first look in the current page/partial's directory for a file called _mypartial.haml.
251
- If not found there it will look for src/partials/mypartial.haml.
252
-
253
- %h4 Specify the partial's local variables
254
-
255
- .code = partial('mypartial', :locals => { :title => 'My Title' })
256
-
257
- %p
258
- This will locate the partial file as in the previous example above but now passes in a local variable called
259
- %em title
260
- that can be used in the partial like so:
261
-
262
- .code %h1 title
263
-
264
- %h4 Specify the partial's directory
265
-
266
- .code = partial('shared/mypartial')
267
-
268
- %p
269
- This will look for the file src/pages/shared/_mypartial.haml first.
270
- If not found there it will look for src/partials/mypartial.haml.
@@ -1,27 +0,0 @@
1
- %h1 Static websites, the modern way
2
-
3
- %p
4
- Web developers are used to using dynamic and frameworks like
5
- = link "Ruby on Rails", "http://www.rubyonrails.com"
6
- to develop applications. When it comes to working with static, non-dynamic websites it can seem like stepping back in time.
7
-
8
- %h2 You'd like to
9
-
10
- %ul
11
- %li.highlight Replace over-featured, cumbersome Content Management Systems
12
- %li.highlight Speed up your prototypes
13
-
14
- %h2 Meet StaticMatic
15
-
16
- .columns
17
- .left_column
18
- %em Concise and terse Haml Templating
19
- = img "homepage-templating.jpg"
20
-
21
- .right_column
22
- %em Live preview server for development
23
- = img "homepage-previewing.jpg"
24
-
25
- %p
26
- %em Output full HTML pages
27
- = img "homepage-build.jpg"
@@ -1,22 +0,0 @@
1
- %h1 StaticMatic 0.8.10
2
-
3
- %h2 What's New
4
-
5
- %ul
6
- %li [NEW] rails-like partials. Partials can start with an underscore and live in the pages directory tree, old way still works (Brent Beardsley)
7
- %li [NEW] added current_page helper for use in other helpers, layouts, or pages (Brent Beardsley)
8
- %li [NEW] add src_dir, site_dir, and current_page attr_reader's on staticmatic class (Brent Beardsley)
9
-
10
- %h2 What's Fixed
11
-
12
- %ul
13
- %li [FIX] img helper changes and tests (Jason Tennier)
14
- %li [FIX] removed dependency on rails needing to be installed (Brent Beardsley)
15
- %li [FIX] fixed preview bug where setting a layout in a page would cause it to be used even for pages that did not have a layout specified and should be using the default (Brent Beardsley)
16
- %li [FIX] tag helper only outputs the attribute if it has a value (Brent Beardsley)
17
- %li [FIX] renamed RakeFile to Rakefile so it'll work on non-windows boxes (Brent Beardsley)
18
- %li [FIX] write tag helper attributes out in alphabetical order for consistency (Brent Beardsley)
19
-
20
- %p
21
- See what changed in
22
- = link('0.8.8', '/releases/0_8_8.html')
@@ -1,25 +0,0 @@
1
- %h1 StaticMatic 0.8.4
2
-
3
- %p Don't be fooled by the small minor increments - there's loads of great stuff in the latest release:
4
-
5
- %h2 Sub-Directory Support
6
- %p Thanks to Brent Beardsley, you can now have as many directories as you like. This should be considered 'beta' at the moment as there is likely to be issues with paths in the helpers, but try it out and we'll figure out the best solution.
7
-
8
- %h2 Partials!
9
- %p
10
- Simply create a 'partials' directory in your src/ and you'll be able to do:
11
- .code partial("partial_name")
12
-
13
- %h2 Layouts based on directory
14
- %p Along with sub-directory support, you can also create layouts based on the sub-directory a template is in. For example, if you have a 'projects' directory and would like it to render a different template, simply create 'projects.haml' in your layouts directory.
15
-
16
- %h2 Relative Stylesheet Linking
17
- %p
18
- You can now tell the stylesheet helper to use relative linking:
19
- .code = stylesheets :relative => true
20
-
21
- %p
22
- %em Note that you may get issues with nested directories and relative stylesheets
23
-
24
- %h2 What's Next?
25
- %p The main things on the list are configuration and clearing up any bugs not yet sorted. It'd also be great to start extending the test set more.