Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support the CLASSPATH env variable #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions tasks/flyway.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,18 @@ module.exports = function(grunt) {

// Windows CLASSPATH separator
var classPathSeparator = ';';
var classPathEnvVar = '%CLASSPATH%';

// Unix CLASSPATH separator
if(Os.platform() === 'linux' || Os.platform() === 'darwin') {

classPathSeparator = ':';
classPathEnvVar = '$CLASSPATH';

}

// Creates the Java CLASSPATH used to run Flyway
var javaClasspath = flywayBinPath + '/flyway-commandline-2.1.1.jar' + classPathSeparator;
var javaClasspath = classPathEnvVar + classPathSeparator + flywayBinPath + '/flyway-commandline-2.1.1.jar' + classPathSeparator;
javaClasspath = javaClasspath + flywayBinPath + '/flyway-core-2.1.1.jar';

// Object used to configure the Flyway Commands which are available with the Grunt Flyway Plugin
Expand Down Expand Up @@ -137,7 +139,7 @@ module.exports = function(grunt) {
}

// Create the Console Command line used to execute the Flyway Command Line program
var flywayCommand = 'java -cp ' + javaClasspath + ' com.googlecode.flyway.commandline.Main ' + this.data.command;
var flywayCommand = 'java -cp "' + javaClasspath + '" com.googlecode.flyway.commandline.Main ' + this.data.command;

// Gets valid command line options associated to the Flyway Command which have been entered
var commandOptions = availableCommands[this.data.command];
Expand Down Expand Up @@ -264,4 +266,4 @@ module.exports = function(grunt) {
});

});
};
};