staticpress 0.6.0 → 0.6.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.
Files changed (37) hide show
  1. data/docs/content/docs.haml +5 -14
  2. data/docs/content/docs/build.markdown +6 -0
  3. data/docs/content/docs/content-types.markdown +6 -0
  4. data/docs/content/docs/deploy.markdown +6 -0
  5. data/docs/content/docs/help.markdown +6 -0
  6. data/docs/content/docs/plugins.markdown +6 -0
  7. data/docs/content/docs/plugins/menu.markdown +19 -0
  8. data/docs/content/docs/setup.markdown +6 -0
  9. data/docs/content/docs/themes.markdown +6 -0
  10. data/docs/content/features.haml +4 -6
  11. data/docs/content/index.haml +5 -6
  12. data/features/getting_started.feature +0 -2
  13. data/features/step_definitions/editing_blog_contents_steps.rb +10 -10
  14. data/features/step_definitions/getting_started_steps.rb +1 -1
  15. data/features/support/env.rb +3 -0
  16. data/lib/skeleton/config.yml +2 -1
  17. data/lib/staticpress/content/base.rb +10 -3
  18. data/lib/staticpress/content/category.rb +5 -1
  19. data/lib/staticpress/content/index.rb +6 -6
  20. data/lib/staticpress/content/page.rb +4 -0
  21. data/lib/staticpress/content/post.rb +5 -1
  22. data/lib/staticpress/content/tag.rb +5 -1
  23. data/lib/staticpress/content/theme.rb +4 -0
  24. data/lib/staticpress/plugins/menu.rb +79 -0
  25. data/lib/staticpress/site.rb +1 -1
  26. data/lib/staticpress/version.rb +1 -1
  27. data/lib/staticpress/view_helpers.rb +12 -4
  28. data/lib/themes/basic/assets/styles/all.css.sass +29 -11
  29. data/lib/themes/basic/layouts/default.haml +5 -4
  30. data/lib/themes/basic/layouts/post_index.haml +5 -4
  31. data/lib/themes/basic/views/default.haml +6 -1
  32. data/tests/staticpress/content/base_test.rb +13 -10
  33. data/tests/staticpress/content/index_test.rb +2 -0
  34. data/tests/staticpress/view_helpers_test.rb +7 -0
  35. data/tests/test_blog/content/_posts/2012-09-19-unpublished.markdown +6 -0
  36. metadata +6 -3
  37. data/lib/themes/basic/includes/list_posts.haml +0 -3
@@ -1,15 +1,6 @@
1
- %nav
2
- %menu{ :type => :toolbar }
3
- %li
4
- %a{ :href => '/docs' } Documentation
5
- %li
6
- %a{ :href => '/features' } Features
1
+ ---
2
+ menu:
3
+ position: 1
4
+ ---
7
5
 
8
- :markdown
9
- * [Setup](/docs/setup)
10
- * [Help](/docs/help)
11
- * [Content Types](/docs/content-types)
12
- * [Build](/docs/build)
13
- * [Deploy](/docs/deploy)
14
- * [Themes](/docs/themes)
15
- * [Plugins](/docs/plugins)
6
+ = menu -1, sub_menu_for(page), :type => :list
@@ -1,3 +1,9 @@
1
+ ---
2
+ menu:
3
+ position: 1.3
4
+ text: Build
5
+ ---
6
+
1
7
  # Build
2
8
 
3
9
  You can build your site in an ad-hoc fashion with `staticpress build`, but you will likely want to turn on the preview server. Run `staticpress serve` and open your browser to [http://localhost:4000/](http://localhost:4000/). Any change you make will be viewable with just a refresh.
@@ -1,3 +1,9 @@
1
+ ---
2
+ menu:
3
+ position: 1.2
4
+ text: Content Types
5
+ ---
6
+
1
7
  # Content Types
2
8
 
3
9
  Staticpress supports many formats for content. To do so, 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.
@@ -1 +1,7 @@
1
+ ---
2
+ menu:
3
+ position: 1.4
4
+ text: Deploy
5
+ ---
6
+
1
7
  # Deploying
@@ -1 +1,7 @@
1
+ ---
2
+ menu:
3
+ position: 1.1
4
+ text: Help
5
+ ---
6
+
1
7
  # Getting Help
@@ -1 +1,7 @@
1
+ ---
2
+ menu:
3
+ position: 1.6
4
+ text: Plugins
5
+ ---
6
+
1
7
  # Plugins
@@ -0,0 +1,19 @@
1
+ ---
2
+ menu:
3
+ position: 1.6.0
4
+ text: Menu
5
+ ---
6
+
7
+ # Menu
8
+
9
+ Frontmatter menu key
10
+
11
+ * adding `menu` to a page's frontmatter causes the page to be available to the menu system
12
+ * `text` subkey can be used to specify alternate menu text, otherwise the page's natural title will be used
13
+ * menu items are ordered alphabetically unless overridden by `position`
14
+ * `position`, when specified, allows the menu item to be moved around
15
+ * `position` can be used to build a menu tree of arbitrary depth
16
+ * `position` is zero-based
17
+ * `position: 2` # third menu item
18
+ * `position: 2.1` # second submenu item under third menu item
19
+ * if `position` is negative, position menu item relative to the end, instead of the start
@@ -1,3 +1,9 @@
1
+ ---
2
+ menu:
3
+ position: 1.0
4
+ text: Setup
5
+ ---
6
+
1
7
  # Zero To Blogging
2
8
 
3
9
  ## Pre-requisites
@@ -1 +1,7 @@
1
+ ---
2
+ menu:
3
+ position: 1.5
4
+ text: Themes
5
+ ---
6
+
1
7
  # Themes
@@ -1,6 +1,4 @@
1
- %nav
2
- %menu{ :type => :toolbar }
3
- %li
4
- %a{ :href => '/docs' } Documentation
5
- %li
6
- %a{ :href => '/features' } Features
1
+ ---
2
+ menu:
3
+ position: 2
4
+ ---
@@ -1,6 +1,5 @@
1
- %nav
2
- %menu{ :type => :toolbar }
3
- %li
4
- %a{ :href => '/docs' } Documentation
5
- %li
6
- %a{ :href => '/features' } Features
1
+ ---
2
+ menu:
3
+ position: 0
4
+ text: Home
5
+ ---
@@ -1,11 +1,9 @@
1
1
  Feature: Getting started
2
2
 
3
- @focus
4
3
  Scenario: Getting help
5
4
  Given I ask for help
6
5
  Then I am pointed in the right direction
7
6
 
8
- @focus
9
7
  Scenario: Finding the version
10
8
  Given I want Staticpress' version
11
9
  Then I see the version
@@ -54,6 +54,7 @@ Then /^the formats page only contains markup$/ do
54
54
  <!DOCTYPE html>
55
55
  <html>
56
56
  <head>
57
+ <meta charset='utf-8' />
57
58
  <title>Formats | Transient Thoughts</title>
58
59
  <link href='/assets/basic/styles/all.css' rel='stylesheet' type='text/css' />
59
60
  <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js'></script>
@@ -61,12 +62,11 @@ Then /^the formats page only contains markup$/ do
61
62
  </head>
62
63
  <body>
63
64
  <header>
64
- <span class='site-title'>Transient Thoughts</span>
65
- <span class='site-subtitle'>A blogging framework for hackers</span>
65
+ <div class='site-title'>Transient Thoughts</div>
66
+ <div class='site-subtitle'>A blogging framework for hackers</div>
66
67
  </header>
67
- <section>
68
- <p>hello world</p>
69
- </section>
68
+ <nav></nav>
69
+ <section><p>hello world</p></section>
70
70
  <section></section>
71
71
  </body>
72
72
  </html>
@@ -100,6 +100,7 @@ Then /^the build homepage looks good$/ do
100
100
  <!DOCTYPE html>
101
101
  <html>
102
102
  <head>
103
+ <meta charset='utf-8' />
103
104
  <title>Custom Home Page | Transient Thoughts</title>
104
105
  <link href='/assets/basic/styles/all.css' rel='stylesheet' type='text/css' />
105
106
  <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js'></script>
@@ -107,12 +108,11 @@ Then /^the build homepage looks good$/ do
107
108
  </head>
108
109
  <body>
109
110
  <header>
110
- <span class='site-title'>Transient Thoughts</span>
111
- <span class='site-subtitle'>A blogging framework for hackers</span>
111
+ <div class='site-title'>Transient Thoughts</div>
112
+ <div class='site-subtitle'>A blogging framework for hackers</div>
112
113
  </header>
113
- <section>
114
- <p>in custom page</p>
115
- </section>
114
+ <nav></nav>
115
+ <section><p>in custom page</p></section>
116
116
  <section></section>
117
117
  </body>
118
118
  </html>
@@ -44,7 +44,7 @@ Then /^the minimal files are present$/ do
44
44
  end
45
45
 
46
46
  Then /^Staticpress should remember my blog title$/ do
47
- check_exact_file_content 'config.yml', <<-YAML
47
+ check_file_content 'config.yml', <<-YAML, true
48
48
  ---
49
49
  :title: This is my blog
50
50
  YAML
@@ -13,6 +13,9 @@ module IntegrationHelpers
13
13
  blog_title = title ? "'#{title}'" : nil
14
14
  run_simple "staticpress new temporary_blog #{blog_title}"
15
15
  cd('temporary_blog')
16
+ append_to_file 'Gemfile', <<-RUBY
17
+ gem 'staticpress', :path => '../../..'
18
+ RUBY
16
19
  end
17
20
 
18
21
  def run_one_of(*commands)
@@ -11,7 +11,8 @@
11
11
  :plugins_path: plugins
12
12
  :source_path: content
13
13
  :posts_source_path: content/_posts
14
- :plugins: []
14
+ :plugins:
15
+ - menu
15
16
  :subscribe_rss: /atom.xml
16
17
  :deployment_strategy: :custom
17
18
  :deployment_strategies:
@@ -27,16 +27,14 @@ module Staticpress::Content
27
27
 
28
28
  def ==(other)
29
29
  other.respond_to?(:params) && (params == other.params) &&
30
- other.respond_to?(:url_path) && (url_path == other.url_path)
30
+ other.respond_to?(:url_path) && (url_path == other.url_path)
31
31
  end
32
32
 
33
33
  def content
34
34
  return @content if @content
35
35
 
36
- # regex_frontmatter = /^\<!-{2,}${1}(?<frontmatter>.*)^-+>${1}/m
37
36
  regex_frontmatter = /^-{3}${1}(?<frontmatter>.*)^-{3}${1}/m
38
37
  regex_text = /(?<text>.*)/m
39
- # regex = /(#{regex_frontmatter})?#{regex_text}/
40
38
  regex = /#{regex_frontmatter}#{regex_text}/
41
39
 
42
40
  c = template_path_content
@@ -88,6 +86,15 @@ module Staticpress::Content
88
86
  end
89
87
  end
90
88
 
89
+ def published?
90
+ published = meta.published
91
+ if published.is_a? Time
92
+ published <= Time.utc
93
+ else
94
+ published.nil? ? true : published
95
+ end
96
+ end
97
+
91
98
  def raw
92
99
  content[:text].strip
93
100
  end
@@ -39,13 +39,17 @@ module Staticpress::Content
39
39
  reply
40
40
  end
41
41
 
42
+ def self.published
43
+ all
44
+ end
45
+
42
46
  def self.categories
43
47
  content_by_category.keys
44
48
  end
45
49
 
46
50
  def self.content_by_category
47
51
  reply = Hash.new { |hash, key| hash[key] = [] }
48
- Staticpress::Content::Post.all.each do |post|
52
+ Staticpress::Content::Post.published.each do |post|
49
53
  (post.meta.categories || []).each do |category|
50
54
  (reply[category] ||= []) << post
51
55
  end
@@ -20,17 +20,17 @@ module Staticpress::Content
20
20
  end
21
21
 
22
22
  def self.all
23
- reply = []
24
-
25
- 1.upto paginate(all_posts).count do |number|
26
- reply << new(:number => number)
23
+ (1..paginate(all_posts).count).map do |number|
24
+ new(:number => number)
27
25
  end
26
+ end
28
27
 
29
- reply
28
+ def self.published
29
+ all
30
30
  end
31
31
 
32
32
  def self.all_posts
33
- Staticpress::Content::Post.all
33
+ Staticpress::Content::Post.published
34
34
  end
35
35
  end
36
36
  end
@@ -48,6 +48,10 @@ module Staticpress::Content
48
48
  gather_resources_from all_but_posts
49
49
  end
50
50
 
51
+ def self.published
52
+ all.select &:published?
53
+ end
54
+
51
55
  def self.create(format, title, path = nil)
52
56
  name = title.gsub(/ /, '-').downcase
53
57
 
@@ -14,7 +14,7 @@ module Staticpress::Content
14
14
  end
15
15
 
16
16
  def created_at
17
- meta.created_at ? meta.created_at : created_on
17
+ meta.created_at ? meta.created_at.utc : created_on
18
18
  end
19
19
 
20
20
  def created_on
@@ -47,6 +47,10 @@ module Staticpress::Content
47
47
  end
48
48
  end
49
49
 
50
+ def self.published
51
+ all.select &:published?
52
+ end
53
+
50
54
  def self.create(format, title)
51
55
  now = Time.now.utc
52
56
  created_on = "#{now.year}-#{'%02d' % now.month}-#{'%02d' % now.day}"
@@ -39,13 +39,17 @@ module Staticpress::Content
39
39
  reply
40
40
  end
41
41
 
42
+ def self.published
43
+ all
44
+ end
45
+
42
46
  def self.tags
43
47
  content_by_tag.keys
44
48
  end
45
49
 
46
50
  def self.content_by_tag
47
51
  reply = Hash.new { |hash, key| hash[key] = [] }
48
- Staticpress::Content::Post.all.each do |post|
52
+ Staticpress::Content::Post.published.each do |post|
49
53
  (post.meta.tags || []).each do |tag|
50
54
  (reply[tag] ||= []) << post
51
55
  end
@@ -23,6 +23,10 @@ module Staticpress::Content
23
23
  gather_resources_from((Staticpress::Theme.theme.root + 'assets').children)
24
24
  end
25
25
 
26
+ def self.published
27
+ all
28
+ end
29
+
26
30
  def self.find_by_path(path)
27
31
  if path.file?
28
32
  stubs = Staticpress::Route::REGEX_STUBS
@@ -0,0 +1,79 @@
1
+ module Staticpress::Plugins
2
+ module Menu
3
+ def root_menu
4
+ menu 1
5
+ end
6
+
7
+ def menu(max_depth, menu_items = root_menu_items, menu_options = {})
8
+ if (menu_items.count > 0) && !max_depth.zero?
9
+ tag :menu, { :type => :toolbar }.merge(menu_options) do
10
+ menu_items.sort.map do |item|
11
+ tag :li do
12
+ a = tag :a, :href => item.url_path do
13
+ item.text
14
+ end
15
+ remaining_depth = (max_depth < 0) ? max_depth : max_depth - 1
16
+ sub = menu(remaining_depth, item.sub_items, menu_options) || ''
17
+ a + sub
18
+ end
19
+ end.join("\n")
20
+ end
21
+ end
22
+ end
23
+
24
+ def sub_menu_for(page)
25
+ convert_to_menu_item(page).sub_items
26
+ end
27
+
28
+ def menu_pages
29
+ @menu_pages ||= lambda do
30
+ Staticpress::Content::Page.published.reject do |page|
31
+ page.meta.menu.nil?
32
+ end
33
+ end.call
34
+ end
35
+
36
+ def convert_to_menu_item(page)
37
+ parent_position = page.meta.menu.position.to_s
38
+ matcher = /^#{parent_position.gsub('.', '\.')}\.(?<sub_position>-?\d{1,})$/
39
+ sub_items = menu_pages.select do |sub_page|
40
+ matcher.match sub_page.meta.menu.position.to_s
41
+ end.map do |sub_page|
42
+ convert_to_menu_item sub_page
43
+ end
44
+ MenuItem.new parent_position.split('.').last, page.meta.menu.text || page.title, page.url_path, sub_items
45
+ end
46
+
47
+ def menu_depth(position)
48
+ position.split('.').count - 1
49
+ end
50
+
51
+ def root_menu_items
52
+ menu_pages.select do |page|
53
+ menu_depth(page.meta.menu.position.to_s).zero?
54
+ end.map do |page|
55
+ convert_to_menu_item page
56
+ end
57
+ end
58
+
59
+ class MenuItem
60
+ attr_reader :position, :text, :url_path, :sub_items
61
+
62
+ def initialize(position, text, url_path, sub_items = [])
63
+ @position = position.to_i
64
+ @text = text
65
+ @url_path = url_path
66
+ @sub_items = sub_items
67
+ end
68
+
69
+ def <=>(other)
70
+ reply = case
71
+ when (position < 0) && (other.position < 0) then other.position.abs <=> position.abs
72
+ when (position < 0) || (other.position < 0) then other.position <=> position
73
+ else position <=> other.position
74
+ end
75
+ reply.zero? ? (text <=> other.text) : reply
76
+ end
77
+ end
78
+ end
79
+ end
@@ -27,7 +27,7 @@ module Staticpress
27
27
 
28
28
  CONTENT_TYPES.each do |content_type|
29
29
  threads << Thread.new do
30
- content_type.all.each do |content|
30
+ content_type.published.each do |content|
31
31
  semaphore.synchronize do
32
32
  block.call content
33
33
  end
@@ -2,7 +2,7 @@ module Staticpress
2
2
  class Version
3
3
  extend Comparable
4
4
 
5
- SIGNATURE = [0, 6, 0]
5
+ SIGNATURE = [0, 6, 1]
6
6
 
7
7
  def self.<=>(other)
8
8
  other = other.split('.').map(&:to_i) if other.respond_to? :split
@@ -15,10 +15,6 @@ module Staticpress
15
15
  end
16
16
  end
17
17
 
18
- # TODO site_meta should be an aggregate all metadata
19
- def site_meta
20
- end
21
-
22
18
  def partial(name, locals = {})
23
19
  template_name = theme.include_for name
24
20
  if template_name.file?
@@ -26,5 +22,17 @@ module Staticpress
26
22
  template.render self.class.new(page), locals
27
23
  end
28
24
  end
25
+
26
+ # TODO site_meta should be an aggregate all metadata
27
+ def site_meta
28
+ end
29
+
30
+ def tag(name, attributes = {}, &block)
31
+ attribute_string = attributes.map do |key, value|
32
+ " #{key}=\"#{value}\""
33
+ end.join('')
34
+ content = block_given? ? block.call : ''
35
+ "<#{name}#{attribute_string}>#{content}</#{name}>"
36
+ end
29
37
  end
30
38
  end
@@ -1,13 +1,17 @@
1
1
  @import normalize
2
2
 
3
- $foreground-color: rgb(15, 12, 60)
4
- $background-color: invert($foreground-color)
3
+ // http://leaverou.github.com/contrast-ratio/#%23444459-on-%23F9F9F9
4
+ $foreground-color: #444459
5
+ $background-color: #F9F9F9
5
6
 
6
7
  @import compass/css3/border-radius
7
8
  @import compass/css3/box-shadow
8
9
  @import compass/css3/text-shadow
9
10
  @import compass/typography/lists
10
11
 
12
+ @mixin shadow($color: $foreground-color, $offset: 0)
13
+ @include single-text-shadow($color, $offset, $offset, $offset + 1px)
14
+
11
15
  html
12
16
  background-color: lighten($background-color, 5%)
13
17
 
@@ -18,23 +22,28 @@ body
18
22
  background-color: $background-color
19
23
  color: $foreground-color
20
24
  margin: 0 auto
21
- bottom: 1em
25
+ bottom: 1rem
22
26
  padding: 20px
23
- width: 960px
27
+ max-width: 960px
24
28
 
25
29
  .site-title,
26
30
  .site-subtitle
27
31
  display: block
28
32
  .site-title
29
- @include single-text-shadow(lighten($foreground-color, 10%), 1px, 1px, 2px)
30
- font-size: 3em
33
+ @include shadow(lighten($foreground-color, 10%), 1px)
34
+ font-size: 3rem
31
35
  .site-subtitle
32
- @include single-text-shadow($foreground-color, 1px, 1px, 1px)
33
- font-size: 2em
36
+ @include shadow
37
+ font-size: 2rem
34
38
 
35
39
  @for $level from 1 through 6
36
40
  h#{$level}
37
- @include single-text-shadow($foreground-color, 0, 0, 1px)
41
+ @include shadow
42
+
43
+ h,
44
+ .h
45
+ @include shadow
46
+ font-size: 1.8rem
38
47
 
39
48
  menu[type='toolbar']
40
49
  background-color: darken($foreground-color, 5%)
@@ -43,8 +52,8 @@ menu[type='toolbar']
43
52
  margin: 0
44
53
  padding: 0
45
54
  a
46
- margin: 0 0.25em
47
- padding: 0.5em
55
+ margin: 0 0.25rem
56
+ padding: 0.5rem
48
57
  text-decoration: none
49
58
  &:active,
50
59
  &:hover
@@ -60,6 +69,15 @@ menu[type='toolbar']
60
69
  @include inline-block
61
70
  color: darken($background-color, 5%)
62
71
 
72
+ .post
73
+ @include border-radius
74
+ @include box-shadow($foreground-color, 3px)
75
+ border: 0.1rem solid $foreground-color
76
+ margin: 1rem 0
77
+ padding: 0.5rem
78
+ &:hover
79
+ background-color: lighten($background-color, 5%)
80
+
63
81
  code
64
82
  background-color: darken($background-color, 10%)
65
83
  color: $foreground-color
@@ -1,14 +1,15 @@
1
1
  !!! 5
2
2
  %html
3
3
  %head
4
+ %meta{ :charset => 'utf-8' }/
4
5
  %title= page.full_title
5
6
  %link{ :rel => :stylesheet, :href => '/assets/basic/styles/all.css', :type => 'text/css' }/
6
7
  %script{ :src => 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js' }
7
8
  %script{ :src => '/assets/basic/scripts/application.js' }
8
9
  %body
9
10
  %header
10
- %span.site-title= config.title
11
- %span.site-subtitle= config.subtitle
12
- %section
13
- = yield
11
+ %div.site-title= config.title
12
+ %div.site-subtitle= config.subtitle
13
+ %nav= root_menu
14
+ %section= yield
14
15
  %section
@@ -1,14 +1,15 @@
1
1
  !!! 5
2
2
  %html
3
3
  %head
4
+ %meta{ :charset => 'utf-8' }/
4
5
  %title= page.full_title
5
6
  %link{ :rel => :stylesheet, :href => '/assets/basic/styles/all.css', :type => 'text/css' }/
6
7
  %script{ :src => 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js' }
7
8
  %script{ :src => '/assets/basic/scripts/application.js' }
8
9
  %body
9
10
  %header
10
- %span.site-title= config.title
11
- %span.site-subtitle= config.subtitle
12
- %section
13
- = yield
11
+ %div.site-title= config.title
12
+ %div.site-subtitle= config.subtitle
13
+ %nav= root_menu
14
+ %section= yield
14
15
  %section
@@ -2,4 +2,9 @@
2
2
  layout: post_index
3
3
  ---
4
4
 
5
- = partial :list_posts, :posts => page.sub_content
5
+ %section
6
+ - page.sub_content.each do |post|
7
+ %article.post
8
+ %header
9
+ %div.h= post.title
10
+ %section= post.render_partial
@@ -20,6 +20,7 @@ class ContentBaseTest < TestCase
20
20
  let(:page_fake) { Staticpress::Content::Page.new :slug => 'i/dont/exist' }
21
21
 
22
22
  let(:post) { Staticpress::Content::Post.new(:year => '2011', :month => '07', :day => '20', :title => 'hello') }
23
+ let(:unpublished) { Staticpress::Content::Post.new(:year => '2012', :month => '09', :day => '19', :title => 'unpublished') }
23
24
 
24
25
  let(:tag) { Staticpress::Content::Tag.new :name => 'charlotte' }
25
26
 
@@ -75,6 +76,7 @@ class ContentBaseTest < TestCase
75
76
  assert page_root.exist?, "#{page_root} does not exist"
76
77
 
77
78
  assert post.exist?, "#{post} does not exist"
79
+ assert unpublished.exist?, "#{unpublished} does not exist"
78
80
  assert tag.exist?, "#{tag} does not exist"
79
81
 
80
82
  assert asset_style.exist?, "#{asset_style} does not exist"
@@ -114,16 +116,17 @@ class ContentBaseTest < TestCase
114
116
  end
115
117
 
116
118
  def test_output_path
117
- assert_equal (Staticpress.blog_path + 'public' + 'chained' + 'index.html'), chained.output_path
118
- assert_equal (Staticpress.blog_path + 'public' + 'chain.html'), chain.output_path
119
- assert_equal (Staticpress.blog_path + 'public' + 'about' + 'index.html'), page.output_path
120
- assert_equal (Staticpress.blog_path + 'public' + 'index.html'), page_root.output_path
121
- assert_equal (Staticpress.blog_path + 'public' + 'style2.css'), style_2.output_path
122
- assert_equal (Staticpress.blog_path + 'public' + 'ruby.png'), static_bin.output_path
123
- assert_equal (Staticpress.blog_path + 'public' + 'plain.txt'), static_txt.output_path
124
- assert_equal (Staticpress.blog_path + 'public' + '2011' + '07' + '20' + 'hello' + 'index.html'), post.output_path
125
- assert_equal (Staticpress.blog_path + 'public' + 'assets' + 'test_theme' + 'styles' + 'all'), asset_style.output_path
126
- assert_equal (Staticpress.blog_path + 'public' + 'assets' + 'test_theme' + 'scripts' + 'application.js'), asset_script.output_path
119
+ output_directory = Staticpress.blog_path + 'public'
120
+ assert_equal (output_directory + 'chained' + 'index.html'), chained.output_path
121
+ assert_equal (output_directory + 'chain.html'), chain.output_path
122
+ assert_equal (output_directory + 'about' + 'index.html'), page.output_path
123
+ assert_equal (output_directory + 'index.html'), page_root.output_path
124
+ assert_equal (output_directory + 'style2.css'), style_2.output_path
125
+ assert_equal (output_directory + 'ruby.png'), static_bin.output_path
126
+ assert_equal (output_directory + 'plain.txt'), static_txt.output_path
127
+ assert_equal (output_directory + '2011' + '07' + '20' + 'hello' + 'index.html'), post.output_path
128
+ assert_equal (output_directory + 'assets' + 'test_theme' + 'styles' + 'all'), asset_style.output_path
129
+ assert_equal (output_directory + 'assets' + 'test_theme' + 'scripts' + 'application.js'), asset_script.output_path
127
130
  end
128
131
 
129
132
  def test_params
@@ -4,6 +4,7 @@ class ContentIndexTest < TestCase
4
4
  include Staticpress::Helpers
5
5
 
6
6
  let(:index) { Staticpress::Content::Index.new }
7
+ let(:unpublished) { Staticpress::Content::Post.new(:year => '2012', :month => '09', :day => '19', :title => 'unpublished') }
7
8
 
8
9
  def test_pages_count
9
10
  assert_equal 1, index.pages_count
@@ -22,6 +23,7 @@ class ContentIndexTest < TestCase
22
23
  Staticpress::Content::Post.new(:year => '2011', :month => '08', :day => '20', :title => 'forever')
23
24
  ]
24
25
  assert_equal expected, index.sub_content
26
+ refute_includes index.sub_content, unpublished
25
27
  end
26
28
  end
27
29
 
@@ -22,4 +22,11 @@ class ViewHelpersTest < TestCase
22
22
  HTML
23
23
  assert_equal expected, view_helpers.partial(:list_posts, :posts => [ ])
24
24
  end
25
+
26
+ def test_tag
27
+ assert_equal '<t></t>', view_helpers.tag(:t)
28
+ assert_equal '<t one="1"></t>', view_helpers.tag(:t, :one => 1)
29
+ assert_equal '<t>content</t>', view_helpers.tag(:t) { 'content' }
30
+ assert_equal '<t><n></n></t>', view_helpers.tag(:t) { view_helpers.tag(:n) }
31
+ end
25
32
  end
@@ -0,0 +1,6 @@
1
+ ---
2
+ created_at: 2012-09-19 11:32:02 UTC
3
+ published: false
4
+ ---
5
+
6
+ in post
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.6.0
4
+ version: 0.6.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-07 00:00:00.000000000 Z
12
+ date: 2012-11-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aruba
@@ -230,6 +230,7 @@ files:
230
230
  - docs/content/docs/deploy.markdown
231
231
  - docs/content/docs/help.markdown
232
232
  - docs/content/docs/plugins.markdown
233
+ - docs/content/docs/plugins/menu.markdown
233
234
  - docs/content/docs/setup.markdown
234
235
  - docs/content/docs/themes.markdown
235
236
  - docs/content/features.haml
@@ -267,6 +268,7 @@ files:
267
268
  - lib/staticpress/plugins.rb
268
269
  - lib/staticpress/plugins/blockquote.rb
269
270
  - lib/staticpress/plugins/gist.rb
271
+ - lib/staticpress/plugins/menu.rb
270
272
  - lib/staticpress/plugins/titlecase.rb
271
273
  - lib/staticpress/pusher.rb
272
274
  - lib/staticpress/route.rb
@@ -279,7 +281,6 @@ files:
279
281
  - lib/themes/basic/assets/scripts/application.js
280
282
  - lib/themes/basic/assets/styles/_normalize.scss
281
283
  - lib/themes/basic/assets/styles/all.css.sass
282
- - lib/themes/basic/includes/list_posts.haml
283
284
  - lib/themes/basic/layouts/archive.haml
284
285
  - lib/themes/basic/layouts/atom.haml
285
286
  - lib/themes/basic/layouts/default.haml
@@ -318,6 +319,7 @@ files:
318
319
  - tests/test_blog/content/_posts/2011-08-06-conferences.markdown
319
320
  - tests/test_blog/content/_posts/2011-08-06-in-charlotte.markdown
320
321
  - tests/test_blog/content/_posts/2011-08-20-forever.markdown
322
+ - tests/test_blog/content/_posts/2012-09-19-unpublished.markdown
321
323
  - tests/test_blog/content/about.markdown
322
324
  - tests/test_blog/content/chain.html.markdown.erb
323
325
  - tests/test_blog/content/chained.markdown.erb
@@ -404,6 +406,7 @@ test_files:
404
406
  - tests/test_blog/content/_posts/2011-08-06-conferences.markdown
405
407
  - tests/test_blog/content/_posts/2011-08-06-in-charlotte.markdown
406
408
  - tests/test_blog/content/_posts/2011-08-20-forever.markdown
409
+ - tests/test_blog/content/_posts/2012-09-19-unpublished.markdown
407
410
  - tests/test_blog/content/about.markdown
408
411
  - tests/test_blog/content/chain.html.markdown.erb
409
412
  - tests/test_blog/content/chained.markdown.erb
@@ -1,3 +0,0 @@
1
- %section
2
- - posts.each do |post|
3
- %article= post.render_partial