staticpress 0.6.2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/NOTES.markdown +23 -0
- data/Rakefile +1 -6
- data/docs/content/docs/plugins/pagination.haml +30 -0
- data/docs/content/docs/samples/page.markdown +14 -0
- data/docs/content/docs/samples/post.markdown +18 -0
- data/docs/content/docs/themes.markdown +47 -0
- data/lib/skeleton/config.yml +1 -0
- data/lib/staticpress/cli.rb +5 -9
- data/lib/staticpress/content/base.rb +8 -10
- data/lib/staticpress/content/category.rb +17 -4
- data/lib/staticpress/content/collection_content.rb +1 -3
- data/lib/staticpress/content/index.rb +6 -3
- data/lib/staticpress/content/page.rb +4 -0
- data/lib/staticpress/content/post.rb +4 -1
- data/lib/staticpress/content/resource_content.rb +2 -8
- data/lib/staticpress/content/tag.rb +17 -4
- data/lib/staticpress/content/theme.rb +1 -1
- data/lib/staticpress/helpers.rb +5 -5
- data/lib/staticpress/plugins/menu.rb +1 -1
- data/lib/staticpress/plugins/pagination.rb +38 -0
- data/lib/staticpress/theme.rb +45 -17
- data/lib/staticpress/version.rb +1 -1
- data/lib/themes/basic/includes/github.haml +2 -0
- data/lib/themes/basic/layouts/default.haml +1 -0
- data/lib/themes/basic/views/page_paged.haml +6 -0
- data/{tests → spec/fixtures}/test_blog/Gemfile +0 -0
- data/{tests → spec/fixtures}/test_blog/README.markdown +0 -0
- data/{tests → spec/fixtures}/test_blog/config.ru +0 -0
- data/{tests → spec/fixtures}/test_blog/config.yml +0 -0
- data/{tests → spec/fixtures}/test_blog/content/_posts/2011-07-20-hello.markdown +0 -0
- data/{tests → spec/fixtures}/test_blog/content/_posts/2011-08-01-announcing-staticpress.markdown +0 -0
- data/{tests → spec/fixtures}/test_blog/content/_posts/2011-08-02-staticpress.markdown +0 -0
- data/{tests → spec/fixtures}/test_blog/content/_posts/2011-08-06-blogging-with-staticpress.markdown +0 -0
- data/{tests → spec/fixtures}/test_blog/content/_posts/2011-08-06-conferences.markdown +0 -0
- data/{tests → spec/fixtures}/test_blog/content/_posts/2011-08-06-in-charlotte.markdown +0 -0
- data/{tests → spec/fixtures}/test_blog/content/_posts/2011-08-20-forever.markdown +0 -0
- data/{tests → spec/fixtures}/test_blog/content/_posts/2012-09-19-unpublished.markdown +0 -0
- data/{tests → spec/fixtures}/test_blog/content/about.markdown +0 -0
- data/{tests → spec/fixtures}/test_blog/content/chain.html.markdown.erb +0 -0
- data/{tests → spec/fixtures}/test_blog/content/chained.markdown.erb +0 -0
- data/{tests → spec/fixtures}/test_blog/content/contact.markdown +0 -0
- data/{tests → spec/fixtures}/test_blog/content/foo/bar/baz.markdown +0 -0
- data/{tests → spec/fixtures}/test_blog/content/index.markdown +0 -0
- data/{tests → spec/fixtures}/test_blog/content/plain.txt +0 -0
- data/{tests → spec/fixtures}/test_blog/content/ruby.png +0 -0
- data/{tests → spec/fixtures}/test_blog/content/style1.css +0 -0
- data/{tests → spec/fixtures}/test_blog/content/style2.css.sass +0 -0
- data/{tests → spec/fixtures}/test_blog/content/style3.sass +0 -0
- data/{tests → spec/fixtures}/test_blog/themes/test_theme/assets/scripts/application.js +0 -0
- data/{tests → spec/fixtures}/test_blog/themes/test_theme/assets/styles/all.sass +0 -0
- data/{tests → spec/fixtures}/test_blog/themes/test_theme/includes/list_posts.haml +0 -0
- data/{lib/themes/basic → spec/fixtures/test_blog/themes/test_theme}/layouts/archive.haml +0 -0
- data/{lib/themes/basic → spec/fixtures/test_blog/themes/test_theme}/layouts/atom.haml +0 -0
- data/{tests → spec/fixtures}/test_blog/themes/test_theme/layouts/default.haml +0 -0
- data/{tests → spec/fixtures}/test_blog/themes/test_theme/layouts/index.haml +0 -0
- data/{tests → spec/fixtures}/test_blog/themes/test_theme/layouts/post_index.haml +0 -0
- data/{tests → spec/fixtures}/test_blog/themes/test_theme/views/default.haml +0 -0
- data/spec/integration/editing_blog_contents_spec.rb +52 -0
- data/spec/integration/editing_blog_spec.rb +42 -0
- data/spec/integration/getting_started_spec.rb +29 -0
- data/spec/spec_helper.rb +35 -0
- data/spec/support/custom_matchers.rb +15 -0
- data/spec/support/fixtures.rb +35 -0
- data/spec/support/integration_support.rb +230 -0
- data/spec/support/unit_support.rb +18 -0
- data/spec/unit/staticpress/content/base_spec.rb +327 -0
- data/spec/unit/staticpress/content/category_spec.rb +60 -0
- data/spec/unit/staticpress/content/index_spec.rb +48 -0
- data/spec/unit/staticpress/content/page_spec.rb +70 -0
- data/spec/unit/staticpress/content/post_spec.rb +54 -0
- data/spec/unit/staticpress/content/resource_content_spec.rb +21 -0
- data/spec/unit/staticpress/content/tag_spec.rb +53 -0
- data/spec/unit/staticpress/content/theme_spec.rb +31 -0
- data/spec/unit/staticpress/helpers_spec.rb +72 -0
- data/spec/unit/staticpress/js_object_spec.rb +61 -0
- data/spec/unit/staticpress/metadata_spec.rb +15 -0
- data/spec/unit/staticpress/route_spec.rb +219 -0
- data/spec/unit/staticpress/server_spec.rb +23 -0
- data/spec/unit/staticpress/settings_spec.rb +19 -0
- data/spec/unit/staticpress/site_spec.rb +26 -0
- data/spec/unit/staticpress/theme_spec.rb +80 -0
- data/spec/unit/staticpress/view_helpers_spec.rb +40 -0
- data/spec/unit/staticpress_spec.rb +27 -0
- data/staticpress.gemspec +3 -4
- metadata +133 -136
- data/features/editing_blog.feature +0 -24
- data/features/editing_blog_contents.feature +0 -40
- data/features/getting_started.feature +0 -17
- data/features/step_definitions/editing_blog_contents_steps.rb +0 -128
- data/features/step_definitions/editing_blog_steps.rb +0 -52
- data/features/step_definitions/getting_started_steps.rb +0 -51
- data/features/support/env.rb +0 -30
- data/lib/themes/basic/layouts/post_index.haml +0 -15
- data/lib/themes/basic/views/default.haml +0 -10
- data/tests/staticpress/configuration_test.rb +0 -4
- data/tests/staticpress/content/base_test.rb +0 -291
- data/tests/staticpress/content/category_test.rb +0 -48
- data/tests/staticpress/content/index_test.rb +0 -40
- data/tests/staticpress/content/page_test.rb +0 -56
- data/tests/staticpress/content/post_test.rb +0 -42
- data/tests/staticpress/content/resource_content_test.rb +0 -17
- data/tests/staticpress/content/tag_test.rb +0 -39
- data/tests/staticpress/content/theme_test.rb +0 -26
- data/tests/staticpress/helpers_test.rb +0 -63
- data/tests/staticpress/js_object_test.rb +0 -47
- data/tests/staticpress/metadata_test.rb +0 -14
- data/tests/staticpress/plugin_test.rb +0 -4
- data/tests/staticpress/pusher_test.rb +0 -9
- data/tests/staticpress/route_test.rb +0 -186
- data/tests/staticpress/server_test.rb +0 -17
- data/tests/staticpress/settings_test.rb +0 -13
- data/tests/staticpress/site_test.rb +0 -20
- data/tests/staticpress/theme_test.rb +0 -83
- data/tests/staticpress/view_helpers_test.rb +0 -32
- data/tests/staticpress_test.rb +0 -18
- data/tests/test_blog/themes/test_theme/layouts/archive.haml +0 -0
- data/tests/test_blog/themes/test_theme/layouts/atom.haml +0 -0
- data/tests/test_case.rb +0 -54
@@ -1,17 +0,0 @@
|
|
1
|
-
require_relative '../test_case'
|
2
|
-
|
3
|
-
class ServerTest < TestCase
|
4
|
-
let(:server) { Staticpress::Server.new }
|
5
|
-
|
6
|
-
def test_call_root
|
7
|
-
response = server.call(env('/'))
|
8
|
-
assert_equal 200, response.first
|
9
|
-
assert_equal 'text/html', response[1]['Content-Type']
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_call_image
|
13
|
-
response = server.call(env('/ruby.png'))
|
14
|
-
assert_equal 200, response.first
|
15
|
-
assert_equal 'image/png', response[1]['Content-Type']
|
16
|
-
end
|
17
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require_relative '../test_case'
|
2
|
-
|
3
|
-
class SettingsTest < TestCase
|
4
|
-
def test_default
|
5
|
-
refute Staticpress::Settings.instance.verbose
|
6
|
-
end
|
7
|
-
|
8
|
-
def test_set!
|
9
|
-
assert_equal nil, Staticpress::Settings.instance.favorite_number
|
10
|
-
Staticpress::Settings.set! :favorite_number => 42
|
11
|
-
assert_equal 42, Staticpress::Settings.instance.favorite_number
|
12
|
-
end
|
13
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require_relative '../test_case'
|
2
|
-
|
3
|
-
class SiteTest < TestCase
|
4
|
-
let(:site) { Staticpress::Site.new }
|
5
|
-
|
6
|
-
let(:index) { Staticpress::Content::Page.new :slug => '' }
|
7
|
-
let(:page) { Staticpress::Content::Page.new :slug => 'about' }
|
8
|
-
let(:post) { Staticpress::Content::Post.new :year => '2011', :month => '07', :day => '20', :title => 'hello' }
|
9
|
-
|
10
|
-
def test_find_content_by_env
|
11
|
-
assert_equal index, site.find_content_by_env(env('/'))
|
12
|
-
assert_equal page, site.find_content_by_env(env('/about'))
|
13
|
-
assert_equal post, site.find_content_by_env(env('/2011/07/20/hello'))
|
14
|
-
assert_nil site.find_content_by_env(env('/i/dont/exist'))
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_save
|
18
|
-
refute_raises(ArgumentError) { site.save }
|
19
|
-
end
|
20
|
-
end
|
@@ -1,83 +0,0 @@
|
|
1
|
-
require_relative '../test_case'
|
2
|
-
|
3
|
-
class ThemeTest < TestCase
|
4
|
-
include Staticpress::Helpers
|
5
|
-
|
6
|
-
let(:theme) { Staticpress::Theme.new :test_theme }
|
7
|
-
|
8
|
-
def setup
|
9
|
-
super
|
10
|
-
config.theme = :test_theme
|
11
|
-
end
|
12
|
-
|
13
|
-
def test__equalsequals
|
14
|
-
assert_operator theme, :==, Staticpress::Theme.new(:test_theme)
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_root
|
18
|
-
assert_equal theme.root, (Staticpress.blog_path + 'themes' + 'test_theme')
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_theme
|
22
|
-
assert_equal theme, Staticpress::Theme.theme
|
23
|
-
end
|
24
|
-
|
25
|
-
|
26
|
-
def test_default_include
|
27
|
-
refute_respond_to theme, :default_include
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_keyed_includes
|
31
|
-
assert_equal((theme.root + 'includes' + 'list_posts.haml'), theme.keyed_includes['list_posts'])
|
32
|
-
assert_nil theme.keyed_includes['fake']
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_include_for
|
36
|
-
assert_equal (theme.root + 'includes' + 'list_posts.haml'), theme.include_for(:list_posts)
|
37
|
-
assert_nil theme.include_for(:fake)
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_includes
|
41
|
-
assert_equal 1, theme.includes.count
|
42
|
-
end
|
43
|
-
|
44
|
-
|
45
|
-
def test_default_layout
|
46
|
-
assert_equal (theme.root + 'layouts' + 'default.haml'), theme.default_layout
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_keyed_layouts
|
50
|
-
assert_equal((theme.root + 'layouts' + 'default.haml'), theme.keyed_layouts['default'])
|
51
|
-
assert_equal((theme.root + 'layouts' + 'post_index.haml'), theme.keyed_layouts['post_index'])
|
52
|
-
assert_nil theme.keyed_layouts['fake']
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_layout_for
|
56
|
-
assert_equal (theme.root + 'layouts' + 'default.haml'), theme.layout_for(:default)
|
57
|
-
assert_equal (theme.root + 'layouts' + 'post_index.haml'), theme.layout_for(:post_index)
|
58
|
-
assert_nil theme.layout_for(:fake)
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_layouts
|
62
|
-
assert_equal 5, theme.layouts.count
|
63
|
-
end
|
64
|
-
|
65
|
-
|
66
|
-
def test_default_view
|
67
|
-
assert_equal (theme.root + 'views' + 'default.haml'), theme.default_view
|
68
|
-
end
|
69
|
-
|
70
|
-
def test_keyed_views
|
71
|
-
assert_equal((theme.root + 'views' + 'default.haml'), theme.keyed_views['default'])
|
72
|
-
assert_nil theme.keyed_views['fake']
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_view_for
|
76
|
-
assert_equal (theme.root + 'views' + 'default.haml'), theme.view_for(:default)
|
77
|
-
assert_nil theme.view_for(:fake)
|
78
|
-
end
|
79
|
-
|
80
|
-
def test_views
|
81
|
-
assert_equal 1, theme.views.count
|
82
|
-
end
|
83
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require_relative '../test_case'
|
2
|
-
|
3
|
-
class ViewHelpersTest < TestCase
|
4
|
-
include Staticpress::Helpers
|
5
|
-
|
6
|
-
let(:post) { Staticpress::Content::Post.new :year => '2011', :month => '07', :day => '20', :title => 'hello' }
|
7
|
-
let(:view_helpers) { Staticpress::ViewHelpers.new post }
|
8
|
-
|
9
|
-
def test_partial_with_one_post
|
10
|
-
expected = <<-HTML
|
11
|
-
<section>
|
12
|
-
<article>#{post.render_partial.strip}</article>
|
13
|
-
</section>
|
14
|
-
HTML
|
15
|
-
assert_equal expected, view_helpers.partial(:list_posts, :posts => [ post ])
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_partial_with_no_posts
|
19
|
-
expected = <<-HTML
|
20
|
-
<section>
|
21
|
-
</section>
|
22
|
-
HTML
|
23
|
-
assert_equal expected, view_helpers.partial(:list_posts, :posts => [ ])
|
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
|
32
|
-
end
|
data/tests/staticpress_test.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require_relative 'test_case'
|
2
|
-
|
3
|
-
require 'pathname'
|
4
|
-
|
5
|
-
class StaticpressTest < TestCase
|
6
|
-
def test_blog_path
|
7
|
-
assert_equal Pathname('tests/test_blog').expand_path, Staticpress.blog_path
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_blog_path=
|
11
|
-
Staticpress.blog_path = 'some/other/directory'
|
12
|
-
assert_equal Pathname('some/other/directory').expand_path, Staticpress.blog_path
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_root
|
16
|
-
assert_equal Pathname('lib/').expand_path, Staticpress.root
|
17
|
-
end
|
18
|
-
end
|
File without changes
|
File without changes
|
data/tests/test_case.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
require 'minitest/autorun'
|
2
|
-
|
3
|
-
require 'compass'
|
4
|
-
require 'debugger'
|
5
|
-
require 'haml'
|
6
|
-
require 'redcarpet'
|
7
|
-
require 'sass'
|
8
|
-
|
9
|
-
require_relative '../lib/staticpress'
|
10
|
-
|
11
|
-
class TestCase < MiniTest::Spec
|
12
|
-
TEST_BLOG = (Staticpress.root + '..' + 'tests' + 'test_blog').expand_path
|
13
|
-
|
14
|
-
def setup
|
15
|
-
Staticpress.blog_path = TEST_BLOG
|
16
|
-
end
|
17
|
-
|
18
|
-
def teardown
|
19
|
-
Staticpress.blog_path = '.'
|
20
|
-
test_blog_public = TEST_BLOG + 'public'
|
21
|
-
FileUtils.rm_rf test_blog_public if test_blog_public.directory?
|
22
|
-
end
|
23
|
-
|
24
|
-
def env(path)
|
25
|
-
{
|
26
|
-
'REQUEST_PATH' => path
|
27
|
-
}
|
28
|
-
end
|
29
|
-
|
30
|
-
def assert_eql(expected, actual, message = nil)
|
31
|
-
assert actual.eql?(expected), (message || "Expected #{actual} to have same content as #{expected}")
|
32
|
-
end
|
33
|
-
|
34
|
-
def refute_raises(exception, &block)
|
35
|
-
begin
|
36
|
-
block.call
|
37
|
-
assert true
|
38
|
-
rescue Exception => e
|
39
|
-
refute e.is_an?(exception), exception_details(e, "Expected #{e} not to be raised")
|
40
|
-
raise e
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def with_config(options, &block)
|
45
|
-
original = self.config
|
46
|
-
|
47
|
-
begin
|
48
|
-
self.config.merge(options).save
|
49
|
-
block.call
|
50
|
-
ensure
|
51
|
-
original.save
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|