... | ... |
@@ -4,18 +4,32 @@ |
4 | 4 |
4. **It's easy to use.** A collection of rake tasks simplifies development and makes deploying a cinch. |
5 | 5 |
5. **Get curated plugins.** Plugins are hand selected from the Jekyll community then tested and improved. |
6 | 6 |
|
7 |
-## Get Setup |
|
7 |
+## Getting Started |
|
8 | 8 |
|
9 |
-[Fork Octopress](https://github.com/imathis/octopress), then open the console and follow along. |
|
9 |
+[Create a new repository](https://github.com/repositories/new) for your website then |
|
10 |
+open up a terminal and follow along. If you plan to host your site on [Github Pages](http://pages.github.com) for a user or organization, make sure the |
|
11 |
+repository is named `your_username.github.com` or `your_organization.github.com`. |
|
10 | 12 |
|
11 |
- git clone (your repo url) |
|
13 |
+### Setting up Git |
|
12 | 14 |
|
13 |
- # Optionally add a branch for pulling in Octopress updates |
|
15 |
+ mkdir my_octopress_site |
|
16 |
+ cd my_octopress_site |
|
17 |
+ git init |
|
14 | 18 |
git remote add octopress git://github.com/imathis/octopress.git |
19 |
+ git pull octopress master |
|
20 |
+ git remote add origin (your repository url) |
|
21 |
+ git push origin master |
|
15 | 22 |
|
16 |
-Setup an [RVM](http://beginrescueend.com/) and install dependencies. |
|
23 |
+ # If you're using Github user or organization pages, |
|
24 |
+ # rename the master branch to source and then push |
|
25 |
+ git branch -m master source |
|
26 |
+ git push origin source |
|
17 | 27 |
|
18 |
- source .rvmrc |
|
28 |
+ |
|
29 |
+### Setting up Octopress |
|
30 |
+<span>Next</span>, setup an [RVM](http://beginrescueend.com/) and install dependencies. |
|
31 |
+ |
|
32 |
+ rvm rvmrc trust |
|
19 | 33 |
bundle install |
20 | 34 |
|
21 | 35 |
# Install pygments (for syntax highlighing) |
... | ... |
@@ -25,7 +39,23 @@ Setup an [RVM](http://beginrescueend.com/) and install dependencies. |
25 | 25 |
# Install the default Octopress theme |
26 | 26 |
rake install |
27 | 27 |
|
28 |
-### Write A Post |
|
28 |
+### Generating Your Blog |
|
29 |
+ |
|
30 |
+ rake generate # Generates your blog into the public directory |
|
31 |
+ rake watch # Watches files for changes and regenerates your blog |
|
32 |
+ rake preview # Watches, regenerates, and mounts a webserver at http://localhost:4000 |
|
33 |
+ |
|
34 |
+Jekyll's built in webbrick server is handy, but if you're a [POW](http://pow.cx) user, you can set it up to work with Octopress like this. |
|
35 |
+ |
|
36 |
+ cd ~/.pow |
|
37 |
+ ln -s /path/to/octopress |
|
38 |
+ cd - |
|
39 |
+ |
|
40 |
+Now you'll just run `rake watch` and load up `http://octopress.dev` instead. |
|
41 |
+ |
|
42 |
+## Writing A Post |
|
43 |
+ |
|
44 |
+While running `rake preview` or `rake watch`, open a new terminal session and start a Hello World post. |
|
29 | 45 |
|
30 | 46 |
rake post['hello world'] |
31 | 47 |
|
... | ... |
@@ -39,49 +69,58 @@ which tells Jekyll how to processes posts and pages. |
39 | 39 |
layout: post |
40 | 40 |
--- |
41 | 41 |
|
42 |
-Octopress adds some custom paramaters to give you more publishing flexibility and you can [read about those here](#include_link), |
|
43 |
-but for now. Go ahead and type up a sample post or use some [inspired filler](http://baconipsum.com/). |
|
42 |
+Now, go ahead and type up a sample post, or use some [inspired filler](http://baconipsum.com/). Save and refresh your browser, and you |
|
43 |
+should see the new post show up in your blog index. |
|
44 | 44 |
|
45 |
-{% pullquote %} |
|
46 |
- When writing longform posts, I find it helpful to include pullquotes, which help those scanning a post discern whether or not a post is helpful. |
|
47 |
- It is important to note, {" pullquotes are merely visual in presentation and should not appear twice in the text. "} That is why it is prefered |
|
48 |
- to use a CSS only technique for styling pullquotes. |
|
49 |
-{% endpullquote %} |
|
45 |
+Octopress does more than this though. Check out [Blogging with Octopress](#include_link) to learn about cool features which |
|
46 |
+help make blogging easier and more beautiful. |
|
50 | 47 |
|
51 |
-## Generate Your Blog |
|
48 |
+## Configuring Octopress |
|
52 | 49 |
|
53 |
- rake preview |
|
50 |
+I've tried to keep configuring Octopress fairly simple. Here's a list of files for configuring Octopress. |
|
54 | 51 |
|
55 |
-This will generate your blog, watch your `sass` and `source` directories for changes regenerating automatically, and mount Jekyll's built in webbrick server. Open your browser to `http://localhost:4000` and check it out. |
|
52 |
+ _config.yml # Main config (Jekyll blog settings) |
|
53 |
+ Rakefile # Config for Rsync deployment |
|
54 |
+ config.rb # Compass config |
|
56 | 55 |
|
57 |
-If you'd rather use [POW](http://pow.cx) to serve up your site, you can do this instead. |
|
56 |
+ sass/custom/_colors.scss # change your blog's color scheme |
|
57 |
+ sass/custom/_layout.scss # change your blog's layout |
|
58 |
+ sass/custom/_styles.scss # override your blog's styles |
|
58 | 59 |
|
59 |
- cd ~/.pow |
|
60 |
- ln -s /path/to/octopress |
|
60 |
+Octopress keeps it's main configurations in two places, the `Rakefile` and the `_config.yml`. You probably won't have to change anything in the rakefile except the |
|
61 |
+deployment configurations (if you're going to [deploy with Rsync over SSH](#deploy_with_rsync)). |
|
62 |
+ |
|
63 |
+## Deploying |
|
64 |
+ |
|
65 |
+### Deploying with Rsync via SSH |
|
61 | 66 |
|
62 |
- #Then generate your site |
|
63 |
- rake watch |
|
67 |
+Add your server configurations to the `Rakefile` under Rsync deploy config. To deploy with Rsync, be sure your public key is listed in your server's `~/.ssh/authorized_keys` file. |
|
64 | 68 |
|
65 |
-`rake watch` does the same thing as `rake preview` except it doesn't mount Jekyll's webbrick server. |
|
69 |
+ ssh_user = "user@domain.com" |
|
70 |
+ document_root = "~/website.com/" |
|
66 | 71 |
|
67 |
-### Configure Octopress |
|
72 |
+Now if you run `rake deploy` in your terminal, your `public` directory will be synced to your server's document root. |
|
68 | 73 |
|
69 |
-Octopress keeps configurations in two places, the `Rakefile` and the `_config.yml`. |
|
74 |
+### Deploying to Github Pages |
|
70 | 75 |
|
71 |
-In the `rakefile` you'll want to set up your deployment configurations. |
|
76 |
+To setup deployment, you'll want to clone your target repository into the `_deploy` directory in your Octopress project. |
|
77 |
+If you're using Github project pages, clone the repository for that project, eg `git@github.com:username/project.git`. |
|
78 |
+If you're using Github user or organization pages, clone the repository `git@github.com:usernem/username.github.com.git`. |
|
72 | 79 |
|
73 |
- ## -- Rsync Deploy config -- ## |
|
74 |
- # Be sure your public key is listed in your server's ~/.ssh/authorized_keys file |
|
75 |
- ssh_user = "mathisweb@imathis.com" |
|
76 |
- document_root = "~/dev.octopress.org/" |
|
80 |
+ # For Github project pages: |
|
81 |
+ git clone git@github.com:username/project.git _deploy |
|
82 |
+ rake init_deploy[gh-pages] |
|
77 | 83 |
|
78 |
- ## -- Git deploy config -- ## |
|
79 |
- source_branch = "source" # this compiles to your deploy branch |
|
80 |
- deploy_branch = "master" # For user/organization pages, use "master" for project pages use "gh-pages" |
|
84 |
+ # For Github user/organization pages: |
|
85 |
+ git clone git@github.com:username/username.github.com _deploy |
|
86 |
+ rake init_deploy[master] |
|
81 | 87 |
|
82 |
-If you want to deploy with github pages, read [http://pages.github.com](http://pages.github.com) for guidance. |
|
88 |
+ # Now to deploy, you'll run |
|
89 |
+ rake push |
|
83 | 90 |
|
84 |
-TODO : Write _configt.yml instructions… |
|
91 |
+The `init_deploy` rake task takes a branch name as an argument and creates a [new empty branch](http://book.git-scm.com/5_creating_new_empty_branches.html), adds an initial commit, and pushes it to the origin remote. |
|
92 |
+This prepares your branch for easy deployment. The `rake push` task copies the generated blog from the `public` directory to the `_deploy` directory, adds new files, removes old files, sets a commit message, and pushes to Github. |
|
93 |
+Then Github will queue your site for publishing (which usually occurs within minutes). |
|
85 | 94 |
|
86 | 95 |
## License |
87 | 96 |
(The MIT License) |
... | ... |
@@ -34,6 +34,12 @@ end |
34 | 34 |
# Working with Jekyll # |
35 | 35 |
####################### |
36 | 36 |
|
37 |
+desc "Generate jekyll site" |
|
38 |
+task :generate do |
|
39 |
+ puts "## Generating Site with Jekyll" |
|
40 |
+ system "jekyll" |
|
41 |
+end |
|
42 |
+ |
|
37 | 43 |
desc "Watch the site and regenerate when it changes" |
38 | 44 |
task :watch do |
39 | 45 |
system "trap 'kill $jekyllPid $compassPid' Exit; jekyll --auto & jekyllPid=$!; compass watch & compassPid=$!; wait" |
... | ... |
@@ -83,37 +89,14 @@ end |
83 | 83 |
# Deploying # |
84 | 84 |
############## |
85 | 85 |
|
86 |
-## if you're deploying with github, change the default deploy to push_github |
|
87 |
-desc "default push task" |
|
88 |
-task :push => [:push_rsync] do |
|
89 |
-end |
|
90 |
- |
|
91 |
-desc "Generate and deploy task" |
|
92 |
-multitask :deploy => [:integrate, :generate, :push] do |
|
93 |
-end |
|
94 |
- |
|
95 |
-desc "Generate jekyll site" |
|
96 |
-task :generate do |
|
97 |
- puts "## Generating Site with Jekyll" |
|
98 |
- system "jekyll" |
|
99 |
-end |
|
100 |
- |
|
101 |
-def ok_failed(condition) |
|
102 |
- if (condition) |
|
103 |
- puts "OK" |
|
104 |
- else |
|
105 |
- puts "FAILED" |
|
106 |
- end |
|
107 |
-end |
|
108 |
- |
|
109 | 86 |
desc "Deploy website via rsync" |
110 |
-task :push_rsync do |
|
87 |
+task :sync do |
|
111 | 88 |
puts "## Deploying website via Rsync" |
112 | 89 |
ok_failed system("rsync -avz --delete #{public_dir}/ #{ssh_user}:#{document_root}") |
113 | 90 |
end |
114 | 91 |
|
115 | 92 |
desc "deploy public directory to github pages" |
116 |
-multitask :push_github do |
|
93 |
+task :push do |
|
117 | 94 |
puts "## Deploying branch to Github Pages " |
118 | 95 |
(Dir["#{deploy_dir}/*"]).each { |f| rm_rf(f) } |
119 | 96 |
system "cp -R #{public_dir}/ #{deploy_dir}" |
... | ... |
@@ -130,7 +113,26 @@ multitask :push_github do |
130 | 130 |
end |
131 | 131 |
end |
132 | 132 |
|
133 |
+desc "setup _deploy folder and deploy branch" |
|
134 |
+task :init_deploy, :branch do |t, args| |
|
135 |
+ puts "Please provide a deploy branch, eg. rake init_deploy[gh-pages]" unless args.branch |
|
136 |
+ cd "#{_deploy}" do |
|
137 |
+ system "git symbolic-ref HEAD refs/heads/#{args.branch}" |
|
138 |
+ system "rm .git/index" |
|
139 |
+ system "git clean -fdx" |
|
140 |
+ system "touch README && echo 'initial commit' >> README" |
|
141 |
+ system "git add ." |
|
142 |
+ system "git push origin #{args.branch}" |
|
143 |
+ end |
|
144 |
+end |
|
133 | 145 |
|
146 |
+def ok_failed(condition) |
|
147 |
+ if (condition) |
|
148 |
+ puts "OK" |
|
149 |
+ else |
|
150 |
+ puts "FAILED" |
|
151 |
+ end |
|
152 |
+end |
|
134 | 153 |
|
135 | 154 |
desc "list tasks" |
136 | 155 |
task :list do |