module Bones::App::Git
def initialize_github
def initialize_github return unless @config[:github] user = Git.global_config['github.user'] token = Git.global_config['github.token'] raise ::Bones::App::Error, 'A GitHub username was not found in the global configuration.' unless user raise ::Bones::App::Error, 'A GitHub token was not found in the global configuration.' unless token Net::HTTP.post_form( URI.parse('http://github.com/api/v2/yaml/repos/create'), 'login' => user, 'token' => token, 'name' => name, 'description' => @config[:github_desc] ) @git.add_remote 'origin', "git@github.com:#{user}/#{name}.git" @git.config 'branch.master.remote', 'origin' @git.config 'branch.master.merge', 'refs/heads/master' @git.push 'origin' end