yuzu 0.2.1.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/.document +5 -0
  2. data/.yardopts +7 -0
  3. data/ChangeLog.md +8 -0
  4. data/Gemfile +26 -0
  5. data/Gemfile.lock +30 -0
  6. data/LICENSE.txt +20 -0
  7. data/README.md +52 -0
  8. data/Rakefile +62 -0
  9. data/bin/yuzu +17 -0
  10. data/docs/About.md +19 -0
  11. data/docs/GettingStarted.md +48 -0
  12. data/docs/Reference.md +97 -0
  13. data/lib/helpers/object.rb +19 -0
  14. data/lib/helpers/path.rb +296 -0
  15. data/lib/helpers/string.rb +35 -0
  16. data/lib/helpers/system_checks.rb +10 -0
  17. data/lib/helpers/url.rb +64 -0
  18. data/lib/html/base.rb +187 -0
  19. data/lib/uploader/base.rb +59 -0
  20. data/lib/uploader/config.rb +19 -0
  21. data/lib/uploader/filesystem_service.rb +72 -0
  22. data/lib/uploader/ftp_service.rb +90 -0
  23. data/lib/uploader/s3_service.rb +135 -0
  24. data/lib/uploader/service.rb +57 -0
  25. data/lib/uploader/suppressor.rb +25 -0
  26. data/lib/yuzu.rb +6 -0
  27. data/lib/yuzu/argparse.rb +60 -0
  28. data/lib/yuzu/command.rb +104 -0
  29. data/lib/yuzu/commands/base.rb +150 -0
  30. data/lib/yuzu/commands/create.rb +68 -0
  31. data/lib/yuzu/commands/generate.rb +95 -0
  32. data/lib/yuzu/commands/help.rb +20 -0
  33. data/lib/yuzu/commands/preview.rb +58 -0
  34. data/lib/yuzu/commands/publish.rb +43 -0
  35. data/lib/yuzu/commands/stage.rb +62 -0
  36. data/lib/yuzu/commands/watch.rb +70 -0
  37. data/lib/yuzu/content/blog_post.rb +45 -0
  38. data/lib/yuzu/content/sample_project.rb +130 -0
  39. data/lib/yuzu/core/config.rb +154 -0
  40. data/lib/yuzu/core/layout.rb +85 -0
  41. data/lib/yuzu/core/paginated_file.rb +69 -0
  42. data/lib/yuzu/core/registrar.rb +32 -0
  43. data/lib/yuzu/core/siteroot.rb +57 -0
  44. data/lib/yuzu/core/template.rb +158 -0
  45. data/lib/yuzu/core/updater.rb +123 -0
  46. data/lib/yuzu/core/visitor.rb +44 -0
  47. data/lib/yuzu/core/website_base.rb +150 -0
  48. data/lib/yuzu/core/website_file.rb +270 -0
  49. data/lib/yuzu/core/website_folder.rb +176 -0
  50. data/lib/yuzu/filters/base.rb +86 -0
  51. data/lib/yuzu/filters/catalog.rb +248 -0
  52. data/lib/yuzu/filters/categories.rb +58 -0
  53. data/lib/yuzu/filters/currentpath.rb +35 -0
  54. data/lib/yuzu/filters/description.rb +16 -0
  55. data/lib/yuzu/filters/extension.rb +16 -0
  56. data/lib/yuzu/filters/images.rb +32 -0
  57. data/lib/yuzu/filters/linkroot.rb +35 -0
  58. data/lib/yuzu/filters/post_date.rb +45 -0
  59. data/lib/yuzu/filters/post_title.rb +66 -0
  60. data/lib/yuzu/filters/post_title_removed.rb +28 -0
  61. data/lib/yuzu/filters/sidebar.rb +26 -0
  62. data/lib/yuzu/filters/template.rb +16 -0
  63. data/lib/yuzu/generators/base.rb +44 -0
  64. data/lib/yuzu/generators/category_folders.rb +91 -0
  65. data/lib/yuzu/generators/index.rb +108 -0
  66. data/lib/yuzu/generators/paginate.rb +136 -0
  67. data/lib/yuzu/postprocessors/all_categories.rb +48 -0
  68. data/lib/yuzu/postprocessors/base.rb +34 -0
  69. data/lib/yuzu/postprocessors/contents_without_first_paragraph.rb +20 -0
  70. data/lib/yuzu/postprocessors/excerpt.rb +23 -0
  71. data/lib/yuzu/postprocessors/first_paragraph.rb +16 -0
  72. data/lib/yuzu/postprocessors/pagination.rb +35 -0
  73. data/lib/yuzu/postprocessors/recent_posts.rb +27 -0
  74. data/lib/yuzu/postprocessors/thumbnails.rb +48 -0
  75. data/lib/yuzu/preprocessors/base.rb +71 -0
  76. data/lib/yuzu/preprocessors/insert_contents.rb +57 -0
  77. data/lib/yuzu/renderers/base.rb +23 -0
  78. data/lib/yuzu/renderers/breadcrumb.rb +163 -0
  79. data/lib/yuzu/renderers/gallery.rb +24 -0
  80. data/lib/yuzu/renderers/title.rb +21 -0
  81. data/lib/yuzu/translators/base.rb +57 -0
  82. data/lib/yuzu/translators/markdown.rb +21 -0
  83. data/lib/yuzu/translators/plaintext.rb +17 -0
  84. data/lib/yuzu/version.rb +12 -0
  85. data/resources/config/compass.rb +6 -0
  86. data/resources/config/yuzu.yml +166 -0
  87. data/resources/git/post-commit +42 -0
  88. data/resources/sample_content/introduction/_snippets/about_insert_contents.md +3 -0
  89. data/resources/sample_content/introduction/about.md +6 -0
  90. data/resources/sample_content/introduction/advanced-posts.md +18 -0
  91. data/resources/sample_content/introduction/blog/blog-folder-is-special.md +8 -0
  92. data/resources/sample_content/introduction/getting-started.md +14 -0
  93. data/resources/sample_content/introduction/index.md +6 -0
  94. data/resources/sample_content/introduction/sample-post.md +13 -0
  95. data/resources/sample_projects.yml +7 -0
  96. data/resources/themes/minimal/_sass/print.sass +0 -0
  97. data/resources/themes/minimal/_sass/screen.sass +81 -0
  98. data/resources/themes/minimal/_templates/_block.haml +4 -0
  99. data/resources/themes/minimal/_templates/_blog.haml +3 -0
  100. data/resources/themes/minimal/_templates/_footer.haml +2 -0
  101. data/resources/themes/minimal/_templates/_gallery.haml +25 -0
  102. data/resources/themes/minimal/_templates/_head.haml +12 -0
  103. data/resources/themes/minimal/_templates/_header.haml +1 -0
  104. data/resources/themes/minimal/_templates/_menu.haml +6 -0
  105. data/resources/themes/minimal/_templates/blog.haml +21 -0
  106. data/resources/themes/minimal/_templates/generic.haml +26 -0
  107. data/resources/themes/minimal/_templates/home.haml +15 -0
  108. data/resources/themes/minimal/_templates/index.haml +21 -0
  109. data/resources/themes/minimal/css/print.css +0 -0
  110. data/resources/themes/minimal/css/screen.css +133 -0
  111. data/resources/themes/minimal/img/favicon.png +0 -0
  112. data/resources/yard/default/fulldoc/html/css/common.css +16 -0
  113. data/test/helper.rb +18 -0
  114. data/test/test_yuzu.rb +8 -0
  115. data/yuzu.gemspec +182 -0
  116. metadata +302 -0
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env ruby -wKU
2
+
3
+ #
4
+ # An example hook script that is called after a successful
5
+ # commit is made.
6
+ #
7
+ # To enable this hook, rename this file to "post-commit".
8
+
9
+ puts "Updating changed files..."
10
+
11
+ diff = `git diff --name-only HEAD HEAD^`
12
+
13
+ ignore_extensions = [".rb",".sass",".yml"]
14
+
15
+ files_to_change = []
16
+
17
+ # If the diff includes a .sass file that's been updated, make sure
18
+ # to compile it with compass, then get the new diff to catch the
19
+ # updated css files as well.
20
+ if diff.include?(".sass")
21
+ puts "SASS file change detected. Making sure the CSS is updated as well..."
22
+ puts `compass compile`
23
+ diff = `git diff --name-only HEAD HEAD^`
24
+ end
25
+
26
+ changed_files = diff.split("\n")
27
+
28
+ changed_files.each do |file|
29
+ ext = File.extname(file)
30
+ if not ignore_extensions.include?( ext ) and file[0].chr != "." and file[0].chr != "_"
31
+ files_to_change << file.to_s
32
+ end
33
+ end
34
+
35
+ if files_to_change.length > 0
36
+ file_list = files_to_change.join(" ")
37
+ output = `./update.rb #{file_list}`
38
+ puts output
39
+ puts "Done updating!"
40
+ else
41
+ puts "No files to update."
42
+ end
@@ -0,0 +1,3 @@
1
+ This piece text was placed in the folder called `_snippets`, which by itself is not special, other than that the preceding undescore hides the file from Yuzu's normal processing. You can hide folders and files in this manner so Yuzu doesn't a separate HTML file for it.
2
+
3
+ This is used to demonstrate how Yuzu can mix content from various sources. If you want to organize content one way and publish it under a different organization, you can reference content from the root of your project and use the `INSERTCONTENTS` directive.
@@ -0,0 +1,6 @@
1
+ # About Yuzu
2
+
3
+ Yuzu is a blog-aware, static-website generator and publisher that builds an HTML5 website from a folder of text files and images.
4
+
5
+ This is one of the sample websites that comes with Yuzu.
6
+
@@ -0,0 +1,18 @@
1
+ # A More Advanced Post
2
+
3
+ Posts can take advantage of a number of _directives_ to mix content and tag the post with additional information. This one shows you by example how to use the most common ones.
4
+
5
+ Notice how the post is dated February 11, 2013. This is set by using the `DATE` directive at the bottom of the post, after the `SIDEBAR`. Directives like this are removed from the raw contents of the post, processed, and placed according to the HAML _templates_ located in the folder called `_templates`.
6
+
7
+ Here we will insert some contents from a different file:
8
+
9
+ INSERTCONTENTS(_snippets/about_insert_contents.md)
10
+
11
+ If you look at the source, the directive is indented. I only do this because Markdown highlighters treat underscores as markup to italicize text. Indenting treats it as code with no markup applied.
12
+
13
+ SIDEBAR{
14
+ This is text that will appear in the sidebar.
15
+
16
+ You can make this by using the `SIDEBAR` tag, which uses curly braces to offset text to be placed with `post.sidebar` in a HAML template.
17
+ }
18
+ DATE(2013-02-11)
@@ -0,0 +1,8 @@
1
+ # The Blog Folder is Special
2
+
3
+ CATEGORIES(introduction)
4
+
5
+ The blog folder has some special behaviors that make it easier to organize content in a more blog-like fashion, such as organized categories, auto-generated folders for each category, and default HAML templates and partials so you can render the blog differently from other pages.
6
+
7
+ By default, it is called `blog`, but you can customize this in in `yuzu.yml`. Currently, a yuzu site can only contain one blog folder, but this may change in the future.
8
+
@@ -0,0 +1,14 @@
1
+ # Getting Started with Yuzu
2
+
3
+ If you're reading this, you've successfully created your yuzu project, and you're likely browsing the source of the new project.
4
+
5
+
6
+ ## Home
7
+
8
+ The front page is `index.md`, found in the folder you ran `yuzu create` in. If you look in it, you'll see a directive called `INSERTCATALOG`. Directives such as these are the mechanism that enables you to give Yuzu various instructions or information to aid in rendering your site.
9
+
10
+
11
+ ## Configuration
12
+
13
+ You shoud edit `config/yuzu.yml` to update the path found under `preview` called `destination`. If you're on a Mac, simply run change `username` to your username.
14
+
@@ -0,0 +1,6 @@
1
+ TEMPLATE(home.haml)
2
+
3
+ # Yuzu Starter Site
4
+
5
+ INSERTCATALOG(path:., total:100, per_page:10, per_col:1, template:_block.haml)
6
+
@@ -0,0 +1,13 @@
1
+ # Sample Yuzu Post
2
+
3
+ This what a typical post looks like in Yuzu.
4
+
5
+ It is written in [Markdown](http://daringfireball.net/projects/markdown/) and may contain various tags called "directives" (in ALLCAPS in other posts), that either indicate to Yuzu pieces of information about this post (e.g. the desired publication date of this page) or instructions on what to render (like inserting the contents of another file).
6
+
7
+ ## Writing Posts
8
+
9
+ You don't have to include any directives in a post; you can simply write Markdown as usual (or other formats, coming soon), like any other text file. By default, Yuzu grabs all the "processable" files (ones indicated in the configuration by their extension), and turns them into HTML files by passing them through a series of transformations.
10
+
11
+ One of the things to notice here is that the title of the post is extracted from the first hash `#` header tag at the top. If this weren't here, the title would be extracted from the file name. In this case, it would be "Sample Post," a titleized form of the tile name.
12
+
13
+ For an example of what a post with directives looks like, see [A More Advanced Post](advanced-posts.html).
@@ -0,0 +1,7 @@
1
+ # Sample Projects Registry
2
+
3
+ default:
4
+ content: introduction
5
+ theme: minimal
6
+ description: A getting-started project to get to know Yuzu.
7
+
File without changes
@@ -0,0 +1,81 @@
1
+
2
+ // Main layout here
3
+ .wrapper
4
+ width: 910px
5
+ padding: 60px
6
+ .contents
7
+ width: 700px
8
+ float: left
9
+ min-height: 600px
10
+ .sidebar
11
+ width: 200px
12
+ margin: 50px 0 0 10px
13
+ float: left
14
+ footer
15
+ padding: 40px 0 0 0
16
+ width: 910px
17
+ clear: both
18
+
19
+ // Breadcrumb
20
+ .breadcrumb
21
+ float: left
22
+ a
23
+ color: #ccc
24
+ .breadcrumb_0
25
+ display: none
26
+ header
27
+ overflow: hidden
28
+ h1
29
+ float: left
30
+
31
+ // Typography
32
+ html, body
33
+ background-color: white
34
+ font-family: Georgia, serif
35
+ color: #333
36
+ font-size: 19px
37
+ line-height: 30px
38
+ h1, h2, h3, h4, h5, h6
39
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif
40
+ font-size: 100%
41
+ margin: 0 0 1em 0
42
+ font-weight: bold
43
+ a
44
+ color: black
45
+ a:hover
46
+ text-decoration: none
47
+ p, ul, ol
48
+ margin: 0 0 1em 0
49
+ padding: 0
50
+ .sidebar
51
+ ul, li
52
+ list-style-type: none
53
+ li
54
+ margin: 0
55
+ footer, .date, .sidebar p, .sidebar li, .aside
56
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif
57
+ font-size: 14px
58
+ color: #bbb
59
+ line-height: 22px
60
+ .sidebar
61
+ h1, h2, h3, h4, h5, h6
62
+ font-size: 14px
63
+ line-height: 22px
64
+ .date
65
+ line-height: 30px
66
+ .breadcrumb
67
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif
68
+ font-weight: normal
69
+ .date
70
+ float: left
71
+ width: 130px
72
+ blockquote
73
+ padding-left: 20px
74
+ color: #999
75
+ font-style: italic
76
+
77
+
78
+ // Other
79
+ hr
80
+ display: none
81
+
@@ -0,0 +1,4 @@
1
+ %div{:class => klass}
2
+ %a{:href => post.link_url}= post.post_title
3
+ %span(class="location")= post.in_blog? ? post.blog_folder.link_to_self(:class => 'aside') : ""
4
+ %span(class="date")= format_date(post.post_date)
@@ -0,0 +1,3 @@
1
+ %div{:class => klass}
2
+ %a{:href => post.link_url}= post.post_title
3
+ %span(class="date")= format_date(post.post_date)
@@ -0,0 +1,2 @@
1
+ %p= config.site_name
2
+ %p by William Martin
@@ -0,0 +1,25 @@
1
+ .gallery-main
2
+ - images.each_index do |i|
3
+ - big_image = images[i].gsub(".", "-large.")
4
+ - visibility = i == 0 ? "display:block;z-index:2;" : "display:none;z-index:1;"
5
+ .slide{:id => "slide-#{i}", :style => "#{visibility}"}
6
+ %img{:src => big_image}
7
+
8
+ :javascript
9
+ var count = #{images.length};
10
+
11
+ .gallery-thumbnails
12
+ - images.each_index do |i|
13
+ - image = images[i]
14
+ - thumb_url = image.gsub(".", "-small.")
15
+ - klass = i%6 == 5 ? "gallery-thumb last" : "gallery-thumb"
16
+ %div{:class => klass}
17
+ %a{:href => "#", :onclick => "slide(#{i});return false;"}
18
+ %img{:src => "#{thumb_url}"}
19
+
20
+ - num_blanks = (6 - images.length % 6) % 6
21
+ - num_blanks.times do |i|
22
+ - klass = i%6 == 5 ? "gallery-thumb last" : "gallery-thumb"
23
+ %div{:class => klass} &nbsp;
24
+
25
+ %hr
@@ -0,0 +1,12 @@
1
+ %head
2
+ %meta{:charset=>"utf-8"}
3
+ %title= post.title
4
+
5
+ %meta{"http-equiv"=>"X-UA-Compatible", :content=>"IE=edge,chrome=1"}
6
+ %meta{:name => "description", :content => post.description}
7
+ %meta{:name => "author", :content => post.author}
8
+
9
+ %link{:href => "#{config.link_root}/img/favicon.png", :rel => "icon", :type => "image/png"}
10
+
11
+ %link(rel="stylesheet" href="#{config.link_root}/css/screen.css" type="text/css" media="screen, projection")
12
+ %link(rel="stylesheet" href="#{config.link_root}/css/print.css" type="text/css" media="print")
@@ -0,0 +1 @@
1
+ %h1= post_title
@@ -0,0 +1,6 @@
1
+ %ul
2
+ %li{:class => ""}
3
+ %a{:href => "#{config.link_root}/index.html"} Home
4
+ %li{:class => ""}
5
+ %a{:href => "#{config.link_root}/about.html"} About
6
+
@@ -0,0 +1,21 @@
1
+ !!! 5
2
+ %html
3
+ = layout.head
4
+
5
+ %body.index
6
+ .wrapper
7
+ %article.contents
8
+ %header
9
+ %h1= post.post_title
10
+ .breadcrumb= post.breadcrumb
11
+
12
+ = post.contents
13
+ = post.pagination
14
+ .sidebar
15
+ %h4 Categories
16
+ %ul
17
+ - post.all_categories.each do |cat|
18
+ %li= cat.link
19
+ = post.sidebar
20
+ %footer
21
+ = layout.footer
@@ -0,0 +1,26 @@
1
+ !!! 5
2
+ %html
3
+ = layout.head
4
+
5
+ %body.generic
6
+ .wrapper
7
+ %article.contents
8
+ %header
9
+ %h1= post.post_title
10
+ .breadcrumb= post.breadcrumb
11
+
12
+ = post.contents
13
+
14
+ .sidebar
15
+ = layout.menu
16
+
17
+ %h4 Categories
18
+ %ul
19
+ - post.all_categories.each do |cat|
20
+ %li= cat.link
21
+
22
+ = post.sidebar
23
+
24
+ %footer
25
+ = layout.footer
26
+
@@ -0,0 +1,15 @@
1
+ !!! 5
2
+ %html
3
+ = layout.head
4
+
5
+ %body.index
6
+ .wrapper
7
+ %article.contents
8
+ %header
9
+ %h1= post.post_title
10
+ = post.contents
11
+ = post.pagination
12
+ .sidebar
13
+ = post.sidebar
14
+ %footer
15
+ = layout.footer
@@ -0,0 +1,21 @@
1
+ !!! 5
2
+ %html
3
+ = layout.head
4
+
5
+ %body.index
6
+ .wrapper
7
+ %article.contents
8
+ %header
9
+ %h1= post.post_title
10
+ .breadcrumb= post.breadcrumb
11
+
12
+ = post.contents
13
+ = post.pagination
14
+ .sidebar
15
+ %h4 Categories
16
+ %ul
17
+ - post.all_categories.each do |cat|
18
+ %li= cat.link
19
+ = post.sidebar
20
+ %footer
21
+ = layout.footer
File without changes
@@ -0,0 +1,133 @@
1
+ /* line 3, ../_sass/screen.sass */
2
+ .wrapper {
3
+ width: 910px;
4
+ padding: 60px;
5
+ }
6
+
7
+ /* line 6, ../_sass/screen.sass */
8
+ .contents {
9
+ width: 700px;
10
+ float: left;
11
+ min-height: 600px;
12
+ }
13
+
14
+ /* line 10, ../_sass/screen.sass */
15
+ .sidebar {
16
+ width: 200px;
17
+ margin: 50px 0 0 10px;
18
+ float: left;
19
+ }
20
+
21
+ /* line 14, ../_sass/screen.sass */
22
+ footer {
23
+ padding: 40px 0 0 0;
24
+ width: 910px;
25
+ clear: both;
26
+ }
27
+
28
+ /* line 20, ../_sass/screen.sass */
29
+ .breadcrumb {
30
+ float: left;
31
+ }
32
+ /* line 22, ../_sass/screen.sass */
33
+ .breadcrumb a {
34
+ color: #cccccc;
35
+ }
36
+ /* line 24, ../_sass/screen.sass */
37
+ .breadcrumb .breadcrumb_0 {
38
+ display: none;
39
+ }
40
+
41
+ /* line 26, ../_sass/screen.sass */
42
+ header {
43
+ overflow: hidden;
44
+ }
45
+ /* line 28, ../_sass/screen.sass */
46
+ header h1 {
47
+ float: left;
48
+ }
49
+
50
+ /* line 32, ../_sass/screen.sass */
51
+ html, body {
52
+ background-color: white;
53
+ font-family: Georgia, serif;
54
+ color: #333333;
55
+ font-size: 19px;
56
+ line-height: 30px;
57
+ }
58
+
59
+ /* line 38, ../_sass/screen.sass */
60
+ h1, h2, h3, h4, h5, h6 {
61
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
62
+ font-size: 100%;
63
+ margin: 0 0 1em 0;
64
+ font-weight: bold;
65
+ }
66
+
67
+ /* line 43, ../_sass/screen.sass */
68
+ a {
69
+ color: black;
70
+ }
71
+
72
+ /* line 45, ../_sass/screen.sass */
73
+ a:hover {
74
+ text-decoration: none;
75
+ }
76
+
77
+ /* line 47, ../_sass/screen.sass */
78
+ p, ul, ol {
79
+ margin: 0 0 1em 0;
80
+ padding: 0;
81
+ }
82
+
83
+ /* line 51, ../_sass/screen.sass */
84
+ .sidebar ul, .sidebar li {
85
+ list-style-type: none;
86
+ }
87
+ /* line 53, ../_sass/screen.sass */
88
+ .sidebar li {
89
+ margin: 0;
90
+ }
91
+
92
+ /* line 55, ../_sass/screen.sass */
93
+ footer, .date, .sidebar p, .sidebar li, .aside {
94
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
95
+ font-size: 14px;
96
+ color: #bbbbbb;
97
+ line-height: 22px;
98
+ }
99
+
100
+ /* line 61, ../_sass/screen.sass */
101
+ .sidebar h1, .sidebar h2, .sidebar h3, .sidebar h4, .sidebar h5, .sidebar h6 {
102
+ font-size: 14px;
103
+ line-height: 22px;
104
+ }
105
+
106
+ /* line 64, ../_sass/screen.sass */
107
+ .date {
108
+ line-height: 30px;
109
+ }
110
+
111
+ /* line 66, ../_sass/screen.sass */
112
+ .breadcrumb {
113
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
114
+ font-weight: normal;
115
+ }
116
+
117
+ /* line 69, ../_sass/screen.sass */
118
+ .date {
119
+ float: left;
120
+ width: 130px;
121
+ }
122
+
123
+ /* line 72, ../_sass/screen.sass */
124
+ blockquote {
125
+ padding-left: 20px;
126
+ color: #999999;
127
+ font-style: italic;
128
+ }
129
+
130
+ /* line 79, ../_sass/screen.sass */
131
+ hr {
132
+ display: none;
133
+ }