pith 0.2.0 → 0.2.1
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.
- 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/input/verbatim.rb~
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
require "fileutils"
|
2
|
-
require "pith/input/abstract"
|
3
|
-
|
4
|
-
module Pith
|
5
|
-
module Input
|
6
|
-
|
7
|
-
class Verbatim < Abstract
|
8
|
-
|
9
|
-
def output_path
|
10
|
-
path
|
11
|
-
end
|
12
|
-
|
13
|
-
def type
|
14
|
-
"copy"
|
15
|
-
end
|
16
|
-
|
17
|
-
def uptodate?
|
18
|
-
FileUtils.uptodate?(output_file, [file])
|
19
|
-
end
|
20
|
-
|
21
|
-
# Copy this input verbatim into the output directory
|
22
|
-
#
|
23
|
-
def generate_output
|
24
|
-
output_file.parent.mkpath
|
25
|
-
FileUtils.copy(file, output_file)
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require "pith/input/abstract"
|
3
|
-
require "pith/project"
|
4
|
-
|
5
|
-
describe Pith::Input::Abstract do
|
6
|
-
|
7
|
-
before do
|
8
|
-
$input_dir.mkpath
|
9
|
-
@project = Pith::Project.new(:input_dir => $input_dir)
|
10
|
-
@input_file = $input_dir + "some_page.html.haml"
|
11
|
-
@input_file.touch
|
12
|
-
end
|
13
|
-
|
14
|
-
describe "#title" do
|
15
|
-
|
16
|
-
it "is based on last component of filename" do
|
17
|
-
@project.input("some_page.html").title.should == "Some page"
|
18
|
-
end
|
19
|
-
|
20
|
-
it "can be over-ridden in metadata" do
|
21
|
-
@input_file.open("w") do |i|
|
22
|
-
i.puts "---"
|
23
|
-
i.puts "title: Blah blah"
|
24
|
-
i.puts "..."
|
25
|
-
end
|
26
|
-
@project.input("some_page.html").title.should == "Blah blah"
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require "pith/input/abstract"
|
3
|
-
require "pith/project"
|
4
|
-
|
5
|
-
describe Pith::Input::Template do
|
6
|
-
|
7
|
-
before do
|
8
|
-
$input_dir.mkpath
|
9
|
-
@project = Pith::Project.new(:input_dir => $input_dir)
|
10
|
-
end
|
11
|
-
|
12
|
-
def make_input(path)
|
13
|
-
input_file = $input_dir + path
|
14
|
-
input_file.parent.mkpath
|
15
|
-
input_file.open("w") do |io|
|
16
|
-
yield io if block_given?
|
17
|
-
end
|
18
|
-
@project.input(path)
|
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
|
-
|
36
|
-
it "returns false for non-template paths" do
|
37
|
-
Pith::Input::Template.can_handle?("foo.html").should_not be_true
|
38
|
-
Pith::Input::Template.can_handle?("foo").should_not be_true
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
describe "#title" do
|
44
|
-
|
45
|
-
it "is based on last component of filename" do
|
46
|
-
@input = make_input("dir/some_page.html.haml")
|
47
|
-
@input.title.should == "Some page"
|
48
|
-
end
|
49
|
-
|
50
|
-
it "can be over-ridden in metadata" do
|
51
|
-
@input = make_input("dir/some_page.html.haml") do |i|
|
52
|
-
i.puts "---"
|
53
|
-
i.puts "title: Blah blah"
|
54
|
-
i.puts "..."
|
55
|
-
end
|
56
|
-
@input.title.should == "Blah blah"
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
|
-
describe "#output_path" do
|
62
|
-
|
63
|
-
it "excludes the template-type extension" do
|
64
|
-
@input = make_input("dir/some_page.html.haml")
|
65
|
-
@input.output_path.should == Pathname("dir/some_page.html")
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|