Started on site config feature
This commit is contained in:
parent
3c0bc3b2de
commit
4e302c0445
|
@ -3,3 +3,4 @@ test/dest/
|
||||||
pkg/
|
pkg/
|
||||||
*.swp
|
*.swp
|
||||||
*~
|
*~
|
||||||
|
_site/
|
||||||
|
|
|
@ -5,56 +5,51 @@ Feature: Site configuration
|
||||||
|
|
||||||
Scenario: Change destination directory
|
Scenario: Change destination directory
|
||||||
Given I have a blank site in "_sourcedir"
|
Given I have a blank site in "_sourcedir"
|
||||||
And I have an "index.html" file that contains "Changing source directory"
|
And I have an "_sourcedir/index.html" file that contains "Changing source directory"
|
||||||
And I have a configuration file in "_sourcedir" with "source" set to "_sourcedir"
|
And I have a configuration file with "source" set to "_sourcedir"
|
||||||
When I run jekyll
|
When I run jekyll
|
||||||
Then the _site directory should exist
|
Then the _site directory should exist
|
||||||
And I should see "Changing source directory" in "_site/index.html"
|
And I should see "Changing source directory" in "_site/index.html"
|
||||||
|
|
||||||
Scenario: Change destination directory
|
Scenario: Change destination directory
|
||||||
Given I have a blank site
|
Given I have an "index.html" file that contains "Changing destination directory"
|
||||||
And I have an "index.html" file that contains "Changing destination directory"
|
And I have a configuration file with "destination" set to "_mysite"
|
||||||
And I have a configuration file with "site" set to "_mysite"
|
|
||||||
When I run jekyll
|
When I run jekyll
|
||||||
Then the _mysite directory should exist
|
Then the _mysite directory should exist
|
||||||
And I should see "Basic Site" in "_mysite/index.html"
|
And I should see "Changing destination directory" in "_mysite/index.html"
|
||||||
|
|
||||||
Scenario: Use RDiscount for markup
|
Scenario: Use RDiscount for markup
|
||||||
Given I have a blank site
|
Given I have an "index.html" file that contains "[Google](http://google.com)"
|
||||||
And I have an "index.html" file that contains "[Google](http://google.com)"
|
|
||||||
And I have a configuration file with "markdown" set to "rdiscount"
|
And I have a configuration file with "markdown" set to "rdiscount"
|
||||||
When I run jekyll
|
When I run jekyll
|
||||||
Then the _site directory should exist
|
Then the _site directory should exist
|
||||||
And I should see "<a href='http://google.com/>Google</a>" in "_site/index.html"
|
And I should see "<a href='http://google.com/>Google</a>" in "_site/index.html"
|
||||||
|
|
||||||
Scenario: Use Maruku for markup
|
Scenario: Use Maruku for markup
|
||||||
Given I have a blank site
|
Given I have an "index.markdown" page that contains "[Google](http://google.com)"
|
||||||
And I have an "index.html" file that contains "[Google](http://google.com)"
|
And I have a configuration file with "markdown" set to "maruku"
|
||||||
And I have a configuration file with "markdown" set to "rdiscount"
|
|
||||||
When I run jekyll
|
When I run jekyll
|
||||||
Then the _site directory should exist
|
Then the _site directory should exist
|
||||||
And I should see "<a href='http://google.com/>Google</a>" in "_site/index.html"
|
And I should see "<a href='http://google.com'>Google</a>" in "_site/index.html"
|
||||||
|
|
||||||
Scenario: Disable auto-regeneration
|
Scenario: Enable auto-regeneration
|
||||||
Given I have a blank site
|
Given I have an "index.html" file that contains "My Awesome Site"
|
||||||
And I have an "index.html" file that contains "My Awesome Site"
|
And I have a configuration file with "auto" set to "true"
|
||||||
And I have a configuration file with "auto" set to "false"
|
When I run jekyll in the background
|
||||||
When I run jekyll
|
And I change "index.html" to contain "Auto-regenerate on!"
|
||||||
And I change "index.html" to contain "Auto-regenerate off!"
|
|
||||||
Then the _site directory should exist
|
Then the _site directory should exist
|
||||||
And I should see "My awesome site" in "_site/index.html"
|
And I should see "My Awesome Site" in "_site/index.html"
|
||||||
|
And I should see "Auto-regenerate on!" in "_site/index.html"
|
||||||
|
|
||||||
Scenario: Run server to host generated site
|
Scenario: Run server to host generated site
|
||||||
Given I have a blank site
|
Given I have an "index.html" file that contains "WEBrick to the rescue"
|
||||||
And I have an "index.html" file that contains "WEBrick to the rescue"
|
|
||||||
And I have a configuration file with "server" set to "true"
|
And I have a configuration file with "server" set to "true"
|
||||||
When I run jekyll
|
When I run jekyll
|
||||||
And I go to "http://0.0.0.0:4000"
|
And I go to "http://0.0.0.0:4000"
|
||||||
Then I should see "WEBrick to the rescue"
|
Then I should see "WEBrick to the rescue"
|
||||||
|
|
||||||
Scenario: Run server on a different server port
|
Scenario: Run server on a different server port
|
||||||
Given I have a blank site
|
Given I have an "index.html" file that contains "Changing Port"
|
||||||
And I have an "index.html" file that contains "Changing Port"
|
|
||||||
And I have a configuration file with "server" set to "true"
|
And I have a configuration file with "server" set to "true"
|
||||||
And I have a configuration file with "port" set to "1337"
|
And I have a configuration file with "port" set to "1337"
|
||||||
When I run jekyll
|
When I run jekyll
|
||||||
|
@ -62,8 +57,7 @@ Feature: Site configuration
|
||||||
Then I should see "Changing Port"
|
Then I should see "Changing Port"
|
||||||
|
|
||||||
Scenario: Use none permalink schema
|
Scenario: Use none permalink schema
|
||||||
Given I have a blank site
|
Given I have a _posts directory
|
||||||
And I have a _posts directory
|
|
||||||
And I have the following post:
|
And I have the following post:
|
||||||
| title | date | content |
|
| title | date | content |
|
||||||
| None Permalink Schema | 3/27/2009 | Totally nothing. |
|
| None Permalink Schema | 3/27/2009 | Totally nothing. |
|
||||||
|
@ -73,8 +67,7 @@ Feature: Site configuration
|
||||||
And I should see "Totally nothing." in "_site/none-permalink-schema.html"
|
And I should see "Totally nothing." in "_site/none-permalink-schema.html"
|
||||||
|
|
||||||
Scenario: Use pretty permalink schema
|
Scenario: Use pretty permalink schema
|
||||||
Given I have a blank site
|
Given I have a _posts directory
|
||||||
And I have a _posts directory
|
|
||||||
And I have the following post:
|
And I have the following post:
|
||||||
| title | date | content |
|
| title | date | content |
|
||||||
| Pretty Permalink Schema | 3/27/2009 | Totally wordpress. |
|
| Pretty Permalink Schema | 3/27/2009 | Totally wordpress. |
|
||||||
|
@ -84,8 +77,7 @@ Feature: Site configuration
|
||||||
And I should see "Totally wordpress." in "_site/2009/03/27/pretty-permalink-schema/index.html"
|
And I should see "Totally wordpress." in "_site/2009/03/27/pretty-permalink-schema/index.html"
|
||||||
|
|
||||||
Scenario: Highlight code with pygments
|
Scenario: Highlight code with pygments
|
||||||
Given I have a blank site
|
Given I have an "index.html" file that contains "{% highlight ruby %} puts 'Hello world!' {% endhighlight %}"
|
||||||
And I have an "index.html" file that contains "{% highlight ruby %} puts 'Hello world!' {% endhighlight %}"
|
|
||||||
And I have a configuration file with "pygments" set to "true"
|
And I have a configuration file with "pygments" set to "true"
|
||||||
When I run jekyll
|
When I run jekyll
|
||||||
Then the _site directory should exist
|
Then the _site directory should exist
|
||||||
|
|
|
@ -8,15 +8,19 @@ After do
|
||||||
FileUtils.rm_rf(TEST_DIR)
|
FileUtils.rm_rf(TEST_DIR)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Given /^I have a blank site in "(.*)"$/ do |path|
|
||||||
|
FileUtils.mkdir(path)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Like "I have a foo file" but gives a yaml front matter so jekyll actually processes it
|
||||||
Given /^I have an "(.*)" page(?: with layout "(.*)")? that contains "(.*)"$/ do |file, layout, text|
|
Given /^I have an "(.*)" page(?: with layout "(.*)")? that contains "(.*)"$/ do |file, layout, text|
|
||||||
File.open(file, 'w') do |f|
|
File.open(file, 'w') do |f|
|
||||||
f.write <<EOF
|
f.write <<EOF
|
||||||
---
|
---
|
||||||
layout: #{layout || 'nil'}
|
layout: #{layout || 'nil'}
|
||||||
---
|
---
|
||||||
|
#{text}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
f.write(text)
|
|
||||||
f.close
|
f.close
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -75,16 +79,25 @@ EOF
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Given /^I have a configuration file(?: in "(.*)")? with "(.*)" set to "(.*)"$/ do |dir, key, value|
|
Given /^I have a configuration file with "(.*)" set to "(.*)"$/ do |key, value|
|
||||||
pending
|
File.open('_config.yml', 'w') do |f|
|
||||||
|
f.write("#{key}: #{value}")
|
||||||
|
f.close
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
When /^I run jekyll in the background$/ do
|
||||||
|
run_jekyll(:bg => true)
|
||||||
end
|
end
|
||||||
|
|
||||||
When /^I run jekyll$/ do
|
When /^I run jekyll$/ do
|
||||||
system File.join(ENV['PWD'], 'bin', 'jekyll') + " >> /dev/null"
|
run_jekyll
|
||||||
end
|
end
|
||||||
|
|
||||||
When /^I change "(.*)" to contain "(.*)"$/ do |file, text|
|
When /^I change "(.*)" to contain "(.*)"$/ do |file, text|
|
||||||
pending
|
File.open(file, 'a') do |f|
|
||||||
|
f.write(text)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
When /^I go to "(.*)"$/ do |address|
|
When /^I go to "(.*)"$/ do |address|
|
||||||
|
|
|
@ -6,4 +6,12 @@ World do
|
||||||
include Test::Unit::Assertions
|
include Test::Unit::Assertions
|
||||||
end
|
end
|
||||||
|
|
||||||
TEST_DIR = File.join('/', 'tmp', 'jekyll')
|
TEST_DIR = File.join('/', 'tmp', 'jekyll')
|
||||||
|
JEKYLL_PATH = File.join(ENV['PWD'], 'bin', 'jekyll')
|
||||||
|
|
||||||
|
def run_jekyll(opts = {})
|
||||||
|
if opts[:bg]
|
||||||
|
bg = '&'
|
||||||
|
end
|
||||||
|
system "#{JEKYLL_PATH} >> /dev/null #{bg}"
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue