nanoc2 2.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. data/ChangeLog +3 -0
  2. data/LICENSE +19 -0
  3. data/README +75 -0
  4. data/Rakefile +76 -0
  5. data/bin/nanoc2 +26 -0
  6. data/lib/nanoc2.rb +73 -0
  7. data/lib/nanoc2/base.rb +26 -0
  8. data/lib/nanoc2/base/asset.rb +117 -0
  9. data/lib/nanoc2/base/asset_defaults.rb +21 -0
  10. data/lib/nanoc2/base/asset_rep.rb +282 -0
  11. data/lib/nanoc2/base/binary_filter.rb +44 -0
  12. data/lib/nanoc2/base/code.rb +41 -0
  13. data/lib/nanoc2/base/compiler.rb +67 -0
  14. data/lib/nanoc2/base/core_ext.rb +2 -0
  15. data/lib/nanoc2/base/core_ext/hash.rb +78 -0
  16. data/lib/nanoc2/base/core_ext/string.rb +8 -0
  17. data/lib/nanoc2/base/data_source.rb +286 -0
  18. data/lib/nanoc2/base/defaults.rb +30 -0
  19. data/lib/nanoc2/base/filter.rb +93 -0
  20. data/lib/nanoc2/base/layout.rb +91 -0
  21. data/lib/nanoc2/base/notification_center.rb +66 -0
  22. data/lib/nanoc2/base/page.rb +132 -0
  23. data/lib/nanoc2/base/page_defaults.rb +20 -0
  24. data/lib/nanoc2/base/page_rep.rb +324 -0
  25. data/lib/nanoc2/base/plugin.rb +71 -0
  26. data/lib/nanoc2/base/proxies.rb +5 -0
  27. data/lib/nanoc2/base/proxies/asset_proxy.rb +29 -0
  28. data/lib/nanoc2/base/proxies/asset_rep_proxy.rb +26 -0
  29. data/lib/nanoc2/base/proxies/layout_proxy.rb +25 -0
  30. data/lib/nanoc2/base/proxies/page_proxy.rb +35 -0
  31. data/lib/nanoc2/base/proxies/page_rep_proxy.rb +28 -0
  32. data/lib/nanoc2/base/proxy.rb +37 -0
  33. data/lib/nanoc2/base/router.rb +72 -0
  34. data/lib/nanoc2/base/site.rb +274 -0
  35. data/lib/nanoc2/base/template.rb +64 -0
  36. data/lib/nanoc2/binary_filters.rb +1 -0
  37. data/lib/nanoc2/binary_filters/image_science_thumbnail.rb +28 -0
  38. data/lib/nanoc2/cli.rb +9 -0
  39. data/lib/nanoc2/cli/base.rb +132 -0
  40. data/lib/nanoc2/cli/commands.rb +10 -0
  41. data/lib/nanoc2/cli/commands/autocompile.rb +80 -0
  42. data/lib/nanoc2/cli/commands/compile.rb +312 -0
  43. data/lib/nanoc2/cli/commands/create_layout.rb +85 -0
  44. data/lib/nanoc2/cli/commands/create_page.rb +85 -0
  45. data/lib/nanoc2/cli/commands/create_site.rb +323 -0
  46. data/lib/nanoc2/cli/commands/create_template.rb +76 -0
  47. data/lib/nanoc2/cli/commands/help.rb +69 -0
  48. data/lib/nanoc2/cli/commands/info.rb +125 -0
  49. data/lib/nanoc2/cli/commands/switch.rb +141 -0
  50. data/lib/nanoc2/cli/commands/update.rb +91 -0
  51. data/lib/nanoc2/cli/logger.rb +72 -0
  52. data/lib/nanoc2/data_sources.rb +2 -0
  53. data/lib/nanoc2/data_sources/filesystem.rb +707 -0
  54. data/lib/nanoc2/data_sources/filesystem_combined.rb +495 -0
  55. data/lib/nanoc2/extra.rb +6 -0
  56. data/lib/nanoc2/extra/auto_compiler.rb +285 -0
  57. data/lib/nanoc2/extra/context.rb +22 -0
  58. data/lib/nanoc2/extra/core_ext.rb +2 -0
  59. data/lib/nanoc2/extra/core_ext/hash.rb +54 -0
  60. data/lib/nanoc2/extra/core_ext/time.rb +13 -0
  61. data/lib/nanoc2/extra/file_proxy.rb +29 -0
  62. data/lib/nanoc2/extra/vcs.rb +48 -0
  63. data/lib/nanoc2/extra/vcses.rb +5 -0
  64. data/lib/nanoc2/extra/vcses/bazaar.rb +21 -0
  65. data/lib/nanoc2/extra/vcses/dummy.rb +20 -0
  66. data/lib/nanoc2/extra/vcses/git.rb +21 -0
  67. data/lib/nanoc2/extra/vcses/mercurial.rb +21 -0
  68. data/lib/nanoc2/extra/vcses/subversion.rb +21 -0
  69. data/lib/nanoc2/filters.rb +16 -0
  70. data/lib/nanoc2/filters/bluecloth.rb +13 -0
  71. data/lib/nanoc2/filters/erb.rb +19 -0
  72. data/lib/nanoc2/filters/erubis.rb +14 -0
  73. data/lib/nanoc2/filters/haml.rb +21 -0
  74. data/lib/nanoc2/filters/markaby.rb +14 -0
  75. data/lib/nanoc2/filters/maruku.rb +14 -0
  76. data/lib/nanoc2/filters/old.rb +19 -0
  77. data/lib/nanoc2/filters/rainpress.rb +13 -0
  78. data/lib/nanoc2/filters/rdiscount.rb +13 -0
  79. data/lib/nanoc2/filters/rdoc.rb +23 -0
  80. data/lib/nanoc2/filters/redcloth.rb +14 -0
  81. data/lib/nanoc2/filters/relativize_paths.rb +16 -0
  82. data/lib/nanoc2/filters/relativize_paths_in_css.rb +16 -0
  83. data/lib/nanoc2/filters/relativize_paths_in_html.rb +16 -0
  84. data/lib/nanoc2/filters/rubypants.rb +14 -0
  85. data/lib/nanoc2/filters/sass.rb +18 -0
  86. data/lib/nanoc2/helpers.rb +9 -0
  87. data/lib/nanoc2/helpers/blogging.rb +217 -0
  88. data/lib/nanoc2/helpers/capturing.rb +63 -0
  89. data/lib/nanoc2/helpers/filtering.rb +54 -0
  90. data/lib/nanoc2/helpers/html_escape.rb +25 -0
  91. data/lib/nanoc2/helpers/link_to.rb +113 -0
  92. data/lib/nanoc2/helpers/render.rb +49 -0
  93. data/lib/nanoc2/helpers/tagging.rb +56 -0
  94. data/lib/nanoc2/helpers/text.rb +38 -0
  95. data/lib/nanoc2/helpers/xml_sitemap.rb +63 -0
  96. data/lib/nanoc2/routers.rb +3 -0
  97. data/lib/nanoc2/routers/default.rb +54 -0
  98. data/lib/nanoc2/routers/no_dirs.rb +66 -0
  99. data/lib/nanoc2/routers/versioned.rb +79 -0
  100. metadata +185 -0
@@ -0,0 +1,3 @@
1
+ require 'nanoc2/routers/default'
2
+ require 'nanoc2/routers/no_dirs'
3
+ require 'nanoc2/routers/versioned'
@@ -0,0 +1,54 @@
1
+ module Nanoc2::Routers
2
+
3
+ # The default router organises pages in the most obvious, but sometimes
4
+ # slightly restrictive, way: the hierarchy of compiled pages and assets is
5
+ # the same as the hierarchy of uncompiled pages and assets.
6
+ class Default < Nanoc2::Router
7
+
8
+ identifier :default
9
+
10
+ def path_for_page_rep(page_rep)
11
+ # Get data we need
12
+ filename = page_rep.attribute_named(:filename)
13
+ extension = page_rep.attribute_named(:extension)
14
+
15
+ # Initialize path
16
+ path = page_rep.page.path + filename
17
+
18
+ # Add rep name if necessary
19
+ unless page_rep.name == :default
20
+ path += '-' + page_rep.name.to_s
21
+ end
22
+
23
+ # Add extension
24
+ path += '.' + extension
25
+
26
+ # Done
27
+ path
28
+ end
29
+
30
+ def path_for_asset_rep(asset_rep)
31
+ # Get data we need
32
+ extension = asset_rep.attribute_named(:extension)
33
+ modified_path = asset_rep.asset.path[0..-2]
34
+ version = asset_rep.attribute_named(:version)
35
+
36
+ # Initialize path
37
+ assets_prefix = @site.config[:assets_prefix] || '/assets'
38
+ path = assets_prefix + modified_path
39
+
40
+ # Add rep name if necessary
41
+ unless asset_rep.name == :default
42
+ path += '-' + asset_rep.name.to_s
43
+ end
44
+
45
+ # Add extension
46
+ path += '.' + extension
47
+
48
+ # Done
49
+ path
50
+ end
51
+
52
+ end
53
+
54
+ end
@@ -0,0 +1,66 @@
1
+ module Nanoc2::Routers
2
+
3
+ # The no-directories router organises pages very similarly to the default
4
+ # router, but does not create directories unless necessary. This router will
5
+ # therefore generate pages with less pretty URLs.
6
+ #
7
+ # For example, a page with path /about/ will be written to /about.html
8
+ # instead of /about/index.html.
9
+ class NoDirs < Nanoc2::Router
10
+
11
+ identifier :no_dirs
12
+
13
+ def path_for_page_rep(page_rep)
14
+ # Get data we need
15
+ filename = page_rep.attribute_named(:filename)
16
+ extension = page_rep.attribute_named(:extension)
17
+
18
+ # Initialize path
19
+ if page_rep.page.path == '/'
20
+ path = '/' + filename
21
+ else
22
+ path = page_rep.page.path[0..-2]
23
+ end
24
+
25
+ # Add rep name if necessary
26
+ unless page_rep.name == :default
27
+ path += '-' + page_rep.name.to_s
28
+ end
29
+
30
+ # Add extension
31
+ path += '.' + extension
32
+
33
+ # Done
34
+ path
35
+ end
36
+
37
+ def path_for_asset_rep(asset_rep)
38
+ # Get data we need
39
+ extension = asset_rep.attribute_named(:extension)
40
+ modified_path = asset_rep.asset.path[0..-2]
41
+ version = asset_rep.attribute_named(:version)
42
+
43
+ # Initialize path
44
+ assets_prefix = @site.config[:assets_prefix] || '/assets'
45
+ path = assets_prefix + modified_path
46
+
47
+ # Add version if necessary
48
+ unless version.nil?
49
+ path += '-v' + version.to_s
50
+ end
51
+
52
+ # Add rep name
53
+ unless asset_rep.name == :default
54
+ path += '-' + asset_rep.name.to_s
55
+ end
56
+
57
+ # Add extension
58
+ path += '.' + extension
59
+
60
+ # Done
61
+ path
62
+ end
63
+
64
+ end
65
+
66
+ end
@@ -0,0 +1,79 @@
1
+ module Nanoc2::Routers
2
+
3
+ # The versioned router behaves pretty much like the default router, with the
4
+ # exception that asset representations (but not page representations) can
5
+ # have versions which will be added to generated URLs.
6
+ #
7
+ # This is very useful if you want to cache assets aggressively by sending an
8
+ # +Expires+ header to clients. An +Expires+ header usually has the issue
9
+ # that clients will not request the asset even if it has changed; giving the
10
+ # asset a different version will cause the URL to be changed, which in turn
11
+ # will cause the client to request the new asset.
12
+ #
13
+ # = Example
14
+ #
15
+ # For example, the URL of a textual asset containing the CSS stylesheet with
16
+ # its 'version' attribute set to 28 will become /assets/style-v28.css.
17
+ #
18
+ # To link to the stylesheet in a DRY way,
19
+ # give the asset a unique name (such as 'style') and then do something along
20
+ # this way:
21
+ #
22
+ # <link rel="stylesheet"
23
+ # type="text/css"
24
+ # media="screen"
25
+ # href="<%= @assets.find { |a| a.asset_id == 'style' }.path %>">
26
+ class Versioned < Nanoc2::Router
27
+
28
+ identifier :versioned
29
+
30
+ def path_for_page_rep(page_rep)
31
+ # Get data we need
32
+ filename = page_rep.attribute_named(:filename)
33
+ extension = page_rep.attribute_named(:extension)
34
+
35
+ # Initialize path
36
+ path = page_rep.page.path + filename
37
+
38
+ # Add rep name if necessary
39
+ unless page_rep.name == :default
40
+ path += '-' + page_rep.name.to_s
41
+ end
42
+
43
+ # Add extension
44
+ path += '.' + extension
45
+
46
+ # Done
47
+ path
48
+ end
49
+
50
+ def path_for_asset_rep(asset_rep)
51
+ # Get data we need
52
+ extension = asset_rep.attribute_named(:extension)
53
+ modified_path = asset_rep.asset.path[0..-2]
54
+ version = asset_rep.attribute_named(:version)
55
+
56
+ # Initialize path
57
+ assets_prefix = @site.config[:assets_prefix] || '/assets'
58
+ path = assets_prefix + modified_path
59
+
60
+ # Add version if necessary
61
+ unless version.nil?
62
+ path += '-v' + version.to_s
63
+ end
64
+
65
+ # Add rep name
66
+ unless asset_rep.name == :default
67
+ path += '-' + asset_rep.name.to_s
68
+ end
69
+
70
+ # Add extension
71
+ path += '.' + extension
72
+
73
+ # Done
74
+ path
75
+ end
76
+
77
+ end
78
+
79
+ end
metadata ADDED
@@ -0,0 +1,185 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nanoc2
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.2.3
5
+ platform: ruby
6
+ authors:
7
+ - Denis Defreyne
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-02-20 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: a tool that runs on your local computer and compiles Markdown, Textile, Haml, ... documents into static web pages
17
+ email: denis.defreyne@stoneship.org
18
+ executables:
19
+ - nanoc2
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README
24
+ files:
25
+ - README
26
+ - LICENSE
27
+ - ChangeLog
28
+ - Rakefile
29
+ - bin/nanoc2
30
+ - lib/nanoc2/base/asset.rb
31
+ - lib/nanoc2/base/asset_defaults.rb
32
+ - lib/nanoc2/base/asset_rep.rb
33
+ - lib/nanoc2/base/binary_filter.rb
34
+ - lib/nanoc2/base/code.rb
35
+ - lib/nanoc2/base/compiler.rb
36
+ - lib/nanoc2/base/core_ext/hash.rb
37
+ - lib/nanoc2/base/core_ext/string.rb
38
+ - lib/nanoc2/base/core_ext.rb
39
+ - lib/nanoc2/base/data_source.rb
40
+ - lib/nanoc2/base/defaults.rb
41
+ - lib/nanoc2/base/filter.rb
42
+ - lib/nanoc2/base/layout.rb
43
+ - lib/nanoc2/base/notification_center.rb
44
+ - lib/nanoc2/base/page.rb
45
+ - lib/nanoc2/base/page_defaults.rb
46
+ - lib/nanoc2/base/page_rep.rb
47
+ - lib/nanoc2/base/plugin.rb
48
+ - lib/nanoc2/base/proxies/asset_proxy.rb
49
+ - lib/nanoc2/base/proxies/asset_rep_proxy.rb
50
+ - lib/nanoc2/base/proxies/layout_proxy.rb
51
+ - lib/nanoc2/base/proxies/page_proxy.rb
52
+ - lib/nanoc2/base/proxies/page_rep_proxy.rb
53
+ - lib/nanoc2/base/proxies.rb
54
+ - lib/nanoc2/base/proxy.rb
55
+ - lib/nanoc2/base/router.rb
56
+ - lib/nanoc2/base/site.rb
57
+ - lib/nanoc2/base/template.rb
58
+ - lib/nanoc2/base.rb
59
+ - lib/nanoc2/binary_filters/image_science_thumbnail.rb
60
+ - lib/nanoc2/binary_filters.rb
61
+ - lib/nanoc2/cli/base.rb
62
+ - lib/nanoc2/cli/commands/autocompile.rb
63
+ - lib/nanoc2/cli/commands/compile.rb
64
+ - lib/nanoc2/cli/commands/create_layout.rb
65
+ - lib/nanoc2/cli/commands/create_page.rb
66
+ - lib/nanoc2/cli/commands/create_site.rb
67
+ - lib/nanoc2/cli/commands/create_template.rb
68
+ - lib/nanoc2/cli/commands/help.rb
69
+ - lib/nanoc2/cli/commands/info.rb
70
+ - lib/nanoc2/cli/commands/switch.rb
71
+ - lib/nanoc2/cli/commands/update.rb
72
+ - lib/nanoc2/cli/commands.rb
73
+ - lib/nanoc2/cli/logger.rb
74
+ - lib/nanoc2/cli.rb
75
+ - lib/nanoc2/data_sources/filesystem.rb
76
+ - lib/nanoc2/data_sources/filesystem_combined.rb
77
+ - lib/nanoc2/data_sources.rb
78
+ - lib/nanoc2/extra/auto_compiler.rb
79
+ - lib/nanoc2/extra/context.rb
80
+ - lib/nanoc2/extra/core_ext/hash.rb
81
+ - lib/nanoc2/extra/core_ext/time.rb
82
+ - lib/nanoc2/extra/core_ext.rb
83
+ - lib/nanoc2/extra/file_proxy.rb
84
+ - lib/nanoc2/extra/vcs.rb
85
+ - lib/nanoc2/extra/vcses/bazaar.rb
86
+ - lib/nanoc2/extra/vcses/dummy.rb
87
+ - lib/nanoc2/extra/vcses/git.rb
88
+ - lib/nanoc2/extra/vcses/mercurial.rb
89
+ - lib/nanoc2/extra/vcses/subversion.rb
90
+ - lib/nanoc2/extra/vcses.rb
91
+ - lib/nanoc2/extra.rb
92
+ - lib/nanoc2/filters/bluecloth.rb
93
+ - lib/nanoc2/filters/erb.rb
94
+ - lib/nanoc2/filters/erubis.rb
95
+ - lib/nanoc2/filters/haml.rb
96
+ - lib/nanoc2/filters/markaby.rb
97
+ - lib/nanoc2/filters/maruku.rb
98
+ - lib/nanoc2/filters/old.rb
99
+ - lib/nanoc2/filters/rainpress.rb
100
+ - lib/nanoc2/filters/rdiscount.rb
101
+ - lib/nanoc2/filters/rdoc.rb
102
+ - lib/nanoc2/filters/redcloth.rb
103
+ - lib/nanoc2/filters/relativize_paths.rb
104
+ - lib/nanoc2/filters/relativize_paths_in_css.rb
105
+ - lib/nanoc2/filters/relativize_paths_in_html.rb
106
+ - lib/nanoc2/filters/rubypants.rb
107
+ - lib/nanoc2/filters/sass.rb
108
+ - lib/nanoc2/filters.rb
109
+ - lib/nanoc2/helpers/blogging.rb
110
+ - lib/nanoc2/helpers/capturing.rb
111
+ - lib/nanoc2/helpers/filtering.rb
112
+ - lib/nanoc2/helpers/html_escape.rb
113
+ - lib/nanoc2/helpers/link_to.rb
114
+ - lib/nanoc2/helpers/render.rb
115
+ - lib/nanoc2/helpers/tagging.rb
116
+ - lib/nanoc2/helpers/text.rb
117
+ - lib/nanoc2/helpers/xml_sitemap.rb
118
+ - lib/nanoc2/helpers.rb
119
+ - lib/nanoc2/routers/default.rb
120
+ - lib/nanoc2/routers/no_dirs.rb
121
+ - lib/nanoc2/routers/versioned.rb
122
+ - lib/nanoc2/routers.rb
123
+ - lib/nanoc2.rb
124
+ has_rdoc: true
125
+ homepage: http://nanoc.stoneship.org/
126
+ licenses: []
127
+
128
+ post_install_message: |-
129
+ ------------------------------------------------------------------------------
130
+ Thanks for installing nanoc 2.2! Here are some resources to help you get started:
131
+
132
+ * The tutorial at <http://nanoc.stoneship.org/help/tutorial/>
133
+ * The manual at <http://nanoc.stoneship.org/help/manual/>
134
+ * The discussion group at <http://groups.google.com/group/nanoc>
135
+
136
+ Be sure to check out the nanoc blog at <http://nanoc.stoneship.org/blog/> for
137
+ details about this release.
138
+
139
+ Enjoy!
140
+ ------------------------------------------------------------------------------
141
+ rdoc_options:
142
+ - --title
143
+ - nanoc2
144
+ - --main
145
+ - README
146
+ - --charset
147
+ - utf-8
148
+ - --exclude
149
+ - lib/nanoc2/cli/commands
150
+ - --exclude
151
+ - lib/nanoc2/binary_filters
152
+ - --exclude
153
+ - lib/nanoc2/extra/vcses
154
+ - --exclude
155
+ - lib/nanoc2/filters
156
+ - --exclude
157
+ - doc
158
+ - --exclude
159
+ - test
160
+ - --exclude
161
+ - vendor
162
+ - --line-numbers
163
+ require_paths:
164
+ - lib
165
+ required_ruby_version: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ version: 1.8.5
170
+ version:
171
+ required_rubygems_version: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ version: "0"
176
+ version:
177
+ requirements: []
178
+
179
+ rubyforge_project: nanoc
180
+ rubygems_version: 1.3.5
181
+ signing_key:
182
+ specification_version: 3
183
+ summary: a tool that runs on your local computer and compiles Markdown, Textile, Haml, ... documents into static web pages
184
+ test_files: []
185
+