« Back to home

Shell action and installing Octopress

I was trying to install Octopress and see what the buzz is about. I'm also a fan of static site generators such as
Scriptogr.am which I use for this blog and I wanted to explore other options such as Jekyll which is what Octopress is based off.
This blog post is meant to document my experience/journey with the installation, and things that I encountered along the way
including how to fix them.
I also have been working lately with command prompt so I wanted a little bit of a challenge and see if I can do it. Granted,
it takes a little bit of work to get Octopress runnning so it requires a lot of patience, research and following the
documentation to the tee. I'm also running all these in Windows.

Octopress installation

While reading the setup documentation and
stepping through the installation process, I realized that I was using Ruby 1.8.7 (or at least the system only
recognize that version).
Even though I had 1.9.3 installed via the Ruby Installer for Windows, I had to make a copy of the Ruby
installation folder and move it to c:\ruby193 to make referencing things easier.

Since it was only recognizing 1.8.7, I had to install Pik so I can switch the Ruby version (ruby --v) to
1.9.3. Pik is basically a tool to manage multiple version of Ruby on Windows.
Using Ruby Gems gem install pick -i c:\ruby193 to install Pik in that location then having Pik recognize the path
to Ruby 1.9.3 using pick add c:\ruby193\bin.
To switch to 1.9.3, pik use 193 (193 is the option when looking at the Ruby versions installed in your system
pik list). As a reference, I used Node command prompt for performing these operations.

One last important change was I added the \bin path to the Windows environment variables. Ruby installer
also installed the version of Ruby in the program files, so I had to uninstall it (I already have a copy
on c:\ruby193) to fix the read-only installer when installing Ruby Gems on command line.

After taking care of the Ruby versioning and gem installation, I switched to Git bash for executing the commands for Octopress
and setting it up for GitHub.
In the middle of executing Octopress installation commands, after doing a bundle install, it complains that the "fast-stemmer"
native requires installed build tools. It gives an instruction on how to include the build tools and where
to download the DevKit. After installing the DevKit, I was able to run the bundle install again to
finish the installation of libraries and its dependencies (sass, compass, haml, jekyll, fast-stemmer, etc).

Hosting and deployment

I chose GitHub pages to host the blog since it's free and a widely popular site within the web developer
community.

When doing a rake deploy, Github complained about "Git push failed - non-fast forward updates were rejected.
The issue was, the local files were out of sync with what's in the remote repository. Issuing the git pull origin master
did not fix the issue so I had to delete the repository from Github and create a new one from scratch without the readme.md
file. After several attempts of pushing changes to Github and doing rake generate and rake deploy on the Octopress
project, everything is going well.

Creating post and pages

If you're familiar with Ruby, the commands for doing deployment and creating posts is done using Rake which is used to
build stuff in Ruby. Creating a page
for instance for /about is by invoking rake new_page[about/index.markdown] and post by doing a rake new_post["title"].
Pages lives in the project/source and the posts within the _post of the same directory. Doing a rake generate compiles
the markdown files into HTML.

Some useful rake commands are:

rake generate (to compile pages and posts to HTML)
rake watch (regenerates/compiles SASS to CSS)
rake preview (to run the blog locally on http://localhost:4000)

Conclusion

I'm glad that I only have to do this once. Whew. My new Octopress blog can be viewed at menacestudio.github.io although
I'm probably going to move it to my own custom domain sometime in the near future.

Comments

comments powered by Disqus