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

node-hydra-connector

v0.0.3

Published

A Node.js module that allows remote control of a Hydra instance: a Nix-based continuous integration service

Downloads

10

Readme

node-hydra-connector

Remotely control Hydra: a Nix-based continuous integration server by invoking its REST API from a Node.js application.

Installation

There are two ways this package can installed.

To install this package through the Nix package manager, obtain a copy of Nixpkgs and run:

$ nix-env -f '<nixpkgs>' -iA nodePackages.node-hydra-connector

Alternatively, this package can also be installed through NPM by running:

$ npm install -g node-hydra-connector

API usage

Instantiate a HydraConnector object and then call any of the supported operations.

The following example code connects to a Hydra instance running on localhost, queries all projects and displays their names:

var HydraConnector = require('hydra-connector').HydraConnector;

var hydraConnector = new HydraConnector("http://localhost");

hydraConnector.queryProjects(function(err, projects) {
    if(err) {
        console.log("Some error occurred: "+err);
    } else {
        for(var i = 0; i < projects.length; i++) {
            var project = projects[i];
            console.log("Project: "+project.name);
        }
    }
});

Some operations, e.g. the write operations require user authentication. By invoking the login() method, we can authenticate ourselves:

hydraConnector.login("admin", "myverysecretpassword", function(err) {
    if(err) {
        console.log("Login succeeded!");
    } else {
        console.log("Some error occurred: "+err);
    }
});

Likewise, we can also logout by invoking:

hydraConnector.logout(function(err) {
    if(err) {
        console.log("Logout succeeded!");
    } else {
        console.log("Some error occurred: "+err);
    }
});

A private Hydra server may be hidden behind a reverse proxy that requires HTTP basic authentication. To authenticate, we can provide the HTTP basic credentials to the HydraConnector constructor:

var HydraConnector = require('hydra-connector').HydraConnector;

var hydraConnector = new HydraConnector("http://localhost", "sander", "12345"); // HTTP basic credentials

Command-line utility usage

This package also includes a command-line utility using the API to communicate with a Hydra instance from the command-line.

$ hydra-connect --help

When using the tool, you typically want to start with an overview of projects:

$ hydra-connect --url http://localhost --projects

For each request, the tool will provide command suggestions that can be used to obtain more detailed information, such as querying the properties of an individual project:

$ hydra-connect --url http://localhost --project MyProject

All requests that display information can also provide the underlying JSON representation that comes from Hydra's REST API:

$ hydra-connect --url http://localhost --project MyProject --json

API documentation

This package includes API documentation, which can be generated with JSDoc.

License

MIT