class GitLab
- GitLab
- Reference
- Object
Overview
A GitLab provides a simple API for interacting with a GitLab server.
Defined in:
gitlab.crgitlab/option_parser.cr
Constant Summary
-
VERSION =
"0.1.0" -
The version of the module.
Constructors
-
.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.
Class Method Summary
-
.expand_short_options(args : Array(String), op : OptionParser | Nil = nil) : Array(String)
Expands combined short options (e.g., "-qt" becomes ["-q", "-t"]).
-
.git(name : String)
Makes a new GitLab using values from the git configuration under name.
Instance Method Summary
- #config(path = ".")
-
#delete(resource)
Deletes a resource.
-
#done=(done : Bool)
Flag to indicate a terminal command (--help, --version) was handled.
-
#done? : Bool
Flag to indicate a terminal command (--help, --version) was handled.
- #error : IO
- #error=(error : IO)
-
#get(resource, form = {} of String => Array(String))
Gets a resource.
-
#home : Path
The home path used to create the workdir tree manager
-
#mutation(query, values = {} of String => String)
Queries GraphQL with a mutation
-
#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).
- #option_parser
-
#output : IO
IO streams for CLI output (allows testing by injecting IO::Memory).
-
#output=(output : IO)
IO streams for CLI output (allows testing by injecting IO::Memory).
-
#patch(resource, params = {} of String => String)
Modifies a resource.
-
#post(collection, params = {} of String => String)
Creates a new resource.
-
#project?(path = ".")
Returns a Project if the given Path represents a project.
-
#put(resource, params = {} of String => String)
Sets a resource.
-
#query(query, values = {} of String => String)
Queries GraphQL (with a query)
-
#run(args : Array(String), output : IO = STDOUT, error : IO = STDERR) : Int32
Runs the CLI with the given arguments, returning an exit code.
-
#token : -> String
The token proc used to create the client
-
#uri : URI
The URI used to create the client
-
#user : String
The username used to identify the user's branch of the workdir tree manager
Constructor Detail
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.
Class Method Detail
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).
Makes a new GitLab using values from the git configuration under name.
Instance Method Detail
Queries GraphQL with a mutation
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).
Runs the CLI with the given arguments, returning an exit code.