henshin 0.4.2 → 1.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENCE +18 -0
- data/README.md +133 -0
- data/Rakefile +6 -51
- data/bin/henshin +127 -134
- data/lib/henshin.rb +163 -38
- data/lib/henshin/compressor.rb +31 -0
- data/lib/henshin/compressors/css.rb +20 -0
- data/lib/henshin/compressors/js.rb +20 -0
- data/lib/henshin/core_ext.rb +69 -0
- data/lib/henshin/error.rb +28 -0
- data/lib/henshin/file.rb +67 -0
- data/lib/henshin/files/abstract.rb +102 -0
- data/lib/henshin/files/attributes.rb +31 -0
- data/lib/henshin/files/empty_template.rb +24 -0
- data/lib/henshin/files/physical.rb +117 -0
- data/lib/henshin/files/post.rb +64 -0
- data/lib/henshin/files/templatable.rb +29 -0
- data/lib/henshin/files/template.rb +45 -0
- data/lib/henshin/files/tilt.rb +50 -0
- data/lib/henshin/files/tilt_template.rb +45 -0
- data/lib/henshin/package.rb +27 -0
- data/lib/henshin/packages/script.rb +23 -0
- data/lib/henshin/packages/style.rb +20 -0
- data/lib/henshin/path.rb +143 -0
- data/lib/henshin/publisher.rb +42 -0
- data/lib/henshin/publishers/sftp.rb +79 -0
- data/lib/henshin/reader.rb +68 -0
- data/lib/henshin/safety.rb +74 -0
- data/lib/henshin/scope.rb +55 -0
- data/lib/henshin/site.rb +291 -228
- data/lib/henshin/ui.rb +35 -0
- data/lib/henshin/version.rb +3 -0
- data/lib/henshin/writer.rb +43 -0
- data/lib/rack/henshin.rb +113 -0
- data/site/assets/scripts/config.js +11 -0
- data/site/assets/styles/_mixins.sass +16 -0
- data/site/assets/styles/screen.sass +198 -0
- data/site/config.yml +13 -0
- data/site/drafts/a-work-in-progress.md +5 -0
- data/site/feed.xml.slim +19 -0
- data/site/index.html.slim +28 -0
- data/site/init.rb +33 -0
- data/site/posts/1-hello-world.md +46 -0
- data/site/posts/2-code-testing.md +36 -0
- data/site/posts/3-style-test.md +80 -0
- data/site/templates/default.slim +11 -0
- data/site/templates/post.slim +30 -0
- data/site/test.html.md +7 -0
- data/spec/helper.rb +70 -0
- data/spec/henshin/compressor_spec.rb +25 -0
- data/spec/henshin/compressors/css_spec.rb +22 -0
- data/spec/henshin/compressors/js_spec.rb +22 -0
- data/spec/henshin/core_ext_spec.rb +59 -0
- data/spec/henshin/error_spec.rb +22 -0
- data/spec/henshin/file_spec.rb +28 -0
- data/spec/henshin/files/abstract_spec.rb +98 -0
- data/spec/henshin/files/attributes_spec.rb +25 -0
- data/spec/henshin/files/empty_template_spec.rb +11 -0
- data/spec/henshin/files/physical_spec.rb +55 -0
- data/spec/henshin/files/post_spec.rb +66 -0
- data/spec/henshin/files/template_spec.rb +53 -0
- data/spec/henshin/files/tilt_spec.rb +59 -0
- data/spec/henshin/package_spec.rb +24 -0
- data/spec/henshin/packages/script_spec.rb +17 -0
- data/spec/henshin/packages/style_spec.rb +17 -0
- data/spec/henshin/path_spec.rb +56 -0
- data/spec/henshin/publisher_spec.rb +44 -0
- data/spec/henshin/publishers/sftp_spec.rb +21 -0
- data/spec/henshin/reader_spec.rb +55 -0
- data/spec/henshin/safety_spec.rb +66 -0
- data/spec/henshin/scope_spec.rb +33 -0
- data/spec/henshin/site_spec.rb +142 -0
- data/spec/henshin/ui_spec.rb +26 -0
- data/spec/henshin/writer_spec.rb +26 -0
- metadata +352 -197
- data/.gitignore +0 -27
- data/LICENSE +0 -20
- data/README.markdown +0 -35
- data/VERSION +0 -1
- data/henshin.gemspec +0 -121
- data/lib/henshin/archive.rb +0 -133
- data/lib/henshin/exec/files.rb +0 -46
- data/lib/henshin/ext.rb +0 -55
- data/lib/henshin/gen.rb +0 -154
- data/lib/henshin/labels.rb +0 -144
- data/lib/henshin/plugin.rb +0 -100
- data/lib/henshin/plugins/highlight.rb +0 -24
- data/lib/henshin/plugins/liquid.rb +0 -61
- data/lib/henshin/plugins/maruku.rb +0 -18
- data/lib/henshin/plugins/sass.rb +0 -24
- data/lib/henshin/plugins/textile.rb +0 -18
- data/lib/henshin/post.rb +0 -156
- data/lib/henshin/static.rb +0 -33
- data/test/helper.rb +0 -44
- data/test/site/css/_reset.sass +0 -34
- data/test/site/css/print.css +0 -12
- data/test/site/css/screen.sass +0 -70
- data/test/site/includes/head.html +0 -1
- data/test/site/index.html +0 -23
- data/test/site/layouts/archive_date.html +0 -20
- data/test/site/layouts/archive_month.html +0 -24
- data/test/site/layouts/archive_year.html +0 -26
- data/test/site/layouts/category_index.html +0 -27
- data/test/site/layouts/category_page.html +0 -20
- data/test/site/layouts/main.html +0 -13
- data/test/site/layouts/post.html +0 -36
- data/test/site/layouts/tag_index.html +0 -27
- data/test/site/layouts/tag_page.html +0 -20
- data/test/site/options.yaml +0 -17
- data/test/site/plugins/test.rb +0 -3
- data/test/site/posts/Testing-Stuff.markdown +0 -14
- data/test/site/posts/Textile-Test.textile +0 -7
- data/test/site/posts/cat/test.markdown +0 -6
- data/test/site/posts/lorem-ipsum.markdown +0 -7
- data/test/site/posts/same-date.markdown +0 -7
- data/test/site/static.html +0 -19
- data/test/suite.rb +0 -4
- data/test/test_gen.rb +0 -98
- data/test/test_options.rb +0 -73
- data/test/test_post.rb +0 -67
- data/test/test_site.rb +0 -197
- data/test/test_static.rb +0 -13
data/test/test_post.rb
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__) ,'helper')
|
2
|
-
|
3
|
-
class TestPost < Test::Unit::TestCase
|
4
|
-
context "A post" do
|
5
|
-
|
6
|
-
setup do
|
7
|
-
@site = Henshin::Site.new(site_override)
|
8
|
-
@post = "#{root_dir}/posts/lorem-ipsum.markdown"
|
9
|
-
@post_with_date = "#{root_dir}/posts/2010-08-10-lorem-ipsum.markdown"
|
10
|
-
remove_site
|
11
|
-
end
|
12
|
-
|
13
|
-
should "get data from filename" do
|
14
|
-
site = @site.dup
|
15
|
-
site.config['file_name'] = "{date}-{title-with-dashes}.{extension}"
|
16
|
-
post = Henshin::Post.new(@post_with_date.to_p, site)
|
17
|
-
post.read_name
|
18
|
-
assert_equal 'Lorem Ipsum', post.data['title']
|
19
|
-
assert_equal '2010-08-10', post.data['date']
|
20
|
-
assert_equal 'markdown', post.data['input']
|
21
|
-
end
|
22
|
-
|
23
|
-
should "turn date to Time object" do
|
24
|
-
post = Henshin::Post.new(@post.to_p, @site)
|
25
|
-
post.read
|
26
|
-
assert post.data['date'].is_a? Time
|
27
|
-
end
|
28
|
-
|
29
|
-
should "get next post" do
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
should "get previous post" do
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
should "have correct permalink" do
|
38
|
-
site = @site.dup
|
39
|
-
site.config['file_name'] = "{date}-{title-with-dashes}.{extension}"
|
40
|
-
post = Henshin::Post.new(@post_with_date.to_p, @site)
|
41
|
-
post.read
|
42
|
-
assert_equal '/2010/8/10/lorem-ipsum/index.html', post.permalink
|
43
|
-
end
|
44
|
-
|
45
|
-
should "have correct url" do
|
46
|
-
site = @site.dup
|
47
|
-
site.config['file_name'] = "{date}-{title-with-dashes}.{extension}"
|
48
|
-
post = Henshin::Post.new(@post_with_date.to_p, @site)
|
49
|
-
post.read
|
50
|
-
assert_equal '/2010/8/10/lorem-ipsum', post.url
|
51
|
-
end
|
52
|
-
|
53
|
-
should "be written to the correct place" do
|
54
|
-
site = @site.dup
|
55
|
-
site.config['file_name'] = "{date}-{title-with-dashes}.{extension}"
|
56
|
-
post = Henshin::Post.new(@post_with_date.to_p, @site)
|
57
|
-
post.read
|
58
|
-
path = Pathname.new("#{root_dir}/_site/2010/8/10/lorem-ipsum/index.html")
|
59
|
-
assert_equal path, post.write_path
|
60
|
-
end
|
61
|
-
|
62
|
-
should "be sortable" do
|
63
|
-
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|
67
|
-
end
|
data/test/test_site.rb
DELETED
@@ -1,197 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__) ,'helper')
|
2
|
-
|
3
|
-
class TestSite < Test::Unit::TestCase
|
4
|
-
context "A new site" do
|
5
|
-
|
6
|
-
should "reset data" do
|
7
|
-
site = new_site
|
8
|
-
site.reset
|
9
|
-
assert_equal [], site.posts
|
10
|
-
assert_equal [], site.gens
|
11
|
-
assert_equal [], site.statics
|
12
|
-
assert_equal Hash.new, site.layouts
|
13
|
-
assert site.archive.size.zero?
|
14
|
-
assert site.tags.size.zero?
|
15
|
-
assert site.categories.size.zero?
|
16
|
-
end
|
17
|
-
|
18
|
-
should "load and sort plugins" do
|
19
|
-
site = new_site
|
20
|
-
|
21
|
-
site.plugins[:generators].each_value do |i|
|
22
|
-
assert_is_a Henshin::Generator, i
|
23
|
-
end
|
24
|
-
|
25
|
-
site.plugins[:layoutors].each do |i|
|
26
|
-
assert_is_a Henshin::Layoutor, i
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
|
33
|
-
context "Reading site" do
|
34
|
-
|
35
|
-
should "read layouts" do
|
36
|
-
site = new_site
|
37
|
-
site.read_layouts
|
38
|
-
l = Dir.glob( File.join(root_dir, 'layouts', '*.*') )
|
39
|
-
assert_equal l.size, site.layouts.size
|
40
|
-
end
|
41
|
-
|
42
|
-
should "read layouts first" do
|
43
|
-
site = new_site
|
44
|
-
site.read
|
45
|
-
if mock.instance_of(Henshin::Site).read_posts
|
46
|
-
assert site.layouts.size > 0
|
47
|
-
end
|
48
|
-
if mock.instance_of(Henshin::Site).read_gens
|
49
|
-
assert site.layouts.size > 0
|
50
|
-
end
|
51
|
-
if mock.instance_of(Henshin::Site).read_statics
|
52
|
-
assert site.layouts.size > 0
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
should "read posts" do
|
57
|
-
site = new_site
|
58
|
-
site.read_posts
|
59
|
-
p = Dir.glob( File.join(root_dir, 'posts', '**', '*.*') )
|
60
|
-
assert_equal p.size, site.posts.size
|
61
|
-
end
|
62
|
-
|
63
|
-
should "read gens" do
|
64
|
-
site = new_site
|
65
|
-
site.read_gens
|
66
|
-
# For reference these are the gens
|
67
|
-
# /css/print.sass
|
68
|
-
# /index.html
|
69
|
-
assert_equal 2, site.gens.size
|
70
|
-
end
|
71
|
-
|
72
|
-
should "read statics" do
|
73
|
-
site = new_site
|
74
|
-
site.read_statics
|
75
|
-
# For reference these are the static files:
|
76
|
-
# /css/screen.css
|
77
|
-
# /static.html
|
78
|
-
assert_equal 2, site.statics.size
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|
82
|
-
|
83
|
-
context "Processing site" do
|
84
|
-
|
85
|
-
should "process posts" do
|
86
|
-
site = new_site
|
87
|
-
site.read
|
88
|
-
site2 = new_site
|
89
|
-
site2.read.process
|
90
|
-
assert_not_equal site.posts, site2.posts
|
91
|
-
end
|
92
|
-
|
93
|
-
should "process gens" do
|
94
|
-
site = new_site
|
95
|
-
site.read
|
96
|
-
site2 = new_site
|
97
|
-
site2.read.process
|
98
|
-
assert_not_equal site.gens, site2.gens
|
99
|
-
end
|
100
|
-
|
101
|
-
should "sort posts" do
|
102
|
-
site = new_site
|
103
|
-
site.read.process
|
104
|
-
assert_equal site.posts, site.posts.sort
|
105
|
-
end
|
106
|
-
|
107
|
-
should "sort gens" do
|
108
|
-
site = new_site
|
109
|
-
site.read.process
|
110
|
-
assert_equal site.gens, site.gens.sort
|
111
|
-
end
|
112
|
-
|
113
|
-
should "build tags array" do
|
114
|
-
site = new_site
|
115
|
-
site.read.process
|
116
|
-
# For reference these are the tags:
|
117
|
-
# test: lorem-ipsum.markdown, same-date.markdown, Testing-Stuff.markdown, Textile-Test.textile
|
118
|
-
# markdown: Testing-Stuff.markdown
|
119
|
-
# lorem: lorem-ipsum.markdown, same-date.markdown
|
120
|
-
# plugin: Textile-Test.textile
|
121
|
-
assert_equal 4, site.tags.size
|
122
|
-
assert site.tags[0].is_a? Henshin::Label
|
123
|
-
assert_equal 'tag', site.tags.base
|
124
|
-
end
|
125
|
-
|
126
|
-
should "build categories array" do
|
127
|
-
site = new_site
|
128
|
-
site.read.process
|
129
|
-
# For reference these are the categories:
|
130
|
-
# cat: cat/test.markdown
|
131
|
-
# test: Testing-Stuff.markdown
|
132
|
-
assert_equal 2, site.categories.size
|
133
|
-
assert site.categories[0].is_a? Henshin::Label
|
134
|
-
assert_equal 'category', site.categories.base
|
135
|
-
end
|
136
|
-
|
137
|
-
should "build archives" do
|
138
|
-
site = new_site
|
139
|
-
site.read.process
|
140
|
-
assert site.archive.size > 0
|
141
|
-
end
|
142
|
-
|
143
|
-
end
|
144
|
-
|
145
|
-
context "Rendering site" do
|
146
|
-
|
147
|
-
should "render posts" do
|
148
|
-
site = new_site.read.process
|
149
|
-
site2 = new_site.read.process.render
|
150
|
-
assert_not_equal site.posts, site2.posts
|
151
|
-
end
|
152
|
-
|
153
|
-
should "render gens" do
|
154
|
-
site = new_site.read.process
|
155
|
-
site2 = new_site.read.process.render
|
156
|
-
assert_not_equal site.gens, site2.gens
|
157
|
-
end
|
158
|
-
|
159
|
-
should "not render statics" do
|
160
|
-
site = new_site
|
161
|
-
site.read.process
|
162
|
-
site2 = new_site
|
163
|
-
site2.read.process.render
|
164
|
-
assert_equal site.statics[0].content, site2.statics[0].content
|
165
|
-
end
|
166
|
-
|
167
|
-
end
|
168
|
-
|
169
|
-
context "Writing site" do
|
170
|
-
|
171
|
-
should "write posts" do
|
172
|
-
|
173
|
-
end
|
174
|
-
|
175
|
-
should "write gens" do
|
176
|
-
|
177
|
-
end
|
178
|
-
|
179
|
-
should "write statics" do
|
180
|
-
|
181
|
-
end
|
182
|
-
|
183
|
-
should "write tags" do
|
184
|
-
|
185
|
-
end
|
186
|
-
|
187
|
-
should "write categories" do
|
188
|
-
|
189
|
-
end
|
190
|
-
|
191
|
-
should "write archive" do
|
192
|
-
|
193
|
-
end
|
194
|
-
|
195
|
-
end
|
196
|
-
|
197
|
-
end
|
data/test/test_static.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__) ,'helper')
|
2
|
-
|
3
|
-
class TestStatic < Test::Unit::TestCase
|
4
|
-
context "A static" do
|
5
|
-
|
6
|
-
should "be written to the same relative path" do
|
7
|
-
site = new_site
|
8
|
-
stat = Henshin::Static.new(site.root + "static.html", site)
|
9
|
-
assert_equal Pathname.new("#{target_dir}/static.html"), stat.write_path
|
10
|
-
end
|
11
|
-
|
12
|
-
end
|
13
|
-
end
|