pith 0.4.0 → 0.5.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.
- checksums.yaml +7 -0
- data/README.markdown +1 -1
- data/cucumber.yml +1 -1
- data/features/layouts.feature +7 -7
- data/features/relative_linking.feature +2 -2
- data/features/step_definitions/build_steps.rb +1 -1
- data/features/textile.feature +11 -5
- data/lib/pith/input.rb +1 -0
- data/lib/pith/plugins/compass.rb +1 -1
- data/lib/pith/render_context.rb +0 -3
- data/lib/pith/version.rb +1 -1
- data/spec/pith/config_spec.rb +9 -9
- data/spec/pith/input_spec.rb +17 -9
- data/spec/pith/pathname_ext_spec.rb +5 -5
- data/spec/pith/plugins/publication_spec.rb +7 -7
- data/spec/pith/project_spec.rb +13 -13
- data/spec/pith/server_spec.rb +8 -9
- data/spec/spec_helper.rb +2 -0
- metadata +74 -140
- data/features/content_for.feature~ +0 -29
- data/features/haml.feature~ +0 -24
- data/features/helpers.feature~ +0 -23
- data/features/ignorance.feature~ +0 -37
- data/features/include.feature~ +0 -84
- data/features/incremental_rebuild.feature~ +0 -24
- data/features/layouts.feature~ +0 -63
- data/features/linking.feature~ +0 -79
- data/features/metadata.feature~ +0 -20
- data/features/relative_linking.feature~ +0 -109
- data/features/step_definitions/build_steps.rb~ +0 -66
- data/features/support/env.rb~ +0 -86
- data/features/support/rspec_matchers.rb~ +0 -5
- data/features/textile.feature~ +0 -29
- data/features/verbatim.feature~ +0 -32
- data/lib/pith.rb~ +0 -1
- data/lib/pith/console_logger.rb~ +0 -16
- data/lib/pith/input.rb~ +0 -20
- data/lib/pith/metadata.rb~ +0 -26
- data/lib/pith/pathname_ext.rb~ +0 -16
- data/lib/pith/plugins/publication.rb~ +0 -2
- data/lib/pith/plugins/publication/input.rb~ +0 -50
- data/lib/pith/plugins/publication/project.rb~ +0 -14
- data/lib/pith/project.rb~ +0 -143
- data/lib/pith/reference_error.rb~ +0 -5
- data/lib/pith/render_context.rb~ +0 -117
- data/lib/pith/server.rb~ +0 -46
- data/lib/pith/version.rb~ +0 -3
- data/lib/pith/watcher.rb~ +0 -32
- data/sample/_out/index.html +0 -14
- data/sample/_out/stylesheets/app.css +0 -38
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d871b90920e2e14c3f174e171c276de29b9c090c
|
4
|
+
data.tar.gz: aaf52a3fc9e117cd939d9790d47527ae096e8739
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: '0679d8de13b5441f57b275a5b91b167bc20fa06abddfaa5cefd1bcedb2926764b60dcd03add3175b315b749c0c6017f2fd7eff053f1cf0e5dfc92a6f0e2818a9'
|
7
|
+
data.tar.gz: b3e6e3e839e1e5cca899654aa841b57b454c91dc6b8b5642fd0d00bb7c3cb9f10c1d4ca5ccebbcf5e76b15eee1aa209619a073b7e1577c2d2fd4344f4da5f169
|
data/README.markdown
CHANGED
@@ -214,7 +214,7 @@ For even quicker prototyping, Pith includes a simple HTTP server. Start it by u
|
|
214
214
|
|
215
215
|
Pith will incrementally re-build the site as you browse -- that is, if you alter any input files, Pith will regenerate the affected outputs.
|
216
216
|
|
217
|
-
Add the "`--live`" option to "`serve`" to enable [Live.js][livejs]
|
217
|
+
Add the "`--live`" option to "`serve`" to enable [Live.js][livejs], for live-reloading of HTML, CSS and Javascript.
|
218
218
|
|
219
219
|
Plugins
|
220
220
|
-------
|
data/cucumber.yml
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
default: --tags
|
1
|
+
default: --tags 'not @wip' features
|
2
2
|
wip: --tags @wip:3 --wip features
|
data/features/layouts.feature
CHANGED
@@ -10,13 +10,13 @@ Scenario: Haml template with a layout
|
|
10
10
|
= inside "layouts/_simple.haml" do
|
11
11
|
blah blah
|
12
12
|
"""
|
13
|
-
And input file "layouts/_simple.haml" contains
|
13
|
+
And input file "layouts/_simple.haml" contains
|
14
14
|
"""
|
15
15
|
%p= yield
|
16
16
|
"""
|
17
|
-
|
17
|
+
|
18
18
|
When I build the site
|
19
|
-
Then output file "index.html" should contain
|
19
|
+
Then output file "index.html" should contain
|
20
20
|
"""
|
21
21
|
<p>blah blah</p>
|
22
22
|
"""
|
@@ -34,7 +34,7 @@ Scenario: instance variable assigned within the layed-out block
|
|
34
34
|
%h1= @title
|
35
35
|
= yield
|
36
36
|
"""
|
37
|
-
|
37
|
+
|
38
38
|
When I build the site
|
39
39
|
Then output file "index.html" should contain
|
40
40
|
"""
|
@@ -51,13 +51,13 @@ Scenario: Layout specified in meta-data
|
|
51
51
|
...
|
52
52
|
blah blah
|
53
53
|
"""
|
54
|
-
And input file "layouts/_simple.haml" contains
|
54
|
+
And input file "layouts/_simple.haml" contains
|
55
55
|
"""
|
56
56
|
%p= yield
|
57
57
|
"""
|
58
|
-
|
58
|
+
|
59
59
|
When I build the site
|
60
|
-
Then output file "index.html" should contain
|
60
|
+
Then output file "index.html" should contain
|
61
61
|
"""
|
62
62
|
<p>blah blah</p>
|
63
63
|
"""
|
@@ -68,7 +68,7 @@ Scenario: link to an image
|
|
68
68
|
When I build the site
|
69
69
|
Then output file "subdir/page.html" should contain
|
70
70
|
"""
|
71
|
-
<img src='../logo.png'
|
71
|
+
<img src='../logo.png'>
|
72
72
|
"""
|
73
73
|
|
74
74
|
Scenario: links within a layout block
|
@@ -109,7 +109,7 @@ Scenario: links included from a partial
|
|
109
109
|
When I build the site
|
110
110
|
Then output file "subdir/page.html" should contain
|
111
111
|
"""
|
112
|
-
<link href='../stylesheets/app.css' rel='stylesheet' type='text/css'
|
112
|
+
<link href='../stylesheets/app.css' rel='stylesheet' type='text/css'>
|
113
113
|
"""
|
114
114
|
|
115
115
|
Scenario: use "title" meta-data attribute in link
|
data/features/textile.feature
CHANGED
@@ -2,22 +2,28 @@ Feature: support for Textile markup
|
|
2
2
|
|
3
3
|
I want to use Textile fragments in pages
|
4
4
|
So that I can express content succintly
|
5
|
-
|
5
|
+
|
6
6
|
Scenario: Haml page with embedded Textile
|
7
7
|
|
8
|
+
Given input file "_pith/config.rb" contains
|
9
|
+
"""
|
10
|
+
require 'haml'
|
11
|
+
require 'haml/filters/textile'
|
12
|
+
"""
|
13
|
+
|
8
14
|
Given input file "page.html.haml" contains
|
9
15
|
"""
|
10
16
|
:textile
|
11
17
|
|
12
18
|
A paragraph.
|
13
|
-
|
19
|
+
|
14
20
|
* one
|
15
21
|
* two
|
16
|
-
* three
|
22
|
+
* three
|
17
23
|
"""
|
18
|
-
|
24
|
+
|
19
25
|
When I build the site
|
20
|
-
|
26
|
+
|
21
27
|
Then output file "page.html" should contain
|
22
28
|
"""
|
23
29
|
<p>A paragraph.</p>
|
data/lib/pith/input.rb
CHANGED
@@ -153,6 +153,7 @@ module Pith
|
|
153
153
|
while remaining_path =~ /^(.+)(\..+)$/
|
154
154
|
extension = $2
|
155
155
|
break if extension == ".html" # ignore Tilt::PlainTemplate
|
156
|
+
break if extension == ".rb" # ignore Opal::Processor
|
156
157
|
if handler = Tilt[extension]
|
157
158
|
remaining_path = $1
|
158
159
|
@pipeline << handler
|
data/lib/pith/plugins/compass.rb
CHANGED
data/lib/pith/render_context.rb
CHANGED
data/lib/pith/version.rb
CHANGED
data/spec/pith/config_spec.rb
CHANGED
@@ -8,13 +8,13 @@ describe Pith::Config do
|
|
8
8
|
describe "#ignore_patterns" do
|
9
9
|
|
10
10
|
it "is a set" do
|
11
|
-
config.ignore_patterns.
|
11
|
+
expect(config.ignore_patterns).to be_kind_of(Set)
|
12
12
|
end
|
13
13
|
|
14
14
|
it "includes some sensible defaults" do
|
15
|
-
config.ignore_patterns.
|
16
|
-
config.ignore_patterns.
|
17
|
-
config.ignore_patterns.
|
15
|
+
expect(config.ignore_patterns).to include("_*")
|
16
|
+
expect(config.ignore_patterns).to include(".git")
|
17
|
+
expect(config.ignore_patterns).to include(".svn")
|
18
18
|
end
|
19
19
|
|
20
20
|
end
|
@@ -23,19 +23,19 @@ describe Pith::Config do
|
|
23
23
|
|
24
24
|
it "adds to ignore_patterns" do
|
25
25
|
config.ignore("foo")
|
26
|
-
config.ignore_patterns.
|
26
|
+
expect(config.ignore_patterns).to be_member('foo')
|
27
27
|
end
|
28
28
|
|
29
29
|
it "adds multiple patterns to ignore_patterns (when passed multiple arguments)" do
|
30
30
|
config.ignore("foo", "bar")
|
31
|
-
config.ignore_patterns.
|
32
|
-
config.ignore_patterns.
|
31
|
+
expect(config.ignore_patterns).to be_member('foo')
|
32
|
+
expect(config.ignore_patterns).to be_member('bar')
|
33
33
|
end
|
34
34
|
|
35
35
|
it "adds multiple patterns to ignore_patterns (when passed an array)" do
|
36
36
|
config.ignore(["foo", "bar"])
|
37
|
-
config.ignore_patterns.
|
38
|
-
config.ignore_patterns.
|
37
|
+
expect(config.ignore_patterns).to be_member('foo')
|
38
|
+
expect(config.ignore_patterns).to be_member('bar')
|
39
39
|
end
|
40
40
|
|
41
41
|
end
|
data/spec/pith/input_spec.rb
CHANGED
@@ -24,12 +24,12 @@ describe Pith::Input do
|
|
24
24
|
make_input("dir/some_page.html.md.erb")
|
25
25
|
end
|
26
26
|
|
27
|
-
it {
|
27
|
+
it { is_expected.to be_template }
|
28
28
|
|
29
29
|
describe "#title" do
|
30
30
|
|
31
31
|
it "is based on last component of filename" do
|
32
|
-
subject.title.
|
32
|
+
expect(subject.title).to eq("Some page")
|
33
33
|
end
|
34
34
|
|
35
35
|
it "can be over-ridden in metadata" do
|
@@ -38,7 +38,7 @@ describe Pith::Input do
|
|
38
38
|
i.puts "title: Blah blah"
|
39
39
|
i.puts "..."
|
40
40
|
end
|
41
|
-
input.title.
|
41
|
+
expect(input.title).to eq("Blah blah")
|
42
42
|
end
|
43
43
|
|
44
44
|
end
|
@@ -46,7 +46,7 @@ describe Pith::Input do
|
|
46
46
|
describe "#output" do
|
47
47
|
|
48
48
|
it "returns an Output" do
|
49
|
-
subject.output.
|
49
|
+
expect(subject.output).not_to be_nil
|
50
50
|
end
|
51
51
|
|
52
52
|
end
|
@@ -54,7 +54,7 @@ describe Pith::Input do
|
|
54
54
|
describe "#output_path" do
|
55
55
|
|
56
56
|
it "excludes the template-type extensions" do
|
57
|
-
subject.output_path.
|
57
|
+
expect(subject.output_path).to eq(Pathname("dir/some_page.html"))
|
58
58
|
end
|
59
59
|
|
60
60
|
end
|
@@ -62,7 +62,7 @@ describe Pith::Input do
|
|
62
62
|
describe "#pipeline" do
|
63
63
|
|
64
64
|
it "is a list of Tilt processors" do
|
65
|
-
subject.pipeline.
|
65
|
+
expect(subject.pipeline).to eq([Tilt["erb"], Tilt["md"]])
|
66
66
|
end
|
67
67
|
|
68
68
|
end
|
@@ -75,9 +75,13 @@ describe Pith::Input do
|
|
75
75
|
make_input("dir/some_image.gif")
|
76
76
|
end
|
77
77
|
|
78
|
-
it {
|
78
|
+
it { is_expected.not_to be_template }
|
79
79
|
|
80
|
-
|
80
|
+
describe "pipeline" do
|
81
|
+
it "should be empty" do
|
82
|
+
expect(subject.pipeline).to be_empty
|
83
|
+
end
|
84
|
+
end
|
81
85
|
|
82
86
|
end
|
83
87
|
|
@@ -87,7 +91,11 @@ describe Pith::Input do
|
|
87
91
|
make_input("_blah/blah.de")
|
88
92
|
end
|
89
93
|
|
90
|
-
|
94
|
+
describe "output" do
|
95
|
+
it "should be nil" do
|
96
|
+
expect(subject.output).to be_nil
|
97
|
+
end
|
98
|
+
end
|
91
99
|
|
92
100
|
end
|
93
101
|
|
@@ -8,20 +8,20 @@ describe Pathname do
|
|
8
8
|
describe "#in?" do
|
9
9
|
|
10
10
|
it "returns false for siblings" do
|
11
|
-
pathname.in?("foo/baz").
|
11
|
+
expect(pathname.in?("foo/baz")).to eq(false)
|
12
12
|
end
|
13
13
|
|
14
14
|
it "returns true for ancestors" do
|
15
|
-
pathname.in?("foo").
|
15
|
+
expect(pathname.in?("foo")).to eq(true)
|
16
16
|
end
|
17
17
|
|
18
18
|
it "returns false for other prefixes" do
|
19
|
-
pathname.in?("fo").
|
20
|
-
pathname.in?("foo/b").
|
19
|
+
expect(pathname.in?("fo")).to eq(false)
|
20
|
+
expect(pathname.in?("foo/b")).to eq(false)
|
21
21
|
end
|
22
22
|
|
23
23
|
it "returns false for itself" do
|
24
|
-
pathname.in?("foo/bar").
|
24
|
+
expect(pathname.in?("foo/bar")).to eq(false)
|
25
25
|
end
|
26
26
|
|
27
27
|
end
|
@@ -11,22 +11,22 @@ describe Pith::Plugins::Publication::TemplateMethods do
|
|
11
11
|
describe "#published_at" do
|
12
12
|
|
13
13
|
it "defaults to nil" do
|
14
|
-
@template.published_at.
|
14
|
+
expect(@template.published_at).to be_nil
|
15
15
|
end
|
16
16
|
|
17
17
|
it "is derived by parsing the 'published' meta-field" do
|
18
18
|
@template.meta["published"] = "25 Dec 1999 22:30"
|
19
|
-
@template.published_at.
|
19
|
+
expect(@template.published_at).to eq(Time.local(1999, 12, 25, 22, 30))
|
20
20
|
end
|
21
21
|
|
22
22
|
it "honours any parsing (of Time) that yaml may do on the 'published' meta-field" do
|
23
23
|
@template.meta["published"] = Time.local(1999, 12, 25, 22, 30)
|
24
|
-
@template.published_at.
|
24
|
+
expect(@template.published_at).to eq(Time.local(1999, 12, 25, 22, 30))
|
25
25
|
end
|
26
26
|
|
27
27
|
it "honours any parsing (to Date) of time that yaml may do on the 'published' meta-field" do
|
28
28
|
@template.meta["published"] = Date.new(1999, 12, 25)
|
29
|
-
@template.published_at.
|
29
|
+
expect(@template.published_at).to eq(Time.local(1999, 12, 25))
|
30
30
|
end
|
31
31
|
|
32
32
|
end
|
@@ -35,18 +35,18 @@ describe Pith::Plugins::Publication::TemplateMethods do
|
|
35
35
|
|
36
36
|
it "defaults to #published_at" do
|
37
37
|
@template.meta["published"] = "25 Dec 1999 22:30"
|
38
|
-
@template.updated_at.
|
38
|
+
expect(@template.updated_at).to eq(Time.local(1999, 12, 25, 22, 30))
|
39
39
|
end
|
40
40
|
|
41
41
|
it "can be overridden with an 'updated' meta-field" do
|
42
42
|
@template.meta["published"] = "25 Dec 1999 22:30"
|
43
43
|
@template.meta["updated"] = "1 Jan 2000 03:00"
|
44
|
-
@template.updated_at.
|
44
|
+
expect(@template.updated_at).to eq(Time.local(2000, 1, 1, 3, 0))
|
45
45
|
end
|
46
46
|
|
47
47
|
it "honours any parsing of time that yaml may do on the 'updated' meta-field" do
|
48
48
|
@template.meta["updated"] = Date.new(2000, 1, 1)
|
49
|
-
@template.updated_at.
|
49
|
+
expect(@template.updated_at).to eq(Time.local(2000, 1, 1))
|
50
50
|
end
|
51
51
|
|
52
52
|
end
|
data/spec/pith/project_spec.rb
CHANGED
@@ -14,7 +14,7 @@ describe Pith::Project do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it "creates the output directory" do
|
17
|
-
$output_dir.
|
17
|
+
expect($output_dir).to be_directory
|
18
18
|
end
|
19
19
|
|
20
20
|
end
|
@@ -31,14 +31,14 @@ describe Pith::Project do
|
|
31
31
|
|
32
32
|
it "returns an Input object" do
|
33
33
|
@input = @project.input("input.html.haml")
|
34
|
-
@input.
|
35
|
-
@input.file.
|
34
|
+
expect(@input).to be_kind_of(Pith::Input)
|
35
|
+
expect(@input.file).to eq(@input_file)
|
36
36
|
end
|
37
37
|
|
38
38
|
it "returns the same object the second time" do
|
39
39
|
first_time = @project.input("input.html.haml")
|
40
40
|
second_time = @project.input("input.html.haml")
|
41
|
-
second_time.
|
41
|
+
expect(second_time).to equal(first_time)
|
42
42
|
end
|
43
43
|
|
44
44
|
end
|
@@ -46,7 +46,7 @@ describe Pith::Project do
|
|
46
46
|
describe "(with an invalid input path)" do
|
47
47
|
|
48
48
|
it "returns nil" do
|
49
|
-
@project.input("bogus.path").
|
49
|
+
expect(@project.input("bogus.path")).to be_nil
|
50
50
|
end
|
51
51
|
|
52
52
|
end
|
@@ -66,8 +66,8 @@ describe Pith::Project do
|
|
66
66
|
let(:output) { @project.output("input.html") }
|
67
67
|
|
68
68
|
it "returns the matching Output" do
|
69
|
-
output.
|
70
|
-
output.file.
|
69
|
+
expect(output).to be_kind_of(Pith::Output)
|
70
|
+
expect(output.file).to eq($output_dir + "input.html")
|
71
71
|
end
|
72
72
|
|
73
73
|
end
|
@@ -77,7 +77,7 @@ describe Pith::Project do
|
|
77
77
|
let(:output) { @project.output("bogus.html.haml") }
|
78
78
|
|
79
79
|
it "returns nil" do
|
80
|
-
output.
|
80
|
+
expect(output).to be_nil
|
81
81
|
end
|
82
82
|
|
83
83
|
end
|
@@ -90,26 +90,26 @@ describe Pith::Project do
|
|
90
90
|
@input_file = $input_dir + "input.html.haml"
|
91
91
|
@input_file.touch(Time.now - 10)
|
92
92
|
@project.sync
|
93
|
-
@project.input("input.html.haml").
|
94
|
-
@project.output("input.html").
|
93
|
+
expect(@project.input("input.html.haml")).not_to be_nil
|
94
|
+
expect(@project.output("input.html")).not_to be_nil
|
95
95
|
FileUtils.rm(@input_file)
|
96
96
|
@project.sync
|
97
97
|
end
|
98
98
|
|
99
99
|
describe "#input" do
|
100
100
|
it "returns nil" do
|
101
|
-
@project.input("input.html.haml").
|
101
|
+
expect(@project.input("input.html.haml")).to be_nil
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
105
|
describe "#output" do
|
106
106
|
it "returns nil" do
|
107
|
-
@project.output("input.html").
|
107
|
+
expect(@project.output("input.html")).to be_nil
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
111
|
it "doesn't confuse subsequent calls to #sync" do
|
112
|
-
|
112
|
+
expect { @project.sync }.not_to raise_error
|
113
113
|
end
|
114
114
|
|
115
115
|
end
|