class Jeweler::Generator
def create_and_push_repo
def create_and_push_repo puts 'Please provide your Github password to create the Github repository' begin login = github_username password = ask('Password: ') { |q| q.echo = false } github = Github.new(login: login.strip, password: password.strip) github.repos.create(name: project_name, description: summary) rescue Github::Error::Unauthorized puts 'Wrong login/password! Please try again' retry rescue Github::Error::UnprocessableEntity raise GitRepoCreationFailed, "Can't create that repo. Does it already exist?" end # TODO: do a HEAD request to see when it's ready? @repo.push('origin') end