pith 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/README.markdown +29 -0
  2. data/Rakefile +16 -0
  3. data/bin/pith +60 -0
  4. data/cucumber.yml +7 -0
  5. data/features/content_for.feature +29 -0
  6. data/features/content_for.feature~ +29 -0
  7. data/features/haml.feature +24 -0
  8. data/features/haml.feature~ +24 -0
  9. data/features/helpers.feature +23 -0
  10. data/features/ignorance.feature +26 -0
  11. data/features/ignorance.feature~ +26 -0
  12. data/features/include.feature +84 -0
  13. data/features/include.feature~ +84 -0
  14. data/features/incremental_rebuild.feature +24 -0
  15. data/features/layouts.feature +43 -0
  16. data/features/layouts.feature~ +43 -0
  17. data/features/linking.feature +79 -0
  18. data/features/linking.feature~ +79 -0
  19. data/features/metadata.feature +20 -0
  20. data/features/metadata.feature~ +20 -0
  21. data/features/step_definitions/build_steps.rb +46 -0
  22. data/features/step_definitions/build_steps.rb~ +29 -0
  23. data/features/support/env.rb +75 -0
  24. data/features/support/env.rb~ +43 -0
  25. data/features/support/rspec_matchers.rb +5 -0
  26. data/features/textile.feature +29 -0
  27. data/features/textile.feature~ +29 -0
  28. data/features/verbatim.feature +32 -0
  29. data/features/verbatim.feature~ +32 -0
  30. data/lib/pith.rb +1 -0
  31. data/lib/pith.rb~ +2 -0
  32. data/lib/pith/console_logger.rb +20 -0
  33. data/lib/pith/console_logger.rb~ +20 -0
  34. data/lib/pith/input.rb +189 -0
  35. data/lib/pith/input.rb~ +95 -0
  36. data/lib/pith/metadata.rb +26 -0
  37. data/lib/pith/metadata.rb~ +26 -0
  38. data/lib/pith/project.rb +68 -0
  39. data/lib/pith/project.rb~ +50 -0
  40. data/lib/pith/render_context.rb +77 -0
  41. data/lib/pith/render_context.rb~ +66 -0
  42. data/lib/pith/server.rb +42 -0
  43. data/lib/pith/server.rb~ +45 -0
  44. data/lib/pith/version.rb +3 -0
  45. data/lib/pith/version.rb~ +3 -0
  46. data/sample/_layouts/standard.haml +7 -0
  47. data/sample/index.html.haml +8 -0
  48. data/sample/stylesheets/app.css.sass +44 -0
  49. data/spec/pith/metadata_spec.rb +46 -0
  50. data/spec/pith/metadata_spec.rb~ +46 -0
  51. data/spec/pith/project_spec.rb +61 -0
  52. data/spec/spec_helper.rb +27 -0
  53. data/spec/spec_helper.rb~ +0 -0
  54. metadata +166 -0
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+ require 'stringio'
3
+
4
+ require 'pith/metadata'
5
+
6
+ describe Pith::Metadata do
7
+
8
+ def metadata
9
+ Pith::Metadata.extract_from(StringIO.new(@input))
10
+ end
11
+
12
+ describe "with input containing no YAML metadata" do
13
+
14
+ before do
15
+ @input = "%p Blah blah"
16
+ end
17
+
18
+ it "returns an empty Hash" do
19
+ metadata.should == {}
20
+ end
21
+
22
+ end
23
+
24
+ describe "with input containing YAML metadata" do
25
+
26
+ before do
27
+ @input = <<-HAML.gsub(/^ +/, '')
28
+ -# ---
29
+ -# x: 1
30
+ -# y: "2"
31
+ -# ...
32
+ -# other stuff
33
+ HAML
34
+ end
35
+
36
+ it "extracts the metadata" do
37
+ metadata.should == {
38
+ "x" => 1,
39
+ "y" => "2"
40
+ }
41
+ end
42
+
43
+ end
44
+
45
+ end
46
+
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+ require 'stringio'
3
+
4
+ require 'pith/metadata'
5
+
6
+ describe Pith::Metadata do
7
+
8
+ def metadata
9
+ Pith::Metadata.extract_from(StringIO.new(@input))
10
+ end
11
+
12
+ describe "with input containing no YAML metadata" do
13
+
14
+ before do
15
+ @input = "%p Blah blah"
16
+ end
17
+
18
+ it "returns an empty Hash" do
19
+ metadata.should == {}
20
+ end
21
+
22
+ end
23
+
24
+ describe "with input containing YAML metadata" do
25
+
26
+ before do
27
+ @input = <<-HAML.gsub(/^ +/, '')
28
+ -# ---
29
+ -# x: 1
30
+ -# y: "2"
31
+ -# ...
32
+ -# other stuff
33
+ HAML
34
+ end
35
+
36
+ it "extracts the metadata" do
37
+ metadata.should == {
38
+ "x" => 1,
39
+ "y" => "2"
40
+ }
41
+ end
42
+
43
+ end
44
+
45
+ end
46
+
@@ -0,0 +1,61 @@
1
+ require 'spec_helper'
2
+ require 'pith/project'
3
+
4
+ describe Pith::Project do
5
+
6
+ before do
7
+ $input_dir.mkpath
8
+ @project = Pith::Project.new(:input_dir => $input_dir)
9
+ end
10
+
11
+ describe "#input" do
12
+
13
+ describe "(with a non-template input path)" do
14
+
15
+ before do
16
+ @input_path = $input_dir + "input.txt"
17
+ @input_path.touch
18
+ end
19
+
20
+ it "constructs an Verbatim object" do
21
+ @input = @project.input("input.txt")
22
+ @input.should be_kind_of(Pith::Input::Verbatim)
23
+ @input.full_path.should == @input_path
24
+ end
25
+
26
+ it "returns the same Input output every time" do
27
+ first_time = @project.input("input.txt")
28
+ second_time = @project.input("input.txt")
29
+ second_time.should equal(first_time)
30
+ end
31
+
32
+ end
33
+
34
+ describe "(with a template input path)" do
35
+
36
+ before do
37
+ @input_path = $input_dir + "input.haml"
38
+ @input_path.touch
39
+ end
40
+
41
+ it "constructs an Template object" do
42
+ @input = @project.input("input.haml")
43
+ @input.should be_kind_of(Pith::Input::Template)
44
+ @input.full_path.should == @input_path
45
+ end
46
+
47
+ end
48
+
49
+ describe "(with an invalid input path)" do
50
+
51
+ it "complains" do
52
+ lambda do
53
+ @project.input("bogus.path")
54
+ end.should raise_error
55
+ end
56
+
57
+ end
58
+
59
+ end
60
+
61
+ end
@@ -0,0 +1,27 @@
1
+ require "rubygems"
2
+
3
+ require "fileutils"
4
+ require "pathname"
5
+
6
+ class Pathname
7
+
8
+ def touch
9
+ FileUtils.touch(self.to_s)
10
+ end
11
+
12
+ end
13
+
14
+ $project_dir = Pathname(__FILE__).expand_path.parent.parent
15
+ $tmp_dir = $project_dir + "tmp"
16
+ $input_dir = $tmp_dir + "input"
17
+ $output_dir = $tmp_dir + "output"
18
+
19
+ Spec::Runner.configure do |config|
20
+
21
+ config.before(:suite) do
22
+ [$input_dir, $output_dir].each do |dir|
23
+ dir.rmtree if dir.exist?
24
+ end
25
+ end
26
+
27
+ end
File without changes
metadata ADDED
@@ -0,0 +1,166 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pith
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 2
9
+ version: 0.0.2
10
+ platform: ruby
11
+ authors:
12
+ - Mike Williams
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-08-19 00:00:00 +10:00
18
+ default_executable: pith
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: tilt
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 9
30
+ version: "0.9"
31
+ type: :runtime
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: adsf
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ segments:
41
+ - 1
42
+ - 0
43
+ - 1
44
+ version: 1.0.1
45
+ type: :runtime
46
+ version_requirements: *id002
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ prerelease: false
50
+ requirement: &id003 !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ segments:
55
+ - 1
56
+ - 2
57
+ - 9
58
+ version: 1.2.9
59
+ type: :development
60
+ version_requirements: *id003
61
+ - !ruby/object:Gem::Dependency
62
+ name: cucumber
63
+ prerelease: false
64
+ requirement: &id004 !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ segments:
69
+ - 0
70
+ - 8
71
+ - 3
72
+ version: 0.8.3
73
+ type: :development
74
+ version_requirements: *id004
75
+ description:
76
+ email: mdub@dogbiscuit.org
77
+ executables:
78
+ - pith
79
+ extensions: []
80
+
81
+ extra_rdoc_files: []
82
+
83
+ files:
84
+ - lib/pith/console_logger.rb
85
+ - lib/pith/console_logger.rb~
86
+ - lib/pith/input.rb
87
+ - lib/pith/input.rb~
88
+ - lib/pith/metadata.rb
89
+ - lib/pith/metadata.rb~
90
+ - lib/pith/project.rb
91
+ - lib/pith/project.rb~
92
+ - lib/pith/render_context.rb
93
+ - lib/pith/render_context.rb~
94
+ - lib/pith/server.rb
95
+ - lib/pith/server.rb~
96
+ - lib/pith/version.rb
97
+ - lib/pith/version.rb~
98
+ - lib/pith.rb
99
+ - lib/pith.rb~
100
+ - sample/_layouts/standard.haml
101
+ - sample/index.html.haml
102
+ - sample/stylesheets/app.css.sass
103
+ - README.markdown
104
+ has_rdoc: true
105
+ homepage: http://github.com/mdub/pith
106
+ licenses: []
107
+
108
+ post_install_message:
109
+ rdoc_options: []
110
+
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ segments:
118
+ - 0
119
+ version: "0"
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ segments:
125
+ - 0
126
+ version: "0"
127
+ requirements: []
128
+
129
+ rubyforge_project:
130
+ rubygems_version: 1.3.6
131
+ signing_key:
132
+ specification_version: 3
133
+ summary: A static website generator
134
+ test_files:
135
+ - Rakefile
136
+ - spec/pith/metadata_spec.rb
137
+ - spec/pith/metadata_spec.rb~
138
+ - spec/pith/project_spec.rb
139
+ - spec/spec_helper.rb
140
+ - spec/spec_helper.rb~
141
+ - features/content_for.feature
142
+ - features/content_for.feature~
143
+ - features/haml.feature
144
+ - features/haml.feature~
145
+ - features/helpers.feature
146
+ - features/ignorance.feature
147
+ - features/ignorance.feature~
148
+ - features/include.feature
149
+ - features/include.feature~
150
+ - features/incremental_rebuild.feature
151
+ - features/layouts.feature
152
+ - features/layouts.feature~
153
+ - features/linking.feature
154
+ - features/linking.feature~
155
+ - features/metadata.feature
156
+ - features/metadata.feature~
157
+ - features/step_definitions/build_steps.rb
158
+ - features/step_definitions/build_steps.rb~
159
+ - features/support/env.rb
160
+ - features/support/env.rb~
161
+ - features/support/rspec_matchers.rb
162
+ - features/textile.feature
163
+ - features/textile.feature~
164
+ - features/verbatim.feature
165
+ - features/verbatim.feature~
166
+ - cucumber.yml