pith 0.2.1 → 0.2.2

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/README.markdown CHANGED
@@ -70,7 +70,8 @@ Page metadata
70
70
  A YAML header can be provided at the top of any template, defining page metadata. The header is introduced by a first line containing three dashes, and terminated by a line containing three dots.
71
71
 
72
72
  ---
73
- title: "All about fish"
73
+ title: "Fish"
74
+ subtitle: "All about fish"
74
75
  ...
75
76
 
76
77
  Metadata provided in the header can be referenced by template content, via the "`page.meta`" Hash:
@@ -80,9 +81,12 @@ Metadata provided in the header can be referenced by template content, via the "
80
81
  %title= page.meta["title"]
81
82
  %body
82
83
  %h1= page.meta["title"]
84
+ %h2= page.meta["subtitle"]
83
85
 
84
86
  This is especially useful in "layout" templates (see below).
85
-
87
+
88
+ Since the page title is such a common thing to want to specify in the header, it's also available as "`page.title`", as a shortcut (if no explicit title was provided, Pith will guess one from the input file name).
89
+
86
90
  Partials and Layouts
87
91
  --------------------
88
92
 
@@ -173,10 +177,10 @@ For quick prototyping, use the "`watch`" command, rather than "`build`". After
173
177
 
174
178
  $ pith -i SITE watch
175
179
  Generating to "SITE/_out"
176
- --(copy)--> images/logo.png
177
- --(haml)--> index.html
180
+ --> images/logo.png
181
+ --> index.html
178
182
  # ... edit "index.html.haml" ...
179
- --(haml)--> index.html
183
+ --> index.html
180
184
 
181
185
  Built-in web-server
182
186
  -------------------
@@ -185,8 +189,8 @@ For even quicker prototyping, Pith includes a simple HTTP server. Start it by u
185
189
 
186
190
  $ pith -i SITE serve
187
191
  Generating to "SITE/_out"
188
- --(copy)--> images/logo.png
189
- --(haml)--> index.html
192
+ --> images/logo.png
193
+ --> index.html
190
194
  Taking the Pith at "http://localhost:4321"
191
195
  >> Thin web server (v1.2.7 codename No Hup)
192
196
  >> Maximum connections set to 1024
data/Rakefile CHANGED
@@ -4,10 +4,10 @@ Bundler::GemHelper.install_tasks
4
4
 
5
5
  task :default => :spec
6
6
 
7
- require 'spec/rake/spectask'
7
+ require "rspec/core/rake_task"
8
8
 
9
- Spec::Rake::SpecTask.new(:spec) do |t|
10
- t.spec_opts << ["--color"]
9
+ RSpec::Core::RakeTask.new do |t|
10
+ t.pattern = 'spec/**/*_spec.rb'
11
11
  end
12
12
 
13
13
  task :default => :cucumber
@@ -15,7 +15,7 @@ task :default => :cucumber
15
15
  require 'cucumber/rake/task'
16
16
 
17
17
  namespace :cucumber do
18
-
18
+
19
19
  [:wip, :default].each do |profile|
20
20
 
21
21
  Cucumber::Rake::Task.new(profile) do |t|
@@ -1,8 +1,8 @@
1
1
  Feature: incremental rebuilding
2
2
 
3
3
  I want to rebuild just the outputs whose inputs have changed
4
- So that that I can bring the project up-to-date efficiently
5
-
4
+ So that I can bring the project up-to-date efficiently
5
+
6
6
  Scenario: alter an input, and the output changes
7
7
 
8
8
  Given input file "page.html.haml" contains "Old content"
@@ -10,7 +10,7 @@ Scenario: alter an input, and the output changes
10
10
 
11
11
  When I change input file "page.html.haml" to contain "New content"
12
12
  And I rebuild the site
13
-
13
+
14
14
  Then output file "page.html" should be re-generated
15
15
  And output file "page.html" should contain "New content"
16
16
 
@@ -0,0 +1,48 @@
1
+ Feature: incremental rebuilding
2
+
3
+ I want to reload any altered Ruby code
4
+ So that I can quickly iterate config and support libraries
5
+
6
+ @wip
7
+ Scenario: change a helper
8
+
9
+ Given input file "_pith/config.rb" contains
10
+ """
11
+ lib_dir = File.expand_path("../lib", __FILE__)
12
+ $: << lib_dir unless $:.member?(lib_dir)
13
+
14
+ require 'stuff'
15
+
16
+ project.helpers do
17
+ include Stuff
18
+ end
19
+ """
20
+
21
+ And input file "_pith/lib/stuff.rb" contains
22
+
23
+ """
24
+ module Stuff
25
+ def greet(subject)
26
+ "Hello, #{subject}"
27
+ end
28
+ end
29
+ """
30
+
31
+ And input file "index.html.haml" contains "= greet('mate')"
32
+
33
+ When I build the site
34
+
35
+ Then output file "index.html" should contain "Hello, mate"
36
+
37
+ When I change input file "_pith/lib/stuff.rb" to contain
38
+ """
39
+ module Stuff
40
+ def greet(subject)
41
+ "Hola, #{subject}"
42
+ end
43
+ end
44
+ """
45
+
46
+ And I rebuild the site
47
+
48
+ Then output file "index.html" should contain "Hola, mate"
@@ -1,6 +1,6 @@
1
- require 'spec'
1
+ require 'rspec'
2
2
 
3
- Spec::Matchers.define :contain do |expected|
3
+ RSpec::Matchers.define :contain do |expected|
4
4
  match do |actual|
5
5
  actual.any? { |x| expected === x }
6
6
  end
data/lib/pith/project.rb CHANGED
@@ -8,7 +8,7 @@ module Pith
8
8
 
9
9
  class Project
10
10
 
11
- DEFAULT_IGNORE_PATTERNS = ["_*", ".git", ".svn"].freeze
11
+ DEFAULT_IGNORE_PATTERNS = ["_*", ".git", ".svn", "*~"].freeze
12
12
 
13
13
  def initialize(attributes = {})
14
14
  @ignore_patterns = DEFAULT_IGNORE_PATTERNS.dup
@@ -68,6 +68,7 @@ module Pith
68
68
  refresh
69
69
  load_config
70
70
  remove_old_outputs
71
+ output_dir.mkpath
71
72
  generate_outputs
72
73
  output_dir.touch
73
74
  end
data/lib/pith/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pith
2
- VERSION = "0.2.1".freeze
2
+ VERSION = "0.2.2".freeze
3
3
  end
@@ -5,7 +5,19 @@ describe Pith::Project do
5
5
 
6
6
  before do
7
7
  $input_dir.mkpath
8
- @project = Pith::Project.new(:input_dir => $input_dir)
8
+ @project = Pith::Project.new(:input_dir => $input_dir, :output_dir => $output_dir)
9
+ end
10
+
11
+ describe "#build" do
12
+
13
+ before do
14
+ @project.build
15
+ end
16
+
17
+ it "creates the output directory" do
18
+ $output_dir.should be_directory
19
+ end
20
+
9
21
  end
10
22
 
11
23
  describe "#input" do
data/spec/spec_helper.rb CHANGED
@@ -1,18 +1,18 @@
1
1
  require "rubygems"
2
2
 
3
3
  require "fileutils"
4
-
4
+
5
5
  $project_dir = Pathname(__FILE__).expand_path.parent.parent
6
6
  $tmp_dir = $project_dir + "tmp"
7
7
  $input_dir = $tmp_dir + "input"
8
8
  $output_dir = $tmp_dir + "output"
9
9
 
10
- Spec::Runner.configure do |config|
10
+ RSpec.configure do |config|
11
11
 
12
12
  config.before(:suite) do
13
13
  [$input_dir, $output_dir].each do |dir|
14
14
  dir.rmtree if dir.exist?
15
15
  end
16
16
  end
17
-
17
+
18
18
  end
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.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-10 00:00:00.000000000Z
12
+ date: 2012-01-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: tilt
16
- requirement: &70152548570880 !ruby/object:Gem::Requirement
16
+ requirement: &70328100528500 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ~>
19
+ - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: '1.1'
21
+ version: '1.3'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70152548570880
24
+ version_requirements: *70328100528500
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: adsf
27
- requirement: &70152548570160 !ruby/object:Gem::Requirement
27
+ requirement: &70328100527980 !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: *70152548570160
35
+ version_requirements: *70328100527980
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rack
38
- requirement: &70152548569500 !ruby/object:Gem::Requirement
38
+ requirement: &70328100527460 !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: *70152548569500
46
+ version_requirements: *70328100527460
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: thin
49
- requirement: &70152548568780 !ruby/object:Gem::Requirement
49
+ requirement: &70328100527000 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,84 +54,18 @@ dependencies:
54
54
  version: 1.2.7
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70152548568780
57
+ version_requirements: *70328100527000
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: clamp
60
- requirement: &70152548568040 !ruby/object:Gem::Requirement
60
+ requirement: &70328100526520 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
64
64
  - !ruby/object:Gem::Version
65
- version: 0.1.7
65
+ version: 0.3.0
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70152548568040
69
- - !ruby/object:Gem::Dependency
70
- name: rake
71
- requirement: &70152548567460 !ruby/object:Gem::Requirement
72
- none: false
73
- requirements:
74
- - - ! '>='
75
- - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :development
78
- prerelease: false
79
- version_requirements: *70152548567460
80
- - !ruby/object:Gem::Dependency
81
- name: rspec
82
- requirement: &70152548551340 !ruby/object:Gem::Requirement
83
- none: false
84
- requirements:
85
- - - ~>
86
- - !ruby/object:Gem::Version
87
- version: 1.2.9
88
- type: :development
89
- prerelease: false
90
- version_requirements: *70152548551340
91
- - !ruby/object:Gem::Dependency
92
- name: cucumber
93
- requirement: &70152548550740 !ruby/object:Gem::Requirement
94
- none: false
95
- requirements:
96
- - - ~>
97
- - !ruby/object:Gem::Version
98
- version: 0.8.3
99
- type: :development
100
- prerelease: false
101
- version_requirements: *70152548550740
102
- - !ruby/object:Gem::Dependency
103
- name: haml
104
- requirement: &70152548550260 !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
110
- type: :development
111
- prerelease: false
112
- version_requirements: *70152548550260
113
- - !ruby/object:Gem::Dependency
114
- name: RedCloth
115
- requirement: &70152548549740 !ruby/object:Gem::Requirement
116
- none: false
117
- requirements:
118
- - - ! '>='
119
- - !ruby/object:Gem::Version
120
- version: '0'
121
- type: :development
122
- prerelease: false
123
- version_requirements: *70152548549740
124
- - !ruby/object:Gem::Dependency
125
- name: rdiscount
126
- requirement: &70152548549320 !ruby/object:Gem::Requirement
127
- none: false
128
- requirements:
129
- - - ! '>='
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: *70152548549320
68
+ version_requirements: *70328100526520
135
69
  description: ! 'Pith builds static websites, using markup/template languages including
136
70
  Haml, Sass, ERb, Liquid, Markdown and Textile.
137
71
 
@@ -207,6 +141,7 @@ files:
207
141
  - features/pipeline.feature
208
142
  - features/relative_linking.feature
209
143
  - features/relative_linking.feature~
144
+ - features/reloading.feature
210
145
  - features/resources.feature
211
146
  - features/step_definitions/build_steps.rb
212
147
  - features/step_definitions/build_steps.rb~
@@ -233,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
233
168
  version: '0'
234
169
  segments:
235
170
  - 0
236
- hash: -3377947525028361057
171
+ hash: 1318173105558920173
237
172
  required_rubygems_version: !ruby/object:Gem::Requirement
238
173
  none: false
239
174
  requirements:
@@ -242,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
177
  version: '0'
243
178
  segments:
244
179
  - 0
245
- hash: -3377947525028361057
180
+ hash: 1318173105558920173
246
181
  requirements: []
247
182
  rubyforge_project:
248
183
  rubygems_version: 1.8.10
@@ -282,6 +217,7 @@ test_files:
282
217
  - features/pipeline.feature
283
218
  - features/relative_linking.feature
284
219
  - features/relative_linking.feature~
220
+ - features/reloading.feature
285
221
  - features/resources.feature
286
222
  - features/step_definitions/build_steps.rb
287
223
  - features/step_definitions/build_steps.rb~