staticpress 0.3.0 → 0.4.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 (94) hide show
  1. data.tar.gz.sig +0 -0
  2. data/docs/Gemfile +8 -0
  3. data/{tests/sample_sites/test_blog → docs}/README.markdown +0 -0
  4. data/{tests/sample_sites/test_blog → docs}/config.ru +0 -0
  5. data/docs/config.yml +2 -0
  6. data/docs/content/docs/diving-deeper.markdown +3 -0
  7. data/docs/content/docs/setup.markdown +15 -0
  8. data/docs/content/index.markdown +1 -0
  9. data/features/happy_path.feature +36 -1
  10. data/features/step_definitions/staticpress_steps.rb +1 -1
  11. data/lib/skeleton/Gemfile +0 -2
  12. data/lib/staticpress/booter.rb +1 -1
  13. data/lib/staticpress/cli.rb +2 -2
  14. data/lib/staticpress/content/base.rb +66 -23
  15. data/lib/staticpress/content/category.rb +12 -3
  16. data/lib/staticpress/content/collection_content.rb +0 -4
  17. data/lib/staticpress/content/index.rb +10 -3
  18. data/lib/staticpress/content/page.rb +32 -17
  19. data/lib/staticpress/content/post.rb +22 -27
  20. data/lib/staticpress/content/resource_content.rb +11 -3
  21. data/lib/staticpress/content/static_content.rb +10 -4
  22. data/lib/staticpress/content/tag.rb +12 -3
  23. data/lib/staticpress/content/theme.rb +17 -19
  24. data/lib/staticpress/helpers.rb +4 -0
  25. data/lib/staticpress/route.rb +21 -95
  26. data/lib/staticpress/server.rb +1 -3
  27. data/lib/staticpress/site.rb +20 -16
  28. data/lib/staticpress/version.rb +1 -1
  29. data/tests/staticpress/configuration_test.rb +4 -0
  30. data/tests/staticpress/content/base_test.rb +271 -0
  31. data/tests/staticpress/content/category_test.rb +29 -0
  32. data/tests/staticpress/content/index_test.rb +6 -0
  33. data/tests/staticpress/content/page_test.rb +37 -0
  34. data/tests/staticpress/content/post_test.rb +45 -0
  35. data/tests/staticpress/content/tag_test.rb +33 -0
  36. data/tests/staticpress/content/theme_test.rb +29 -0
  37. data/tests/{lib/staticpress → staticpress}/helpers_test.rb +2 -2
  38. data/tests/staticpress/js_object_test.rb +43 -0
  39. data/tests/staticpress/metadata_test.rb +16 -0
  40. data/tests/staticpress/plugin_test.rb +4 -0
  41. data/tests/staticpress/pusher_test.rb +9 -0
  42. data/tests/{lib/staticpress → staticpress}/route_test.rb +19 -41
  43. data/tests/{lib/staticpress → staticpress}/server_test.rb +5 -14
  44. data/tests/staticpress/site_test.rb +21 -0
  45. data/tests/staticpress/theme_test.rb +86 -0
  46. data/tests/staticpress/view_helpers_test.rb +28 -0
  47. data/tests/{lib/staticpress_test.rb → staticpress_test.rb} +3 -3
  48. data/tests/{sample_sites/test_blog → test_blog}/Gemfile +0 -2
  49. data/tests/test_blog/README.markdown +21 -0
  50. data/tests/test_blog/config.ru +8 -0
  51. data/tests/{sample_sites/test_blog → test_blog}/config.yml +0 -0
  52. data/tests/{sample_sites/test_blog → test_blog}/content/_posts/2011-07-20-hello.markdown +0 -0
  53. data/tests/{sample_sites/test_blog → test_blog}/content/_posts/2011-08-01-announcing-staticpress.markdown +0 -0
  54. data/tests/{sample_sites/test_blog → test_blog}/content/_posts/2011-08-02-staticpress.markdown +0 -0
  55. data/tests/{sample_sites/test_blog → test_blog}/content/_posts/2011-08-06-blogging-with-staticpress.markdown +0 -0
  56. data/tests/{sample_sites/test_blog → test_blog}/content/_posts/2011-08-06-conferences.markdown +0 -0
  57. data/tests/{sample_sites/test_blog → test_blog}/content/_posts/2011-08-06-in-charlotte.markdown +0 -0
  58. data/tests/{sample_sites/test_blog → test_blog}/content/_posts/2011-08-20-forever.markdown +0 -0
  59. data/tests/{sample_sites/test_blog → test_blog}/content/about.markdown +0 -0
  60. data/tests/{sample_sites/test_blog → test_blog}/content/contact.markdown +0 -0
  61. data/tests/{sample_sites/test_blog → test_blog}/content/foo/bar/baz.markdown +0 -0
  62. data/tests/test_blog/content/index.markdown +1 -0
  63. data/tests/{sample_sites/test_blog → test_blog}/content/plain.txt +0 -0
  64. data/tests/{sample_sites/test_blog → test_blog}/content/ruby.png +0 -0
  65. data/tests/{sample_sites/test_blog → test_blog}/content/style1.css +0 -0
  66. data/tests/{sample_sites/test_blog → test_blog}/content/style2.css.sass +0 -0
  67. data/tests/{sample_sites/test_blog → test_blog}/content/style3.sass +0 -0
  68. data/tests/{sample_sites/test_blog → test_blog}/themes/test_theme/assets/scripts/application.js +0 -0
  69. data/tests/{sample_sites/test_blog → test_blog}/themes/test_theme/assets/styles/all.sass +0 -0
  70. data/tests/{sample_sites/test_blog → test_blog}/themes/test_theme/includes/list_posts.haml +0 -0
  71. data/tests/{sample_sites/test_blog → test_blog}/themes/test_theme/layouts/archive.haml +0 -0
  72. data/tests/{sample_sites/test_blog → test_blog}/themes/test_theme/layouts/atom.haml +0 -0
  73. data/tests/{sample_sites/test_blog → test_blog}/themes/test_theme/layouts/default.haml +0 -0
  74. data/tests/{sample_sites/test_blog → test_blog}/themes/test_theme/layouts/index.haml +0 -0
  75. data/tests/{sample_sites/test_blog → test_blog}/themes/test_theme/layouts/post_index.haml +0 -0
  76. data/tests/{sample_sites/test_blog → test_blog}/themes/test_theme/views/default.haml +0 -0
  77. data/tests/{test_helper.rb → test_case.rb} +9 -5
  78. metadata +81 -73
  79. metadata.gz.sig +0 -0
  80. data/tests/lib/staticpress/configuration_test.rb +0 -4
  81. data/tests/lib/staticpress/content/base_test.rb +0 -6
  82. data/tests/lib/staticpress/content/category_test.rb +0 -62
  83. data/tests/lib/staticpress/content/index_test.rb +0 -45
  84. data/tests/lib/staticpress/content/page_test.rb +0 -147
  85. data/tests/lib/staticpress/content/post_test.rb +0 -89
  86. data/tests/lib/staticpress/content/tag_test.rb +0 -60
  87. data/tests/lib/staticpress/content/theme_test.rb +0 -114
  88. data/tests/lib/staticpress/js_object_test.rb +0 -45
  89. data/tests/lib/staticpress/metadata_test.rb +0 -19
  90. data/tests/lib/staticpress/plugin_test.rb +0 -4
  91. data/tests/lib/staticpress/pusher_test.rb +0 -9
  92. data/tests/lib/staticpress/site_test.rb +0 -26
  93. data/tests/lib/staticpress/theme_test.rb +0 -86
  94. data/tests/lib/staticpress/view_helpers_test.rb +0 -33
@@ -1,45 +0,0 @@
1
- require_relative '../../test_helper'
2
-
3
- require 'staticpress/js_object'
4
-
5
- class JSObjectTest < TestHelper
6
- JSO = Staticpress::JSObject
7
-
8
- def setup
9
- @js_object = JSO.new :key => :value, :nested => { :a => :b }
10
- end
11
-
12
- def test__minus
13
- assert_equal(JSO.new({ :key => :value, :nested => { :a => :b } }), @js_object - {})
14
- assert_equal(JSO.new({ :nested => { :a => :b } }), @js_object - { :key => :value })
15
- assert_equal(JSO.new({ :key => :value }), @js_object - { :nested => { :a => :b } })
16
- assert_equal(JSO.new({}), @js_object - { :key => :value, :nested => { :a => :b } })
17
-
18
- assert_equal(JSO.new({ :key => :value, :nested => { :a => :b } }), @js_object - JSO.new({}))
19
- assert_equal(JSO.new({ :nested => { :a => :b } }), @js_object - JSO.new({ :key => :value }))
20
- assert_equal(JSO.new({ :key => :value }), @js_object - JSO.new({ :nested => { :a => :b } }))
21
- assert_equal(JSO.new({}), @js_object - JSO.new({ :key => :value, :nested => { :a => :b } }))
22
- end
23
-
24
- def test__squares
25
- assert_nil @js_object[:some_random]
26
- assert_equal :value, @js_object[:key]
27
- assert_equal :value, @js_object['key']
28
- end
29
-
30
- def test_regular_access
31
- assert_equal :value, @js_object.key
32
- assert_equal :b, @js_object.nested.a
33
- assert_nil @js_object.nested.other
34
- end
35
-
36
- def test_assignment
37
- assert_nil @js_object.hoopla
38
- @js_object.hoopla = :hullabaloo
39
- assert_equal :hullabaloo, @js_object.hoopla
40
- end
41
-
42
- def test_to_hash
43
- assert_equal({ :key => :value, :nested => { :a => :b } }, @js_object.to_hash)
44
- end
45
- end
@@ -1,19 +0,0 @@
1
- require_relative 'js_object_test'
2
-
3
- require 'staticpress/metadata'
4
-
5
- class MetadataTest < JSObjectTest
6
- def setup
7
- super
8
- @meta = Staticpress::Metadata.new
9
- @another_meta = Staticpress::Metadata.new :layout => 'post_index', :categories => %w[programming], :tags => %w[code tutorial]
10
- end
11
-
12
- def test__chevron
13
- end
14
-
15
- def test_inspect
16
- assert_equal '#<Staticpress::Metadata>', @meta.inspect
17
- assert_equal '#<Staticpress::Metadata categories=["programming"], layout="post_index", tags=["code", "tutorial"]>', @another_meta.inspect
18
- end
19
- end
@@ -1,4 +0,0 @@
1
- require_relative '../../test_helper'
2
-
3
- class PluginTest < TestHelper
4
- end
@@ -1,9 +0,0 @@
1
- require_relative '../../test_helper'
2
-
3
- class PusherTest < TestHelper
4
- def test_custom
5
- end
6
-
7
- def test_push
8
- end
9
- end
@@ -1,26 +0,0 @@
1
- require_relative '../../test_helper'
2
-
3
- require 'staticpress/content/page'
4
- require 'staticpress/content/post'
5
- require 'staticpress/route'
6
- require 'staticpress/site'
7
-
8
- class SiteTest < TestHelper
9
- def setup
10
- super
11
-
12
- @site = Staticpress::Site.new
13
-
14
- @page_route = Staticpress::Route.from_url_path '/about'
15
- @page = Staticpress::Content::Page.new @page_route, :markdown
16
-
17
- @post_route = Staticpress::Route.from_url_path '/2011/07/20/hello'
18
- @post = Staticpress::Content::Post.new @post_route, :markdown
19
- end
20
-
21
- def test_find_content_by_url_path
22
- assert_equal @page, @site.find_content_by_url_path('/about')
23
- assert_equal @post, @site.find_content_by_url_path('/2011/07/20/hello')
24
- assert_nil @site.find_content_by_url_path('/i/dont/exist')
25
- end
26
- end
@@ -1,86 +0,0 @@
1
- require_relative '../../test_helper'
2
-
3
- require 'staticpress/helpers'
4
- require 'staticpress/theme'
5
-
6
- class ThemeTest < TestHelper
7
- include Staticpress::Helpers
8
-
9
- def setup
10
- super
11
-
12
- config.theme = :test_theme
13
- @theme = Staticpress::Theme.new :test_theme
14
- end
15
-
16
- def test__equalsequals
17
- assert_operator @theme, :==, Staticpress::Theme.new(:test_theme)
18
- end
19
-
20
- def test_root
21
- assert_equal @theme.root, (Staticpress.blog_path + 'themes' + 'test_theme')
22
- end
23
-
24
- def test_theme
25
- assert_equal @theme, Staticpress::Theme.theme
26
- end
27
-
28
-
29
- def test_default_include
30
- refute_respond_to @theme, :default_include
31
- end
32
-
33
- def test_keyed_includes
34
- assert_equal((@theme.root + 'includes' + 'list_posts.haml'), @theme.keyed_includes['list_posts'])
35
- assert_nil @theme.keyed_includes['fake']
36
- end
37
-
38
- def test_include_for
39
- assert_equal (@theme.root + 'includes' + 'list_posts.haml'), @theme.include_for(:list_posts)
40
- assert_nil @theme.include_for(:fake)
41
- end
42
-
43
- def test_includes
44
- assert_equal 1, @theme.includes.count
45
- end
46
-
47
-
48
- def test_default_layout
49
- assert_equal (@theme.root + 'layouts' + 'default.haml'), @theme.default_layout
50
- end
51
-
52
- def test_keyed_layouts
53
- assert_equal((@theme.root + 'layouts' + 'default.haml'), @theme.keyed_layouts['default'])
54
- assert_equal((@theme.root + 'layouts' + 'post_index.haml'), @theme.keyed_layouts['post_index'])
55
- assert_nil @theme.keyed_layouts['fake']
56
- end
57
-
58
- def test_layout_for
59
- assert_equal (@theme.root + 'layouts' + 'default.haml'), @theme.layout_for(:default)
60
- assert_equal (@theme.root + 'layouts' + 'post_index.haml'), @theme.layout_for(:post_index)
61
- assert_nil @theme.layout_for(:fake)
62
- end
63
-
64
- def test_layouts
65
- assert_equal 5, @theme.layouts.count
66
- end
67
-
68
-
69
- def test_default_view
70
- assert_equal (@theme.root + 'views' + 'default.haml'), @theme.default_view
71
- end
72
-
73
- def test_keyed_views
74
- assert_equal((@theme.root + 'views' + 'default.haml'), @theme.keyed_views['default'])
75
- assert_nil @theme.keyed_views['fake']
76
- end
77
-
78
- def test_view_for
79
- assert_equal (@theme.root + 'views' + 'default.haml'), @theme.view_for(:default)
80
- assert_nil @theme.view_for(:fake)
81
- end
82
-
83
- def test_views
84
- assert_equal 1, @theme.views.count
85
- end
86
- end
@@ -1,33 +0,0 @@
1
- require_relative '../../test_helper'
2
-
3
- require 'staticpress/helpers'
4
- require 'staticpress/view_helpers'
5
-
6
- class ViewHelpersTest < TestHelper
7
- include Staticpress::Helpers
8
-
9
- def setup
10
- super
11
-
12
- @post_route = Staticpress::Route.from_url_path '/2011/07/20/hello'
13
- @post = Staticpress::Content::Post.new @post_route, Staticpress.blog_path + config.posts_source_path + '2011-07-20-hello.markdown'
14
- @view_helpers = Staticpress::ViewHelpers.new @post
15
- end
16
-
17
- def test_partial_with_one_post
18
- expected = <<-HTML
19
- <section>
20
- <article>#{@post.render_partial.strip}</article>
21
- </section>
22
- HTML
23
- assert_equal expected, @view_helpers.partial(:list_posts, :posts => [ @post ])
24
- end
25
-
26
- def test_partial_with_no_posts
27
- expected = <<-HTML
28
- <section>
29
- </section>
30
- HTML
31
- assert_equal expected, @view_helpers.partial(:list_posts, :posts => [ ])
32
- end
33
- end