staticpress 0.5.2 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. data/.rbenv-version +1 -1
  2. data/Gemfile +7 -0
  3. data/README.markdown +0 -14
  4. data/Rakefile +3 -16
  5. data/bin/staticpress +1 -2
  6. data/docs/config.ru +1 -2
  7. data/docs/content/docs.haml +15 -0
  8. data/docs/content/docs/build.markdown +3 -0
  9. data/docs/content/docs/content-types.markdown +1 -1
  10. data/docs/content/docs/deploy.markdown +1 -0
  11. data/docs/content/docs/help.markdown +1 -0
  12. data/docs/content/docs/plugins.markdown +1 -0
  13. data/docs/content/docs/setup.markdown +4 -0
  14. data/docs/content/docs/themes.markdown +1 -0
  15. data/docs/content/features.haml +6 -0
  16. data/docs/content/index.haml +6 -0
  17. data/features/editing_blog.feature +24 -0
  18. data/features/editing_blog_contents.feature +40 -0
  19. data/features/getting_started.feature +19 -0
  20. data/features/step_definitions/editing_blog_contents_steps.rb +128 -0
  21. data/features/step_definitions/editing_blog_steps.rb +52 -0
  22. data/features/step_definitions/getting_started_steps.rb +51 -0
  23. data/features/support/env.rb +26 -2
  24. data/lib/skeleton/config.ru +1 -2
  25. data/lib/staticpress.rb +39 -0
  26. data/lib/staticpress/cli.rb +0 -9
  27. data/lib/staticpress/configuration.rb +4 -19
  28. data/lib/staticpress/content/base.rb +2 -6
  29. data/lib/staticpress/content/category.rb +0 -5
  30. data/lib/staticpress/content/collection_content.rb +0 -3
  31. data/lib/staticpress/content/index.rb +0 -5
  32. data/lib/staticpress/content/page.rb +0 -6
  33. data/lib/staticpress/content/post.rb +0 -5
  34. data/lib/staticpress/content/resource_content.rb +0 -3
  35. data/lib/staticpress/content/static_content.rb +0 -2
  36. data/lib/staticpress/content/tag.rb +0 -5
  37. data/lib/staticpress/content/theme.rb +1 -6
  38. data/lib/staticpress/helpers.rb +0 -4
  39. data/lib/staticpress/integrations.rb +14 -0
  40. data/lib/staticpress/js_object.rb +0 -2
  41. data/lib/staticpress/metadata.rb +0 -3
  42. data/lib/staticpress/plugin.rb +0 -4
  43. data/lib/staticpress/plugins.rb +0 -2
  44. data/lib/staticpress/pusher.rb +0 -4
  45. data/lib/staticpress/route.rb +0 -3
  46. data/lib/staticpress/server.rb +0 -4
  47. data/lib/staticpress/settings.rb +0 -3
  48. data/lib/staticpress/site.rb +0 -10
  49. data/lib/staticpress/theme.rb +0 -3
  50. data/lib/staticpress/version.rb +1 -1
  51. data/lib/staticpress/view_helpers.rb +0 -5
  52. data/lib/themes/basic/assets/styles/_normalize.scss +520 -0
  53. data/lib/themes/basic/assets/styles/all.css.sass +65 -0
  54. data/staticpress.gemspec +12 -13
  55. data/tests/staticpress/content/base_test.rb +2 -10
  56. data/tests/staticpress/content/category_test.rb +0 -4
  57. data/tests/staticpress/content/index_test.rb +0 -4
  58. data/tests/staticpress/content/page_test.rb +0 -3
  59. data/tests/staticpress/content/post_test.rb +0 -3
  60. data/tests/staticpress/content/resource_content_test.rb +0 -3
  61. data/tests/staticpress/content/tag_test.rb +0 -3
  62. data/tests/staticpress/content/theme_test.rb +0 -3
  63. data/tests/staticpress/helpers_test.rb +0 -2
  64. data/tests/staticpress/js_object_test.rb +0 -2
  65. data/tests/staticpress/metadata_test.rb +0 -2
  66. data/tests/staticpress/route_test.rb +0 -2
  67. data/tests/staticpress/server_test.rb +0 -2
  68. data/tests/staticpress/site_test.rb +0 -5
  69. data/tests/staticpress/theme_test.rb +0 -3
  70. data/tests/staticpress/view_helpers_test.rb +0 -3
  71. data/tests/test_blog/config.ru +1 -2
  72. data/tests/test_case.rb +4 -4
  73. metadata +180 -84
  74. data.tar.gz.sig +0 -2
  75. data/docs/content/docs/deploying.markdown +0 -0
  76. data/docs/content/docs/diving-deeper.markdown +0 -3
  77. data/docs/content/docs/theme.markdown +0 -0
  78. data/docs/content/index.markdown +0 -1
  79. data/features/happy_path.feature +0 -202
  80. data/features/step_definitions/staticpress_steps.rb +0 -33
  81. data/lib/staticpress/booter.rb +0 -7
  82. metadata.gz.sig +0 -0
@@ -1 +1 @@
1
- 1.9.3-p0
1
+ 1.9.3-p194
data/Gemfile CHANGED
@@ -1,3 +1,10 @@
1
1
  source :rubygems
2
2
 
3
3
  gemspec
4
+
5
+ # FIXME these are only needed when running integration tests
6
+ gem 'compass'
7
+ gem 'debugger'
8
+ gem 'haml'
9
+ gem 'redcarpet'
10
+ gem 'sass'
@@ -8,17 +8,3 @@ Staticpress is a blog-focused static site generator. It uses Tilt for rendering
8
8
  Staticpress is installable as a Rubygem so a simple `[sudo] gem install staticpress` is all you need. Once installed you will need to initialize your blog with `staticpress new <path-to-blog> [name-of-blog]`, where `<path-to-blog>` is a relative path to some directory and `[name-of-blog]` is an optional title. If the directory does not exist yet, it will be created, so go ahead and `cd` into it.
9
9
 
10
10
  From your blog directory, you can create a new blog post with `staticpress create <title>`. You can turn on the server with `staticpress serve` to preview work in progress. Several other commands are available; check out `staticpress help` for more information.
11
-
12
-
13
- * .new passes params to #initialize
14
- * #initialize manually calculates full path to template from params and populates @template_types
15
- * Base#template_types is looped over in Base#render_partial
16
- * Base#template_extension joins Base#template_types and prepends with . if not empty
17
- * #template_path uses Base#template_extension to create full path to source
18
-
19
-
20
- * http://jekyllbootstrap.com/
21
- * http://vitobotta.com/how-to-migrate-from-wordpress-to-jekyll/
22
- * http://vitobotta.com/sinatra-contact-form-jekyll/
23
-
24
- * http://nanoc.stoneship.org/docs/
data/Rakefile CHANGED
@@ -1,23 +1,10 @@
1
1
  require 'bundler/gem_tasks'
2
- require 'pathname'
2
+ require 'rake/testtask'
3
3
 
4
4
  task :default => [ :tests ]
5
5
 
6
- desc 'Run all tests in path specified (defaults to tests). Tell Rake to start at a specific path with `rake tests[\'tests/lib/staticpress/content\']`'
7
- task :tests, :path do |t, args|
8
- args.with_defaults(:path => 'tests')
9
-
10
- run_recursively = lambda do |dir|
11
- Pathname(dir).expand_path.children.each do |dir_or_test|
12
- if dir_or_test.directory?
13
- run_recursively.call dir_or_test
14
- elsif dir_or_test.to_s.end_with? '_test.rb'
15
- require_relative dir_or_test
16
- end
17
- end
18
- end
19
-
20
- run_recursively.call args[:path]
6
+ Rake::TestTask.new(:tests) do |t|
7
+ t.pattern = 'tests/**/*_test.rb'
21
8
  end
22
9
 
23
10
  desc 'Enumerate annotations. Optionally takes a pipe-separated list of tags to process'
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'staticpress/booter'
4
- require 'staticpress/cli'
3
+ require 'staticpress'
5
4
 
6
5
  Staticpress::CLI.start
@@ -1,5 +1,4 @@
1
- require 'staticpress/booter'
2
- require 'staticpress/server'
1
+ require 'staticpress'
3
2
 
4
3
  use Rack::ShowStatus
5
4
  use Rack::ShowExceptions
@@ -0,0 +1,15 @@
1
+ %nav
2
+ %menu{ :type => :toolbar }
3
+ %li
4
+ %a{ :href => '/docs' } Documentation
5
+ %li
6
+ %a{ :href => '/features' } Features
7
+
8
+ :markdown
9
+ * [Setup](/docs/setup)
10
+ * [Help](/docs/help)
11
+ * [Content Types](/docs/content-types)
12
+ * [Build](/docs/build)
13
+ * [Deploy](/docs/deploy)
14
+ * [Themes](/docs/themes)
15
+ * [Plugins](/docs/plugins)
@@ -0,0 +1,3 @@
1
+ # Build
2
+
3
+ You can build your site in an ad-hoc fashion with `staticpress build`, but you will likely want to turn on the preview server. Run `staticpress serve` and open your browser to [http://localhost:4000/](http://localhost:4000/). Any change you make will be viewable with just a refresh.
@@ -1,3 +1,3 @@
1
1
  # Content Types
2
2
 
3
- Staticpress supports many formats for content. Staticpress uses [Tilt](https://github.com/rtomayko/tilt) under the covers. You can mix and match format as much as you like. Additionally you can create pages in any format; if Tilt does not recognize the file, it will be copied through untouched. This is useful for including images in your posts for instance.
3
+ Staticpress supports many formats for content. To do so, Staticpress uses [Tilt](https://github.com/rtomayko/tilt) under the covers. You can mix and match format as much as you like. Additionally you can create pages in any format; if Tilt does not recognize the file, it will be copied through untouched. This is useful for including images in your posts for instance.
@@ -0,0 +1 @@
1
+ # Deploying
@@ -0,0 +1 @@
1
+ # Getting Help
@@ -0,0 +1 @@
1
+ # Plugins
@@ -13,3 +13,7 @@ When you want to create a new Staticpress blog, simply run `staticpress new <pat
13
13
  ## Hello, World
14
14
 
15
15
  After creating a new blog, you will probably want to create a new post. Type `staticpress create <title>` to create a new post. Staticpress will create a new empty post in `content/_posts/`. Open this file with your favorite text editor and start pontificating. When your are done, type `staticpress serve` to turn on the local development server. Open your favorite browser and navigate to [http://localhost:4000/](http://localhost:4000) to preview your post. Congratulations!
16
+
17
+ ## Diving Deeper
18
+
19
+ In addition to blog posts, Staticpress can handle regular pages. Simply type `staticpress create_page <title> [path-in-content]` to get started.
@@ -0,0 +1 @@
1
+ # Themes
@@ -0,0 +1,6 @@
1
+ %nav
2
+ %menu{ :type => :toolbar }
3
+ %li
4
+ %a{ :href => '/docs' } Documentation
5
+ %li
6
+ %a{ :href => '/features' } Features
@@ -0,0 +1,6 @@
1
+ %nav
2
+ %menu{ :type => :toolbar }
3
+ %li
4
+ %a{ :href => '/docs' } Documentation
5
+ %li
6
+ %a{ :href => '/features' } Features
@@ -0,0 +1,24 @@
1
+ Feature: Editing blog
2
+
3
+ Background:
4
+ Given a blog exists
5
+
6
+ Scenario: Creating a new blog post
7
+ When I create a new post
8
+ Then I can edit the post
9
+
10
+ Scenario: Creating a static page
11
+ When I create a new page
12
+ Then I can edit the page
13
+
14
+ Scenario: Copying a built-in plugin
15
+ When I fork a plugin
16
+ Then I can edit the forked plugin
17
+
18
+ Scenario: Copying and renaming a built-in plugin
19
+ When I fork and rename a plugin
20
+ Then I can edit my plugin
21
+
22
+ Scenario: Copying the default theme
23
+ When I fork the default theme
24
+ Then I can edit the theme files
@@ -0,0 +1,40 @@
1
+ Feature: Editing blog contents
2
+
3
+ Background:
4
+ Given a blog with content exists
5
+
6
+ Scenario: Creating a static page with multiple formats
7
+ When I create a simple page with multiple formats
8
+ And build the site
9
+ Then the formats page only contains markup
10
+
11
+ Scenario: Listing all routes
12
+ When I list my blog's URLs
13
+ Then the static pages are present
14
+
15
+ Scenario: Building a site
16
+ Then the output directory does not exist
17
+ When I build the site
18
+ Then the output directory contains some markup files
19
+
20
+ Scenario: Building a site (verbose)
21
+ When I build the site verbosely
22
+ Then I see each output file
23
+
24
+ Scenario: Building a site with a custom homepage
25
+ When I create a custom home page
26
+ And I build the site
27
+ Then the build homepage looks good
28
+
29
+ Scenario: Pushing a compiled site to a remote location
30
+ Given I build the site
31
+ When I add a custom deployment strategy
32
+ And push the site
33
+ Then the site is deployed
34
+
35
+ Scenario: Deploying site (build and push in one step)
36
+ Given I add a custom deployment strategy
37
+ And the site is not built or deployed
38
+ When I deploy the site
39
+ Then the output directory contains some markup files
40
+ And the site is deployed
@@ -0,0 +1,19 @@
1
+ Feature: Getting started
2
+
3
+ @focus
4
+ Scenario: Getting help
5
+ Given I ask for help
6
+ Then I am pointed in the right direction
7
+
8
+ @focus
9
+ Scenario: Finding the version
10
+ Given I want Staticpress' version
11
+ Then I see the version
12
+
13
+ Scenario: Creating a new blog
14
+ When I make a new blog
15
+ Then the minimal files are present
16
+
17
+ Scenario: Creating a new blog with a custum title
18
+ When I make a new blog called "This is my blog"
19
+ Then Staticpress should remember my blog title
@@ -0,0 +1,128 @@
1
+ Given /^a blog with content exists$/ do
2
+ create_sample_blog
3
+ run_simple 'staticpress create_page about'
4
+ run_simple 'staticpress create hello-goodbye'
5
+ end
6
+
7
+ Given /^the site is not built or deployed$/ do
8
+ files = [
9
+ 'public/index.html',
10
+ 'public/about/index.html',
11
+ '../deployed/index.html',
12
+ '../deployed/about/index.html'
13
+ ]
14
+ check_file_presence files, false
15
+ end
16
+
17
+
18
+ When /^I create a simple page with multiple formats$/ do
19
+ write_file 'content/formats.markdown.erb', 'hello world'
20
+ end
21
+
22
+ When /^(I )?(\w+) the site$/ do |ignored, action|
23
+ run_simple "staticpress #{action}"
24
+ end
25
+
26
+ When /^I list my blog's URLs$/ do
27
+ run_simple 'staticpress list url_path'
28
+ end
29
+
30
+ When /^I build the site verbosely$/ do
31
+ run_simple 'staticpress build --verbose'
32
+ end
33
+
34
+ When /^I create a custom home page$/ do
35
+ write_file 'content/index.markdown', <<-MARKDOWN
36
+ ---
37
+ title: Custom Home Page
38
+ ---
39
+
40
+ in custom page
41
+ MARKDOWN
42
+ end
43
+
44
+ When /^I add a custom deployment strategy$/ do
45
+ append_to_file 'config.yml', <<-YAML
46
+ :deployment_strategies:
47
+ :custom: 'cp -R public ../deployed'
48
+ YAML
49
+ end
50
+
51
+
52
+ Then /^the formats page only contains markup$/ do
53
+ check_exact_file_content 'public/formats/index.html', <<-HTML
54
+ <!DOCTYPE html>
55
+ <html>
56
+ <head>
57
+ <title>Formats | Transient Thoughts</title>
58
+ <link href='/assets/basic/styles/all.css' rel='stylesheet' type='text/css' />
59
+ <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js'></script>
60
+ <script src='/assets/basic/scripts/application.js'></script>
61
+ </head>
62
+ <body>
63
+ <header>
64
+ <span class='site-title'>Transient Thoughts</span>
65
+ <span class='site-subtitle'>A blogging framework for hackers</span>
66
+ </header>
67
+ <section>
68
+ <p>hello world</p>
69
+ </section>
70
+ <section></section>
71
+ </body>
72
+ </html>
73
+ HTML
74
+ end
75
+
76
+ Then /^the static pages are present$/ do
77
+ assert_partial_output '/', all_output
78
+ assert_partial_output '/about', all_output
79
+ assert_partial_output '/hello-goodbye', all_output
80
+ end
81
+
82
+ Then /^the output directory does not exist$/ do
83
+ check_directory_presence ['public'], false
84
+ end
85
+
86
+ Then /^the output directory contains some markup files$/ do
87
+ files = [
88
+ 'public/index.html',
89
+ 'public/about/index.html'
90
+ ]
91
+ check_file_presence files, true
92
+ end
93
+
94
+ Then /^I see each output file$/ do
95
+ assert_partial_output " page public/about/index.html", all_output
96
+ end
97
+
98
+ Then /^the build homepage looks good$/ do
99
+ check_exact_file_content 'public/index.html', <<-HTML
100
+ <!DOCTYPE html>
101
+ <html>
102
+ <head>
103
+ <title>Custom Home Page | Transient Thoughts</title>
104
+ <link href='/assets/basic/styles/all.css' rel='stylesheet' type='text/css' />
105
+ <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js'></script>
106
+ <script src='/assets/basic/scripts/application.js'></script>
107
+ </head>
108
+ <body>
109
+ <header>
110
+ <span class='site-title'>Transient Thoughts</span>
111
+ <span class='site-subtitle'>A blogging framework for hackers</span>
112
+ </header>
113
+ <section>
114
+ <p>in custom page</p>
115
+ </section>
116
+ <section></section>
117
+ </body>
118
+ </html>
119
+ HTML
120
+ end
121
+
122
+ Then /^the site is deployed$/ do
123
+ files = [
124
+ '../deployed/index.html',
125
+ '../deployed/about/index.html'
126
+ ]
127
+ check_file_presence files, true
128
+ end
@@ -0,0 +1,52 @@
1
+ Given /^a blog exists$/ do
2
+ create_sample_blog
3
+ end
4
+
5
+
6
+ When /^I create a new post$/ do
7
+ run_simple 'staticpress create \'Hello World\''
8
+ end
9
+
10
+ When /^I create a new page$/ do
11
+ run_simple 'staticpress create_page about'
12
+ end
13
+
14
+ When /^I fork a plugin$/ do
15
+ run_simple 'staticpress fork_plugin blockquote'
16
+ end
17
+
18
+ When /^I fork and rename a plugin$/ do
19
+ run_simple 'staticpress fork_plugin blockquote pullquote'
20
+ end
21
+
22
+ When /^I fork the default theme$/ do
23
+ run_simple 'staticpress fork_theme'
24
+ end
25
+
26
+
27
+ Then /^I can edit the post$/ do
28
+ now = Time.now.utc
29
+ filename = [
30
+ now.year,
31
+ ('%02d' % now.month),
32
+ ('%02d' % now.day),
33
+ 'hello-world.markdown'
34
+ ].join('-')
35
+ verify_directory_contains_file 'content/_posts', filename
36
+ end
37
+
38
+ Then /^I can edit the page$/ do
39
+ verify_directory_contains_file 'content', 'about.markdown'
40
+ end
41
+
42
+ Then /^I can edit the forked plugin$/ do
43
+ verify_directory_contains_file 'plugins', 'blockquote.rb'
44
+ end
45
+
46
+ Then /^I can edit my plugin$/ do
47
+ verify_directory_contains_file 'plugins', 'pullquote.rb'
48
+ end
49
+
50
+ Then /^I can edit the theme files$/ do
51
+ check_directory_presence ['themes/basic'], true
52
+ end
@@ -0,0 +1,51 @@
1
+ Given /^I ask for help$/ do
2
+ commands = [
3
+ 'staticpress',
4
+ 'staticpress help',
5
+ 'staticpress -h',
6
+ 'staticpress --help'
7
+ ]
8
+ run_one_of *commands
9
+ end
10
+
11
+ Given /^I want Staticpress' version$/ do
12
+ commands = [
13
+ 'staticpress version',
14
+ 'staticpress -v',
15
+ 'staticpress --version'
16
+ ]
17
+ run_one_of *commands
18
+ end
19
+
20
+
21
+ When /^I make a new blog( called "(.+)")?$/ do |ignored, title|
22
+ create_sample_blog title
23
+ end
24
+
25
+
26
+ Then /^I am pointed in the right direction$/ do
27
+ assert_exit_status 0
28
+ assert_partial_output 'Usage', all_output
29
+ end
30
+
31
+ Then /^I see the version$/ do
32
+ assert_exit_status 0
33
+ assert_partial_output 'Staticpress', all_output
34
+ end
35
+
36
+ Then /^the minimal files are present$/ do
37
+ files = [
38
+ 'config.ru',
39
+ 'config.yml',
40
+ 'Gemfile',
41
+ 'README.markdown'
42
+ ]
43
+ check_file_presence files, true
44
+ end
45
+
46
+ Then /^Staticpress should remember my blog title$/ do
47
+ check_exact_file_content 'config.yml', <<-YAML
48
+ ---
49
+ :title: This is my blog
50
+ YAML
51
+ end