staticpress 0.6.2 → 0.7.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.
- 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
data/lib/staticpress/theme.rb
CHANGED
|
@@ -1,18 +1,51 @@
|
|
|
1
|
+
require 'hike'
|
|
2
|
+
|
|
1
3
|
module Staticpress
|
|
2
4
|
class Theme
|
|
3
5
|
extend Staticpress::Helpers
|
|
4
6
|
include Staticpress::Helpers
|
|
5
7
|
|
|
6
|
-
attr_reader :root
|
|
8
|
+
attr_reader :name, :root, :trail
|
|
7
9
|
|
|
8
10
|
def initialize(name)
|
|
9
|
-
@name = name
|
|
11
|
+
@name = name.to_sym
|
|
10
12
|
custom = Staticpress.blog_path + 'themes' + @name.to_s
|
|
11
13
|
@root = custom.directory? ? custom : Staticpress.root + 'themes' + @name.to_s
|
|
14
|
+
|
|
15
|
+
@trail = Hike::Trail.new
|
|
16
|
+
@trail.append_paths custom, Staticpress.root + 'themes' + @name.to_s
|
|
17
|
+
@trail.append_extensions *Tilt.mappings.keys
|
|
12
18
|
end
|
|
13
19
|
|
|
14
20
|
def ==(other)
|
|
15
|
-
other.respond_to?(:
|
|
21
|
+
other.respond_to?(:name) ? (name == other.name) : super
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def assets
|
|
25
|
+
reply = spider_map (root + 'assets').children do |file|
|
|
26
|
+
file
|
|
27
|
+
end.flatten
|
|
28
|
+
parent ? (parent.assets + reply) : reply
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def copy_to(name)
|
|
32
|
+
destination = Staticpress.blog_path + 'themes' + name.to_s
|
|
33
|
+
|
|
34
|
+
if destination.directory?
|
|
35
|
+
raise Staticpress::Error, "Cannot copy theme. Destination (#{destination}) already exists."
|
|
36
|
+
else
|
|
37
|
+
FileUtils.mkdir_p destination
|
|
38
|
+
FileUtils.cp_r root.children, destination
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def parent
|
|
43
|
+
@parent ||= lambda do
|
|
44
|
+
if config.theme_parent
|
|
45
|
+
reply = self.class.new(config.theme_parent)
|
|
46
|
+
@parent = reply unless self == reply
|
|
47
|
+
end
|
|
48
|
+
end.call
|
|
16
49
|
end
|
|
17
50
|
|
|
18
51
|
[
|
|
@@ -20,20 +53,15 @@ module Staticpress
|
|
|
20
53
|
:layout,
|
|
21
54
|
:view
|
|
22
55
|
].each do |method_name|
|
|
23
|
-
define_method "
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
send("keyed_#{method_name}s")[name.to_s]
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
define_method "#{method_name}s" do
|
|
36
|
-
(root + "#{method_name}s").children
|
|
56
|
+
define_method "#{method_name}_for" do |*names|
|
|
57
|
+
names_with_default = (method_name == :include) ? names : names + [:default]
|
|
58
|
+
catch :path do
|
|
59
|
+
names_with_default.each do |name|
|
|
60
|
+
path = trail.find "#{method_name}s/#{name}"
|
|
61
|
+
throw :path, Pathname(path) if path
|
|
62
|
+
end
|
|
63
|
+
nil
|
|
64
|
+
end
|
|
37
65
|
end
|
|
38
66
|
end
|
|
39
67
|
|
data/lib/staticpress/version.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/{tests → spec/fixtures}/test_blog/content/_posts/2011-08-01-announcing-staticpress.markdown
RENAMED
|
File without changes
|
|
File without changes
|
data/{tests → spec/fixtures}/test_blog/content/_posts/2011-08-06-blogging-with-staticpress.markdown
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe 'Editing blog contents', :blur do
|
|
4
|
+
create_sample_blog
|
|
5
|
+
|
|
6
|
+
before :each do
|
|
7
|
+
run_simple 'staticpress create_page about'
|
|
8
|
+
run_simple 'staticpress create hello-goodbye'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it 'Creating a static page with multiple formats' do
|
|
12
|
+
add_multi_format_page
|
|
13
|
+
build_site
|
|
14
|
+
confirm_formats_page_contains_markup
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'Listing all routes' do
|
|
18
|
+
list_urls
|
|
19
|
+
confirm_static_pages_present
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'Building a site' do
|
|
23
|
+
build_site
|
|
24
|
+
confirm_output_directory_contains_expected_files
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'Building a site (verbose)' do
|
|
28
|
+
build_site_verbosely
|
|
29
|
+
confirm_filenames_output
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it 'Building a site with a custom home page' do
|
|
33
|
+
create_custom_home_page
|
|
34
|
+
build_site
|
|
35
|
+
confirm_built_home_page
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it 'Pushing a compiled site to a remote location' do
|
|
39
|
+
build_site
|
|
40
|
+
add_custom_deploy_strategy
|
|
41
|
+
push_site
|
|
42
|
+
confirm_site_deployed
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it 'Deploying site (build and push in one step)' do
|
|
46
|
+
add_custom_deploy_strategy
|
|
47
|
+
confirm_site_not_built_or_deployed
|
|
48
|
+
deploy_site
|
|
49
|
+
confirm_output_directory_contains_expected_files
|
|
50
|
+
confirm_site_deployed
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe 'Editing blog' do
|
|
4
|
+
create_sample_blog
|
|
5
|
+
|
|
6
|
+
it 'Creating a new blog post' do
|
|
7
|
+
create_post
|
|
8
|
+
edit_post
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it 'Creating a static page' do
|
|
12
|
+
create_page
|
|
13
|
+
edit_page
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
context 'without any custom plugins' do
|
|
17
|
+
before :each do
|
|
18
|
+
run_simple 'rm -fR plugins'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'Copying a built-in plugin' do
|
|
22
|
+
fork_plugin
|
|
23
|
+
confirm_plugin_editable 'blockquote'
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it 'Copying and renaming a built-in plugin' do
|
|
27
|
+
fork_plugin 'pullquote'
|
|
28
|
+
confirm_plugin_editable 'pullquote'
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
context 'without a custom theme' do
|
|
33
|
+
before :each do
|
|
34
|
+
run_simple 'rm -fR themes'
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'Copying the default theme' do
|
|
38
|
+
fork_theme
|
|
39
|
+
confirm_theme_is_local 'basic'
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe 'Getting started' do
|
|
4
|
+
it 'Getting help' do
|
|
5
|
+
ask_for_help
|
|
6
|
+
see_helpful_tips
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it 'Finding the version' do
|
|
10
|
+
check_the_version
|
|
11
|
+
see_the_version
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
context 'generic blog' do
|
|
15
|
+
create_sample_blog
|
|
16
|
+
|
|
17
|
+
it 'Creating a new blog' do
|
|
18
|
+
confirm_minimal_files
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
context do
|
|
23
|
+
create_sample_blog 'This is my blog'
|
|
24
|
+
|
|
25
|
+
it 'Creating a new blog with a custum title' do
|
|
26
|
+
confirm_settings_saved
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require 'compass'
|
|
2
|
+
require 'aruba/api'
|
|
3
|
+
require 'fileutils'
|
|
4
|
+
require 'haml'
|
|
5
|
+
require 'pathname'
|
|
6
|
+
require 'pry'
|
|
7
|
+
require 'redcarpet'
|
|
8
|
+
require 'sass'
|
|
9
|
+
|
|
10
|
+
require_relative '../lib/staticpress'
|
|
11
|
+
|
|
12
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |path| require_relative path }
|
|
13
|
+
|
|
14
|
+
RSpec.configure do |config|
|
|
15
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
|
16
|
+
config.run_all_when_everything_filtered = true
|
|
17
|
+
config.filter_run :focus
|
|
18
|
+
config.filter_run_excluding :blur => true
|
|
19
|
+
|
|
20
|
+
# config.expect_with :rspec do |c|
|
|
21
|
+
# c.syntax = :expect
|
|
22
|
+
# end
|
|
23
|
+
|
|
24
|
+
# Run specs in random order to surface order dependencies. If you find an
|
|
25
|
+
# order dependency and want to debug it, you can fix the order by providing
|
|
26
|
+
# the seed, which is printed after each run.
|
|
27
|
+
# --seed 1234
|
|
28
|
+
config.order = 'random'
|
|
29
|
+
|
|
30
|
+
config.include Aruba::Api
|
|
31
|
+
config.include CustomMatchers
|
|
32
|
+
config.include UnitSupport
|
|
33
|
+
config.include IntegrationSupport
|
|
34
|
+
config.extend Fixtures
|
|
35
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module CustomMatchers
|
|
2
|
+
def assert_eql(expected, actual, message = nil)
|
|
3
|
+
assert actual.eql?(expected), (message || "Expected #{actual} to have same content as #{expected}")
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def refute_raises(exception, &block)
|
|
7
|
+
begin
|
|
8
|
+
block.call
|
|
9
|
+
assert true
|
|
10
|
+
rescue Exception => e
|
|
11
|
+
refute e.is_an?(exception), exception_details(e, "Expected #{e} not to be raised")
|
|
12
|
+
raise e
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
module Fixtures
|
|
2
|
+
FIXTURES_PATH = (Staticpress.root + '..' + 'spec' + 'fixtures').expand_path
|
|
3
|
+
TEMP_PATH = (Staticpress.root + '..' + 'tmp').expand_path
|
|
4
|
+
|
|
5
|
+
def basic_blog
|
|
6
|
+
setup_blog 'test_blog'
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def setup_blog(name)
|
|
10
|
+
source_path = FIXTURES_PATH + name
|
|
11
|
+
temp_path = TEMP_PATH + name
|
|
12
|
+
|
|
13
|
+
before :each do
|
|
14
|
+
FileUtils.rm_rf temp_path if temp_path.directory?
|
|
15
|
+
FileUtils.cp_r source_path, temp_path
|
|
16
|
+
|
|
17
|
+
Staticpress.blog_path = temp_path.clone
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
after :each do
|
|
21
|
+
Staticpress.blog_path = '.'
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def create_sample_blog(title = 'Transient Thoughts')
|
|
26
|
+
before :each do
|
|
27
|
+
blog_title = title ? "'#{title}'" : nil
|
|
28
|
+
run_simple "staticpress new temporary_blog #{blog_title}"
|
|
29
|
+
cd('temporary_blog')
|
|
30
|
+
append_to_file 'Gemfile', <<-RUBY
|
|
31
|
+
gem 'staticpress', :path => '../../..'
|
|
32
|
+
RUBY
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
module IntegrationSupport
|
|
2
|
+
def run_one_of(*commands)
|
|
3
|
+
run_simple commands.shuffle.first
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def verify_directory_contains_file(directory, file)
|
|
7
|
+
check_directory_presence [directory], true
|
|
8
|
+
check_file_presence ["#{directory}/#{file}"], true
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def samples_path
|
|
12
|
+
Pathname("#{__FILE__}/../fixtures").expand_path
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def ask_for_help
|
|
16
|
+
commands = [
|
|
17
|
+
'staticpress',
|
|
18
|
+
'staticpress help',
|
|
19
|
+
'staticpress -h',
|
|
20
|
+
'staticpress --help'
|
|
21
|
+
]
|
|
22
|
+
run_one_of *commands
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def check_the_version
|
|
26
|
+
commands = [
|
|
27
|
+
'staticpress version',
|
|
28
|
+
'staticpress -v',
|
|
29
|
+
'staticpress --version'
|
|
30
|
+
]
|
|
31
|
+
run_one_of *commands
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def see_helpful_tips
|
|
35
|
+
assert_exit_status 0
|
|
36
|
+
assert_partial_output 'Usage', all_output
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def see_the_version
|
|
40
|
+
assert_exit_status 0
|
|
41
|
+
assert_partial_output 'Staticpress', all_output
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def confirm_minimal_files
|
|
45
|
+
files = [
|
|
46
|
+
'config.ru',
|
|
47
|
+
'config.yml',
|
|
48
|
+
'Gemfile',
|
|
49
|
+
'README.markdown'
|
|
50
|
+
]
|
|
51
|
+
check_file_presence files, true
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def confirm_settings_saved
|
|
55
|
+
check_file_content 'config.yml', <<-YAML, true
|
|
56
|
+
---
|
|
57
|
+
:title: This is my blog
|
|
58
|
+
YAML
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def create_post
|
|
62
|
+
run_simple 'staticpress create \'Hello World\''
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def create_page
|
|
66
|
+
run_simple 'staticpress create_page about'
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def fork_plugin(new_name = nil)
|
|
70
|
+
run_simple "staticpress fork_plugin blockquote #{new_name}"
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def fork_theme
|
|
74
|
+
run_simple 'staticpress fork_theme'
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def edit_post
|
|
78
|
+
now = Time.now.utc
|
|
79
|
+
filename = [
|
|
80
|
+
now.year,
|
|
81
|
+
('%02d' % now.month),
|
|
82
|
+
('%02d' % now.day),
|
|
83
|
+
'hello-world.markdown'
|
|
84
|
+
].join('-')
|
|
85
|
+
verify_directory_contains_file 'content/_posts', filename
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def edit_page
|
|
89
|
+
verify_directory_contains_file 'content', 'about.markdown'
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def confirm_plugin_editable(name)
|
|
93
|
+
verify_directory_contains_file 'plugins', "#{name}.rb"
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def confirm_theme_is_local(name)
|
|
97
|
+
check_directory_presence ["themes/#{name}"], true
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def confirm_site_not_built_or_deployed
|
|
101
|
+
files = [
|
|
102
|
+
'public/index.html',
|
|
103
|
+
'public/about/index.html',
|
|
104
|
+
'../deployed/index.html',
|
|
105
|
+
'../deployed/about/index.html'
|
|
106
|
+
]
|
|
107
|
+
check_file_presence files, false
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def add_multi_format_page
|
|
111
|
+
write_file 'content/formats.markdown.erb', 'hello world'
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def build_site
|
|
115
|
+
run_simple 'staticpress build'
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def deploy_site
|
|
119
|
+
run_simple 'staticpress deploy'
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def push_site
|
|
123
|
+
run_simple 'staticpress build'
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def list_urls
|
|
127
|
+
run_simple 'staticpress list url_path'
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def build_site_verbosely
|
|
131
|
+
run_simple 'staticpress build --verbose'
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def create_custom_home_page
|
|
135
|
+
write_file 'content/index.markdown', <<-MARKDOWN
|
|
136
|
+
---
|
|
137
|
+
title: Custom Home Page
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
in custom page
|
|
141
|
+
MARKDOWN
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def add_custom_deploy_strategy
|
|
145
|
+
append_to_file 'config.yml', <<-YAML
|
|
146
|
+
:deployment_strategies:
|
|
147
|
+
:custom: 'cp -R public ../deployed'
|
|
148
|
+
YAML
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def confirm_formats_page_contains_markup
|
|
152
|
+
check_exact_file_content 'public/formats/index.html', <<-HTML
|
|
153
|
+
<!DOCTYPE html>
|
|
154
|
+
<html>
|
|
155
|
+
<head>
|
|
156
|
+
<meta charset='utf-8' />
|
|
157
|
+
<title>Formats | Transient Thoughts</title>
|
|
158
|
+
<link href='/assets/basic/styles/all.css' rel='stylesheet' type='text/css' />
|
|
159
|
+
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js'></script>
|
|
160
|
+
<script src='/assets/basic/scripts/application.js'></script>
|
|
161
|
+
</head>
|
|
162
|
+
<body>
|
|
163
|
+
<header>
|
|
164
|
+
<div class='site-title'>Transient Thoughts</div>
|
|
165
|
+
<div class='site-subtitle'>A blogging framework for hackers</div>
|
|
166
|
+
</header>
|
|
167
|
+
<nav></nav>
|
|
168
|
+
<section><p>hello world</p></section>
|
|
169
|
+
<section></section>
|
|
170
|
+
<a class='github-ribbon' href='https://github.com/ravinggenius/staticpress' style='position: absolute; top: 0; right: 0;'>
|
|
171
|
+
<img alt='Fork me on GitHub' src='https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png' />
|
|
172
|
+
</a>
|
|
173
|
+
</body>
|
|
174
|
+
</html>
|
|
175
|
+
HTML
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
def confirm_static_pages_present
|
|
179
|
+
assert_partial_output '/', all_output
|
|
180
|
+
assert_partial_output '/about', all_output
|
|
181
|
+
assert_partial_output '/hello-goodbye', all_output
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
def confirm_output_directory_contains_expected_files
|
|
185
|
+
files = [
|
|
186
|
+
'public/index.html',
|
|
187
|
+
'public/about/index.html'
|
|
188
|
+
]
|
|
189
|
+
check_file_presence files, true
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
def confirm_filenames_output
|
|
193
|
+
assert_partial_output " page public/about/index.html", all_output
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
def confirm_built_home_page
|
|
197
|
+
check_exact_file_content 'public/index.html', <<-HTML
|
|
198
|
+
<!DOCTYPE html>
|
|
199
|
+
<html>
|
|
200
|
+
<head>
|
|
201
|
+
<meta charset='utf-8' />
|
|
202
|
+
<title>Custom Home Page | Transient Thoughts</title>
|
|
203
|
+
<link href='/assets/basic/styles/all.css' rel='stylesheet' type='text/css' />
|
|
204
|
+
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js'></script>
|
|
205
|
+
<script src='/assets/basic/scripts/application.js'></script>
|
|
206
|
+
</head>
|
|
207
|
+
<body>
|
|
208
|
+
<header>
|
|
209
|
+
<div class='site-title'>Transient Thoughts</div>
|
|
210
|
+
<div class='site-subtitle'>A blogging framework for hackers</div>
|
|
211
|
+
</header>
|
|
212
|
+
<nav></nav>
|
|
213
|
+
<section><p>in custom page</p></section>
|
|
214
|
+
<section></section>
|
|
215
|
+
<a class='github-ribbon' href='https://github.com/ravinggenius/staticpress' style='position: absolute; top: 0; right: 0;'>
|
|
216
|
+
<img alt='Fork me on GitHub' src='https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png' />
|
|
217
|
+
</a>
|
|
218
|
+
</body>
|
|
219
|
+
</html>
|
|
220
|
+
HTML
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
def confirm_site_deployed
|
|
224
|
+
files = [
|
|
225
|
+
'../deployed/index.html',
|
|
226
|
+
'../deployed/about/index.html'
|
|
227
|
+
]
|
|
228
|
+
check_file_presence files, true
|
|
229
|
+
end
|
|
230
|
+
end
|