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.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/README.markdown +1 -1
  3. data/cucumber.yml +1 -1
  4. data/features/layouts.feature +7 -7
  5. data/features/relative_linking.feature +2 -2
  6. data/features/step_definitions/build_steps.rb +1 -1
  7. data/features/textile.feature +11 -5
  8. data/lib/pith/input.rb +1 -0
  9. data/lib/pith/plugins/compass.rb +1 -1
  10. data/lib/pith/render_context.rb +0 -3
  11. data/lib/pith/version.rb +1 -1
  12. data/spec/pith/config_spec.rb +9 -9
  13. data/spec/pith/input_spec.rb +17 -9
  14. data/spec/pith/pathname_ext_spec.rb +5 -5
  15. data/spec/pith/plugins/publication_spec.rb +7 -7
  16. data/spec/pith/project_spec.rb +13 -13
  17. data/spec/pith/server_spec.rb +8 -9
  18. data/spec/spec_helper.rb +2 -0
  19. metadata +74 -140
  20. data/features/content_for.feature~ +0 -29
  21. data/features/haml.feature~ +0 -24
  22. data/features/helpers.feature~ +0 -23
  23. data/features/ignorance.feature~ +0 -37
  24. data/features/include.feature~ +0 -84
  25. data/features/incremental_rebuild.feature~ +0 -24
  26. data/features/layouts.feature~ +0 -63
  27. data/features/linking.feature~ +0 -79
  28. data/features/metadata.feature~ +0 -20
  29. data/features/relative_linking.feature~ +0 -109
  30. data/features/step_definitions/build_steps.rb~ +0 -66
  31. data/features/support/env.rb~ +0 -86
  32. data/features/support/rspec_matchers.rb~ +0 -5
  33. data/features/textile.feature~ +0 -29
  34. data/features/verbatim.feature~ +0 -32
  35. data/lib/pith.rb~ +0 -1
  36. data/lib/pith/console_logger.rb~ +0 -16
  37. data/lib/pith/input.rb~ +0 -20
  38. data/lib/pith/metadata.rb~ +0 -26
  39. data/lib/pith/pathname_ext.rb~ +0 -16
  40. data/lib/pith/plugins/publication.rb~ +0 -2
  41. data/lib/pith/plugins/publication/input.rb~ +0 -50
  42. data/lib/pith/plugins/publication/project.rb~ +0 -14
  43. data/lib/pith/project.rb~ +0 -143
  44. data/lib/pith/reference_error.rb~ +0 -5
  45. data/lib/pith/render_context.rb~ +0 -117
  46. data/lib/pith/server.rb~ +0 -46
  47. data/lib/pith/version.rb~ +0 -3
  48. data/lib/pith/watcher.rb~ +0 -32
  49. data/sample/_out/index.html +0 -14
  50. 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]), for live-reloading of HTML, CSS and Javascript.
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 ~@wip features
1
+ default: --tags 'not @wip' features
2
2
  wip: --tags @wip:3 --wip features
@@ -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
@@ -41,7 +41,7 @@ end
41
41
 
42
42
  class String
43
43
  def clean
44
- strip.gsub(/\s+/, ' ')
44
+ strip.gsub(/\s+/, ' ').gsub(' <', '<')
45
45
  end
46
46
  end
47
47
 
@@ -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
@@ -1,5 +1,5 @@
1
1
  require "compass"
2
- require "tilt/css"
2
+ require "tilt/sass"
3
3
 
4
4
  module Pith
5
5
  module Compass
@@ -2,14 +2,11 @@ require "ostruct"
2
2
  require "pathname"
3
3
  require "pith/reference_error"
4
4
  require "set"
5
- require "tilt"
6
5
 
7
6
  module Pith
8
7
 
9
8
  class RenderContext
10
9
 
11
- include Tilt::CompileSite
12
-
13
10
  def initialize(output)
14
11
  @output = output
15
12
  @page = @output.input
data/lib/pith/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pith
2
- VERSION = "0.4.0".freeze
2
+ VERSION = "0.5.0".freeze
3
3
  end
@@ -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.should be_kind_of(Set)
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.should include("_*")
16
- config.ignore_patterns.should include(".git")
17
- config.ignore_patterns.should include(".svn")
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.should be_member('foo')
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.should be_member('foo')
32
- config.ignore_patterns.should be_member('bar')
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.should be_member('foo')
38
- config.ignore_patterns.should be_member('bar')
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
@@ -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 { should be_template }
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.should == "Some page"
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.should == "Blah blah"
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.should_not be_nil
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.should == Pathname("dir/some_page.html")
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.should == [Tilt["erb"], Tilt["md"]]
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 { should_not be_template }
78
+ it { is_expected.not_to be_template }
79
79
 
80
- its(:pipeline) { should be_empty }
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
- its(:output) { should be_nil }
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").should == false
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").should == true
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").should == false
20
- pathname.in?("foo/b").should == false
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").should == false
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.should be_nil
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.should == Time.local(1999, 12, 25, 22, 30)
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.should == Time.local(1999, 12, 25, 22, 30)
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.should == Time.local(1999, 12, 25)
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.should == Time.local(1999, 12, 25, 22, 30)
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.should == Time.local(2000, 1, 1, 3, 0)
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.should == Time.local(2000, 1, 1)
49
+ expect(@template.updated_at).to eq(Time.local(2000, 1, 1))
50
50
  end
51
51
 
52
52
  end
@@ -14,7 +14,7 @@ describe Pith::Project do
14
14
  end
15
15
 
16
16
  it "creates the output directory" do
17
- $output_dir.should be_directory
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.should be_kind_of(Pith::Input)
35
- @input.file.should == @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.should equal(first_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").should be_nil
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.should be_kind_of(Pith::Output)
70
- output.file.should == $output_dir + "input.html"
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.should be_nil
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").should_not be_nil
94
- @project.output("input.html").should_not be_nil
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").should be_nil
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").should be_nil
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
- proc { @project.sync }.should_not raise_error
112
+ expect { @project.sync }.not_to raise_error
113
113
  end
114
114
 
115
115
  end