lib/fourchette/fork.rb in fourchette-0.0.7 vs lib/fourchette/fork.rb in fourchette-0.0.8

- old
+ new

@@ -22,15 +22,15 @@ end def monitor_build build logger.info "Start of the build process on Heroku..." build_info = @heroku.client.build.info(fork_name, build['id']) - # Let's just leave some time to Heroku to download the tarball and start + # Let's just leave some time to Heroku to download the tarball and start # the process. This is some random timing that seems to make sense at first. sleep 30 if build_info['status'] == 'failed' - @github.comment_pr(pr_number, "The build failed on Herok. See the activity tab on Heroku.") + @github.comment_pr(pr_number, "The build failed on Heroku. See the activity tab on Heroku.") fail Fourchette::DeployException end end def create @@ -39,15 +39,13 @@ update end def delete @heroku.delete(fork_name) - - # Update PR with URL @github.comment_pr(pr_number, "Test app deleted!") end - + def fork_name "#{ENV['FOURCHETTE_HEROKU_APP_PREFIX']}-PR-#{pr_number}".downcase # It needs to be lowercase only. end def branch_name @@ -56,16 +54,23 @@ def pr_number @params['pull_request']['number'] end - private def create_unless_exists unless @heroku.app_exists?(fork_name) @heroku.fork(ENV['FOURCHETTE_HEROKU_APP_TO_FORK'] ,fork_name) - # Update PR with URL - @github.comment_pr(pr_number, "Test URL: #{@heroku.client.app.info(fork_name)['web_url']}") + post_fork_url end + end + + private + + # Update PR with URL. This is a method so that we can override it and just not + # have that, if we don't want. Use case: we have custom domains, so we post + # the URLs later on. + def post_fork_url + @github.comment_pr(pr_number, "Test URL: #{@heroku.client.app.info(fork_name)['web_url']}") end def git_branch_name "remotes/origin/#{branch_name}" end