staticpress 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
@@ -8,3 +8,17 @@ Staticpress is a blog-focused static site generator. It uses Tilt for rendering
8
8
  Staticpress is installable as a Rubygem so a simple `[sudo] gem install staticpress` is all you need. Once installed you will need to initialize your blog with `staticpress new <path-to-blog> [name-of-blog]`, where `<path-to-blog>` is a relative path to some directory and `[name-of-blog]` is an optional title. If the directory does not exist yet, it will be created, so go ahead and `cd` into it.
9
9
 
10
10
  From your blog directory, you can create a new blog post with `staticpress create <title>`. You can turn on the server with `staticpress serve` to preview work in progress. Several other commands are available; check out `staticpress help` for more information.
11
+
12
+
13
+ * .new passes params to #initialize
14
+ * #initialize manually calculates full path to template from params and populates @template_types
15
+ * Base#template_types is looped over in Base#render_partial
16
+ * Base#template_extension joins Base#template_types and prepends with . if not empty
17
+ * #template_path uses Base#template_extension to create full path to source
18
+
19
+
20
+ * http://jekyllbootstrap.com/
21
+ * http://vitobotta.com/how-to-migrate-from-wordpress-to-jekyll/
22
+ * http://vitobotta.com/sinatra-contact-form-jekyll/
23
+
24
+ * http://nanoc.stoneship.org/docs/
@@ -0,0 +1,3 @@
1
+ # Content Types
2
+
3
+ Staticpress supports many formats for content. Staticpress uses [Tilt](https://github.com/rtomayko/tilt) under the covers. You can mix and match format as much as you like. Additionally you can create pages in any format; if Tilt does not recognize the file, it will be copied through untouched. This is useful for including images in your posts for instance.
File without changes
@@ -1,3 +1,3 @@
1
1
  # Diving Deeper
2
2
 
3
-
3
+ In addition to blog posts, Staticpress can handle regular pages as well. Simply type `staticpress create_page <title> [path-in-content]` to get started.
File without changes
File without changes
@@ -8,7 +8,7 @@ Once you have Ruby, open a terminal and type `gem install staticpress`. This com
8
8
 
9
9
  ## Usage
10
10
 
11
- When you want to create a new Staticpress blog, simply run `staticpress new <path-to-blog> [name-of-blog]`. Staticpress will create the `<path-to-blog>` for you if it does not exist. `[name-of-blog]` is optional. If you leave it out, Staticpress will make up a blog name from `<path-to-blog>`. Either way, `cd` into `<path-to-blog>`; this will be the place you need to be for all the other commands to work. By the way Staticpress uses several conventions to keep things simple. For instance many commands you are asked to type on the terminal take parameters. Required parameters will `<look-like-this>`, while optional parameters will `[look-like-this]`.
11
+ When you want to create a new Staticpress blog, simply run `staticpress new <path-to-blog> [name-of-blog]`. Staticpress will create the `<path-to-blog>` for you if it does not exist. `[name-of-blog]` is optional. If you leave it out, Staticpress will make up a blog name from `<path-to-blog>`. Either way, `cd` into `<path-to-blog>`; this will be the place you need to be for all the other commands to work. By the way Staticpress uses several conventions to keep things simple. For instance many commands you are asked to type on the terminal take parameters. Required parameters will `<look-like-this>`, while optional parameters will `[look-like-this]`. You should not type the `<>` or `[]` symbols.
12
12
 
13
13
  ## Hello, World
14
14
 
File without changes
@@ -1 +1 @@
1
- hello
1
+ [Read the documentation](/docs/setup).
@@ -58,6 +58,37 @@ Feature: The happy path
58
58
  Then a directory named "content" should exist
59
59
  And a file named "content/about.markdown" should exist
60
60
 
61
+ Scenario: Creating a static page with multiple formats
62
+ Given a blog exists
63
+ When I write to "content/formats.markdown.erb" with:
64
+ """
65
+ hello world
66
+ """
67
+ And I run `staticpress build`
68
+ Then the file "public/formats/index.html" should contain exactly:
69
+ """
70
+ <!DOCTYPE html>
71
+ <html>
72
+ <head>
73
+ <title>Formats | Transient Thoughts</title>
74
+ <link href='/assets/basic/styles/all.css' rel='stylesheet' type='text/css' />
75
+ <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js'></script>
76
+ <script src='/assets/basic/scripts/application.js'></script>
77
+ </head>
78
+ <body>
79
+ <header>
80
+ <span class='site-title'>Transient Thoughts</span>
81
+ <span class='site-subtitle'>A blogging framework for hackers</span>
82
+ </header>
83
+ <section>
84
+ <p>hello world</p>
85
+ </section>
86
+ <section></section>
87
+ </body>
88
+ </html>
89
+
90
+ """
91
+
61
92
  Scenario: Copying a built-in plugin
62
93
  Given a blog exists
63
94
  When I run `staticpress fork_plugin blockquote`
@@ -98,7 +129,7 @@ Feature: The happy path
98
129
  When I run `staticpress build --verbose`
99
130
  Then the output should contain " page public/about/index.html"
100
131
 
101
- Scenario: Building a site a custom homepage
132
+ Scenario: Building a site with a custom homepage
102
133
  Given a blog with content exists
103
134
  And I write to "content/index.markdown" with:
104
135
  """
@@ -124,7 +155,14 @@ Feature: The happy path
124
155
  <script src='/assets/basic/scripts/application.js'></script>
125
156
  </head>
126
157
  <body>
127
- <p>in custom page</p>
158
+ <header>
159
+ <span class='site-title'>Transient Thoughts</span>
160
+ <span class='site-subtitle'>A blogging framework for hackers</span>
161
+ </header>
162
+ <section>
163
+ <p>in custom page</p>
164
+ </section>
165
+ <section></section>
128
166
  </body>
129
167
  </html>
130
168
 
@@ -14,7 +14,7 @@ module Staticpress::Content
14
14
  extend Staticpress::Helpers
15
15
  include Staticpress::Helpers
16
16
 
17
- attr_reader :params
17
+ attr_reader :params, :template_types
18
18
 
19
19
  def initialize(params = {})
20
20
  clean_params = params.select { |key, value| value }.map do |key, value|
@@ -28,6 +28,7 @@ module Staticpress::Content
28
28
  end
29
29
 
30
30
  @params = optional_param_defaults.merge Hash[clean_params]
31
+ @template_types = []
31
32
  end
32
33
 
33
34
  def ==(other)
@@ -68,6 +69,10 @@ module Staticpress::Content
68
69
  end
69
70
  end
70
71
 
72
+ def markup_template?
73
+ config.markup_templates.include?(template_path.extname[1..-1])
74
+ end
75
+
71
76
  def meta
72
77
  Staticpress::Metadata.new(content.names.include?('frontmatter') ? YAML.load(content[:frontmatter]) : {})
73
78
  end
@@ -78,7 +83,13 @@ module Staticpress::Content
78
83
 
79
84
  def output_path
80
85
  base = Staticpress.blog_path + config.destination_path + url_path.sub(/^\//, '')
81
- (config.index_file && config.markup_templates.include?(template_path.extname[1..-1])) ? base + config.index_file : base
86
+
87
+ # FIXME need a better check
88
+ if (markup_template? && config.index_file && (Pathname(config.index_file).extname != base.extname))
89
+ base + config.index_file
90
+ else
91
+ base
92
+ end
82
93
  end
83
94
 
84
95
  def raw
@@ -96,8 +107,10 @@ module Staticpress::Content
96
107
  end
97
108
 
98
109
  def render_partial(locals = {})
99
- template = Tilt.new(template_path.to_s, template_engine_options) { raw }
100
- template.render template_context, locals
110
+ template_types.inject(raw) do |result, template_type|
111
+ template = Tilt.new(template_type.to_s, template_engine_options(template_type)) { result }
112
+ template.render template_context, locals
113
+ end
101
114
  end
102
115
 
103
116
  def save
@@ -120,16 +133,16 @@ module Staticpress::Content
120
133
  Staticpress::ViewHelpers.new self
121
134
  end
122
135
 
123
- def template_engine_options
136
+ def template_engine_options(template_type)
124
137
  (config.template_engine_options[template_type] || {}).to_hash
125
138
  end
126
139
 
127
- def template_path_content
128
- exist? ? template_path.read : ''
140
+ def template_extension
141
+ template_types.empty? ? '' : ".#{template_types.reverse.join('.')}"
129
142
  end
130
143
 
131
- def template_type
132
- template_path.extname.sub(/^\./, '').to_sym
144
+ def template_path_content
145
+ exist? ? template_path.read : ''
133
146
  end
134
147
 
135
148
  def theme
@@ -13,22 +13,22 @@ module Staticpress::Content
13
13
  extend ResourceContent
14
14
  extend StaticContent
15
15
 
16
- attr_reader :extension, :full_slug
16
+ attr_reader :full_slug
17
17
 
18
- def initialize(params)
18
+ def initialize(params = {})
19
19
  super
20
20
 
21
- index = extensionless_basename Pathname(config.index_file)
21
+ source_path = Staticpress.blog_path + config.source_path
22
22
 
23
23
  @full_slug = params[:slug]
24
- @extension = find_supported_extension(Staticpress.blog_path + config.source_path + full_slug)
24
+ @template_types = find_supported_extensions(source_path + full_slug)
25
25
 
26
- if @extension.nil? && !template_path.file?
26
+ unless template_path.file?
27
27
  @full_slug = [
28
28
  params[:slug],
29
- index
29
+ extensionless_basename(Pathname(config.index_file))
30
30
  ].reject(&:empty?).join('/')
31
- @extension = find_supported_extension(Staticpress.blog_path + config.source_path + full_slug)
31
+ @template_types = find_supported_extensions(source_path + full_slug)
32
32
  end
33
33
  end
34
34
 
@@ -41,8 +41,7 @@ module Staticpress::Content
41
41
  end
42
42
 
43
43
  def template_path
44
- slug = extension ? "#{full_slug}.#{extension}" : full_slug
45
- Staticpress.blog_path + config.source_path + slug
44
+ Staticpress.blog_path + config.source_path + "#{full_slug}#{template_extension}"
46
45
  end
47
46
 
48
47
  def self.all
@@ -65,15 +64,21 @@ module Staticpress::Content
65
64
  destination.open('w') { |f| f.write template }
66
65
  end
67
66
 
68
- def self.find_by_path(path)
69
- if path.file?
70
- raw_slug = parse_slug(path, (Staticpress.blog_path + config.source_path)).first
67
+ def self.extract_slug(path)
68
+ base_path = Staticpress.blog_path + config.source_path
69
+ supported = find_supported_extensions(path)
70
+ extension = supported.empty? ? '' : "\\.#{supported.reverse.join('\.')}"
71
+
72
+ if match = /^#{base_path}\/(?<slug>.+)#{extension}$/.match(path.to_s)
71
73
  basename = extensionless_basename Pathname(config.index_file)
72
- slug = raw_slug.sub(/.*(\/?#{basename})$/, '')
73
- new :slug => slug
74
+ match[:slug].sub(/.*(\/?#{basename})$/, '')
74
75
  end
75
76
  end
76
77
 
78
+ def self.find_by_path(path)
79
+ new :slug => extract_slug(path) if path.file?
80
+ end
81
+
77
82
  def self.template
78
83
  <<-TEMPLATE
79
84
  in page
@@ -8,11 +8,10 @@ module Staticpress::Content
8
8
  include ResourceContent
9
9
  extend ResourceContent
10
10
 
11
- attr_reader :extension
12
-
13
11
  def initialize(params)
14
12
  super
15
- @extension = find_supported_extension template_path
13
+ # FIXME calculate template_path
14
+ @template_types = find_supported_extensions template_path
16
15
  end
17
16
 
18
17
  def <=>(other)
@@ -32,7 +31,7 @@ module Staticpress::Content
32
31
  params[:year],
33
32
  params[:month],
34
33
  params[:day],
35
- (extension ? "#{params[:title]}.#{extension}" : params[:title])
34
+ "#{params[:title]}#{template_extension}"
36
35
  ].join('-')
37
36
  Staticpress.blog_path + config.posts_source_path + name
38
37
  end
@@ -5,11 +5,14 @@ require 'staticpress/content/static_content'
5
5
 
6
6
  module Staticpress::Content
7
7
  module ResourceContent
8
- # FIXME add tests
9
- def find_supported_extension(extensionless_path)
10
- Staticpress::Content::StaticContent.supported_extensions.detect do |extension|
11
- extension.to_sym if Pathname("#{extensionless_path}.#{extension}").file?
12
- end
8
+ def find_supported_extensions(path)
9
+ file = path.file? ? path : Dir["#{path}.*"].first
10
+ return [] if file.nil?
11
+
12
+ # TODO stop looping when no more supported extensions
13
+ Pathname(file).sub("#{file.to_s}.", '').to_s.split('.').map(&:to_sym).select do |extension|
14
+ Staticpress::Content::StaticContent.supported_extensions.include? extension
15
+ end.reverse
13
16
  end
14
17
 
15
18
  def gather_resources_from(paths)
@@ -1,3 +1,5 @@
1
+ require 'tilt'
2
+
1
3
  require 'staticpress'
2
4
 
3
5
  module Staticpress::Content
@@ -11,11 +11,9 @@ module Staticpress::Content
11
11
  extend ResourceContent
12
12
  extend StaticContent
13
13
 
14
- attr_reader :extension
15
-
16
14
  def initialize(params)
17
15
  super
18
- @extension = find_supported_extension template_path
16
+ @template_types = find_supported_extensions template_path
19
17
  end
20
18
 
21
19
  def static?
@@ -23,8 +21,7 @@ module Staticpress::Content
23
21
  end
24
22
 
25
23
  def template_path
26
- slug = extension ? "#{params[:slug]}.#{extension}" : params[:slug]
27
- Staticpress::Theme.new(params[:theme]).root + 'assets' + params[:asset_type] + slug
24
+ Staticpress::Theme.new(params[:theme]).root + 'assets' + params[:asset_type] + "#{params[:slug]}#{template_extension}"
28
25
  end
29
26
 
30
27
  def self.all
@@ -11,13 +11,11 @@ module Staticpress
11
11
  end
12
12
 
13
13
  def extensionless_basename(pathname)
14
- path = pathname.basename.to_path
15
- path[0...(path.length - pathname.extname.length)]
14
+ extensionless_path(pathname).basename.to_s
16
15
  end
17
16
 
18
17
  def extensionless_path(pathname)
19
- path = pathname.to_path
20
- Pathname path[0...(path.length - pathname.extname.length)]
18
+ pathname.sub(pathname.extname, '')
21
19
  end
22
20
 
23
21
  def hash_from_array(array, &block)
@@ -2,7 +2,7 @@ module Staticpress
2
2
  class Version
3
3
  extend Comparable
4
4
 
5
- SIGNATURE = [0, 5, 0]
5
+ SIGNATURE = [0, 5, 1]
6
6
 
7
7
  def self.<=>(other)
8
8
  other = other.split('.').map(&:to_i) if other.respond_to? :split
@@ -6,4 +6,9 @@
6
6
  %script{ :src => 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js' }
7
7
  %script{ :src => '/assets/basic/scripts/application.js' }
8
8
  %body
9
- = yield
9
+ %header
10
+ %span.site-title= config.title
11
+ %span.site-subtitle= config.subtitle
12
+ %section
13
+ = yield
14
+ %section
@@ -6,4 +6,9 @@
6
6
  %script{ :src => 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js' }
7
7
  %script{ :src => '/assets/basic/scripts/application.js' }
8
8
  %body
9
- = yield
9
+ %header
10
+ %span.site-title= config.title
11
+ %span.site-subtitle= config.subtitle
12
+ %section
13
+ = yield
14
+ %section
@@ -2,6 +2,7 @@
2
2
 
3
3
  require File.expand_path('../lib/staticpress/version', __FILE__)
4
4
 
5
+ # http://timelessrepo.com/use-the-gemspec
5
6
  Gem::Specification.new do |s|
6
7
  s.name = 'staticpress'
7
8
  s.version = Staticpress::Version
@@ -34,6 +35,7 @@ Staticpress is a blog-focused static site generator. It uses Tilt for rendering
34
35
  s.add_development_dependency 'sass'
35
36
 
36
37
  s.add_runtime_dependency 'bundler'
38
+ #s.add_runtime_dependency 'hike' # look into this for template inheritance https://github.com/sstephenson/hike
37
39
  s.add_runtime_dependency 'rack'
38
40
  s.add_runtime_dependency 'thor'
39
41
  s.add_runtime_dependency 'tilt'
@@ -16,6 +16,8 @@ class ContentBaseTest < TestCase
16
16
  let(:index) { Staticpress::Content::Index.new }
17
17
  let(:index_2) { Staticpress::Content::Index.new :number => 2 }
18
18
 
19
+ let(:chained) { Staticpress::Content::Page.new(:slug => 'chained') }
20
+ let(:chain) { Staticpress::Content::Page.new(:slug => 'chain.html') }
19
21
  let(:page) { Staticpress::Content::Page.new(:slug => 'about') }
20
22
  let(:second_page) { Staticpress::Content::Page.new :slug => 'contact' }
21
23
  let(:page_root) { Staticpress::Content::Page.new :slug => '' }
@@ -61,6 +63,7 @@ class ContentBaseTest < TestCase
61
63
  end
62
64
 
63
65
  def test_content_type
66
+ assert_equal 'text/html', chained.content_type
64
67
  assert_equal 'text/html', page.content_type
65
68
  assert_equal 'text/css', style_2.content_type
66
69
  assert_equal 'image/png', static_bin.content_type
@@ -71,6 +74,8 @@ class ContentBaseTest < TestCase
71
74
  assert category.exist?, "#{category} does not exist"
72
75
  assert index.exist?, "#{index} does not exist"
73
76
 
77
+ assert chained.exist?, "#{chained} does not exist"
78
+ assert chain.exist?, "#{chain} does not exist"
74
79
  assert page.exist?, "#{page} does not exist"
75
80
  assert second_page.exist?, "#{second_page} does not exist"
76
81
  assert static_bin.exist?, "#{static_bin} does not exist"
@@ -91,6 +96,7 @@ class ContentBaseTest < TestCase
91
96
  assert_equal index, Staticpress::Content::Index.find_by_url_path('/')
92
97
 
93
98
  assert_equal page_root, Staticpress::Content::Page.find_by_url_path('/')
99
+ assert_equal chained, Staticpress::Content::Page.find_by_url_path('/chained')
94
100
  assert_equal page, Staticpress::Content::Page.find_by_url_path('/about')
95
101
  assert_equal static_bin, Staticpress::Content::Page.find_by_url_path('/ruby.png')
96
102
 
@@ -107,7 +113,17 @@ class ContentBaseTest < TestCase
107
113
  assert_equal 'Foo -> Bar -> Baz | Test Blog', page_nested.full_title
108
114
  end
109
115
 
116
+ def test_markup_template?
117
+ assert chained.markup_template?, "#{chained} is not markup"
118
+ assert chain.markup_template?, "#{chain} is not markup"
119
+ assert page.markup_template?, "#{page} is not markup"
120
+
121
+ refute style_2.markup_template?, "#{chained} is markup"
122
+ end
123
+
110
124
  def test_output_path
125
+ assert_equal (Staticpress.blog_path + 'public' + 'chained' + 'index.html'), chained.output_path
126
+ assert_equal (Staticpress.blog_path + 'public' + 'chain.html'), chain.output_path
111
127
  assert_equal (Staticpress.blog_path + 'public' + 'about' + 'index.html'), page.output_path
112
128
  assert_equal (Staticpress.blog_path + 'public' + 'index.html'), page_root.output_path
113
129
  assert_equal (Staticpress.blog_path + 'public' + 'style2.css'), style_2.output_path
@@ -124,11 +140,14 @@ class ContentBaseTest < TestCase
124
140
  assert_equal expected, Staticpress::Content::Tag.new(:name => 'charlotte', :number => nil).params
125
141
  assert_equal expected, Staticpress::Content::Tag.new(:name => 'charlotte', :number => 1).params
126
142
  assert_equal expected, Staticpress::Content::Tag.new(:name => 'charlotte', :number => '1').params
143
+
144
+ assert_equal({ :slug => 'chain.html' }, Staticpress::Content::Page.new(:slug => 'chain.html').params)
127
145
  end
128
146
 
129
147
  def test_raw
130
148
  assert_equal '= partial :list_posts, :posts => page.sub_content', category.raw
131
149
 
150
+ assert_equal "<%= 'Processed with ERB' %>, then Markdown.", chained.raw
132
151
  assert_equal 'in page', page.raw
133
152
  assert_equal "in page\n\nin page", second_page.raw
134
153
  assert_equal 'this file intentionally left blank', static_txt.raw
@@ -182,6 +201,7 @@ body{color:green}
182
201
  end
183
202
 
184
203
  def test_render_partial
204
+ assert_equal "<p>Processed with ERB, then Markdown.</p>\n", chained.render_partial
185
205
  assert_equal "<p>in page</p>\n", page.render_partial
186
206
  assert_equal "<p>in page</p>\n\n<p>in page</p>\n", second_page.render_partial
187
207
 
@@ -217,14 +237,16 @@ body{color:green}
217
237
 
218
238
  def test_template_engine_options
219
239
  expected = Compass.sass_engine_options.merge :line_comments => false, :style => :compressed
220
- assert_eql expected, asset_style.template_engine_options
221
- assert_equal({}, asset_script.template_engine_options)
240
+ assert_eql expected, asset_style.template_engine_options(:sass)
241
+ assert_equal({}, asset_script.template_engine_options(:js))
222
242
  end
223
243
 
224
- def test_template_type
225
- assert_equal :markdown, page.template_type
226
- assert_equal :sass, asset_style.template_type
227
- assert_equal :js, asset_script.template_type
244
+ def test_template_types
245
+ assert_equal [:erb, :markdown], chained.template_types
246
+ assert_equal [:erb, :markdown], chain.template_types
247
+ assert_equal [:markdown], page.template_types
248
+ assert_equal [:sass], asset_style.template_types
249
+ assert_equal [], asset_script.template_types
228
250
  end
229
251
 
230
252
  def test_title
@@ -258,6 +280,8 @@ body{color:green}
258
280
  assert_equal '/page/2', index_2.url_path
259
281
 
260
282
  assert_equal '/', page_root.url_path
283
+ assert_equal '/chained', chained.url_path
284
+ assert_equal '/chain.html', chain.url_path
261
285
  assert_equal '/about', page.url_path
262
286
  assert_equal '/contact', second_page.url_path
263
287
  assert_equal '/ruby.png', static_bin.url_path
@@ -8,6 +8,8 @@ class ContentPageTest < TestCase
8
8
 
9
9
  let(:page_dir) { Staticpress.blog_path + config.source_path }
10
10
 
11
+ let(:chained) { Staticpress::Content::Page.new(:slug => 'chained') }
12
+ let(:chain) { Staticpress::Content::Page.new(:slug => 'chain.html') }
11
13
  let(:page) { Staticpress::Content::Page.new :slug => 'about' }
12
14
  let(:second_page) { Staticpress::Content::Page.new :slug => 'contact' }
13
15
  let(:index_page) { Staticpress::Content::Page.new :slug => '' }
@@ -19,10 +21,30 @@ class ContentPageTest < TestCase
19
21
  let(:fake) { Staticpress::Content::Page.new :slug => 'i/dont/exist' }
20
22
 
21
23
  def test_all
22
- assert_equal 9, Staticpress::Content::Page.all.count
24
+ assert_equal 11, Staticpress::Content::Page.all.count
25
+ end
26
+
27
+ def test_extension
28
+ assert_equal '.markdown.erb', chained.template_extension
29
+ assert_equal '.markdown.erb', chain.template_extension
30
+ assert_equal '.markdown', page.template_extension
31
+ end
32
+
33
+ def test_full_slug
34
+ assert_equal 'chained', chained.full_slug
35
+ assert_equal 'chain.html', chain.full_slug
36
+ assert_equal 'about', page.full_slug
37
+ end
38
+
39
+ def test_extract_slug
40
+ assert_equal 'chained', Staticpress::Content::Page.extract_slug(page_dir + 'chained.markdown.erb')
41
+ assert_equal 'about', Staticpress::Content::Page.extract_slug(page_dir + 'about.markdown')
42
+ assert_equal 'plain.txt', Staticpress::Content::Page.extract_slug(page_dir + 'plain.txt')
23
43
  end
24
44
 
25
45
  def test_find_by_path
46
+ assert_equal chained, Staticpress::Content::Page.find_by_path(page_dir + 'chained.markdown.erb')
47
+ assert_equal chain, Staticpress::Content::Page.find_by_path(page_dir + 'chain.html.markdown.erb')
26
48
  assert_equal page, Staticpress::Content::Page.find_by_path(page_dir + 'about.markdown')
27
49
  assert_equal index_page, Staticpress::Content::Page.find_by_path(page_dir + 'index.markdown')
28
50
  assert_nil Staticpress::Content::Page.find_by_path(page_dir + 'i' + 'dont' + 'exist.markdown')
@@ -0,0 +1,20 @@
1
+ require_relative '../../test_case'
2
+
3
+ require 'staticpress/helpers'
4
+ require 'staticpress/content/resource_content'
5
+
6
+ class ResourceContentTest < TestCase
7
+ include Staticpress::Helpers
8
+ include Staticpress::Content::ResourceContent
9
+
10
+ let(:page_dir) { Staticpress.blog_path + config.source_path }
11
+
12
+ def test_find_supported_extensions
13
+ assert_equal [:erb, :markdown], find_supported_extensions(page_dir + 'chained.markdown.erb')
14
+ assert_equal [:erb, :markdown], find_supported_extensions(page_dir + 'chained.markdown')
15
+ assert_equal [:erb, :markdown], find_supported_extensions(page_dir + 'chained')
16
+ assert_equal [:markdown], find_supported_extensions(page_dir + 'about')
17
+ assert_equal [], find_supported_extensions(page_dir + 'plain.txt')
18
+ assert_equal [], find_supported_extensions(page_dir + 'i/dont/exist')
19
+ end
20
+ end
@@ -0,0 +1 @@
1
+ <%= 'Processed with ERB' %>, then Markdown.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: staticpress
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -50,11 +50,11 @@ cert_chain:
50
50
  -----END CERTIFICATE-----
51
51
 
52
52
  '
53
- date: 2011-12-28 00:00:00.000000000 Z
53
+ date: 2012-02-13 00:00:00.000000000 Z
54
54
  dependencies:
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: aruba
57
- requirement: &18072460 !ruby/object:Gem::Requirement
57
+ requirement: &23480280 !ruby/object:Gem::Requirement
58
58
  none: false
59
59
  requirements:
60
60
  - - ! '>='
@@ -62,10 +62,10 @@ dependencies:
62
62
  version: '0'
63
63
  type: :development
64
64
  prerelease: false
65
- version_requirements: *18072460
65
+ version_requirements: *23480280
66
66
  - !ruby/object:Gem::Dependency
67
67
  name: compass
68
- requirement: &18072040 !ruby/object:Gem::Requirement
68
+ requirement: &23479040 !ruby/object:Gem::Requirement
69
69
  none: false
70
70
  requirements:
71
71
  - - ! '>='
@@ -73,10 +73,10 @@ dependencies:
73
73
  version: '0'
74
74
  type: :development
75
75
  prerelease: false
76
- version_requirements: *18072040
76
+ version_requirements: *23479040
77
77
  - !ruby/object:Gem::Dependency
78
78
  name: cucumber
79
- requirement: &18071440 !ruby/object:Gem::Requirement
79
+ requirement: &23477660 !ruby/object:Gem::Requirement
80
80
  none: false
81
81
  requirements:
82
82
  - - ! '>='
@@ -84,10 +84,10 @@ dependencies:
84
84
  version: '0'
85
85
  type: :development
86
86
  prerelease: false
87
- version_requirements: *18071440
87
+ version_requirements: *23477660
88
88
  - !ruby/object:Gem::Dependency
89
89
  name: haml
90
- requirement: &18070840 !ruby/object:Gem::Requirement
90
+ requirement: &23760940 !ruby/object:Gem::Requirement
91
91
  none: false
92
92
  requirements:
93
93
  - - ! '>='
@@ -95,10 +95,10 @@ dependencies:
95
95
  version: '0'
96
96
  type: :development
97
97
  prerelease: false
98
- version_requirements: *18070840
98
+ version_requirements: *23760940
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: minitest
101
- requirement: &18070260 !ruby/object:Gem::Requirement
101
+ requirement: &23760460 !ruby/object:Gem::Requirement
102
102
  none: false
103
103
  requirements:
104
104
  - - ! '>='
@@ -106,10 +106,10 @@ dependencies:
106
106
  version: '0'
107
107
  type: :development
108
108
  prerelease: false
109
- version_requirements: *18070260
109
+ version_requirements: *23760460
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: ruby-debug19
112
- requirement: &18069840 !ruby/object:Gem::Requirement
112
+ requirement: &23759140 !ruby/object:Gem::Requirement
113
113
  none: false
114
114
  requirements:
115
115
  - - ! '>='
@@ -117,10 +117,10 @@ dependencies:
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
- version_requirements: *18069840
120
+ version_requirements: *23759140
121
121
  - !ruby/object:Gem::Dependency
122
122
  name: sass
123
- requirement: &18069400 !ruby/object:Gem::Requirement
123
+ requirement: &23757940 !ruby/object:Gem::Requirement
124
124
  none: false
125
125
  requirements:
126
126
  - - ! '>='
@@ -128,10 +128,10 @@ dependencies:
128
128
  version: '0'
129
129
  type: :development
130
130
  prerelease: false
131
- version_requirements: *18069400
131
+ version_requirements: *23757940
132
132
  - !ruby/object:Gem::Dependency
133
133
  name: bundler
134
- requirement: &18068940 !ruby/object:Gem::Requirement
134
+ requirement: &23756500 !ruby/object:Gem::Requirement
135
135
  none: false
136
136
  requirements:
137
137
  - - ! '>='
@@ -139,10 +139,10 @@ dependencies:
139
139
  version: '0'
140
140
  type: :runtime
141
141
  prerelease: false
142
- version_requirements: *18068940
142
+ version_requirements: *23756500
143
143
  - !ruby/object:Gem::Dependency
144
144
  name: rack
145
- requirement: &18068240 !ruby/object:Gem::Requirement
145
+ requirement: &23755380 !ruby/object:Gem::Requirement
146
146
  none: false
147
147
  requirements:
148
148
  - - ! '>='
@@ -150,10 +150,10 @@ dependencies:
150
150
  version: '0'
151
151
  type: :runtime
152
152
  prerelease: false
153
- version_requirements: *18068240
153
+ version_requirements: *23755380
154
154
  - !ruby/object:Gem::Dependency
155
155
  name: thor
156
- requirement: &18067540 !ruby/object:Gem::Requirement
156
+ requirement: &22843360 !ruby/object:Gem::Requirement
157
157
  none: false
158
158
  requirements:
159
159
  - - ! '>='
@@ -161,10 +161,10 @@ dependencies:
161
161
  version: '0'
162
162
  type: :runtime
163
163
  prerelease: false
164
- version_requirements: *18067540
164
+ version_requirements: *22843360
165
165
  - !ruby/object:Gem::Dependency
166
166
  name: tilt
167
- requirement: &18066880 !ruby/object:Gem::Requirement
167
+ requirement: &22841040 !ruby/object:Gem::Requirement
168
168
  none: false
169
169
  requirements:
170
170
  - - ! '>='
@@ -172,7 +172,7 @@ dependencies:
172
172
  version: '0'
173
173
  type: :runtime
174
174
  prerelease: false
175
- version_requirements: *18066880
175
+ version_requirements: *22841040
176
176
  description: ! 'Staticpress is a blog-focused static site generator. It uses Tilt
177
177
  for rendering nearly any template you can think of and come with a built-in Rack
178
178
  server for easy development previews.
@@ -195,8 +195,13 @@ files:
195
195
  - docs/README.markdown
196
196
  - docs/config.ru
197
197
  - docs/config.yml
198
+ - docs/content/docs/content-types.markdown
199
+ - docs/content/docs/deploying.markdown
198
200
  - docs/content/docs/diving-deeper.markdown
201
+ - docs/content/docs/help.markdown
202
+ - docs/content/docs/plugins.markdown
199
203
  - docs/content/docs/setup.markdown
204
+ - docs/content/docs/theme.markdown
200
205
  - docs/content/index.markdown
201
206
  - features/happy_path.feature
202
207
  - features/step_definitions/staticpress_steps.rb
@@ -251,6 +256,7 @@ files:
251
256
  - tests/staticpress/content/index_test.rb
252
257
  - tests/staticpress/content/page_test.rb
253
258
  - tests/staticpress/content/post_test.rb
259
+ - tests/staticpress/content/resource_content_test.rb
254
260
  - tests/staticpress/content/tag_test.rb
255
261
  - tests/staticpress/content/theme_test.rb
256
262
  - tests/staticpress/helpers_test.rb
@@ -277,6 +283,8 @@ files:
277
283
  - tests/test_blog/content/_posts/2011-08-06-in-charlotte.markdown
278
284
  - tests/test_blog/content/_posts/2011-08-20-forever.markdown
279
285
  - tests/test_blog/content/about.markdown
286
+ - tests/test_blog/content/chain.html.markdown.erb
287
+ - tests/test_blog/content/chained.markdown.erb
280
288
  - tests/test_blog/content/contact.markdown
281
289
  - tests/test_blog/content/foo/bar/baz.markdown
282
290
  - tests/test_blog/content/index.markdown
@@ -316,7 +324,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
316
324
  version: '0'
317
325
  requirements: []
318
326
  rubyforge_project: staticpress
319
- rubygems_version: 1.8.13
327
+ rubygems_version: 1.8.16
320
328
  signing_key:
321
329
  specification_version: 3
322
330
  summary: Blog-centric static site builder
metadata.gz.sig CHANGED
Binary file