octopress / docs

Source for the octopress.org documentation website
24 stars 30 forks source link

Rake deploy - Empty index.html #48

Open dazinator opened 9 years ago

dazinator commented 9 years ago

So I am the proud owner of an Octopress powered blog - hosted on GitHub here: https://github.com/dazinator/dazinator.github.io

Came accross a problem today though, hoping I can get some guidance.

git checkout source
rake generate
rake deploy

The master branch gets updated, but all of the Index.html files in master are completely empty.

However, in back in source, If I do a rake preview, the contents of my "public" folder all look correct and there are Index.html files all populated and all in their correct places. I can browse the site locally via my browser and all looks correct.

Any ideas or pointers would be much appreciated - I am completely at a loss..

@JakeGinnivan - have you come accross this one before during your octopress travels?

In order to workaround this at present I am having to:-

  1. In Source - Rake Generate - take a copy of the public folder.
  2. Checkout Master
  3. Copy all of the Index.html files from my copy of the Source Public folder, into the correct places in master.
  4. Git commit -a on master.

So basically, I am having to manually copying all generated index html's files to master and commit them at present :-(

You can't see this but I am openly weeping

parkr commented 9 years ago

Sorry you're having this problem mate! Does rake generate put the files in the proper folder? It's usually called _deploy but could change. It's untracked by git iirc. It could be that the folder you're generating to for deployment isn't correct. What is the output of rake gen_deploy?

dazinator commented 9 years ago

No worries! Sure - here is a gist with the output of rake gen_deploy: https://gist.github.com/dazinator/2f3c2ee0e35540ad65e8

The _deploy folder looks correct - all the index html's are present inside - and a rake preview works fine.

parkr commented 9 years ago
## Committing: Site updated at 2014-12-15 13:45:19 UTC
On branch source
Your branch is up-to-date with 'origin/source'.

nothing to commit, working directory clean

:point_up: That tells me that the site hasn't changed. It looks like it's trying to commit to source which is freaky. It should be committing to master, should it not? If you cd _deploy && git checkout master and re-run rake gen_deploy, does it work?

dazinator commented 9 years ago

Sorry for the delay!

Here is the output from that - it complains that it can't find a rake file: https://gist.github.com/dazinator/a605dd0e057c87e42dbb

Should there be a rake file in the master branch then?

parkr commented 9 years ago

Always run rake gen_deploy from your site's source directory (i.e. not in _deploy)

dazinator commented 9 years ago

Ok I am an idiot.

I forgot that because the default branch for my repo is source not master I have to do things slightly differently.

I am guessing that rake deploy clones the repo to a local directory expecting it to be 'master' it then copies stuff into this cloned repo and then tries to commit it. In my case it will be copying from source into a cloned source - leading to nothing to commit!

So in my case, I need to do the following (I got this from Jake's blog: http://jake.ginnivan.net/blog/2014/06/10/low-friction-octopress-github-pages-setup/)

 if not exist _deploy (git clone https://%GithubUsername%:%GithubPassword%@github.com/%GithubUsername%/%GithubUsername%.github.io.git _deploy)
 cd _deploy
 git checkout master
 cd ..
rake gen_deploy

I will try that out now. Apologies.

dazinator commented 9 years ago

Ok so when I do the above - it works.

When I do the above via a Team City build though, I end up with empty index.html files in master. So this is something to do with my Team City build process. Thanks for your help with this, and for pointing me towards the right direction :)

dazinator commented 9 years ago