Sha256: 4eff32ba58bfe3e535732929c3a73d3f7c199ae486585c157f25791e238a2b5e
Contents?: true
Size: 1.24 KB
Versions: 15
Compression:
Stored size: 1.24 KB
Contents
require "geny/error" module Geny module Actions # Utilities for interacting with a git repo class Git # Create a new Git # @param shell [Shell] def initialize(shell:) @shell = shell end # Initialize a new git repo # @raise [ExitError] # # @example # git.init def init(**opts) @shell.run("git", "init", out: File::NULL, **opts) end # Stage files to be committed # @param files [Array<String>] # @raise [ExitError] # # @example # git.add # git.add files: ["Gemfile"] def add(files: ["."], **opts) @shell.run("git", "add", *files, out: File::NULL, **opts) end # Commit staged files # @param message [String] # @raise [ExitError] # # @example # git.commit message: "First commit" def commit(message:, **opts) @shell.run("git", "commit", "-m", message, out: File::NULL, **opts) end # Get the path to the current git repo # @raise [ExitError] # # @example # git.repo_path #=> "/path/to/repo" def repo_path(**opts) @shell.capture("git", "rev-parse", "--show-toplevel", **opts) end end end end
Version data entries
15 entries across 15 versions & 1 rubygems