Skip to content
/ ukko Public

Module that manages the download all the needed repos and build them to have your development environment ready to start working in minutes

Notifications You must be signed in to change notification settings

tcorral/ukko

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm npm Build Status Coverage Status Code Climate Dependency Status devDependency Status

ukko

Ukko was created as a simple tool to install your development environment at once, but it can also be used to:

  • create sym links to folders in your computer
  • download a repo from any repo source (Git, SVN, GITHUB, STASH...)
  • download and extract any zip, rar, tar, tar.gz, war...

Installation

Node

Dependencies:

  • node >= 0.10
  • npm >= 2.0.0
npm install ukko --save

Usage

Ukko usage is very simple, it just needs a source to retrieve an object with an ukko-conf key with the information about the endpoints and commands to be executed before and after retrieving the folder/repo/file.

var ukko = require('ukko');
ukko.installOrUpdate({
    data: {
        "dependencies": {
            "target/folder/path/from/the/root": "path/or/url/to/repo"
        }
    }
});

API

installOrUpdate

ukko.installOrUpdate gets an argument to be executed:

Arguments
  • config {Object}
Returns
  • void

Config Object

The expected configuration could be a JSON file or a javascript object passed directly to the installOrUpdate method.

Examples of basic config objects

JSON objects:

Shared dependencies only
{
    "ukko-conf": {
        "dependencies": {
            "target/folder/path/from/the/root": "path/or/url/to/repo"
        }
    }
}
Production environment dependencies by default
{
    "ukko-conf": {
        "dependencies": {
            "target/folder/path/from/the/root": "path/or/url/to/repo"
        },
        "production": {
            "target/folder/path/from/the/root2": "path/or/url/to/repo2"
        }
    }
}
Development environment dependencies by default
{
    "ukko-conf": {
        "dependencies": {
            "target/folder/path/from/the/root": "path/or/url/to/repo"
        },
        "development": {
            "target/folder/path/from/the/root2": "path/or/url/to/repo2"
        }
    }
}
Custom environment dependencies
{
    "ukko-conf": {
        "dependencies": {
            "target/folder/path/from/the/root": "path/or/url/to/repo"
        },
        "localEnv": {
            "target/folder/path/from/the/root2": "path/or/url/to/repo2"
        }
    }
}

Properties of the config object

data
Type
  • {Object}

It can be used to pass the configuration directly to the function in

{
    "data": {
        "dependencies": {
            "target/folder/path/from/the/root": "path/or/url/to/repo"
        }
    }
}
configPath
Type
  • {String}

It expects a path to the json config file. It can be a folder path in your computer or an url to access it remotely. When we pass the config path it can not be used in conjunction with data property. The config path will try to find the config file and if it doesn´t find the file it will fallback to read the config from the package.json.

local usage
{
    "configPath": "path/to/your/ukko-conf.json"
}
remote

Remote URL can be an http/https/ftp

{
    "configPath": "http://path/to/your/ukko-conf.json"
}
repos
Type
  • {Array<>String}

Ukko install all the repos from the endpoints by default but you can specify an array of repos to be downloaded. The repos should be an array of target folders or keys.

{
    "configPath": "http://path/to/your/ukko-conf.json",
    "repos": [ "target/folder/path/from/the/root" ]
}
detached-processes
Type
  • {Array<>String}

Ukko checks if we supply some commands to be executed, this commands could be executed before or after download the code from the specified endpoint, but there are some commands that need to be executed in some background thread to bypass the parent process, as example you can need to execute some server or watching process.

{
    "configPath": "http://path/to/your/ukko-conf.json",
    "detached": [ "mvn jetty:run" ]
}
save-report
Type
  • {Boolean}

As commented in the previous point some commands will be executed in the background, this property tells ukko to save the log of these processes.

Define an endpoint

The endpoints should be inside any of the defined environments or inside the shared dependencies object. There are some different ways to define and endpoint and I will show you some of them.

Ukko detects if the repository exist or not, then it decides what is needed to do if a complete checkout or an update.

Simple
- FileSystem (basic, git, svn)
{
    "ukko-conf" : {
        "dependencies": {
            "target/path" : "path/to/my/source"
        }
    }
}
- Git repository
{
    "ukko-conf": {
        "dependencies": {
            "target/path" : "https://example.com/gitproject.git"
        }
    }
}
{
    "ukko-conf": {
        "dependencies": {
            "target/path" : "ssh://user@server/project.git"
        }
    }
}
- SVN repository
{
    "ukko-conf": {
        "dependencies": {
            "target/path" : "http://svn.red-bean.com/repos/test"
        }
    }
}
{
    "ukko-conf": {
        "dependencies": {
            "target/path" : "svn://<your_ip>/<repository_name>"
        }
    }
}
- Github repository
{
    "ukko-conf": {
        "dependencies": {
            "target/path" : "https://github.com/user/repo.git"
        }
    }
}
- Compressed file url

Compressed files could be: zip, tar, tar.gz, war

{
    "ukko-conf": {
        "dependencies": {
            "target/path" : "http://myserver.com/path/repo.zip"
        }
    }
}
Post-commands simple
{
    "ukko-conf": {
        "dependencies": {
            "target/path" : {
                "endpoint": "https://example.com/gitproject.git",
                "commands": [ "mvn clean install -DskipTests" ]
            }
        }
    }
}
Pre-commands
{
    "ukko-conf": {
        "dependencies": {
            "target/path" : {
                "endpoint": "https://example.com/gitproject.git",
                "commands": {
                    "pre": [ "mvn clean install -DskipTests" ]
                }
            }
        }
    }
}
Pre and post commands
{
    "ukko-conf": {
        "dependencies": {
            "target/path" : {
                "endpoint": "https://example.com/gitproject.git",
                "commands": {
                    "pre": [ "ls -la" ],
                    "post": [ "mvn clean install -DskipTests" ]
                }
            }
        }
    }
}

To get more info I recommend to read the use cases in tests.

Tests

To run the tests with NodeUnit:

npm install
npm test

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Check that it still works: npm test
  5. Push to the branch: git push origin my-new-feature
  6. Submit a pull request :D

History

0.0.32 - First fully working commit.

License

The MIT License (MIT)

Copyright (c) 2015 Tomás Corral

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Module that manages the download all the needed repos and build them to have your development environment ready to start working in minutes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published