cloudfoundry-incubator/bookbinder — pull request #5 by krujos (2014-11-24 18:24:11+00:00)
Title: Use github accesskey when calling github api's and clones

I ran into issues where I could not pull down our private creds repo (docs-pcfp-site-credentials) when I ran push_local_to_staging. With this change we send the GITHUB_API_TOKEN (personal access key) in the url according to github docs. The clone URI which is now assumed to be https instead of git. I'm not sure this is the "right" way to fix this issue, but worked for my needs. It feels weird to change git to https, but there are probably other reasons why that might be good (firewalls), so I didn't sweat it too much). Please advise if I should go about this a different way and I'll take another shot.

Here's a before and after well as a test run:

➜ docs-book-pcfp git:(master) ✗ bundle exec bookbinder push_local_to_staging
Processing pivotal-cf/docs-pcfp-site-credentials
git clone '--' 'git@github.com:pivotal-cf/docs-pcfp-site-credentials' '/var/folders/44/kxt0zwwx12bb7vkcznnd7_8m0000gp/T/d20141124-8557-1ms722l/docs-pcfp-site-credentials' 2>&1:Cloning into '/var/folders/44/kxt0zwwx12bb7vkcznnd7_8m0000gp/T/d20141124-8557-1ms722l/docs-pcfp-site-credentials'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.
➜ docs-book-pcfp git:(master) ✗ (cd ../bookbinder && git checkout api_tokens )
Switched to branch 'api_tokens'

➜ docs-book-pcfp git:(master) ✗ bundle exec bookbinder push_local_to_staging
Processing pivotal-cf/docs-pcfp-site-credentials
API endpoint: https://api.run.pivotal.io
Authenticating...
OK
Targeted org pcfp
....
This URL will expire in 2 hours, so if you need to share it, make sure to save a copy now.

#This is after merging to master, contains changed code)
➜ bookbinder git:(master) (cd ../bookbinder && git status && rake )
On branch master
Your branch is ahead of 'upstream/master' by 1 commit.
(use "git push" to publish your local commits)

nothing to commit, working directory clean
/Users/jkruck/.rvm/rubies/ruby-2.1.1/bin/ruby -I/Users/jkruck/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.1.7/lib:/Users/jkruck/.rvm/gems/ruby-2.1.1/gems/rspec-support-3.1.2/lib /Users/jkruck/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.1.7/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
Run options: exclude {:integration=>true}
........................................................*.......................................................................................................................................................*...................................................................................................................................................*..*....

Pending:
Bookbinder::MiddlemanRunner behaves like a ShellOut
# Not yet implemented
# ./spec/middleman_runner_spec.rb:23
Sieve#links_from when the page is found and it does not have a valid html body
# No reason given
# ./spec/sieve_spec.rb:32
PdfGenerator generates a PDF from the specified pages and header
# No reason given
# ./spec/pdf_generator_spec.rb:20
PdfGenerator when generating pages from a live web-server generates a PDF from a live web-page and header
# No reason given
# ./spec/pdf_generator_spec.rb:34

Finished in 44.46 seconds (files took 2.04 seconds to load)
364 examples, 0 failures, 4 pending

Randomized with seed 57999

Thanks,
Josh