staticpress 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/docs/Gemfile +8 -0
- data/{tests/sample_sites/test_blog → docs}/README.markdown +0 -0
- data/{tests/sample_sites/test_blog → docs}/config.ru +0 -0
- data/docs/config.yml +2 -0
- data/docs/content/docs/diving-deeper.markdown +3 -0
- data/docs/content/docs/setup.markdown +15 -0
- data/docs/content/index.markdown +1 -0
- data/features/happy_path.feature +36 -1
- data/features/step_definitions/staticpress_steps.rb +1 -1
- data/lib/skeleton/Gemfile +0 -2
- data/lib/staticpress/booter.rb +1 -1
- data/lib/staticpress/cli.rb +2 -2
- data/lib/staticpress/content/base.rb +66 -23
- data/lib/staticpress/content/category.rb +12 -3
- data/lib/staticpress/content/collection_content.rb +0 -4
- data/lib/staticpress/content/index.rb +10 -3
- data/lib/staticpress/content/page.rb +32 -17
- data/lib/staticpress/content/post.rb +22 -27
- data/lib/staticpress/content/resource_content.rb +11 -3
- data/lib/staticpress/content/static_content.rb +10 -4
- data/lib/staticpress/content/tag.rb +12 -3
- data/lib/staticpress/content/theme.rb +17 -19
- data/lib/staticpress/helpers.rb +4 -0
- data/lib/staticpress/route.rb +21 -95
- data/lib/staticpress/server.rb +1 -3
- data/lib/staticpress/site.rb +20 -16
- data/lib/staticpress/version.rb +1 -1
- data/tests/staticpress/configuration_test.rb +4 -0
- data/tests/staticpress/content/base_test.rb +271 -0
- data/tests/staticpress/content/category_test.rb +29 -0
- data/tests/staticpress/content/index_test.rb +6 -0
- data/tests/staticpress/content/page_test.rb +37 -0
- data/tests/staticpress/content/post_test.rb +45 -0
- data/tests/staticpress/content/tag_test.rb +33 -0
- data/tests/staticpress/content/theme_test.rb +29 -0
- data/tests/{lib/staticpress → staticpress}/helpers_test.rb +2 -2
- data/tests/staticpress/js_object_test.rb +43 -0
- data/tests/staticpress/metadata_test.rb +16 -0
- data/tests/staticpress/plugin_test.rb +4 -0
- data/tests/staticpress/pusher_test.rb +9 -0
- data/tests/{lib/staticpress → staticpress}/route_test.rb +19 -41
- data/tests/{lib/staticpress → staticpress}/server_test.rb +5 -14
- data/tests/staticpress/site_test.rb +21 -0
- data/tests/staticpress/theme_test.rb +86 -0
- data/tests/staticpress/view_helpers_test.rb +28 -0
- data/tests/{lib/staticpress_test.rb → staticpress_test.rb} +3 -3
- data/tests/{sample_sites/test_blog → test_blog}/Gemfile +0 -2
- data/tests/test_blog/README.markdown +21 -0
- data/tests/test_blog/config.ru +8 -0
- data/tests/{sample_sites/test_blog → test_blog}/config.yml +0 -0
- data/tests/{sample_sites/test_blog → test_blog}/content/_posts/2011-07-20-hello.markdown +0 -0
- data/tests/{sample_sites/test_blog → test_blog}/content/_posts/2011-08-01-announcing-staticpress.markdown +0 -0
- data/tests/{sample_sites/test_blog → test_blog}/content/_posts/2011-08-02-staticpress.markdown +0 -0
- data/tests/{sample_sites/test_blog → test_blog}/content/_posts/2011-08-06-blogging-with-staticpress.markdown +0 -0
- data/tests/{sample_sites/test_blog → test_blog}/content/_posts/2011-08-06-conferences.markdown +0 -0
- data/tests/{sample_sites/test_blog → test_blog}/content/_posts/2011-08-06-in-charlotte.markdown +0 -0
- data/tests/{sample_sites/test_blog → test_blog}/content/_posts/2011-08-20-forever.markdown +0 -0
- data/tests/{sample_sites/test_blog → test_blog}/content/about.markdown +0 -0
- data/tests/{sample_sites/test_blog → test_blog}/content/contact.markdown +0 -0
- data/tests/{sample_sites/test_blog → test_blog}/content/foo/bar/baz.markdown +0 -0
- data/tests/test_blog/content/index.markdown +1 -0
- data/tests/{sample_sites/test_blog → test_blog}/content/plain.txt +0 -0
- data/tests/{sample_sites/test_blog → test_blog}/content/ruby.png +0 -0
- data/tests/{sample_sites/test_blog → test_blog}/content/style1.css +0 -0
- data/tests/{sample_sites/test_blog → test_blog}/content/style2.css.sass +0 -0
- data/tests/{sample_sites/test_blog → test_blog}/content/style3.sass +0 -0
- data/tests/{sample_sites/test_blog → test_blog}/themes/test_theme/assets/scripts/application.js +0 -0
- data/tests/{sample_sites/test_blog → test_blog}/themes/test_theme/assets/styles/all.sass +0 -0
- data/tests/{sample_sites/test_blog → test_blog}/themes/test_theme/includes/list_posts.haml +0 -0
- data/tests/{sample_sites/test_blog → test_blog}/themes/test_theme/layouts/archive.haml +0 -0
- data/tests/{sample_sites/test_blog → test_blog}/themes/test_theme/layouts/atom.haml +0 -0
- data/tests/{sample_sites/test_blog → test_blog}/themes/test_theme/layouts/default.haml +0 -0
- data/tests/{sample_sites/test_blog → test_blog}/themes/test_theme/layouts/index.haml +0 -0
- data/tests/{sample_sites/test_blog → test_blog}/themes/test_theme/layouts/post_index.haml +0 -0
- data/tests/{sample_sites/test_blog → test_blog}/themes/test_theme/views/default.haml +0 -0
- data/tests/{test_helper.rb → test_case.rb} +9 -5
- metadata +81 -73
- metadata.gz.sig +0 -0
- data/tests/lib/staticpress/configuration_test.rb +0 -4
- data/tests/lib/staticpress/content/base_test.rb +0 -6
- data/tests/lib/staticpress/content/category_test.rb +0 -62
- data/tests/lib/staticpress/content/index_test.rb +0 -45
- data/tests/lib/staticpress/content/page_test.rb +0 -147
- data/tests/lib/staticpress/content/post_test.rb +0 -89
- data/tests/lib/staticpress/content/tag_test.rb +0 -60
- data/tests/lib/staticpress/content/theme_test.rb +0 -114
- data/tests/lib/staticpress/js_object_test.rb +0 -45
- data/tests/lib/staticpress/metadata_test.rb +0 -19
- data/tests/lib/staticpress/plugin_test.rb +0 -4
- data/tests/lib/staticpress/pusher_test.rb +0 -9
- data/tests/lib/staticpress/site_test.rb +0 -26
- data/tests/lib/staticpress/theme_test.rb +0 -86
- 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,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
|