Browse code

paramaterized feed, rsync deployment, and unified layouts

B Mathis authored on 20/10/2009 at 13:50:16
Showing 6 changed files
... ...
@@ -1,5 +1,16 @@
1 1
 require 'active_support'
2 2
 
3
+# preview project on this port - http://localhost:4000
4
+port = "4000"
5
+
6
+# compiled site directory
7
+site = "site"
8
+
9
+# for rsync deployment
10
+ssh_user      = "user@host.com"
11
+document_root = "~/document_root/"
12
+
13
+
3 14
 def ok_failed(condition)
4 15
   if (condition)
5 16
     puts "OK"
... ...
@@ -8,9 +19,6 @@ def ok_failed(condition)
8 8
   end
9 9
 end
10 10
 
11
-port = "4000"
12
-site = "site"
13
-
14 11
 desc "list tasks"
15 12
 task :default do
16 13
   puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:default]]).to_sentence}"
... ...
@@ -35,7 +43,7 @@ end
35 35
 desc "generate and deploy website"
36 36
 task :deploy => :generate do
37 37
   print "Deploying website..."
38
-  ok_failed system("rsync -avz --delete #{site}/ user@host.com:~/document_root/")
38
+  ok_failed system("rsync -avz --delete #{site}/ #{ssh_user}:#{document_root}")
39 39
 end
40 40
 
41 41
 desc "start up an instance of serve on the output files"
... ...
@@ -8,4 +8,4 @@ multiviews: true
8 8
 sass: false
9 9
 haml: true
10 10
 post_defaults:
11
-  layout: post
12 11
\ No newline at end of file
12
+  layout: default
13 13
\ No newline at end of file
... ...
@@ -178,9 +178,6 @@ module Helpers
178 178
     input.gsub(/(href|src)(\s*=\s*)(["'])(\/.*?)\3/) { $1 + $2 + $3 + "http://brandonmathis.com" + $4 + $3 }
179 179
   end
180 180
   
181
-  def full_url(input)
182
-    'http://brandonmathis.com'+input
183
-  end
184 181
   def rp(input)
185 182
     RubyPants.new(input).to_html
186 183
   end
... ...
@@ -1,5 +1,6 @@
1 1
 ---
2
-blog_title: My Blog
2
+blog_title: My Octopress Blog
3
+root_url: 
3 4
 ---
4 5
 
5 6
 !!! 1.1 Transitional
... ...
@@ -7,22 +8,29 @@ blog_title: My Blog
7 7
   %head
8 8
     %title= page.title
9 9
     - if page.respond_to? :description
10
-      %meta{:name=>"description", :content=>page.description}/
10
+      %meta(name="description" content="#{page.description}")/
11 11
     - if page.respond_to? :keywords
12
-      %meta{:name=>"keywords", :content=>page.keywords}/
13
-    %link(href="/stylesheets/screen.css" rel="stylesheet" media="screen projection" type="text/css")
14
-    %link(href="/blog/atom.xml" rel="alternate" title="Brandon Mathis - Design Enthusiast" type="application/atom+xml")
12
+      %meta(name="keywords" content="#{page.keywords}")/
13
+    %link(href="#{page.root_url}/stylesheets/screen.css" rel="stylesheet" media="screen projection" type="text/css")
14
+    %link(href="#{page.root_url}/atom.xml" rel="alternate" title="##{page.blog_title}" type="application/atom+xml")
15 15
   %body
16 16
     #header
17 17
       .page_width
18 18
         %a.title(href="/")=page.blog_title
19 19
         %ul#header_nav.nav
20 20
           %li.alpha
21
-            %a(href="/archives") Archives
21
+            %a(href="#{page.root_url}/archives") Archives
22 22
           %li.omega
23
-            %a(href="/atom.xml") Subscribe
23
+            %a(href="#{page.root_url}/atom.xml") Subscribe
24 24
     #page
25 25
       .page_width
26
-        = content
26
+        - if page.respond_to? :date
27
+          %h2= page.title
28
+          = content
29
+          %p.pubdate
30
+            Published:
31
+            =page.date.strftime("%d %b, %Y")
32
+        - else
33
+          = content
27 34
     #footer
28 35
       .page_width Footer
29 36
\ No newline at end of file
30 37
deleted file mode 100644
... ...
@@ -1,26 +0,0 @@
1
-!!! 1.1 Transitional
2
-%html(xmlns="http://www.w3.org/1999/xhtml" xml:lang="en")
3
-  %head
4
-    %title= page.title
5
-    - if page.respond_to? :description
6
-      %meta{:name=>"description", :content=>page.description}/
7
-    - if page.respond_to? :keywords
8
-      %meta{:name=>"keywords", :content=>page.keywords}/
9
-    %link(href="/stylesheets/screen.css" rel="stylesheet" media="screen projection" type="text/css")
10
-    %link(href="/blog/atom.xml" rel="alternate" title="Brandon Mathis - Design Enthusiast" type="application/atom+xml")
11
-  %body
12
-    #header
13
-      .page_width
14
-        %a.title(href="/")My Blog
15
-        %ul#header_nav.nav
16
-          %li.alpha
17
-            %a(href="/") Home
18
-    #page
19
-      .page_width
20
-        %h2= rp(page.title)
21
-        = content
22
-        %p.pubdate
23
-          Published:
24
-          =page.date.strftime("%d %b, %Y")
25
-    #footer
26
-      .page_width Footer
27 1
\ No newline at end of file
... ...
@@ -1,25 +1,25 @@
1 1
 ---
2 2
 layout: nil
3
-address: http://yoursite.com
3
+author: Your Name
4 4
 email: author@domain.com
5
-name: Your Name
6
-blog_title: My Blog
5
+blog_title: My Octopress Blog
6
+root_url: http://yoursite.com
7 7
 ---
8
-<?xml version="1.0" encoding="utf-8"?>
8
+!!! XML
9 9
 %feed(xmlns="http://www.w3.org/2005/Atom")
10
-  %title= "#{page.name} - #{page.blog_title}"
11
-  %link(href="#{page.address}/atom.xml" rel="self")
12
-  %link(href="#{page.address}")
10
+  %title= page.blog_title
11
+  %link(href="#{page.root_url}/atom.xml" rel="self")
12
+  %link(href="#{page.root_url}")
13 13
   %updated= Time.now.xmlschema
14
-  %id=page.address
14
+  %id=page.root_url
15 15
   %author
16
-    %name= page.name
16
+    %name= page.author
17 17
     %email= page.email
18 18
   - site.posts[0..14].each do |post|
19 19
     %entry
20 20
       %title= rp(post.title)
21
-      %link(href="#{full_url(post.url)}")
21
+      %link(href="#{page.root_url}#{post.url}")
22 22
       %updated=post.date.xmlschema
23
-      %id= full_url(post.id)
23
+      %id= "#{page.root_url}#{post.id}"
24 24
       %content(type="html")
25 25
         = h(absolute_url(rp(post.content)))
26 26
\ No newline at end of file