class Maintainer::GITFork

Public Class Methods

new(remote, username, password, msg_success, msg_error, should_crash) click to toggle source
# File lib/maintainer_core/instructions.rb, line 139
def initialize(remote, username, password, msg_success, msg_error, should_crash)
    @remote = remote
    @username = username
    @password = password
    @msg_success = msg_success
    @msg_error = msg_error
    @should_crash = should_crash
end

Public Instance Methods

crash_on_error!() click to toggle source
# File lib/maintainer_core/instructions.rb, line 166
def crash_on_error!()
    return false
end
error_message!() click to toggle source
# File lib/maintainer_core/instructions.rb, line 177
def error_message!()
    if  not @msg_error or @msg_error.empty?
        return "[Error] #{@remote}"
    end
    return "#{@msg_error}"
end
run!() click to toggle source
# File lib/maintainer_core/instructions.rb, line 148
def run!()
    # Check if git is installed
    if not InstallGIT.installed!
        # Install git
        CommandRunner.execute(
            command: Commands::Git::Install,
            error: nil
        )
    end

    # clone
    CommandRunner.execute(
        command: "curl -u #{@username}:#{@password} https://api.github.com/repos/#{@remote}/forks -d ''",
        error: nil
    )
    return true
end
success_message!() click to toggle source
# File lib/maintainer_core/instructions.rb, line 170
def success_message!()
    if not @msg_success or @msg_success.empty?
        return "[Successfully forked] #{@remote}"
    end
    return "#{@msg_success}"
end