Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
hypery2k committed Nov 2, 2016
2 parents 65e23d1 + 7068de9 commit 11abe1e
Show file tree
Hide file tree
Showing 10 changed files with 129 additions and 64 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -6,7 +6,10 @@ cli/lib/galen/*
core/lib/location.js
lcli/ib/location.js
core/coverage/*
core/target/*
cli/coverage/*
cli/target/*


# IDE
.idea/*
Expand Down
3 changes: 2 additions & 1 deletion .travis.yml
Expand Up @@ -3,9 +3,10 @@ dist: trusty
language: node_js
after_success: npm run coverage && cat ./coverage/lcov.info | coveralls
node_js:
- "0.12"
- "4.0"
- "4.3"
- "4.4"
- "4.6"
- "4"
- "5.0"
- "5"
Expand Down
46 changes: 46 additions & 0 deletions Jenkinsfile
@@ -0,0 +1,46 @@
properties properties: [
[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '30', numToKeepStr: '10']],
[$class: 'GithubProjectProperty', displayName: '', projectUrlStr: 'https://github.com/hypery2k/galenframework-cli'],
]

node {
def buildNumber = env.BUILD_NUMBER
def workspace = env.WORKSPACE
def buildUrl = env.BUILD_URL

// PRINT ENVIRONMENT TO JOB
echo "workspace directory is $workspace"
echo "build URL is $buildUrl"
echo "build Number is $buildNumber"
echo "PATH is $env.PATH"

try {
stage('Checkout') {
checkout scm
}

stage('Build') {
sh "cd core && npm install"
sh "cd cli && npm install"
}

stage('Test') {
sh "cd core && npm run test"
sh "cd cli && npm run test"
junit '*/target/tests.js.xml'
}

stage('Publish NPM snapshot') {
def currentVersionCore = sh(returnStdout: true, script: "cd core && npm version | grep \"{\" | tr -s ':' | cut -d \"'\" -f 2").trim()
def newVersionCore = "${currentVersionCore}-${buildNumber}"
sh "cd core && npm version ${newVersionCore} --no-git-tag-version && npm publish --tag next"
def currentVersionCli = sh(returnStdout: true, script: "cd cli && npm version | grep \"{\" | tr -s ':' | cut -d \"'\" -f 4").trim()
def newVersionCli = "${currentVersionCli}-${buildNumber}"
sh "cd cli && npm version ${newVersionCli} --no-git-tag-version && npm publish --tag next"
}

} catch (e) {
mail subject: "${env.JOB_NAME} (${env.BUILD_NUMBER}): Error on build", to: 'github@martinreinhardt-online.de', body: "Please go to ${env.BUILD_URL}."
throw e
}
}
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -6,6 +6,6 @@

The [core](core/) module is just the node wrapper for [Galen](http://galenframework.com) and can be used within CI environments

The [CLI](cli/) module is a command line module for [Galen](http://galenframework.com). This includes the core above and webdriver downloads for different browsers.
The [cli](cli/) module is a command line module for [Galen](http://galenframework.com). This includes the core above and webdriver downloads for different browsers.

[![Join the chat at https://gitter.im/hypery2k/galenframework-cli](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/hypery2k/galenframework-cli?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Bountysource](https://www.bountysource.com/badge/tracker?tracker_id=15642797)](https://www.bountysource.com/trackers/15642797-hypery2k-galenframework-cli?utm_source=15642797&utm_medium=shield&utm_campaign=TRACKER_BADGE) [![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=mreinhardt&url=https://github.com/hypery2k/galenframework-cli&title=badges&language=&tags=github&category=software)
10 changes: 7 additions & 3 deletions cli/README.MD
@@ -1,6 +1,6 @@
# Galenframework CLI

[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](LICENSE)
[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](LICENSE)
[![npm version](https://badge.fury.io/js/galenframework-cli.svg)](http://badge.fury.io/js/galenframework-cli)
[![Dependency Status](https://david-dm.org/hypery2k/galenframework-cli.svg)](https://david-dm.org/hypery2k/galenframework-cli) [![devDependency Status](https://david-dm.org/hypery2k/galenframework-cli/dev-status.svg)](https://david-dm.org/hypery2k/galenframework-cli#info=devDependencies)
[![Coverage Status](https://coveralls.io/repos/hypery2k/galenframework-cli/badge.svg?branch=master&service=github)](https://coveralls.io/github/hypery2k/galenframework-cli?branch=master)
Expand All @@ -12,14 +12,14 @@
[![NPM](https://nodei.co/npm/galenframework-cli.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/galenframework-cli/)

> Feel free to **donate**
>
>
> <a href='https://pledgie.com/campaigns/31915'><img alt='Click here to lend your support to: NPM packages and make a donation at pledgie.com !' src='https://pledgie.com/campaigns/31915.png?skin_name=chrome' border='0' ></a>
> <a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=JYG6LVEHB59TL">
> <img alt="" border="0" src="https://www.paypalobjects.com/de_DE/DE/i/btn/btn_donateCC_LG.gif"/>
> </img></a>
> Or donate [Bitcoins](bitcoin:3NKtxw1SRYgess5ev4Ri54GekoAgkR213D):
> [![Bitcoin](https://martinreinhardt-online.de/bitcoin.png)](bitcoin:3NKtxw1SRYgess5ev4Ri54GekoAgkR213D)
>
>
> Also via [greenaddress](https://greenaddress.it/pay/GA3ZPfh7As3Gc2oP6pQ1njxMij88u/)

Expand All @@ -29,6 +29,10 @@ You must have Java 6+ installed.

> (sudo) npm install -g galenframework-cli
Or the develop build, which maybe **not be stable**

> (sudo) npm install -g galenframework-cli@next
If you want to enable tab completion on Linux, run

> galen completion >> ~/.~/.bashrc
Expand Down
33 changes: 17 additions & 16 deletions cli/install.js
@@ -1,4 +1,4 @@
// Copyright 2015 Martin Reinhardt
// Copyright 2016 Martin Reinhardt

/*
* This simply downloads Galen
Expand All @@ -14,6 +14,7 @@ var npmconf = require('npmconf');
var path = require('path');
var httpreq = require('httpreq');
var which = require('which');
var log = require('npmlog');

var originalPath = process.env.PATH;

Expand All @@ -22,7 +23,7 @@ var validExit = false;

process.on('exit', function () {
if (!validExit) {
console.log('Install exited unexpectedly');
log.info('Install exited unexpectedly');
exit(1);
}
});
Expand Down Expand Up @@ -54,13 +55,13 @@ whichDeferred.promise
// Horrible hack to avoid problems during global install. We check to see if
// the file `which` found is our own bin script.
if (galenPath.indexOf(path.join('npm', 'galenframework-cli')) !== -1) {
console.log('Looks like an `npm install -g` on windows; unable to check for already installed version.');
log.info('Looks like an `npm install -g` on windows; unable to check for already installed version.');
throw new Error('Global install');
}

var contents = fs.readFileSync(galenPath, 'utf8');
if (/NPM_INSTALL_MARKER/.test(contents)) {
console.log('Looks like an `npm install -g`; unable to check for already installed version.');
log.info('Looks like an `npm install -g`; unable to check for already installed version.');
throw new Error('Global install');
} else {
var checkVersionDeferred = kew.defer();
Expand All @@ -69,7 +70,7 @@ whichDeferred.promise
}
})
.then(function () {
console.log('galenframework-cli detected');
log.info('galenframework-cli detected');
var npmconfDeferred = kew.defer();
npmconf.load(npmconfDeferred.makeNodeResolver());
return npmconfDeferred.promise;
Expand All @@ -87,30 +88,30 @@ whichDeferred.promise
var fileName = downloadUrl.split('/').pop();
var downloadedFile = path.join(tmpPath, fileName);
if (!fs.existsSync(downloadedFile)) {
console.log('Downloading', downloadUrl);
log.info('Downloading', downloadUrl);
return requestBinary(downloadUrl, downloadedFile);
} else {
console.log('Download already available at', downloadedFile);
log.info('Download already available at', downloadedFile);
return downloadedFile;
}
}).then(function (downloadedFile) {
// request to open safari extension installation
var spawn = require('child_process').spawn;
console.log('Opening file ', downloadedFile);
log.info('Opening file ', downloadedFile);
spawn('open', [downloadedFile], {
detached: true
});
exit(0);
}).fail(function (err) {
console.error('Safari Driver installation failed', err, err.stack);
log.error('Safari Driver installation failed', err, err.stack);
exit(1);
});
} else {
exit(0);
}
})
.fail(function (err) {
console.error('Galen installation failed', err, err.stack);
log.error('Galen installation failed', err, err.stack);
exit(1);
});

Expand Down Expand Up @@ -142,30 +143,30 @@ function findSuitableTempDirectory(npmConf) {
fs.unlinkSync(testFile);
return candidatePath;
} catch (e) {
console.log(candidatePath, 'is not writable:', e.message);
log.info(candidatePath, 'is not writable:', e.message);
}
}

console.error('Can not find a writable tmp directory.');
log.error('Can not find a writable tmp directory.');
exit(1);
}


function requestBinary(url, dest) {
var deferred = kew.defer();
console.log('Receiving...');
log.info('Receiving...');

httpreq.get(url, {binary: true}, function (err, res) {
if (err) {
deferred.reject(err);
console.error('Error making request.');
log.error('Error making request.');
} else {
fs.writeFile(dest, res.body, function (err) {
if (err) {
deferred.reject(err);
console.log('Error writing file');
log.info('Error writing file');
} else {
console.log('Saved to', dest);
log.info('Saved to', dest);
deferred.resolve(dest);
}
});
Expand Down
5 changes: 3 additions & 2 deletions cli/package.json
Expand Up @@ -22,7 +22,7 @@
"galen": "bin/galen",
"install": "node install.js",
"postinstall": "node postinstall.js",
"test": "nodeunit --reporter=minimal test/tests.js",
"test": "nodeunit --reporter=junit test/tests.js --output target",
"pretest": "jshint -c ../.jshintrc --filename *.js && jshint -c ../.jshintrc --filename lib/*.js && jshint -c ../.jshintrc --filename test/*.js",
"coverage": "istanbul -- cover nodeunit test/tests.js && istanbul-coveralls --no-rm"
},
Expand All @@ -33,10 +33,11 @@
"dependencies": {
"chromedriver": "*",
"fs-extra": "0.26.2",
"galenframework": "2.3.0",
"galenframework": "2.3.1",
"httpreq": "0.4.13",
"kew": "0.7.0",
"npmconf": "2.1.2",
"npmlog": "4.0.0",
"path": "0.12.7",
"which": "1.2.0",
"yargs": "3.30.0"
Expand Down
8 changes: 6 additions & 2 deletions core/README.MD
Expand Up @@ -13,14 +13,14 @@ If you want to install Galen as CLI command install the [CLI-module](https://www


> Feel free to **donate**
>
>
> <a href='https://pledgie.com/campaigns/31915'><img alt='Click here to lend your support to: NPM packages and make a donation at pledgie.com !' src='https://pledgie.com/campaigns/31915.png?skin_name=chrome' border='0' ></a>
> <a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=JYG6LVEHB59TL">
> <img alt="" border="0" src="https://www.paypalobjects.com/de_DE/DE/i/btn/btn_donateCC_LG.gif"/>
> </img></a>
> Or donate [Bitcoins](bitcoin:3NKtxw1SRYgess5ev4Ri54GekoAgkR213D):
> [![Bitcoin](https://martinreinhardt-online.de/bitcoin.png)](bitcoin:3NKtxw1SRYgess5ev4Ri54GekoAgkR213D)
>
>
> Also via [greenaddress](https://greenaddress.it/pay/GA3ZPfh7As3Gc2oP6pQ1njxMij88u/)
## Installation
Expand All @@ -29,6 +29,10 @@ You must have Java 6+ installed.

> (sudo) npm install -g galenframework
Or the develop build, which maybe **not be stable**

> (sudo) npm install -g galenframework@next
In case of errors within Ubuntu/Debian, e.g.
```
sh: 1: node: not find
Expand Down

0 comments on commit 11abe1e

Please sign in to comment.