This is new chapter in my life. I’ve been working in Sweden since 19 November. Moving to Sweden itself is a new experience for me. So, everything surround that are also new, except some general things, such as work, Indonesian friends, iOS development, and MacBook.
I’ve been working since I graduated from technical high school when I was 19. There are some Indonesian friends here in Sweden, mostly students. I’ve been working as iOS developer since 2016, so it’s not really new experience either. And since that time, I’ve been using Macbook for sure.
But, I always face difficulties when I setup this blog in new machine. So, dear future self, this is how you do it.
Prerequisites
You need to have Ruby installed in you new shiny machine, Seto. You always use the latest stable branch. So, go ahead.
1
| |
And for a matter of fact, you always use rbenv when your new machine is MacBook. You never use built in Ruby on Mac. To install it, you use Homebrew. So make sure you install it before you install rbenv. You always joke that you need to install version manager with package manager to eventually install dependency manager. The good thing about meeting new people is you can recycle your jokes.
1 2 3 4 5 6 | |
In this step, you usually face difficulty. Basically you just need to put that line in your .bash_profile. Or just execute this line:
1
| |
If you open the file, it should looks like this:
1 2 3 4 5 6 7 8 9 10 | |
There’s a time when you accidentally add the result of that command instead:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
If you find that code in your .bash_profile, remove.
Now you need to open new terminal, or you can just open new tab. Command + T is the shortcut. If you don’t, your previous setup will not loaded. OK, now install latest Ruby version. Check the available ruby versions, then pick the latest stable release.
1 2 | |
Set the latest Ruby version that you’ve just download as global version. Or local. But always set it as global.
1 2 | |
Done with the Ruby thing.
Clone
Make sure you only clone the source branch of the repository.
1 2 | |
The mistake you always do is to clone the default branch from the repository, which is master. Don’t do that. After you move to the cloned directory, then clone the master branch to _deploy folder.
1
| |
After that, you do setup for the project itself. Which include installing bundler and setup github pages.
1 2 3 4 | |
If you fail with the rake things, you usually prepend the command with bundle exec.
1
| |
Then you need to enter the name of the repository.
1 2 | |
It should done by mow.
Start Blogging
Then you need to test the actual blogging command. Generate post, preview, deploy. You can always refer to the official documentation of how to blog with Octopress. But here’s some commands to get started.
1 2 | |
If you want to workaround with this, there are two options. First, you should uninstall rake that doesn’t match with the rake in the Gemfile.
1 2 3 4 5 6 7 8 9 | |
After that, you can update the rake with this command:
1
| |
though you unsuccessfully update the rake in Gemfile. But now, you should be able to use rake command without prepend it with bundle exec.
Secondly, you should update your Gemfile to the version of rake that already installed in your machine. For example;
1
| |
Always preview the blog before publishing it. Use the preview command and check in your browser on port 4000.
1
| |
This command will watch for changes in your blog, and regenerate it. You just need to refresh your browser.
Deploy The Blog, Seto!
You will likely face difficulty when trying to deploy the blog. So follow this guide below.
This happened when you run rake setup_github_pages: your deploy will be rejected because the tip of your current branch is behind.
1 2 3 4 5 6 7 8 9 10 | |
The explanation for this problem is that, rake setup_github_pages will remove _deploy folder and initiate new repository inside of it. Or, when you run rake generate, it will make master branch which completely different from the remote branch. That’s why git push will fail.
So, if it is happened, just remove _deploy folder, and do clone the master branch in it, again. Like so:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | |
After that, rake deploy should be executed successfully.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
1 2 | |
This will generate your blog, copy the generated files into _deploy/, add them to git, commit and push them up to the master branch. In a few seconds you should get an email from Github telling you that your commit has been received and will be published on your site.
Don’t forget to commit the source for your blog.
1 2 3 | |
Summary
master branch. It is managed by rake command.source and master branch.That’s it for today, Seto. Just remember, everytime you move to a new place, be a nice person as you want your new friends would be. Good luck for the new adventure. Hejdå!