class XZGit::Command

Public Class Methods

new(argv) click to toggle source
Calls superclass method
# File lib/mrbin/command.rb, line 20
def initialize(argv)
    super
end
read_private_token() click to toggle source
# File lib/mrbin/command.rb, line 24
def self.read_private_token()
    if !ENV['GITAPITOKEN']
        puts "not found gitlab private token"
        exit(1)
    end
    if ENV['GITAPITOKEN'].empty?
        puts "gitlab private token is empty"
        exit(1)
    end
    XZGit.settoken(ENV['GITAPITOKEN'])
end
read_remote_project() click to toggle source
# File lib/mrbin/command.rb, line 36
def self.read_remote_project()
    remote = `git config --get remote.origin.url`
    projecturl = remote.split(':')[1].split('.')[0]
    projecturl = projecturl.gsub("/","%2F")
    XZGit.setproject(projecturl)
    projecturl
end
run(argv) click to toggle source
Calls superclass method
# File lib/mrbin/command.rb, line 13
def self.run(argv)
    read_private_token()
    verify_git_repo()
    read_remote_project()
    super(argv)
end
verify_git_repo() click to toggle source
# File lib/mrbin/command.rb, line 44
def self.verify_git_repo()
    currentpath = Dir.pwd
    gitpath = "#{currentpath}/.git"
    if !File.directory?(gitpath)
        puts "can not found .git ,please check your path"
        exit(1)
    end
end