Sha256: 7a5663431ebb543f3d447acc27d71952cbef6338bcbd2203d635729ed457e097

Contents?: true

Size: 771 Bytes

Versions: 7

Compression:

Stored size: 771 Bytes

Contents

require 'provisional/scm/git'
require 'net/http'

module Provisional
  module SCM
    class Github < Provisional::SCM::Git
      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', "git@github.com:#{github_user}/#{@options['name']}.git")
          repo.push
        rescue
          raise RuntimeError, "Repository created locally, but not pushed to GitHub due to exception: #{$!}"
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vigetlabs-provisional-2.1.0 lib/provisional/scm/github.rb
vigetlabs-provisional-2.1.1 lib/provisional/scm/github.rb
vigetlabs-provisional-2.1.2 lib/provisional/scm/github.rb
vigetlabs-provisional-2.1.3 lib/provisional/scm/github.rb
vigetlabs-provisional-2.1.4 lib/provisional/scm/github.rb
vigetlabs-provisional-2.1.5 lib/provisional/scm/github.rb
vigetlabs-provisional-2.1.6 lib/provisional/scm/github.rb