class GitLab

Overview

A GitLab provides a simple API for interacting with a GitLab server.

Defined in:

gitlab.cr
gitlab/option_parser.cr

Constant Summary

VERSION = "0.1.0"

The version of the module.

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(uri : URI = @@uri, token : -> String = @@token, home : Path = @@home, user : String = @@user) #

Makes a new GitLab which can fetch request from uri using the result of calling token, and treats home as the root of its project tree.


[View source]

Class Method Detail

def self.expand_short_options(args : Array(String), op : OptionParser | Nil = nil) : Array(String) #

Expands combined short options (e.g., "-qt" becomes ["-q", "-t"]). Long options and single short options are passed through unchanged. If an OptionParser is provided, it will be used to determine which flags take arguments (e.g., "-ofile" becomes ["-o", "file"] if -o takes a value).


[View source]
def self.git(name : String) #

Makes a new GitLab using values from the git configuration under name.


[View source]

Instance Method Detail

def config(path = ".") #

[View source]
def delete(resource) #

Deletes a resource.


[View source]
def done=(done : Bool) #

Flag to indicate a terminal command (--help, --version) was handled.


[View source]
def done? : Bool #

Flag to indicate a terminal command (--help, --version) was handled.


[View source]
def error : IO #

[View source]
def error=(error : IO) #

[View source]
def get(resource, form = {} of String => Array(String)) #

Gets a resource.


[View source]
def home : Path #

The home path used to create the workdir tree manager


[View source]
def mutation(query, values = {} of String => String) #

Queries GraphQL with a mutation


[View source]
def namespace?(path = ".") : String | Nil #

Returns the namespace path if the given path is within home but not a project (i.e., a directory under home that doesn't have a .git folder).


[View source]
def option_parser #

[View source]
def output : IO #

IO streams for CLI output (allows testing by injecting IO::Memory).


[View source]
def output=(output : IO) #

IO streams for CLI output (allows testing by injecting IO::Memory).


[View source]
def patch(resource, params = {} of String => String) #

Modifies a resource.


[View source]
def post(collection, params = {} of String => String) #

Creates a new resource.


[View source]
def project?(path = ".") #

Returns a Project if the given Path represents a project.


[View source]
def put(resource, params = {} of String => String) #

Sets a resource.


[View source]
def query(query, values = {} of String => String) #

Queries GraphQL (with a query)


[View source]
def run(args : Array(String), output : IO = STDOUT, error : IO = STDERR) : Int32 #

Runs the CLI with the given arguments, returning an exit code.


[View source]
def token : -> String #

The token proc used to create the client


[View source]
def uri : URI #

The URI used to create the client


[View source]
def user : String #

The username used to identify the user's branch of the workdir tree manager


[View source]