darthapo-stratus 0.2

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.
Files changed (88) hide show
  1. data/Changelog +3 -0
  2. data/Manifest +87 -0
  3. data/Rakefile +82 -0
  4. data/Readme.markdown +15 -0
  5. data/bin/stratus +8 -0
  6. data/lib/stratus/cli.rb +206 -0
  7. data/lib/stratus/filters.rb +73 -0
  8. data/lib/stratus/generator/builder.rb +147 -0
  9. data/lib/stratus/generator/context.rb +39 -0
  10. data/lib/stratus/generator/renderer.rb +100 -0
  11. data/lib/stratus/generator/scanner.rb +75 -0
  12. data/lib/stratus/generator.rb +12 -0
  13. data/lib/stratus/resources/attachment.rb +41 -0
  14. data/lib/stratus/resources/base.rb +257 -0
  15. data/lib/stratus/resources/content.rb +17 -0
  16. data/lib/stratus/resources/hash_db.rb +128 -0
  17. data/lib/stratus/resources/layout.rb +18 -0
  18. data/lib/stratus/resources/template.rb +22 -0
  19. data/lib/stratus/resources.rb +75 -0
  20. data/lib/stratus/settings.rb +19 -0
  21. data/lib/stratus/tags/markdown.rb +19 -0
  22. data/lib/stratus/tags/textile.rb +19 -0
  23. data/lib/stratus/tags.rb +3 -0
  24. data/lib/stratus/tasks/app/boilerplate/StratusSite +25 -0
  25. data/lib/stratus/tasks/app/boilerplate/config/defaults/page.default.html +10 -0
  26. data/lib/stratus/tasks/app/boilerplate/config/defaults/post.default.html +10 -0
  27. data/lib/stratus/tasks/app/boilerplate/config/site.yaml +16 -0
  28. data/lib/stratus/tasks/app/boilerplate/content/pages/home/index.html +35 -0
  29. data/lib/stratus/tasks/app/boilerplate/themes/default/styles/main.css +12 -0
  30. data/lib/stratus/tasks/app/boilerplate/themes/default/templates/layouts/main.html +31 -0
  31. data/lib/stratus/tasks/app/boilerplate/themes/default/templates/objects/page.html +7 -0
  32. data/lib/stratus/tasks/app/boilerplate/themes/default/templates/objects/page.index.html +10 -0
  33. data/lib/stratus/tasks/app/boilerplate/themes/default/templates/objects/post.html +22 -0
  34. data/lib/stratus/tasks/app/boilerplate/themes/default/templates/objects/post.index.html +10 -0
  35. data/lib/stratus/tasks/app/site.rake +68 -0
  36. data/lib/stratus/tasks/shared/system.rake +16 -0
  37. data/lib/stratus/tasks/site/new.rake +108 -0
  38. data/lib/stratus/tasks/site/site.rake +21 -0
  39. data/lib/stratus/tasks/site/theme.rake +13 -0
  40. data/lib/stratus.rb +62 -0
  41. data/stratus.gemspec +31 -0
  42. data/test/fixtures/site/StratusSite +26 -0
  43. data/test/fixtures/site/config/defaults/article.default.html +7 -0
  44. data/test/fixtures/site/config/defaults/content.default.html +7 -0
  45. data/test/fixtures/site/config/defaults/page.default.html +10 -0
  46. data/test/fixtures/site/config/defaults/post.default.html +10 -0
  47. data/test/fixtures/site/config/site.yaml +25 -0
  48. data/test/fixtures/site/content/articles/001_im-the-title/index.html +10 -0
  49. data/test/fixtures/site/content/pages/about/index.html +7 -0
  50. data/test/fixtures/site/content/pages/home/index.html +37 -0
  51. data/test/fixtures/site/content/pages/projects/index.html +6 -0
  52. data/test/fixtures/site/content/posts/001_new-blog/dom.js +123 -0
  53. data/test/fixtures/site/content/posts/001_new-blog/index.html +24 -0
  54. data/test/fixtures/site/content/posts/001_new-blog/old.html +18 -0
  55. data/test/fixtures/site/content/posts/002_fun-for-the-whole-family/index.html +12 -0
  56. data/test/fixtures/site/content/posts/002_fun-for-the-whole-family/snippet_one.rb +5 -0
  57. data/test/fixtures/site/content/posts/003_life-is-quite-fun-really/index.html +12 -0
  58. data/test/fixtures/site/themes/default/scripts/code_highlighter.js +188 -0
  59. data/test/fixtures/site/themes/default/scripts/code_syntax.js +92 -0
  60. data/test/fixtures/site/themes/default/styles/code_syntax.css +68 -0
  61. data/test/fixtures/site/themes/default/styles/main.css +66 -0
  62. data/test/fixtures/site/themes/default/templates/layouts/main.html +36 -0
  63. data/test/fixtures/site/themes/default/templates/objects/article.html +7 -0
  64. data/test/fixtures/site/themes/default/templates/objects/article.index.html +8 -0
  65. data/test/fixtures/site/themes/default/templates/objects/feed.xml +25 -0
  66. data/test/fixtures/site/themes/default/templates/objects/page.html +7 -0
  67. data/test/fixtures/site/themes/default/templates/objects/page.index.html +10 -0
  68. data/test/fixtures/site/themes/default/templates/objects/post.html +22 -0
  69. data/test/fixtures/site/themes/default/templates/objects/post.index.html +10 -0
  70. data/test/fixtures/site/www/index.html +82 -0
  71. data/test/fixtures/site/www/pages/about/index.html +43 -0
  72. data/test/fixtures/site/www/pages/home/index.html +82 -0
  73. data/test/fixtures/site/www/pages/index.html +52 -0
  74. data/test/fixtures/site/www/pages/projects/index.html +43 -0
  75. data/test/fixtures/site/www/posts/fun-for-the-whole-family/index.html +66 -0
  76. data/test/fixtures/site/www/posts/fun-for-the-whole-family/snippet_one.rb +5 -0
  77. data/test/fixtures/site/www/posts/index.html +63 -0
  78. data/test/fixtures/site/www/posts/life-is-quite-fun-really/index.html +58 -0
  79. data/test/fixtures/site/www/posts/new-blog/dom.js +123 -0
  80. data/test/fixtures/site/www/posts/new-blog/index.html +192 -0
  81. data/test/fixtures/site/www/posts/new-blog/old.html +18 -0
  82. data/test/fixtures/site/www/theme/scripts/code_highlighter.js +188 -0
  83. data/test/fixtures/site/www/theme/scripts/code_syntax.js +92 -0
  84. data/test/fixtures/site/www/theme/styles/code_syntax.css +68 -0
  85. data/test/fixtures/site/www/theme/styles/main.css +66 -0
  86. data/test/fixtures/site/www/themes/default/styles/main.css +62 -0
  87. data/test/test_helper.rb +0 -0
  88. metadata +143 -0
@@ -0,0 +1,75 @@
1
+ module Stratus::Resources
2
+
3
+ class << self
4
+
5
+ # Every source file: Content, Attachment, (¿Template?)
6
+ def all
7
+ @all ||= HashDB.new
8
+ end
9
+
10
+ def register_content(content)
11
+ content.fixup_meta
12
+ if content.validate! # Should allow returning false to exclude from DB
13
+ collection_types << content.collection_type unless collection_types.include?( content.collection_type )
14
+ all << content
15
+ else
16
+ puts " - Skipping #{content.content_path}: failed validation"
17
+ end
18
+ end
19
+
20
+ def homepage
21
+ @all.find(:first, :is_homepage=>true)
22
+ end
23
+
24
+ def collection_types
25
+ @collecton_types ||= []
26
+ end
27
+
28
+ # Only content objects
29
+ def content(*args)
30
+ filter = args.extract_options!.merge! :content_type=>:content
31
+ all.find((args.first || :all), filter)
32
+ end
33
+
34
+ # Only content attachments
35
+ def attachments(*args)
36
+ filter = args.extract_options!.merge! :content_type=>:attachment
37
+ all.find((args.first || :all), filter)
38
+ end
39
+
40
+ def posts(*args)
41
+ filter = args.extract_options!.merge! :collection_type=>'posts', :content_type=>:content
42
+ all.find((args.first || :all), filter)
43
+ end
44
+
45
+ def pages(*args)
46
+ filter = args.extract_options!.merge! :collection_type=>'pages', :content_type=>:content
47
+ all.find((args.first || :all), filter)
48
+ end
49
+
50
+ # Only templates
51
+ def templates(*args)
52
+ filter = args.extract_options!.merge! :content_type=>:template
53
+ all.find((args.first || :all), filter)
54
+ end
55
+
56
+ # Only templates
57
+ def layouts(*args)
58
+ filter = args.extract_options!.merge! :content_type=>:layout
59
+ all.find((args.first || :all), filter)
60
+ end
61
+
62
+ def clear
63
+ all.clear
64
+ end
65
+
66
+ end
67
+
68
+ end
69
+
70
+ require 'stratus/resources/hash_db'
71
+ require 'stratus/resources/base'
72
+ require 'stratus/resources/attachment'
73
+ require 'stratus/resources/template'
74
+ require 'stratus/resources/layout'
75
+ require 'stratus/resources/content'
@@ -0,0 +1,19 @@
1
+ module Stratus
2
+
3
+ class << self
4
+ def settings
5
+ # Use Mash for these?
6
+ @settings ||= YAML::load( File.open(::Stratus.site_path('config', 'site.yaml')) )
7
+ end
8
+
9
+ def setting(key, default=nil, section='site')
10
+ if settings.has_key?(section) and settings[section].has_key?(key)
11
+ settings[section][key]
12
+ else
13
+ default
14
+ end
15
+ end
16
+
17
+ end
18
+
19
+ end
@@ -0,0 +1,19 @@
1
+ module Stratus
2
+
3
+ class MarkdownTag < Liquid::Block
4
+ # include Liquid::StandardFilters
5
+
6
+ def render(context)
7
+ if defined?(Maruku)
8
+ Maruku.new( super.to_s ).to_html
9
+ else
10
+ puts "You must had Maruku installed to render textile!"
11
+ super.to_s
12
+ end
13
+ end
14
+ end
15
+
16
+ ::Liquid::Template.register_tag('markdown', MarkdownTag)
17
+
18
+ end
19
+
@@ -0,0 +1,19 @@
1
+ module Stratus
2
+
3
+ class TextileTag < Liquid::Block
4
+ # include Liquid::StandardFilters
5
+
6
+ def render(context)
7
+ if defined?(RedCloth)
8
+ RedCloth.new( super.to_s ).to_html
9
+ else
10
+ puts "You must had RedCloth installed to render textile!"
11
+ super.to_s
12
+ end
13
+ end
14
+ end
15
+
16
+ ::Liquid::Template.register_tag('textile', TextileTag)
17
+
18
+ end
19
+
@@ -0,0 +1,3 @@
1
+
2
+ require 'stratus/tags/textile'
3
+ require 'stratus/tags/markdown'
@@ -0,0 +1,25 @@
1
+ # I'm a rake file, so you can put Rake tasks in here, if you like...
2
+
3
+ namespace :new do
4
+
5
+ desc "Creates a new page"
6
+ task :page=>'system:setup' do
7
+ if Stratus.args.length == 0
8
+ puts " You must specify a page title"
9
+ exit(1)
10
+ end
11
+ Stratus.args = ['page', Stratus.args[0]]
12
+ Rake::Task['new:content'].execute
13
+ end
14
+
15
+ desc "Creates a new blog post"
16
+ task :post=>'system:setup' do
17
+ if Stratus.args.length == 0
18
+ puts " You must specify a post title"
19
+ exit(1)
20
+ end
21
+ Stratus.args = ['post', Stratus.args[0]]
22
+ Rake::Task['new:content'].execute
23
+ end
24
+
25
+ end
@@ -0,0 +1,10 @@
1
+ <head>
2
+ <title>{{ title }}</title>
3
+ <meta name="publish-date" content="{{ date | date:'%Y-%m-%d %H:%M' }}"/>
4
+ </head>
5
+ <summary>
6
+ <p>SUMMARY</p>
7
+ </summary>
8
+ <body>
9
+ <p>BODY.</p>
10
+ </body>
@@ -0,0 +1,10 @@
1
+ <head>
2
+ <title>Life is quite fun, really</title>
3
+ <meta name="publish-date" content="2008-12-18 20:06"/>
4
+ </head>
5
+ <summary>
6
+ <p>SUMMARY</p>
7
+ </summary>
8
+ <body>
9
+ <p>BODY.</p>
10
+ </body>
@@ -0,0 +1,16 @@
1
+ site:
2
+ title: "My Site"
3
+ subtitle: "... is rocktacular!"
4
+ theme: "default"
5
+ copyright: "&copy; 2008 Me. All rights reserved."
6
+ homepage: "pages/home"
7
+
8
+ generator:
9
+ output: 'www'
10
+ tags: true
11
+ cleanup_tags: true
12
+ force_xhtml: false
13
+
14
+
15
+ stratus: # Don't touch this section!
16
+ version: 0.2
@@ -0,0 +1,35 @@
1
+ <head>
2
+ <title>Welcome!</title>
3
+ <meta name="layout" content="main"/>
4
+ </head>
5
+ <body>
6
+ <h1>Blog Entries:</h1>
7
+ <div class="home">
8
+
9
+ {% for post in posts limit:1 %}
10
+ <div class="post summary">
11
+ <h2>{{ post.title }}</h2>
12
+ <div class="body">
13
+ {{ post.summary }}
14
+ <p><a href="{{ post | uri_rel }}">Read more...</a></p>
15
+ </div>
16
+ <div class="meta">Published on {{ post.publish_date | short_date }}.</div>
17
+ </div>
18
+ {% endfor %}
19
+
20
+ </div>
21
+
22
+ <div class="archive">
23
+ <h3>Recently:</h3>
24
+
25
+ {% for post in posts limit:5 offset:1 %}
26
+ <div class="post summary">
27
+ <h4>
28
+ <a href="{{ post | uri_rel }}">{{ post.title }}</a>
29
+ <span class="meta">{{ post.publish_date | short_date }}</span>
30
+ </h4>
31
+ </div>
32
+ {% endfor %}
33
+
34
+ </div>
35
+ </body>
@@ -0,0 +1,12 @@
1
+ /*
2
+ Just a default CSS file -- blow it away and start fresh!
3
+ */
4
+
5
+ BODY {
6
+ font-family: tahoma, sans-serif;
7
+ }
8
+
9
+ .page-container {
10
+ width: 700px;
11
+ margin: 0 auto;
12
+ }
@@ -0,0 +1,31 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
6
+ <title>{{ site.title }}</title>
7
+ <link rel="stylesheet" href="{{ 'theme/styles/main.css' | uri_rel }}" type="text/css" media="screen" charset="utf-8"/>
8
+ {{ this.head }}
9
+ </head>
10
+ <body>
11
+ <div class="page-container">
12
+ <div class="header">
13
+ <h1>{{ site.title }}</h1>
14
+ <div class="subtitle">
15
+ {{ site.subtitle }}
16
+ </div>
17
+ </div>
18
+ <div class="navigation">
19
+ <a href="{{ page.home | uri_rel }}">Home</a>
20
+ ::
21
+ <a href="{{ posts | uri_rel }}">Archive</a>
22
+ </div>
23
+ <div class="contents">
24
+ {{ content }}
25
+ </div>
26
+ <div class="footer">
27
+ {{ site.copyright }}
28
+ </div>
29
+ </div>
30
+ </body>
31
+ </html>
@@ -0,0 +1,7 @@
1
+ <meta name="layout" content="main"/>
2
+ <div class="page">
3
+ <h2>{{ this.title }}</h2>
4
+ <div class="body">
5
+ {{ this.body }}
6
+ </div>
7
+ </div>
@@ -0,0 +1,10 @@
1
+ <meta name="layout" content="main">
2
+ <div class="pages">
3
+ {% for page in pages %}
4
+ {% unless page.is_homepage %}
5
+ <div class="page summary">
6
+ <h2><a href="{{ page | uri_rel }}">{{ page.title }}</a></h2>
7
+ </div>
8
+ {% endunless %}
9
+ {% endfor %}
10
+ </div>
@@ -0,0 +1,22 @@
1
+ <meta name="layout" content="main"/>
2
+ <div class="post">
3
+ <h2>{{ this.title }}</h2>
4
+ <div class="body">
5
+ {{ this.summary }}
6
+ {{ this.body }}
7
+ </div>
8
+ <div class="meta">
9
+ Published on {{ this.publish_date | short_date }}. {{ this.body | number_of_words }} words.
10
+ </div>
11
+ <div>
12
+ <div>
13
+ {% if this.prev %}
14
+ <a href="{{ this.prev | uri_rel }}">&laquo; {{ this.prev.title }}</a>
15
+ {% endif %}
16
+ <a href="{{ page.home | uri_rel }}">Home</a>
17
+ {% if this.next %}
18
+ <a href="{{ this.next | uri_rel }}">{{ this.next.title }} &raquo;</a>
19
+ {% endif %}
20
+ </div>
21
+ </div>
22
+ </div>
@@ -0,0 +1,10 @@
1
+ <meta name="layout" content="main">
2
+ <div class="posts">
3
+ {% for post in posts %}
4
+ <div class="post summary">
5
+ <h2>{{ post.title }} <span>{{ post.publish_date | short_date }}</span></h2>
6
+ {{ post.summary }}
7
+ <a href="{{ post | uri_rel }}">Read more...</a>
8
+ </div>
9
+ {% endfor %}
10
+ </div>
@@ -0,0 +1,68 @@
1
+ class String
2
+ def /(other)
3
+ File.join(self, other)
4
+ end
5
+ end
6
+
7
+
8
+ namespace :new do
9
+
10
+ desc "Creates a new stratus blog"
11
+ task :site=>'system:setup' do
12
+ if Stratus.args.length == 0
13
+ puts " You must specify a site (folder) name"
14
+ exit(1)
15
+ end
16
+ site_name = Stratus.args[0]
17
+ site_path = File.expand_path(File.join(ROOT_PATH, site_name))
18
+ if File.exists?(site_path) and !File.directory?(site_path)
19
+ puts " Target is a file!"
20
+ exit(1)
21
+ else
22
+ FileUtils.mkdir_p( site_path )
23
+ end
24
+ template = Dir[File.join( File.dirname(__FILE__), 'boilerplate', "*" )]
25
+ FileUtils.cp_r template, site_path
26
+
27
+ puts <<-EOF
28
+ Done! You can create your first post by:
29
+
30
+ cd #{site_name}
31
+ stratus new:post "My First Post"
32
+
33
+ You can build the website by running:
34
+
35
+ stratus site:build
36
+
37
+ To see all of the available commands, run:
38
+
39
+ stratus -T
40
+
41
+ Enjoy!
42
+ EOF
43
+ end
44
+
45
+
46
+ end
47
+
48
+ task :show_usage do
49
+ puts "Stratus #{Stratus::VERSION}. For more information run:"
50
+ puts
51
+ puts " stratus -h"
52
+ puts
53
+ puts "For a complete list of commands available in this context, run:"
54
+ puts
55
+ puts " stratus -T"
56
+ puts
57
+ end
58
+
59
+ task :default => :show_usage
60
+
61
+
62
+ STRATUS_SITE_TEMPLATE =<<-EOF
63
+
64
+ EOF
65
+
66
+ SITE_YAML_TEMPLATE =<<-EOF
67
+
68
+ EOF
@@ -0,0 +1,16 @@
1
+ namespace :system do
2
+
3
+ # desc "Ensure all dependencies are available"
4
+ # task :deps do
5
+ # end
6
+ #
7
+ # desc "See if there are any updates"
8
+ # task :update do
9
+ #
10
+ # end
11
+
12
+ task :setup do
13
+ ROOT_PATH = File.expand_path('.')
14
+ end
15
+
16
+ end
@@ -0,0 +1,108 @@
1
+ namespace :new do
2
+
3
+ desc "Creates a content object"
4
+ task :content=>'system:setup' do
5
+ if Stratus.args.length < 2
6
+ puts " You must specify a collection type and title"
7
+ exit(1)
8
+ end
9
+
10
+ require 'erb'
11
+ content_type = Stratus.args[0]
12
+ content_type = content_type.pluralize if !File.exists?( Stratus.site_path('content', content_type))
13
+
14
+ if !File.exists?( Stratus.site_path('content', content_type))
15
+ puts "Collection '#{content_type}' not found!"
16
+ exit(1)
17
+ end
18
+
19
+ title = Stratus.args[1]
20
+ slug = title.slugify
21
+ date = Time.now
22
+ count = (Dir[Stratus.site_path('content', content_type, '*')].length + 1).to_s.rjust(3, '0')
23
+ template = ERB.new(CONTENT_TEMPLATE)
24
+ body = template.result(binding)
25
+ dir_path = Stratus.site_path('content', content_type, "#{count}_#{slug}")
26
+ file_path = File.join(dir_path, 'index.html')
27
+
28
+ FileUtils.mkdir_p dir_path
29
+ File.open(file_path, 'w') do |f|
30
+ f.write body
31
+ end
32
+ puts "Created #{file_path}"
33
+ `$EDITOR #{file_path}` if ENV.has_key? 'EDITOR'
34
+ end
35
+
36
+ desc "Creates a collection"
37
+ task :collection=>'system:setup' do
38
+ if Stratus.args.length == 0
39
+ puts " You must specify a collection name"
40
+ exit(1)
41
+ end
42
+ require 'erb'
43
+ name = Stratus.args[0].slugify
44
+ single = name.singularize
45
+ puts "Creating #{name}"
46
+ current_theme = Stratus.setting('theme', 'default')
47
+
48
+ FileUtils.mkdir_p( Stratus.site_path('content', name) )
49
+ File.open( Stratus.site_path('themes', current_theme, 'templates', 'objects', "#{single}.html"), 'w') do |f|
50
+ template = ERB.new(COLLECTION_TEMPLATE)
51
+ body = template.result(binding)
52
+ f.write body
53
+ end
54
+ File.open( Stratus.site_path('themes', current_theme, 'templates', 'objects', "#{single}.index.html"), 'w') do |f|
55
+ template = ERB.new(COLLECTION_INDEX_TEMPLATE)
56
+ body = template.result(binding)
57
+ f.write body
58
+ end
59
+ end
60
+
61
+ end
62
+
63
+ CONTENT_TEMPLATE=<<-EOF
64
+ <head>
65
+ <title><%= title %></title>
66
+ <meta name="publish-date" content="<%= date.strftime('%Y-%m-%d %H:%M') %>"/>
67
+ </head>
68
+ <summary>
69
+ <p>SUMMARY</p>
70
+ </summary>
71
+ <body>
72
+ <p>I'm the main body.</p>
73
+ </body>
74
+ EOF
75
+
76
+ POST_TEMPLATE=<<-EOF
77
+ <head>
78
+ <title><%= title %></title>
79
+ <meta name="publish-date" content="<%= date.strftime('%Y-%m-%d %H:%M') %>"/>
80
+ </head>
81
+ <summary>
82
+ <p>SUMMARY</p?
83
+ </summary>
84
+ <body>
85
+ <p>I'm the main body.</p>
86
+ </body>
87
+ EOF
88
+
89
+ COLLECTION_TEMPLATE=<<-EOF
90
+ <meta name="layout" content="main"/>
91
+ <div class="<%= single %>">
92
+ <h2>{{ this.title }}</h2>
93
+ <div class="body">
94
+ {{ this.body }}
95
+ </div>
96
+ </div>
97
+ EOF
98
+
99
+ COLLECTION_INDEX_TEMPLATE=<<-EOF
100
+ <meta name="layout" content="main">
101
+ <div class="<%= name %>">
102
+ {% for <%= single %> in <%= name %> %}
103
+ <div class="<%= single %> summary">
104
+ <h2><a href="{{ <%= single %> | uri_rel }}">{{ <%= single %>.title }}</a></h2>
105
+ </div>
106
+ {% endfor %}
107
+ </div>
108
+ EOF
@@ -0,0 +1,21 @@
1
+ namespace :site do
2
+
3
+ desc "Generate static html (default)"
4
+ task :build=>'system:setup' do
5
+ Stratus::Generator.build(ROOT_PATH)
6
+ end
7
+
8
+ desc "Removes generated output"
9
+ task :cleanup=>'system:setup' do
10
+ FileUtils.rm_rf Stratus.output_dir
11
+ puts " Done."
12
+ end
13
+
14
+ desc "Upgrades site so it's compatible with the installed version of stratus"
15
+ task :upgrade=>'system:setup' do
16
+ puts " Up to date."
17
+ end
18
+
19
+ end
20
+
21
+ task :default=>'site:build'
@@ -0,0 +1,13 @@
1
+ namespace :theme do
2
+
3
+ desc "Create a new theme"
4
+ task :create do
5
+
6
+ end
7
+
8
+ desc "Ensures theme has required templates"
9
+ task :validate do
10
+
11
+ end
12
+
13
+ end
data/lib/stratus.rb ADDED
@@ -0,0 +1,62 @@
1
+ module Stratus
2
+ VERSION = "0.2"
3
+ LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
4
+ PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
5
+
6
+
7
+ class << self
8
+ def args
9
+ @args || []
10
+ end
11
+ def args=(value)
12
+ @args = value
13
+ end
14
+
15
+ def site_path(*args)
16
+ @site_path ||= File.expand_path('.')
17
+ args.empty? ? @site_path : ::File.join(@site_path, args.flatten)
18
+ end
19
+ def site_path=(value)
20
+ @site_path = value
21
+ end
22
+
23
+ def output_dir(*args)
24
+ @output_dir ||= settings['generator'].fetch('output', 'www')
25
+ args.empty? ? @output_dir : ::File.join(@output_dir, args.flatten)
26
+ end
27
+
28
+ def libpath( *args )
29
+ args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
30
+ end
31
+
32
+ end
33
+
34
+ end
35
+
36
+ require 'rubygems'
37
+ require 'chronic'
38
+ require 'hpricot'
39
+ require 'active_support'
40
+ require 'liquid'
41
+ require 'redcloth' rescue LoadError
42
+ require 'maruku' rescue LoadError
43
+
44
+ require 'stratus/generator'
45
+ require 'stratus/resources'
46
+ require 'stratus/settings'
47
+ require 'stratus/filters'
48
+ require 'stratus/tags'
49
+
50
+
51
+ class String
52
+ def slugify
53
+ downcase.gsub(/&/, ' and ').gsub(/[^a-z0-9']+/, '-').gsub(/^-|-$|'/, '')
54
+ end
55
+ end
56
+
57
+ # function slugify(str) {
58
+ # return str.toLowerCase().
59
+ # replace(/&/g, 'and').
60
+ # replace(/[^a-z0-9']+/g, '-').
61
+ # replace(/^-|-$/g, '');
62
+ # }