Browse code

1. Reduced dependencies and updated the gemfile 2. Added whole vendor directory to .gitignore for `bundle package` users 3. Removed guard tasks and replaced serve tasks in Rakefile. 3. Reorganized rake tasks and cleaned up the Rakefile.

Brandon Mathis authored on 11/06/2011 at 11:56:04
Showing 4 changed files
... ...
@@ -5,4 +5,4 @@
5 5
 _cache
6 6
 public
7 7
 source/_stash
8
-vendor/ruby
8
+vendor
... ...
@@ -7,6 +7,3 @@ gem 'RedCloth'
7 7
 gem 'haml', '>= 3.1'
8 8
 gem 'compass', '>= 0.11'
9 9
 gem 'rubypants'
10
-gem 'rb-fsevent'
11
-gem 'guard-livereload'
12
-gem 'serve'
... ...
@@ -2,8 +2,6 @@ GEM
2 2
   remote: http://rubygems.org/
3 3
   specs:
4 4
     RedCloth (4.2.7)
5
-    activesupport (3.0.7)
6
-    addressable (2.2.6)
7 5
     chunky_png (1.2.0)
8 6
     classifier (1.3.3)
9 7
       fast-stemmer (>= 1.0.0)
... ...
@@ -12,45 +10,22 @@ GEM
12 12
       fssm (>= 0.2.7)
13 13
       sass (~> 3.1)
14 14
     directory_watcher (1.4.0)
15
-    em-websocket (0.2.1)
16
-      addressable (>= 2.1.1)
17
-      eventmachine (>= 0.12.9)
18
-    eventmachine (0.12.10)
19 15
     fast-stemmer (1.0.0)
20 16
     fssm (0.2.7)
21
-    guard (0.3.4)
22
-      thor (~> 0.14.6)
23
-    guard-livereload (0.1.11)
24
-      em-websocket (~> 0.2.0)
25
-      guard (>= 0.2.2)
26
-      json (~> 1.5.1)
27 17
     haml (3.1.1)
28
-    i18n (0.6.0)
29 18
     jekyll (0.10.0)
30 19
       classifier (>= 1.3.1)
31 20
       directory_watcher (>= 1.1.1)
32 21
       liquid (>= 1.9.0)
33 22
       maruku (>= 0.5.9)
34
-    json (1.5.1)
35 23
     liquid (2.2.2)
36 24
     maruku (0.6.0)
37 25
       syntax (>= 1.0.0)
38
-    rack (1.3.0)
39 26
     rake (0.9.0)
40
-    rb-fsevent (0.4.0)
41 27
     rdiscount (1.6.8)
42 28
     rubypants (0.2.0)
43 29
     sass (3.1.1)
44
-    serve (1.1.0)
45
-      activesupport (~> 3.0.7)
46
-      i18n (~> 0.6.0)
47
-      rack (~> 1.3.0)
48
-      tilt (~> 1.3.1)
49
-      tzinfo (~> 0.3.27)
50 30
     syntax (1.0.0)
51
-    thor (0.14.6)
52
-    tilt (1.3.2)
53
-    tzinfo (0.3.27)
54 31
 
55 32
 PLATFORMS
56 33
   ruby
... ...
@@ -58,11 +33,8 @@ PLATFORMS
58 58
 DEPENDENCIES
59 59
   RedCloth
60 60
   compass (>= 0.11)
61
-  guard-livereload
62 61
   haml (>= 3.1)
63 62
   jekyll
64 63
   rake
65
-  rb-fsevent
66 64
   rdiscount
67 65
   rubypants
68
-  serve
... ...
@@ -9,25 +9,16 @@ posts       = "_posts"    # directory for blog files
9 9
 post_format = "markdown"  # file format for new posts when using the post rake task
10 10
 
11 11
 ## -- Rsync Deploy config -- ##
12
+# Be sure your public key is listed in your server's ~/.ssh/authorized_keys file
12 13
 ssh_user      = "user@host.com"    # for rsync deployment
13 14
 document_root = "~/document_root/" # for rsync deployment
14
-## ---- ##
15 15
 
16 16
 ## -- Github Pages deploy config -- ##
17 17
 # Read http://pages.github.com for guidance
18
-# You can deploy to github pages with `rake push_github` or change the default push task below to :push_github
19
-# If you're not using this, you can remove it
18
+# You can deploy to github pages with `rake push_github` or change the default push task to :push_github
20 19
 source_branch = "source" # this compiles to your deploy branch
21 20
 deploy_branch = "master" # For user pages, use "master" for project pages use "gh-pages"
22
-## ---- ##
23 21
 
24
-def ok_failed(condition)
25
-  if (condition)
26
-    puts "OK"
27
-  else
28
-    puts "FAILED"
29
-  end
30
-end
31 22
 
32 23
 desc "Initial setup for Octopress: copies the default theme into the path of Jekyll's generator. rake install defaults to rake install[classic] to install a different theme run rake install[some_theme_name]"
33 24
 task :install, :theme do |t, args|
... ...
@@ -36,22 +27,21 @@ task :install, :theme do |t, args|
36 36
   puts "## Copying "+theme+" theme to Jekyll paths"
37 37
   system "cp -R themes/"+theme+"/source source"
38 38
   system "cp -R themes/"+theme+"/sass sass"
39
-  system "cp -R themes/"+theme+"/_plugins/ _plugins/"
39
+  # system "cp -R themes/"+theme+"/_plugins/ _plugins/"
40 40
 end
41 41
 
42
-## if you're deploying with github, change the default deploy to push_github
43
-desc "default push task"
44
-task :push => [:push_rsync] do
45
-end
42
+#######################
43
+# Working with Jekyll #
44
+#######################
46 45
 
47
-desc "Generate and deploy task"
48
-task :deploy => [:integrate, :generate, :push] do
46
+desc "Watch the site and regenerate when it changes"
47
+task :watch do
48
+  system "trap 'kill $jekyllPid $compassPid' Exit; jekyll --auto & jekyllPid=$!; compass watch & compassPid=$!; wait"
49 49
 end
50 50
 
51
-desc "Generate jekyll site"
52
-task :generate do
53
-  puts "## Generating Site with Jekyll"
54
-  system "jekyll"
51
+desc "preview the site in a web browser"
52
+task :preview do
53
+  system "trap 'kill $jekyllPid $compassPid' Exit; jekyll --auto --server & jekyllPid=$!; compass watch & compassPid=$!; wait"
55 54
 end
56 55
 
57 56
 # usage rake post[my-new-post] or rake post['my new post'] or rake post (defaults to "new-post")
... ...
@@ -83,24 +73,40 @@ task :integrate do
83 83
   FileUtils.mv Dir.glob("#{source}/#{stash}/*.*"), "#{source}/#{posts}/"
84 84
 end
85 85
 
86
-desc "list tasks"
87
-task :list do
88
-  puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).to_sentence}"
89
-  puts "(type rake -T for more detail)\n\n"
86
+##############
87
+# Deploying  #
88
+##############
89
+
90
+## if you're deploying with github, change the default deploy to push_github
91
+desc "default push task"
92
+task :push => [:push_rsync] do
90 93
 end
91 94
 
92
-desc "Watch the site and regenerate when it changes"
93
-task :watch do
94
-  system "trap 'kill $jekyllPid $guardPid $compassPid' Exit; jekyll --auto & jekyllPid=$!; compass watch & compassPid=$!; guard & guardPid=$!; wait"
95
+desc "Generate and deploy task"
96
+multitask :deploy => [:integrate, :generate, :push] do
97
+end
98
+
99
+desc "Generate jekyll site"
100
+task :generate do
101
+  puts "## Generating Site with Jekyll"
102
+  system "jekyll"
95 103
 end
96 104
 
97
-desc "generate and deploy website via rsync"
98
-multitask :push_rsync do
105
+def ok_failed(condition)
106
+  if (condition)
107
+    puts "OK"
108
+  else
109
+    puts "FAILED"
110
+  end
111
+end
112
+
113
+desc "Deploy website via rsync"
114
+task :push_rsync do
99 115
   puts "## Deploying website via Rsync"
100 116
   ok_failed system("rsync -avz --delete #{site}/ #{ssh_user}:#{document_root}")
101 117
 end
102 118
 
103
-desc "deploy website to github user pages"
119
+desc "deploy website to github pages"
104 120
 multitask :push_github do
105 121
   puts "## Deploying #{deploy_branch} branch to Github Pages "
106 122
   require 'git'
... ...
@@ -122,28 +128,10 @@ multitask :push_github do
122 122
   repo.branch("#{source_branch}").checkout
123 123
 end
124 124
 
125
-desc "start up a web server on the output files"
126
-task :start_server => :stop_server do
127
-  print "## Starting serve..."
128
-  system("serve #{site} #{port} > /dev/null 2>&1 &")
129
-  sleep 1
130
-  pid = `ps auxw | awk '/bin\\/serve #{site} #{port}/ { print $2 }'`.strip
131
-  ok_failed !pid.empty?
132
-  system "open http://localhost:#{port}" unless pid.empty?
133
-end
134 125
 
135
-desc "stop the web server"
136
-task :stop_server do
137
-  pid = `ps auxw | awk '/bin\\/serve #{site} #{port}/ { print $2 }'`.strip
138
-  if pid.empty?
139
-    puts "## Adsf is not running"
140
-  else
141
-    print "## Stoping adsf..."
142
-    ok_failed system("kill -9 #{pid}")
143
-  end
144
-end
145 126
 
146
-desc "preview the site in a web browser"
147
-task :preview do
148
-  system "trap 'kill $servePid $jekyllPid $guardPid' Exit; serve #{site} #{port} > /dev/null 2>&1 & servePid=$!; jekyll --auto & jekyllPid=$!; guard & guardPid=$!; compass compile; open http://localhost:#{port}; wait"
127
+desc "list tasks"
128
+task :list do
129
+  puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).to_sentence}"
130
+  puts "(type rake -T for more detail)\n\n"
149 131
 end