Giter Site home page Giter Site logo

jacebrowning / gitman Goto Github PK

View Code? Open in Web Editor NEW
191.0 9.0 31.0 33.11 MB

Language-agnostic dependency manager using Git.

Home Page: https://gitman.readthedocs.io

License: MIT License

Python 96.42% Makefile 3.58%
dependency-manager version-control git command-line

gitman's Introduction

Overview

Gitman is a language-agnostic dependency manager using Git. It aims to serve as a submodules replacement and provides advanced options for managing versions of nested Git repositories.

Demo

Linux Build Windows Build Code Coverage Code Quality PyPI License PyPI Version PyPI Downloads

Setup

Requirements

Installation

Install this tool globally with pipx (or pip):

$ pipx install gitman

or add it to your Poetry project:

$ poetry add gitman

Configuration

Generate a sample config file:

$ gitman init

or manually create one (gitman.yml or .gitman.yml) in the root of your working tree:

location: vendor/gitman

sources:
  - repo: "https://github.com/kstenerud/iOS-Universal-Framework"
    name: framework
    rev: Mk5-end-of-life
  - repo: "https://github.com/jonreid/XcodeCoverage"
    name: coverage
    links:
      - target: Tools/XcodeCoverage
  - repo: "https://github.com/dxa4481/truffleHog"
    name: trufflehog
    rev: master
    scripts:
      - chmod a+x truffleHog/truffleHog.py
  - repo: "https://github.com/FortAwesome/Font-Awesome"
    name: fontawesome
    rev: master
    sparse_paths:
      - "webfonts/*"
  - repo: "https://github.com/google/material-design-icons"
    name: material-design-icons
    rev: master

groups:
  - name: code
    members:
      - framework
      - trufflehog
  - name: resources
    members:
      - fontawesome
      - material-design-icons

default_group: code

Ignore the dependency storage location:

$ echo vendor/gitman >> .gitignore

Usage

See the available commands:

$ gitman --help

Updating Dependencies

Get the latest versions of all dependencies:

$ gitman update

which will essentially:

  1. Create a working tree at <root>/<location>/<name>
  2. Fetch from repo and checkout the specified rev
  3. Symbolically link each <location>/<name> from <root>/<link> (if specified)
  4. Repeat for all nested working trees containing a config file
  5. Record the actual commit SHAs that were checked out (with --lock option)
  6. Run optional post-install scripts for each dependency

where rev can be:

  • all or part of a commit SHA: 123def
  • a tag: v1.0
  • a branch: main
  • a rev-parse date: 'main@{2015-06-18 10:30:59}'

Alternatively, get the latest versions of specific dependencies:

$ gitman update framework

or named groups:

$ gitman update resources

Restoring Previous Versions

Display the versions that are currently installed:

$ gitman list

Reinstall these specific versions at a later time:

$ gitman install

Deleting Dependencies

Remove all installed dependencies:

$ gitman uninstall

Resources

gitman's People

Contributors

daniel-brosche avatar davidwatkins avatar dependabot[bot] avatar erich-mcmillan avatar gunechristensen avatar iagoabal avatar jacebrowning avatar milibopp avatar movermeyer avatar mrpossoms avatar sammousa avatar sch0125 avatar sergey-shuyskiy avatar spurnvoj avatar studioetrange avatar xenji avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gitman's Issues

Install as a Git plugin

If this can't be done automatically by setuptools, just add an --install-git-plugin [path] argument. The plugin should be available as $ git deps. A --force option should be required if the plugin file already exists.

Add a 'lock' command

Make:

gdm update --no-lock
gdm lock [foo bar]

equivalent to the current:

gdm update [foo bar]

Add a command to display revs

It would be useful in scripting scenarios to be able to run something like:

$ gitman --get-rev <name>
v1.0

to write the rev value to standard out.

`gdm install` hangs

Running it my machine just hangs while cloning repos. You should add a -v | --verbose flag to show std_out/std_err

Support individual source selection

If I have two entries "a" and "b" in gdm.yml under sources, and I run gdm update, I will get the latest rev of both "a" and "b".

I would like to be able to call gdm update a and only update "a", leaving "b" untouched.

Could also work for gdm install

Require an option to lock sources

I'd like the user to be more explicit about when they want gdm.yml to change.

Make $ gdm update behave like $ gdm update --no-lock by default and add $ gdm update --lock as a new option.

Once a source as been locked, it's version will continue to be recorded when $ gdm update is run.

"gdm install" fails with "remote origin already exists" error

gdm install always fails with fatal: remote origin already exists error.

$ gdm --version
GDM v0.6

$ cat gdm.yml
location: deps
sources:
- dir: <MY-DEPENDENCY>
  link: lib
  repo: <MY-DEPENDENCY-GIT-URL>
  rev: master

$ gdm install
Installing dependencies...

$ mkdir -p /home/admin/tmp/deps
$ cd /home/admin/tmp/deps

  $ git clone <MY-DEPENDENCY-GIT-URL>
  $ cd <MY-DEPENDENCY>
  $ git remote add origin <MY-DEPENDENCY-GIT-URL>

  IN: '/home/admin/tmp/deps/<MY-DEPENDENCY>'

  RAN: '/usr/bin/git remote add origin <MY-DEPENDENCY-GIT-URL>'

  STDOUT:


  STDERR:
fatal: remote origin already exists.

The gdm install command adds the remote origin. In cases where the remote origin is already present, gdm tries (ignores on failures) to remove the remote and adds it back. The actual command to remote an origin is git remote rm origin, but gdm uses git remote remove origin.

I guess this should have been introduced in commit SHA: 27e5d8b where git fetch was replaced with git remote commands.

Let me know if you need more information.

I will send in a patch (via pull request) with 'remove' changed to 'rm', shortly. I don't see the above error with this patch and gdm removes/adds remotes as expected.

Display shell commands on 'list'

Rather than just display long lines of information, show the commands of cding into each directory and asking Git for the SHA.

Display shell commands on 'uninstall'

This will mirror the behavior of 'install' and emphasis that GDM isn't doing anything special that couldn't be done normally with shell commands.

Checkout branches when possible

Even when tracking a SHA, first try checking out the branch to see if the current head matches the desired ref. This will leave the nested repository in a better state for ongoing development.

Local variable 'path' referenced before assignment

gdm uninstall --quiet
Traceback (most recent call last):
  File "/usr/local/bin/gdm", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.4/site-packages/gdm/cli.py", line 98, in main
    success = function(**kwargs)
  File "/usr/local/lib/python3.4/site-packages/gdm/commands.py", line 82, in delete
    for _ in config.get_deps(allow_dirty=force):
  File "/usr/local/lib/python3.4/site-packages/gdm/config.py", line 211, in get_deps
    yield source.identify(allow_dirty=allow_dirty)
  File "/usr/local/lib/python3.4/site-packages/gdm/config.py", line 109, in identify
    return path, "<missing>", "<unknown>"
UnboundLocalError: local variable 'path' referenced before assignment

Support multiple links

Change the link property to links (and provide migration) to support creating multiple symlinks into different subdirectories of the dependency.


Simplify config format

Move from:

location: gdm_sources
sources:
- dir: api
  link: ''
  repo: https://github.com/example/api
  rev: develop
sources_locked:
- dir: api
  link: ''
  repo: https://github.com/example/api
  rev: b2730855c9efaaa7448b25b82e5a4363785c83ed

to

location: gdm_sources
sources:
- name: api
  repository:
    url: https://github.com/example/api
    rev:
      default: develop
      locked: b2730855c9efaaa7448b25b82e5a4363785c83ed
  link: foo/bar

where rev_locked is optional (along with link).

Add a '--no-clean' option

The default is to clean all untracked/ignored files before checkout. This option would disable that.

Only lock previously locked sources

If a project has two dependencies, foo and bar, but only foo has a locked version, $ gdm update should update both to the latest, but only record the version of foo.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.