# gitwrap

> Simple Git wrapper that doesn't get in the way

Latest version **1.1.0** (published 2015-03-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install gitwrap
pnpm add gitwrap
yarn add gitwrap
bun add gitwrap
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2015-03-10 |
| First published | 2015-03-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| Author | Juan Cruz Viotti |
| Maintainers | jviotti |
| Keywords | git, wrap, wrapper |

## Links

- npm: https://www.npmjs.com/package/gitwrap
- Repository: https://github.com/jviotti/gitwrap
- Issues: https://github.com/jviotti/gitwrap/issues
- npm.io page: https://npm.io/package/gitwrap

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ^3.5.0

## Recent versions

- 1.1.0 (latest) — 2015-03-10
- 1.0.0 — 2015-03-10

## README

gitwrap
-------

[![npm version](https://badge.fury.io/js/gitwrap.svg)](http://badge.fury.io/js/gitwrap)
[![dependencies](https://david-dm.org/jviotti/gitwrap.png)](https://david-dm.org/jviotti/gitwrap.png)
[![Build Status](https://travis-ci.org/jviotti/gitwrap.svg?branch=master)](https://travis-ci.org/jviotti/gitwrap)

Simple Git wrapper that doesn't get in the way.

Gitwrap provides a flexible way to use git from nodejs, without attempting to wrap common operations using JavaScript constructs.

```javascript
var gitwrap = require('gitwrap');

var git = gitwrap.create('path/to/my/repo');

git.execute('log --pretty=oneline -2', function(error, stdout, stderr) {
	if(error) throw error;
	console.log(stdout);
});
```

Installation
------------

Install `gitwrap` by running:

```sh
$ npm install --save gitwrap
```

Documentation
-------------

### gitwrap.create(String directory)

Create an instance of `gitwrap` around a directory that happens to be a git repository.

```javascript
var git = gitwrap.create('path/to/my/repo');
```

#### git#execute(String command, Function callback)

Execute a git command in the selected repository.

An error with a code `ENOGIT` will be returned if `git` was not found in the system.

```javascript
var git = gitwrap.create('path/to/my/repo');

git.execute('log --pretty=oneline -2', function(error, stdout, stderr) {
	if(error) throw error;

	console.log(stdout);
	console.log(stderr);
});
```

#### git#isGitRepository(Function callback)

Check that the selected directory is indeed a git repository.

```javascript
var git = gitwrap.create('path/to/my/repo');

git.isGitRepository(function(isGitRepository) {
	if(isGitRepository) {
		console.log('path/to/my/repo is a git repository!');
	} else {
		console.log('path/to/my/repo is not a git repository!');
	}
});
```

Tests
-----

Run the test suite by doing:

```sh
$ gulp test
```

Contribute
----------

- Issue Tracker: [github.com/jviotti/gitwrap/issues](https://github.com/jviotti/gitwrap/issues)
- Source Code: [github.com/jviotti/gitwrap](https://github.com/jviotti/gitwrap)

Before submitting a PR, please make sure that you include tests, and that [coffeelint](http://www.coffeelint.org/) runs without any warning:

```sh
$ gulp lint
```

Support
-------

If you're having any problem, please [raise an issue](https://github.com/jviotti/gitwrap/issues/new) on GitHub.

ChangeLog
---------

### v1.1.0

- Change git not found error code to `ENOGIT`.
- Improve unit testing.

License
-------

The project is licensed under the MIT license.

---
_Source: https://npm.io/package/gitwrap · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
