pith 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/pith +6 -5
- data/features/error_handling.feature +5 -4
- data/features/step_definitions/build_steps.rb +4 -0
- data/lib/pith/input.rb +215 -11
- data/lib/pith/plugins/publication/input.rb +2 -14
- data/lib/pith/project.rb +26 -19
- data/lib/pith/version.rb +1 -1
- data/spec/pith/{input/template_spec.rb~ → input_spec.rb} +15 -28
- data/spec/pith/project_spec.rb +14 -29
- metadata +28 -41
- data/lib/pith/exception_ext.rb +0 -9
- data/lib/pith/input/abstract.rb +0 -78
- data/lib/pith/input/abstract.rb~ +0 -74
- data/lib/pith/input/base.rb~ +0 -74
- data/lib/pith/input/resource.rb +0 -39
- data/lib/pith/input/resource.rb~ +0 -41
- data/lib/pith/input/template.rb +0 -159
- data/lib/pith/input/template.rb~ +0 -126
- data/lib/pith/input/verbatim.rb~ +0 -31
- data/spec/pith/input/abstract_spec.rb~ +0 -31
- data/spec/pith/input/template_spec.rb +0 -70
data/lib/pith/version.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require "pith/input
|
2
|
+
require "pith/input"
|
3
3
|
require "pith/project"
|
4
4
|
|
5
|
-
describe Pith::Input
|
5
|
+
describe Pith::Input do
|
6
6
|
|
7
7
|
before do
|
8
8
|
$input_dir.mkpath
|
@@ -17,31 +17,9 @@ describe Pith::Input::Template do
|
|
17
17
|
end
|
18
18
|
@project.input(path)
|
19
19
|
end
|
20
|
-
|
21
|
-
describe ".can_handle?" do
|
22
|
-
|
23
|
-
it "returns true for template paths" do
|
24
|
-
Pith::Input::Template.can_handle?("xyz.html.haml").should be_true
|
25
|
-
Pith::Input::Template.can_handle?("xyz.html.md").should be_true
|
26
|
-
end
|
27
|
-
|
28
|
-
it "handles directories" do
|
29
|
-
Pith::Input::Template.can_handle?("dir/xyz.haml").should be_true
|
30
|
-
end
|
31
|
-
|
32
|
-
it "accepts Pathname objects" do
|
33
|
-
Pith::Input::Template.can_handle?(Pathname("xyz.html.haml")).should be_true
|
34
|
-
end
|
35
20
|
|
36
|
-
it "returns false for non-template paths" do
|
37
|
-
Pith::Input::Template.can_handle?("foo.html").should be_false
|
38
|
-
Pith::Input::Template.can_handle?("foo").should be_false
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
21
|
describe "#title" do
|
44
|
-
|
22
|
+
|
45
23
|
it "is based on last component of filename" do
|
46
24
|
@input = make_input("dir/some_page.html.haml")
|
47
25
|
@input.title.should == "Some page"
|
@@ -55,16 +33,25 @@ describe Pith::Input::Template do
|
|
55
33
|
end
|
56
34
|
@input.title.should == "Blah blah"
|
57
35
|
end
|
58
|
-
|
36
|
+
|
59
37
|
end
|
60
38
|
|
61
39
|
describe "#output_path" do
|
62
|
-
|
40
|
+
|
63
41
|
it "excludes the template-type extension" do
|
64
42
|
@input = make_input("dir/some_page.html.haml")
|
65
43
|
@input.output_path.should == Pathname("dir/some_page.html")
|
66
44
|
end
|
67
|
-
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "#pipeline" do
|
49
|
+
|
50
|
+
it "is a list of Tilt processors" do
|
51
|
+
@input = make_input("dir/some_page.html.haml")
|
52
|
+
@input.pipeline.should == [Tilt["haml"]]
|
53
|
+
end
|
54
|
+
|
68
55
|
end
|
69
56
|
|
70
57
|
end
|
data/spec/pith/project_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
require 'pith/project'
|
3
3
|
|
4
4
|
describe Pith::Project do
|
5
|
-
|
5
|
+
|
6
6
|
before do
|
7
7
|
$input_dir.mkpath
|
8
8
|
@project = Pith::Project.new(:input_dir => $input_dir)
|
@@ -10,21 +10,6 @@ describe Pith::Project do
|
|
10
10
|
|
11
11
|
describe "#input" do
|
12
12
|
|
13
|
-
describe "(with a non-template input path)" do
|
14
|
-
|
15
|
-
before do
|
16
|
-
@input_file = $input_dir + "input.txt"
|
17
|
-
@input_file.touch
|
18
|
-
end
|
19
|
-
|
20
|
-
it "constructs an Resource object" do
|
21
|
-
@input = @project.input("input.txt")
|
22
|
-
@input.should be_kind_of(Pith::Input::Resource)
|
23
|
-
@input.file.should == @input_file
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
13
|
describe "(with a template input path)" do
|
29
14
|
|
30
15
|
before do
|
@@ -32,37 +17,37 @@ describe Pith::Project do
|
|
32
17
|
@input_file.touch
|
33
18
|
end
|
34
19
|
|
35
|
-
it "constructs an
|
20
|
+
it "constructs an Input object" do
|
36
21
|
@input = @project.input("input.html.haml")
|
37
|
-
@input.should be_kind_of(Pith::Input
|
22
|
+
@input.should be_kind_of(Pith::Input)
|
38
23
|
@input.file.should == @input_file
|
39
24
|
end
|
40
|
-
|
25
|
+
|
41
26
|
end
|
42
27
|
|
43
|
-
describe "(with a template
|
44
|
-
|
28
|
+
describe "(with a template output path)" do
|
29
|
+
|
45
30
|
before do
|
46
31
|
@input_file = $input_dir + "input.html.haml"
|
47
32
|
@input_file.touch
|
48
33
|
end
|
49
34
|
|
50
|
-
it "can also be used to locate the
|
35
|
+
it "can also be used to locate the Input" do
|
51
36
|
@project.input("input.html").should == @project.input("input.html.haml")
|
52
37
|
end
|
53
|
-
|
38
|
+
|
54
39
|
end
|
55
40
|
|
56
41
|
describe "(with an invalid input path)" do
|
57
|
-
|
42
|
+
|
58
43
|
it "returns nil" do
|
59
44
|
@project.input("bogus.path").should be_nil
|
60
45
|
end
|
61
|
-
|
46
|
+
|
62
47
|
end
|
63
|
-
|
48
|
+
|
64
49
|
end
|
65
|
-
|
50
|
+
|
66
51
|
describe "when an input file is unchanged" do
|
67
52
|
|
68
53
|
before do
|
@@ -92,7 +77,7 @@ describe Pith::Project do
|
|
92
77
|
@input_file.touch(Time.now - 10)
|
93
78
|
end
|
94
79
|
|
95
|
-
describe "a second call to #input" do
|
80
|
+
describe "a second call to #input" do
|
96
81
|
it "returns a different Input object" do
|
97
82
|
|
98
83
|
first_time = @project.input("input.html.haml")
|
@@ -117,7 +102,7 @@ describe Pith::Project do
|
|
117
102
|
@input_file.touch(Time.now - 10)
|
118
103
|
end
|
119
104
|
|
120
|
-
describe "a second call to #input" do
|
105
|
+
describe "a second call to #input" do
|
121
106
|
it "returns nil" do
|
122
107
|
|
123
108
|
first_time = @project.input("input.html.haml")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pith
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-10-
|
12
|
+
date: 2011-10-10 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: tilt
|
16
|
-
requirement: &
|
16
|
+
requirement: &70152548570880 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '1.1'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70152548570880
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: adsf
|
27
|
-
requirement: &
|
27
|
+
requirement: &70152548570160 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.0.1
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70152548570160
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rack
|
38
|
-
requirement: &
|
38
|
+
requirement: &70152548569500 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.2.1
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70152548569500
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: thin
|
49
|
-
requirement: &
|
49
|
+
requirement: &70152548568780 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.2.7
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70152548568780
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: clamp
|
60
|
-
requirement: &
|
60
|
+
requirement: &70152548568040 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 0.1.7
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70152548568040
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
|
-
requirement: &
|
71
|
+
requirement: &70152548567460 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70152548567460
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rspec
|
82
|
-
requirement: &
|
82
|
+
requirement: &70152548551340 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 1.2.9
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70152548551340
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: cucumber
|
93
|
-
requirement: &
|
93
|
+
requirement: &70152548550740 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: 0.8.3
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70152548550740
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: haml
|
104
|
-
requirement: &
|
104
|
+
requirement: &70152548550260 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70152548550260
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: RedCloth
|
115
|
-
requirement: &
|
115
|
+
requirement: &70152548549740 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ! '>='
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: '0'
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *70152548549740
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: rdiscount
|
126
|
-
requirement: &
|
126
|
+
requirement: &70152548549320 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ! '>='
|
@@ -131,7 +131,7 @@ dependencies:
|
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *70152548549320
|
135
135
|
description: ! 'Pith builds static websites, using markup/template languages including
|
136
136
|
Haml, Sass, ERb, Liquid, Markdown and Textile.
|
137
137
|
|
@@ -144,15 +144,6 @@ extra_rdoc_files: []
|
|
144
144
|
files:
|
145
145
|
- lib/pith/console_logger.rb
|
146
146
|
- lib/pith/console_logger.rb~
|
147
|
-
- lib/pith/exception_ext.rb
|
148
|
-
- lib/pith/input/abstract.rb
|
149
|
-
- lib/pith/input/abstract.rb~
|
150
|
-
- lib/pith/input/base.rb~
|
151
|
-
- lib/pith/input/resource.rb
|
152
|
-
- lib/pith/input/resource.rb~
|
153
|
-
- lib/pith/input/template.rb
|
154
|
-
- lib/pith/input/template.rb~
|
155
|
-
- lib/pith/input/verbatim.rb~
|
156
147
|
- lib/pith/input.rb
|
157
148
|
- lib/pith/input.rb~
|
158
149
|
- lib/pith/metadata.rb~
|
@@ -185,9 +176,7 @@ files:
|
|
185
176
|
- sample/stylesheets/app.css.sass
|
186
177
|
- README.markdown
|
187
178
|
- Rakefile
|
188
|
-
- spec/pith/
|
189
|
-
- spec/pith/input/template_spec.rb
|
190
|
-
- spec/pith/input/template_spec.rb~
|
179
|
+
- spec/pith/input_spec.rb
|
191
180
|
- spec/pith/metadata_spec.rb~
|
192
181
|
- spec/pith/plugins/publication_spec.rb
|
193
182
|
- spec/pith/plugins/publication_spec.rb~
|
@@ -244,7 +233,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
244
233
|
version: '0'
|
245
234
|
segments:
|
246
235
|
- 0
|
247
|
-
hash: -
|
236
|
+
hash: -3377947525028361057
|
248
237
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
249
238
|
none: false
|
250
239
|
requirements:
|
@@ -253,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
253
242
|
version: '0'
|
254
243
|
segments:
|
255
244
|
- 0
|
256
|
-
hash: -
|
245
|
+
hash: -3377947525028361057
|
257
246
|
requirements: []
|
258
247
|
rubyforge_project:
|
259
248
|
rubygems_version: 1.8.10
|
@@ -262,9 +251,7 @@ specification_version: 3
|
|
262
251
|
summary: A static website generator
|
263
252
|
test_files:
|
264
253
|
- Rakefile
|
265
|
-
- spec/pith/
|
266
|
-
- spec/pith/input/template_spec.rb
|
267
|
-
- spec/pith/input/template_spec.rb~
|
254
|
+
- spec/pith/input_spec.rb
|
268
255
|
- spec/pith/metadata_spec.rb~
|
269
256
|
- spec/pith/plugins/publication_spec.rb
|
270
257
|
- spec/pith/plugins/publication_spec.rb~
|
data/lib/pith/exception_ext.rb
DELETED
data/lib/pith/input/abstract.rb
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
require "pathname"
|
2
|
-
|
3
|
-
module Pith
|
4
|
-
module Input
|
5
|
-
|
6
|
-
class Abstract
|
7
|
-
|
8
|
-
def initialize(project, path)
|
9
|
-
@project = project
|
10
|
-
@path = path
|
11
|
-
end
|
12
|
-
|
13
|
-
attr_reader :project, :path
|
14
|
-
|
15
|
-
# Public: Get the file-system location of this input.
|
16
|
-
#
|
17
|
-
# Returns a fully-qualified Pathname.
|
18
|
-
#
|
19
|
-
def file
|
20
|
-
project.input_dir + path
|
21
|
-
end
|
22
|
-
|
23
|
-
# Public: Get the file-system location of the corresponding output file.
|
24
|
-
#
|
25
|
-
# Returns a fully-qualified Pathname.
|
26
|
-
#
|
27
|
-
def output_file
|
28
|
-
project.output_dir + output_path
|
29
|
-
end
|
30
|
-
|
31
|
-
# Public: Generate an output file.
|
32
|
-
#
|
33
|
-
def build
|
34
|
-
return false if ignorable? || uptodate?
|
35
|
-
logger.info("--> #{output_path}")
|
36
|
-
generate_output
|
37
|
-
end
|
38
|
-
|
39
|
-
# Public: Resolve a reference relative to this input.
|
40
|
-
#
|
41
|
-
# ref - a String referencing another asset
|
42
|
-
#
|
43
|
-
# A ref starting with "/" is resolved relative to the project root;
|
44
|
-
# anything else is resolved relative to this input.
|
45
|
-
#
|
46
|
-
# Returns a fully-qualified Pathname of the asset.
|
47
|
-
#
|
48
|
-
def resolve_path(ref)
|
49
|
-
ref = ref.to_s
|
50
|
-
if ref[0,1] == "/"
|
51
|
-
Pathname(ref[1..-1])
|
52
|
-
else
|
53
|
-
path.parent + ref
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
# Consider whether this input can be ignored.
|
58
|
-
#
|
59
|
-
# Returns true if it can.
|
60
|
-
#
|
61
|
-
def ignorable?
|
62
|
-
path.each_filename do |path_component|
|
63
|
-
project.ignore_patterns.each do |pattern|
|
64
|
-
return true if File.fnmatch(pattern, path_component)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
protected
|
70
|
-
|
71
|
-
def logger
|
72
|
-
project.logger
|
73
|
-
end
|
74
|
-
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|
78
|
-
end
|