Sha256: 82c5db87249db4bd8b96b5f77c9df76c31ebb20d96e14566e92bde57af8c8a0e

Contents?: true

Size: 900 Bytes

Versions: 6

Compression:

Stored size: 900 Bytes

Contents

require 'thor'

module Creategem
  module Git
    include Thor::Actions

    def create_local_git_repository
      say "Create local git repository", :green
      run "git init"
      run "git add ."
      run "git commit -aqm 'Initial commit'"
    end

    def create_remote_git_repository(repository)
      say "Create remote #{repository.vendor} repository", :green
      if repository.github?
        run "curl -u '#{repository.user}' https://api.github.com/user/repos -d '{\"name\":\"#{repository.name}\"}'"
      else
        run "curl --request POST --user #{repository.user} https://api.bitbucket.org/1.0/repositories/ --data name=#{repository.name} --data scm=git --data is_private=true"
      end
      run "git remote add origin #{repository.origin}"
      say "Push initial commit to remote #{repository.vendor} repository", :green
      run "git push -u origin master"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
creategem-0.2.2 lib/creategem/git.rb
creategem-0.2.1 lib/creategem/git.rb
creategem-0.2.0 lib/creategem/git.rb
creategem-0.1.3 lib/creategem/git.rb
creategem-0.1.2 lib/creategem/git.rb
creategem-0.1.1 lib/creategem/git.rb