Sha256: 7f4f0307801cc444df111ac6c77b7500ad7bf0bc52a4b270da06302f8722ee7b

Contents?: true

Size: 1.02 KB

Versions: 18

Compression:

Stored size: 1.02 KB

Contents

require 'git'

# Creategem::Repository contains informations about the git repository and the git user
module Creategem
  class Repository
    REPOSITORIES = { github: "github.com", bitbucket: "bitbucket.org" }

    attr_reader :vendor, :name, :user, :user_name, :user_email, :gem_server_url

    def initialize(options)
      @vendor = options[:vendor]
      @name = options[:name]
      @user = options[:user]
      @user_name = ::Git.global_config "user.name"
      @user_email = ::Git.global_config "user.email"
      @gem_server_url = options[:gem_server_url]
    end

    def github?
      vendor == :github
    end

    def bitbucket?
      vendor == :bitbucket
    end

    # this could change later. For now all private repositories are on bitbucket and all private ones on github
    def private?
      bitbucket?
    end

    def public?
      !private?
    end

    def url
      "https://#{REPOSITORIES[vendor]}/#{user}/#{name}"
    end

    def origin
      "git@#{REPOSITORIES[vendor]}:#{user}/#{name}.git"
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
creategem-0.4.4 lib/creategem/repository.rb
creategem-0.4.3 lib/creategem/repository.rb
creategem-0.4.2 lib/creategem/repository.rb
creategem-0.4.1 lib/creategem/repository.rb
creategem-0.4.0 lib/creategem/repository.rb
creategem-0.3.4 lib/creategem/repository.rb
creategem-0.3.3 lib/creategem/repository.rb
creategem-0.3.2 lib/creategem/repository.rb
creategem-0.3.1 lib/creategem/repository.rb
creategem-0.3.0 lib/creategem/repository.rb
creategem-0.2.4 lib/creategem/repository.rb
creategem-0.2.3 lib/creategem/repository.rb
creategem-0.2.2 lib/creategem/repository.rb
creategem-0.2.1 lib/creategem/repository.rb
creategem-0.2.0 lib/creategem/repository.rb
creategem-0.1.3 lib/creategem/repository.rb
creategem-0.1.2 lib/creategem/repository.rb
creategem-0.1.1 lib/creategem/repository.rb