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...
Dependencies:
- node >= 0.10
- npm >= 2.0.0
npm install ukko --save
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"
}
}
});
ukko.installOrUpdate
gets an argument to be executed:
config {Object}
void
The expected configuration could be a JSON file or a javascript object passed directly
to the installOrUpdate
method.
JSON objects:
{
"ukko-conf": {
"dependencies": {
"target/folder/path/from/the/root": "path/or/url/to/repo"
}
}
}
{
"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"
}
}
}
{
"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"
}
}
}
{
"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"
}
}
}
{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"
}
}
}
{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.
{
"configPath": "path/to/your/ukko-conf.json"
}
Remote URL can be an http/https/ftp
{
"configPath": "http://path/to/your/ukko-conf.json"
}
{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" ]
}
{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" ]
}
{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.
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.
{
"ukko-conf" : {
"dependencies": {
"target/path" : "path/to/my/source"
}
}
}
{
"ukko-conf": {
"dependencies": {
"target/path" : "https://example.com/gitproject.git"
}
}
}
{
"ukko-conf": {
"dependencies": {
"target/path" : "ssh://user@server/project.git"
}
}
}
{
"ukko-conf": {
"dependencies": {
"target/path" : "http://svn.red-bean.com/repos/test"
}
}
}
{
"ukko-conf": {
"dependencies": {
"target/path" : "svn://<your_ip>/<repository_name>"
}
}
}
{
"ukko-conf": {
"dependencies": {
"target/path" : "https://github.com/user/repo.git"
}
}
}
Compressed files could be: zip, tar, tar.gz, war
{
"ukko-conf": {
"dependencies": {
"target/path" : "http://myserver.com/path/repo.zip"
}
}
}
{
"ukko-conf": {
"dependencies": {
"target/path" : {
"endpoint": "https://example.com/gitproject.git",
"commands": [ "mvn clean install -DskipTests" ]
}
}
}
}
{
"ukko-conf": {
"dependencies": {
"target/path" : {
"endpoint": "https://example.com/gitproject.git",
"commands": {
"pre": [ "mvn clean install -DskipTests" ]
}
}
}
}
}
{
"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.
To run the tests with NodeUnit:
npm install
npm test
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Check that it still works:
npm test
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
0.0.32 - First fully working commit.
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.