Class: Provisional::SCM::Github

Inherits:
Git
  • Object
show all
Defined in:
lib/provisional/scm/github.rb

Instance Method Summary collapse

Methods inherited from Git

#generate_rails, #gitignore, #init, #initialize

Constructor Details

This class inherits a constructor from Provisional::SCM::Git

Instance Method Details

#checkinObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/provisional/scm/github.rb', line 7

def checkin
  begin
    repo = super
    github_user = repo.config 'github.user'
    github_token = repo.config 'github.token'
    Net::HTTP.post_form URI.parse('https://github.com/api/v2/yaml/repos/create'), {
      'login' => github_user,
      'token' => github_token,
      'name' => @options['name']
    }
    repo.add_remote('origin', "[email protected]:#{github_user}/#{@options['name']}.git")
    repo.push
  rescue
    raise RuntimeError, "Repository created locally, but not pushed to GitHub due to exception: #{$!}"
  end
end