npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pushover-f

v1.1.2

Published

git push deploy server over http

Downloads

12

Readme

pushover

Serve up git repositories over http and accept git pushes.

build status

This library makes it super easy to set up custom git push deploy logic.

example

var pushover = require('pushover');
var repos = pushover('/tmp/repos');

repos.on('push', function (push) {
    console.log('push ' + push.repo + '/' + push.commit
        + ' (' + push.branch + ')'
    );
    push.accept();
});

repos.on('fetch', function (fetch) {
    console.log('fetch ' + fetch.commit);
    fetch.accept();
});

var http = require('http');
var server = http.createServer(function (req, res) {
    repos.handle(req, res);
});
server.listen(7005);

then start up the pushover server...

$ node example/simple.js 

meanwhile...

$ git push http://localhost:7000/beep master
Counting objects: 356, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (133/133), done.
Writing objects: 100% (356/356), 46.20 KiB, done.
Total 356 (delta 210), reused 355 (delta 210)
To http://localhost:7000/beep
 * [new branch]      master -> master

and then...

$ node example/simple.js 
push beep.git/d5013a53a0e139804e729a12107fc212f11e64c3 (master)

or...

$ git clone http://localhost:7000/beep.git

and then...

fetch beep.git/d5013a53a0e139804e729a12107fc212f11e64c3

methods

var pushover = require('pushover')

var repos = pushover(repoDir, opts={autoCreate:true})

Create a new repository collection from the directory repoDir. repoDir should be entirely empty except for git repo directories.

repos is an EventEmitter that emits the events listed below in the events section.

By default, repository targets will be created if they don't exist. You can disable that behavior with opts.autoCreate.

If opts.checkout is true, create and expected checked-out repos instead of bare repos.

repos.handle(req, res)

Handle incoming HTTP requests with a connect-style middleware.

Everything is admin-party by default. Check the credentials further up the stack using basic auth or whatevs.

repos.create(repoName, cb)

Create a new bare repository repoName in the instance repository directory.

Optionally get a callback cb(err) to be notified when the repository was created.

repos.mkdir(dir, cb)

Create a subdirectory dir in the repo dir with an errback cb(err).

repos.list(cb)

Get a list of all the repositories in the callback cb(err, repos).

repos.exists(repoName, cb)

Find out whether repoName exists in the callback cb(exists).

events

repos.on('push', function (push) { ... }

Emitted when somebody does a git push to the repo.

Exactly one listener must call push.accept() or push.reject(). If there are no listeners, push.accept() is called automatically.

push is an http duplex object (see below) with these extra properties:

  • push.repo
  • push.commit
  • push.branch

repos.on('tag', function (tag) { ... }

Emitted when somebody does a git push --tags to the repo.

Exactly one listener must call tag.accept() or tag.reject(). If there are no listeners, tag.accept() is called automatically.

tag is an http duplex object (see below) with these extra properties:

  • tag.repo
  • tag.commit
  • tag.version

repos.on('fetch', function (fetch) { ... }

Emitted when somebody does a git fetch to the repo (which happens whenever you do a git pull or a git clone).

Exactly one listener must call fetch.accept() or fetch.reject(). If there are no listeners, fetch.accept() is called automatically.

fetch is an http duplex objects (see below) with these extra properties:

  • fetch.repo
  • fetch.commit

repos.on('info', function (info) { ... }

Emitted when the repo is queried for info before doing other commands.

Exactly one listener must call info.accept() or info.reject(). If there are no listeners, info.accept() is called automatically.

info is an http duplex object (see below) with these extra properties:

  • info.repo

repos.on('head', function (head) { ... }

Emitted when the repo is queried for HEAD before doing other commands.

Exactly one listener must call head.accept() or head.reject(). If there are no listeners, head.accept() is called automatically.

head is an http duplex object (see below) with these extra properties:

  • head.repo

http duplex objects

The arguments to each of the events 'push', 'fetch', 'info', and 'head' are http duplex that act as both http server request and http server response objects so you can pipe to and from them.

For every event if there are no listeners dup.accept() will be called automatically.

dup.accept()

Accept the pending request.

dup.reject()

Reject the pending request.

install

With npm do:

npm install pushover

license

MIT

kudos

Reading through grack was super handy.