diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..6c4b7e1
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+vendor
+composer.lock
+patch.diff
diff --git a/.travis.yml b/.travis.yml
index bdd70fd..28921ff 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,23 +1,12 @@
language: php
+
php:
- - "5.3"
- - "5.4"
- - "5.5"
- - "7.0"
- - "7.1"
-
+ - 5.6
+ - 7.0
+ - 7.1
+
before_script:
- - pear config-set verbose 3
- - pear channel-discover pear.bovigo.org
- - pear install bovigo/vfsStream-beta
- - export PHP_INCLUDE_PATH=`pear config-get php_dir`
- - export PHP_INI_FILE=`pear config-get php_ini`
- - echo 'include_path = ".:${PHP_INCLUDE_PATH}"' >> $PHP_INI_FILE
- - echo $PHP_INCLUDE_PATH
- - phpenv rehash
-
-script: phpunit tests
-
-notifications:
- email: false
- irc: false
+ - composer self-update
+ - composer install --prefer-source --no-interaction --dev
+
+script: phpunit
diff --git a/README.md b/README.md
index 43036ef..d6b7df9 100755
--- a/README.md
+++ b/README.md
@@ -180,10 +180,10 @@ Try will work with your branches! The below scenarios are supported:
Prior to generate the diff, you can configure try to run a list of pre-checks.
$pre_checks = array(
- new TryLib_Precheck_ScriptRunner('/path/to/some/script'),
- new TryLib_Precheck_GitCopyBehind(array('master')),
- new TryLib_Precheck_GitCopyAge(48, 96, $remote_branch)
- new TryLib_Precheck_GitReportUntracked(),
+ new TryLib\Precheck\ScriptRunner('/path/to/some/script'),
+ new TryLib\Precheck\GitCopyBehind(array('master')),
+ new TryLib\Precheck\GitCopyAge(48, 96, $remote_branch)
+ new TryLib\Precheck\GitReportUntracked(),
);
$repo_manager->runPrechecks($pre_checks);
@@ -194,4 +194,4 @@ Some pre-checks will just emit a warning, some can block the try execution.
You can run the unit test suite with:
- phpunit tests
+ phpunit
diff --git a/TryLib/Autoload.php b/TryLib/Autoload.php
deleted file mode 100644
index a871e2a..0000000
--- a/TryLib/Autoload.php
+++ /dev/null
@@ -1,8 +0,0 @@
-check = new TryLib_Precheck_GitWarnOnBlocklisted($blocklist, $safelist, $staged);
- }
-
- function check($cmd_runner, $repo_path, $upstream) {
- $this->check->check($cmd_runner, $repo_path, $upstream);
-
- }
-
-}
diff --git a/TryLib/Util/PHPOptions/test.php b/TryLib/Util/PHPOptions/test.php
deleted file mode 100644
index e0995e0..0000000
--- a/TryLib/Util/PHPOptions/test.php
+++ /dev/null
@@ -1,62 +0,0 @@
-
---
-t,tree output a tree id
-c,commit output a commit id
-
-r,remote= hostname:/path/to/repo of remote repository
-n,name= name of backup set to update (if any)
-d,date= date for the commit (seconds since the epoch)
-v,verbose increase log output (can be used more than once)
-q,quiet,no-progress don't show progress meter
-smaller= only back up files smaller than n bytes
-bwlimit= maximum bytes/sec to transmit to server
-f,indexfile= the name of the index file (normally BUP_DIR/bupindex)
-strip strips the path to every filename given
-strip-path= path-prefix to be stripped when saving
-graft= a graft point *old_path*=*new_path* (can be used more than once)
-#,compress= set compression level to # (0-9, 9 is highest) [1]
-";
-
-$o = new TryLib_Util_PHPOptions_Options($s);
-
-// give it any arbitrary list of arguments, the first one will be ignored
-// (program name).
-list($opt, $flags, $extra) = $o->parse($argv);
-
-// Arguments with no trailing '=' give a boolean value (almost.. see below)
-if ($opt->c)
- print "Committing!\n";
-
-// Arguments that are specified in the option spec above with a prefix of 'no-'
-// or 'no_' get their boolean value inversed.
-// Try using -q to reverse the value of this argument
-if ($opt->progress)
- print "Showing progress meter\n";
-else
- print "NOT showing progress meter\n";
-
-// well ... actually, arguments with no trailing '=' can be used multiple times
-// and add 1 to the variable each time. (which will stay True as a boolean)
-// Try using -v multiple times to see.
-echo "verbose level: ", $opt->v, "\n";
-
-// Access arguments both by short and long argument names
-echo "short arg file name: ", $opt->f, "\n";
-echo "long arg file name: ", $opt->indexfile, "\n";
-
-// A short argument of '#' means the program expects an argument like -4 or -8
-echo "-# should be an integer: ", $opt->compress, "\n";
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..302983c
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,29 @@
+{
+ "name": "etsy/TryLib",
+ "type": "library",
+ "description": "Try lib : send your diffs to your CI cluster.",
+ "version": "2.0.0",
+ "license": "MIT",
+ "keywords": ["try", "etsy", "ci", "continuous integration"],
+ "authors": [
+ {
+ "name": "Nassim Kammah",
+ "email": "nkammah@etsy.com"
+ },
+ {
+ "name": "Laura Beth Lincoln Denker"
+ }
+ ],
+ "require": {
+ "php": ">=5.6.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": ">=5.5.0",
+ "mikey179/vfsStream": "~1"
+ },
+ "autoload": {
+ "psr-4": {
+ "TryLib\\": "src/"
+ }
+ }
+}
diff --git a/package.xml b/package.xml
deleted file mode 100644
index 14da106..0000000
--- a/package.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-
-
- TryLib
- etsy.github.com/TryLib
- Try lib : send your diffs to your CI cluster.
-
- Try provides you the tool to submit a diff between your working copy and the upstream repo to your CI server.
-
-
- Nassim Kammah
- nkammah
- nkammah@etsy.com
- yes
-
-
- Laura Beth Lincoln Denker
- llincoln
- >github@elblinkin.info
- no
-
- 2017-01-04
-
- 1.6.1
- 1.6.1
-
-
- stable
- stable
-
- MIT
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 5.3.10
-
-
- 1.9.1
-
-
-
-
-
diff --git a/phpunit.xml b/phpunit.xml
new file mode 100644
index 0000000..90c0d8d
--- /dev/null
+++ b/phpunit.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ ./tests/
+
+
+
diff --git a/TryLib/CommandRunner.php b/src/CommandRunner.php
similarity index 90%
rename from TryLib/CommandRunner.php
rename to src/CommandRunner.php
index 2cd67ef..fd66040 100644
--- a/TryLib/CommandRunner.php
+++ b/src/CommandRunner.php
@@ -1,6 +1,11 @@
out = '';
try {
- $this->colors = new TryLib_Util_AnsiColor();
- } catch (TryLib_Util_DisplayException $e) {
+ $this->colors = new AnsiColor();
+ } catch (DisplayException $e) {
$this->colors = false;
}
}
diff --git a/TryLib/JenkinsRunner.php b/src/JenkinsRunner.php
similarity index 98%
rename from TryLib/JenkinsRunner.php
rename to src/JenkinsRunner.php
index dbb4021..c4bd17b 100644
--- a/TryLib/JenkinsRunner.php
+++ b/src/JenkinsRunner.php
@@ -1,4 +1,9 @@
excluded_jobs = array();
try {
- $this->colors = new TryLib_Util_AnsiColor();
- } catch (TryLib_Util_DisplayException $e) {
+ $this->colors = new AnsiColor();
+ } catch (DisplayException $e) {
$this->colors = false;
}
@@ -105,7 +111,7 @@ public function pollForCompletion($show_progress) {
public function processLogOuput($prev_text, $show_progress) {
$try_log = $this->getJobOutput();
- $new_text = str_replace($prev_text, '', $try_log);
+ $new_text = str_replace($prev_text, "", $try_log);
$prev_text = $try_log;
if ($show_progress) {
diff --git a/TryLib/Precheck.php b/src/Precheck.php
similarity index 61%
rename from TryLib/Precheck.php
rename to src/Precheck.php
index 07a9b1d..e82f36e 100644
--- a/TryLib/Precheck.php
+++ b/src/Precheck.php
@@ -1,5 +1,7 @@
run('git config --get remote.origin.url');
return $cmd_runner->getOutput();
diff --git a/TryLib/Precheck/GitReportUntracked.php b/src/Precheck/GitReportUntracked.php
similarity index 88%
rename from TryLib/Precheck/GitReportUntracked.php
rename to src/Precheck/GitReportUntracked.php
index 186a643..5e65eb2 100755
--- a/TryLib/Precheck/GitReportUntracked.php
+++ b/src/Precheck/GitReportUntracked.php
@@ -1,9 +1,13 @@
verbose);
- $repo_manager = new TryLib_RepoManager_Git($options->wcpath, $cmd_runner);
+ $cmd_runner = new CommandRunner($options->verbose);
+ $repo_manager = new Git($options->wcpath, $cmd_runner);
if ($this->project_type === self::PROJECT_TYPE_MASTER) {
- $jenkins_runner = new TryLib_JenkinsRunner_MasterProject(
+ $jenkins_runner = new MasterProject(
$options->jenkinsserver,
$this->jenkins_cli_jar_path,
$options->jenkinsjob,
@@ -52,7 +61,7 @@ public function build() {
$jenkins_runner->setSubJobs($subjobs);
} else if ($this->project_type === self::PROJECT_TYPE_FREESTYLE) {
- $jenkins_runner = new TryLib_JenkinsRunner_FreeStyleProject(
+ $jenkins_runner = new FreeStyleProject(
$options->jenkinsserver,
$this->jenkins_cli_jar_path,
$options->jenkinsjob,
@@ -63,7 +72,7 @@ public function build() {
throw new RuntimeException("Unknown project type");
}
- return new TryLib_TryRunner_Runner(
+ return new Runner(
$repo_manager,
$jenkins_runner,
$this->jenkins_cli_jar_path,
@@ -99,7 +108,7 @@ public function overrideUser($override_user) {
}
/**
- * An array of TryLib_Precheck instances to run on your local working copy before sending a job
+ * An array of TryLib\Precheck instances to run on your local working copy before sending a job
* to Jenkins.
*
* Defaults to an empty array.
@@ -110,7 +119,7 @@ public function prechecks(array $prechecks) {
}
/**
- * Command-line options as parsed by TryLib_TryRunner_Options::parse().
+ * Command-line options as parsed by TryLib\TryRunner\Options::parse().
*/
public function optionsTuple(array $options_tuple) {
$this->options_tuple = $options_tuple;
diff --git a/TryLib/TryRunner/Options.php b/src/TryRunner/Options.php
similarity index 95%
rename from TryLib/TryRunner/Options.php
rename to src/TryRunner/Options.php
index 3055e82..1cbb7c4 100644
--- a/TryLib/TryRunner/Options.php
+++ b/src/TryRunner/Options.php
@@ -1,9 +1,11 @@
parse($argv);
}
diff --git a/TryLib/TryRunner/Runner.php b/src/TryRunner/Runner.php
similarity index 96%
rename from TryLib/TryRunner/Runner.php
rename to src/TryRunner/Runner.php
index 0c8e346..9ed7460 100644
--- a/TryLib/TryRunner/Runner.php
+++ b/src/TryRunner/Runner.php
@@ -1,15 +1,20 @@
jenkins_runner->setParam('branch', $remote_branch);
$this->jenkins_runner->setParam('guid', $this->override_user . time());
- $extra_params = TryLib_Util_OptionsUtil::parseExtraParameters($options->extra_param);
+ $extra_params = OptionsUtil::parseExtraParameters($options->extra_param);
foreach($extra_params as $param) {
$this->jenkins_runner->setParam($param[0], $param[1]);
}
diff --git a/TryLib/Util/AnsiColor.php b/src/Util/AnsiColor.php
similarity index 92%
rename from TryLib/Util/AnsiColor.php
rename to src/Util/AnsiColor.php
index 0a773ef..ec14c7b 100644
--- a/TryLib/Util/AnsiColor.php
+++ b/src/Util/AnsiColor.php
@@ -1,4 +1,11 @@
1)
- throw new TryLib_Util_PHPOptions_GetoptError("option --$opt not a unique prefix");
+ throw new GetoptError("option --$opt not a unique prefix");
assert('count($possibilities) == 1');
$unique_match = $possibilities[0];
$has_arg = _endswith($unique_match,'=');
@@ -227,7 +232,7 @@ function _getopt_do_shorts($opts, $optstring, $shortopts, $args) {
if (_getopt_short_has_arg($opt, $shortopts)) {
if ($optstring == '') {
if (! count($args))
- throw new TryLib_Util_PHPOptions_GetoptError("option -$opt requires argument");
+ throw new GetoptError("option -$opt requires argument");
$optstring = $args[0];
array_shift($args);
}
@@ -247,7 +252,7 @@ function _getopt_short_has_arg($opt, $shortopts) {
if ($opt == $shortopts_a[$i] && $opt != ':')
return _startswith($shortopts,':',$i+1);
}
- throw new TryLib_Util_PHPOptions_GetoptError("option -$opt not recognized");
+ throw new GetoptError("option -$opt not recognized");
}
@@ -256,7 +261,7 @@ function _getopt_short_has_arg($opt, $shortopts) {
Keys can be set or accessed with a "no-" or "no_" prefix to negate the
value.
**/
-class TryLib_Util_PHPOptions_OptDict extends ArrayObject {
+class OptDict extends ArrayObject {
private $_opts;
private $_aliases;
@@ -340,7 +345,7 @@ function _tty_width() {
By default, the parser function is a tweaked version of getopt(), and the abort
behaviour is to exit the program.
**/
-class TryLib_Util_PHPOptions_Options {
+class Options {
public $optspec;
public $optfunc;
private $_onabort;
@@ -351,8 +356,8 @@ class TryLib_Util_PHPOptions_Options {
private $_defaults;
private $_usagestr;
- public function __construct($optspec, $optfunc='_gnu_getopt',
- $onabort='_default_onabort') {
+ public function __construct($optspec, $optfunc='TryLib\Util\PHPOptions\_gnu_getopt',
+ $onabort='TryLib\Util\PHPOptions\_default_onabort') {
$this->optspec = $optspec;
$this->_onabort = $onabort;
$this->optfunc = $optfunc;
@@ -464,7 +469,7 @@ public function fatal($msg) {
/**Parse a list of arguments and return (options, flags, extra).
- In the returned tuple, "options" is an TryLib_Util_PHPOptions_OptDict with known options,
+ In the returned tuple, "options" is an OptDict with known options,
"flags" is a list of option flags that were used on the command-line,
and "extra" is a list of positional arguments.
**/
@@ -478,7 +483,7 @@ public function parse($args) {
$this->fatal($e->getMessage());
}
- $opt = new TryLib_Util_PHPOptions_OptDict($this->_aliases);
+ $opt = new OptDict($this->_aliases);
foreach ($this->_defaults as $k => $v)
$opt[$k] = $v;
diff --git a/TryLib/Util/PHPOptions/README.md b/src/Util/PHPOptions/README.md
similarity index 100%
rename from TryLib/Util/PHPOptions/README.md
rename to src/Util/PHPOptions/README.md
diff --git a/tests/phpunit/JenkinsRunner/FreeStyleProjectTest.php b/tests/JenkinsRunner/FreeStyleProjectTest.php
similarity index 85%
rename from tests/phpunit/JenkinsRunner/FreeStyleProjectTest.php
rename to tests/JenkinsRunner/FreeStyleProjectTest.php
index e49338c..a47c25d 100644
--- a/tests/phpunit/JenkinsRunner/FreeStyleProjectTest.php
+++ b/tests/JenkinsRunner/FreeStyleProjectTest.php
@@ -1,8 +1,10 @@
mock_cmd_runner = $this->getMock('TryLib_CommandRunner');
+ $this->mock_cmd_runner = $this->getMockBuilder('TryLib\CommandRunner')
+ ->getMock();
- $this->jenkins_runner = new TryLib_JenkinsRunner_FreeStyleProject(
+ $this->jenkins_runner = new FreeStyleProject(
self::JENKINS_URL,
self::JENKINS_CLI,
self::JENKINS_JOB,
diff --git a/tests/phpunit/JenkinsRunner/MasterProjectTest.php b/tests/JenkinsRunner/MasterProjectTest.php
similarity index 76%
rename from tests/phpunit/JenkinsRunner/MasterProjectTest.php
rename to tests/JenkinsRunner/MasterProjectTest.php
index 7616f71..2b43de8 100644
--- a/tests/phpunit/JenkinsRunner/MasterProjectTest.php
+++ b/tests/JenkinsRunner/MasterProjectTest.php
@@ -1,8 +1,10 @@
mock_cmd_runner = $this->getMock('TryLib_CommandRunner');
+ $this->mock_cmd_runner = $this->getMockBuilder('TryLib\CommandRunner')
+ ->getMock();
- $this->jenkins_runner = new TryLib_JenkinsRunner_MasterProject(
+ $this->jenkins_runner = new MasterProject(
self::JENKINS_URL,
self::JENKINS_CLI,
self::JENKINS_JOB,
@@ -91,11 +94,10 @@ function provideShowProgressJobResultsData() {
/** @dataProvider provideShowProgressJobResultsData */
function testPrintJobResultSuccessAndShowProgress($log_line, $status, $expected_output) {
- $jenkins_runner = $this->getMock(
- 'TryLib_JenkinsRunner_MasterProject',
- array('colorStatus'),
- array(self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB, $this->mock_cmd_runner)
- );
+ $jenkins_runner = $this->getMockBuilder('TryLib\JenkinsRunner\MasterProject')
+ ->setMethods(['colorStatus'])
+ ->setConstructorArgs([self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB, $this->mock_cmd_runner])
+ ->getMock();
$jenkins_runner->expects($this->once())
->method('colorStatus')
@@ -114,11 +116,10 @@ function testPrintJobResultSuccessAndShowProgress($log_line, $status, $expected_
}
function testPrintJobResultNoMatch() {
- $jenkins_runner = $this->getMock(
- 'TryLib_JenkinsRunner_MasterProject',
- array('colorStatus'),
- array(self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB, $this->mock_cmd_runner)
- );
+ $jenkins_runner = $this->getMockBuilder('TryLib\JenkinsRunner\MasterProject')
+ ->setMethods(['colorStatus'])
+ ->setConstructorArgs([self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB, $this->mock_cmd_runner])
+ ->getMock();
$jenkins_runner->expects($this->never())
->method('colorStatus')
@@ -141,11 +142,10 @@ function testProcessLogOutputNotFinishedShowProgress() {
$new_text = $prev_text . PHP_EOL . '......... try-file-tests (pending)';
- $jenkins_runner = $this->getMock(
- 'TryLib_JenkinsRunner_MasterProject',
- array('getJobOutput', 'printJobResults'),
- array(self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB, $this->mock_cmd_runner)
- );
+ $jenkins_runner = $this->getMockBuilder('TryLib\JenkinsRunner\MasterProject')
+ ->setMethods(['getJobOutput', 'printJobResults'])
+ ->setConstructorArgs([self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB, $this->mock_cmd_runner])
+ ->getMock();
$jenkins_runner->expects($this->at(0))
->method('getJobOutput')
@@ -173,11 +173,10 @@ function testProcessLogOutputNotFinishedDoNotShowProgress() {
$new_text = $prev_text . PHP_EOL . '......... try-file-tests (pending)';
- $jenkins_runner = $this->getMock(
- 'TryLib_JenkinsRunner_MasterProject',
- array('getJobOutput', 'printJobResults'),
- array(self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB, $this->mock_cmd_runner)
- );
+ $jenkins_runner = $this->getMockBuilder('TryLib\JenkinsRunner\MasterProject')
+ ->setMethods(['getJobOutput', 'printJobResults'])
+ ->setConstructorArgs([self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB, $this->mock_cmd_runner])
+ ->getMock();
$jenkins_runner->expects($this->once())
->method('getJobOutput')
@@ -205,11 +204,10 @@ function testProcessLogOutputFinishedShowProgress() {
$new_text = $prev_text . PHP_EOL . 'Finished: FAILURE';
- $jenkins_runner = $this->getMock(
- 'TryLib_JenkinsRunner_MasterProject',
- array('getJobOutput', 'printJobResults', 'colorStatus'),
- array(self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB, $this->mock_cmd_runner)
- );
+ $jenkins_runner = $this->getMockBuilder('TryLib\JenkinsRunner\MasterProject')
+ ->setMethods(['getJobOutput', 'printJobResults', 'colorStatus'])
+ ->setConstructorArgs([self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB, $this->mock_cmd_runner])
+ ->getMock();
$jenkins_runner->expects($this->once())
->method('getJobOutput')
@@ -245,11 +243,10 @@ function testProcessLogOutputFinishedDoNotShowProgress() {
$new_text = $prev_text . PHP_EOL . 'Finished: SUCCESS';
- $jenkins_runner = $this->getMock(
- 'TryLib_JenkinsRunner_MasterProject',
- array('getJobOutput', 'printJobResults', 'colorStatus'),
- array(self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB, $this->mock_cmd_runner)
- );
+ $jenkins_runner = $this->getMockBuilder('TryLib\JenkinsRunner\MasterProject')
+ ->setMethods(['getJobOutput', 'printJobResults', 'colorStatus'])
+ ->setConstructorArgs([self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB, $this->mock_cmd_runner])
+ ->getMock();
$jenkins_runner->expects($this->once())
->method('getJobOutput')
@@ -284,11 +281,10 @@ function testProcessLogOutputDifferentPrefixFinishedDoNotShowProgress() {
$new_text = $prev_text . PHP_EOL . 'Finished: SUCCESS';
- $jenkins_runner = $this->getMock(
- 'TryLib_JenkinsRunner_MasterProject',
- array('getJobOutput', 'printJobResults', 'colorStatus'),
- array(self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB . '-foo', $this->mock_cmd_runner, 'bar')
- );
+ $jenkins_runner = $this->getMockBuilder('TryLib\JenkinsRunner\MasterProject')
+ ->setMethods(['getJobOutput', 'printJobResults', 'colorStatus'])
+ ->setConstructorArgs([self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB, $this->mock_cmd_runner])
+ ->getMock();
$jenkins_runner->expects($this->once())
->method('getJobOutput')
@@ -321,11 +317,10 @@ function testPollForCompletionJobUrlNotFound() {
->method('terminate')
->with('Could not find ' .self::JENKINS_JOB . ' URL' . PHP_EOL);
- $jenkins_runner = $this->getMock(
- 'TryLib_JenkinsRunner_MasterProject',
- array('processLogOuput'),
- array(self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB, $this->mock_cmd_runner)
- );
+ $jenkins_runner = $this->getMockBuilder('TryLib\JenkinsRunner\MasterProject')
+ ->setMethods(['processLogOuput'])
+ ->setConstructorArgs([self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB, $this->mock_cmd_runner])
+ ->getMock();
$jenkins_runner->pollForCompletion(true);
@@ -339,11 +334,10 @@ function testPollForCompletionJobFinished() {
->will($this->returnValue($expected_job_url));
- $jenkins_runner = $this->getMock(
- 'TryLib_JenkinsRunner_MasterProject',
- array('processLogOuput'),
- array(self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB, $this->mock_cmd_runner)
- );
+ $jenkins_runner = $this->getMockBuilder('TryLib\JenkinsRunner\MasterProject')
+ ->setMethods(['processLogOuput'])
+ ->setConstructorArgs([self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB, $this->mock_cmd_runner])
+ ->getMock();
$jenkins_runner->expects($this->once())
->method('processLogOuput')
@@ -362,11 +356,10 @@ function testPollForCompletionJobPollsAndFinishes() {
->will($this->returnValue($expected_job_url));
- $jenkins_runner = $this->getMock(
- 'TryLib_JenkinsRunner_MasterProject',
- array('processLogOuput'),
- array(self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB, $this->mock_cmd_runner, null, 0)
- );
+ $jenkins_runner = $this->getMockBuilder('TryLib\JenkinsRunner\MasterProject')
+ ->setMethods(['processLogOuput'])
+ ->setConstructorArgs([self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB, $this->mock_cmd_runner, null, 0])
+ ->getMock();
$jenkins_runner->expects($this->at(0))
->method('processLogOuput')
diff --git a/tests/phpunit/JenkinsRunnerTest.php b/tests/JenkinsRunnerTest.php
similarity index 89%
rename from tests/phpunit/JenkinsRunnerTest.php
rename to tests/JenkinsRunnerTest.php
index 20fd58d..aedccda 100644
--- a/tests/phpunit/JenkinsRunnerTest.php
+++ b/tests/JenkinsRunnerTest.php
@@ -1,10 +1,12 @@
mock_cmd_runner = $this->getMock('TryLib_CommandRunner');
+ $this->mock_cmd_runner = $this->getMockBuilder('TryLib\CommandRunner')
+ ->getMock();
$this->jenkins_runner = new TestRunner(
self::JENKINS_URL,
@@ -43,11 +46,11 @@ function setUp() {
}
/**
- * @expectedException
+ * @expectedException Exception
*/
function testInvalidUrl() {
$this->jenkins_runner = new TestRunner(
- 'http://totallyvalid.com/',
+ 'totallyvalid.com/',
self::JENKINS_CLI,
self::JENKINS_JOB,
$this->mock_cmd_runner
@@ -195,11 +198,10 @@ function provideStartJenkinsJobParam() {
/** @dataProvider provideStartJenkinsJobParam */
function testStartJenkinsJob($show_results, $show_progress, $has_callbacks, $expected_call_count) {
- $jenkins_runner = $this->getMock(
- 'TestRunner',
- array('runJenkinsCommand', 'buildCLICommand', 'pollForCompletion', 'getCallbacks', 'executeCallbacks'),
- array(self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB, 'mock_runner')
- );
+ $jenkins_runner = $this->getMockBuilder('tests\phpunit\TestRunner')
+ ->setMethods(['runJenkinsCommand', 'buildCLICommand', 'pollForCompletion', 'getCallbacks', 'executeCallbacks'])
+ ->setConstructorArgs([self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB, 'mock_runner'])
+ ->getMock();
$jenkins_runner->expects($this->at(0))
->method('buildCLICommand')
diff --git a/tests/phpunit/Precheck/GitCopyAgeTest.php b/tests/Precheck/GitCopyAgeTest.php
similarity index 78%
rename from tests/phpunit/Precheck/GitCopyAgeTest.php
rename to tests/Precheck/GitCopyAgeTest.php
index f2dd0b8..b84d4da 100644
--- a/tests/phpunit/Precheck/GitCopyAgeTest.php
+++ b/tests/Precheck/GitCopyAgeTest.php
@@ -1,20 +1,23 @@
mock_cmd_runner = $this->getMock('TryLib_CommandRunner');
+ $this->mock_cmd_runner = $this->getMockBuilder('TryLib\CommandRunner')
+ ->getMock();
}
function testGetLastFetchDateWithoutRemoteBranchSuccess() {
$last_fetch = 'Sun Feb 10 10:00:00 2013';
- $script_runner = new TryLib_Precheck_GitCopyAge();
+ $script_runner = new GitCopyAge();
$this->mock_cmd_runner->expects($this->once())
->method('run')
@@ -34,7 +37,7 @@ function testGetLastFetchDateWithoutRemoteBranchSuccess() {
function testGetLastFetchDateWithRemoteBranchFailure() {
$last_fetch = 'Sun Feb 10 10:00:00 2013';
- $script_runner = new TryLib_Precheck_GitCopyAge(24, 48, 'branch');
+ $script_runner = new GitCopyAge(24, 48, 'branch');
$this->mock_cmd_runner->expects($this->once())
->method('run')
@@ -51,11 +54,10 @@ function testGetLastFetchDateWithRemoteBranchFailure() {
function testWorkingCopyPastMaxBlockingAge() {
$last_fetch = 'Sun Feb 10 10:00:00 2013';
- $script_runner = $this->getMock(
- 'TryLib_Precheck_GitCopyAge',
- array('getLastFetchDate', 'getTimeDelta', 'formatTimeDiff'),
- array(12, 72, 'branch')
- );
+ $script_runner = $this->getMockBuilder('TryLib\Precheck\GitCopyAge')
+ ->setMethods(['getLastFetchDate', 'getTimeDelta', 'formatTimeDiff'])
+ ->setConstructorArgs([12, 72, 'branch'])
+ ->getMock();
$script_runner->expects($this->once())
->method('getLastFetchDate')
@@ -82,12 +84,11 @@ function testWorkingCopyPastMaxBlockingAge() {
function testWorkingCopyPastMaxWarningAge() {
$last_fetch = 'Sun Feb 10 10:00:00 2013';
- $script_runner = $this->getMock(
- 'TryLib_Precheck_GitCopyAge',
- array('getLastFetchDate', 'getTimeDelta', 'formatTimeDiff'),
- array(12, 72, 'branch')
- );
-
+ $script_runner = $this->getMockBuilder('TryLib\Precheck\GitCopyAge')
+ ->setMethods(['getLastFetchDate', 'getTimeDelta', 'formatTimeDiff'])
+ ->setConstructorArgs([12, 72, 'branch'])
+ ->getMock();
+
$script_runner->expects($this->once())
->method('getLastFetchDate')
->with($this->mock_cmd_runner)
@@ -116,11 +117,10 @@ function testWorkingCopyPastMaxWarningAge() {
function testWorkingCopySuccess() {
$last_fetch = 'Sun Feb 10 10:00:00 2013';
- $script_runner = $this->getMock(
- 'TryLib_Precheck_GitCopyAge',
- array('getLastFetchDate', 'getTimeDelta', 'formatTimeDiff'),
- array(12, 72, 'branch')
- );
+ $script_runner = $this->getMockBuilder('TryLib\Precheck\GitCopyAge')
+ ->setMethods(['getLastFetchDate', 'getTimeDelta', 'formatTimeDiff'])
+ ->setConstructorArgs([12, 72, 'branch'])
+ ->getMock();
$script_runner->expects($this->once())
->method('getLastFetchDate')
diff --git a/tests/phpunit/Precheck/GitCopyBehindTest.php b/tests/Precheck/GitCopyBehindTest.php
similarity index 65%
rename from tests/phpunit/Precheck/GitCopyBehindTest.php
rename to tests/Precheck/GitCopyBehindTest.php
index f1c504e..bc44f72 100644
--- a/tests/phpunit/Precheck/GitCopyBehindTest.php
+++ b/tests/Precheck/GitCopyBehindTest.php
@@ -1,11 +1,14 @@
getMock('TryLib_CommandRunner');
+ $mock_cmd_runner = $this->getMockBuilder('TryLib\CommandRunner')
+ ->getMock();
$mock_cmd_runner->expects($this->once())
->method('run')
@@ -15,13 +18,14 @@ function testShouldRunCheckShouldRun() {
->method('getOutput')
->will($this->returnValue('master'));
- $git_copy_behind_check = new TryLib_Precheck_GitCopyBehind(array('master'));
+ $git_copy_behind_check = new GitCopyBehind(array('master'));
$this->assertTrue($git_copy_behind_check->shouldRunCheck($mock_cmd_runner));
}
function testShouldRunCheckShouldNotRun() {
- $mock_cmd_runner = $this->getMock('TryLib_CommandRunner');
+ $mock_cmd_runner = $this->getMockBuilder('TryLib\CommandRunner')
+ ->getMock();
$mock_cmd_runner->expects($this->once())
->method('run')
@@ -31,13 +35,14 @@ function testShouldRunCheckShouldNotRun() {
->method('getOutput')
->will($this->returnValue('myfeature'));
- $git_copy_behind_check = new TryLib_Precheck_GitCopyBehind(array('master'));
+ $git_copy_behind_check = new GitCopyBehind(array('master'));
$this->assertFalse($git_copy_behind_check->shouldRunCheck($mock_cmd_runner));
}
function testShouldRunCheckNoBranches() {
- $mock_cmd_runner = $this->getMock('TryLib_CommandRunner');
+ $mock_cmd_runner = $this->getMockBuilder('TryLib\CommandRunner')
+ ->getMock();
$mock_cmd_runner->expects($this->once())
->method('run')
@@ -47,13 +52,14 @@ function testShouldRunCheckNoBranches() {
->method('getOutput')
->will($this->returnValue('master'));
- $git_copy_behind_check = new TryLib_Precheck_GitCopyBehind(array());
+ $git_copy_behind_check = new GitCopyBehind(array());
$this->assertFalse($git_copy_behind_check->shouldRunCheck($mock_cmd_runner));
}
function testCheckWorkingCopyBehind() {
- $mock_cmd_runner = $this->getMock('TryLib_CommandRunner');
+ $mock_cmd_runner = $this->getMockBuilder('TryLib\CommandRunner')
+ ->getMock();
$mock_cmd_runner->expects($this->once())
->method('run')
@@ -66,11 +72,10 @@ function testCheckWorkingCopyBehind() {
$mock_cmd_runner->expects($this->once())
->method('warn');
- $script_runner = $this->getMock(
- 'TryLib_Precheck_GitCopyBehind',
- array('shouldRunCheck'),
- array(array('master'))
- );
+ $script_runner = $this->getMockBuilder('TryLib\Precheck\GitCopyBehind')
+ ->setMethods(['shouldRunCheck'])
+ ->setConstructorArgs([['master']])
+ ->getMock();
$script_runner->expects($this->once())
->method('shouldRunCheck')
@@ -81,7 +86,8 @@ function testCheckWorkingCopyBehind() {
}
function testCheckWorkingCopyNotBehind() {
- $mock_cmd_runner = $this->getMock('TryLib_CommandRunner');
+ $mock_cmd_runner = $this->getMockBuilder('TryLib\CommandRunner')
+ ->getMock();
$mock_cmd_runner->expects($this->once())
->method('run')
@@ -94,11 +100,10 @@ function testCheckWorkingCopyNotBehind() {
$mock_cmd_runner->expects($this->never())
->method('warn');
- $script_runner = $this->getMock(
- 'TryLib_Precheck_GitCopyBehind',
- array('shouldRunCheck'),
- array(array('master'))
- );
+ $script_runner = $this->getMockBuilder('TryLib\Precheck\GitCopyBehind')
+ ->setMethods(['shouldRunCheck'])
+ ->setConstructorArgs([['master']])
+ ->getMock();
$script_runner->expects($this->once())
->method('shouldRunCheck')
@@ -109,7 +114,8 @@ function testCheckWorkingCopyNotBehind() {
}
function testCheckShouldNotRun() {
- $mock_cmd_runner = $this->getMock('TryLib_CommandRunner');
+ $mock_cmd_runner = $this->getMockBuilder('TryLib\CommandRunner')
+ ->getMock();
$mock_cmd_runner->expects($this->never())
->method('run');
@@ -120,11 +126,10 @@ function testCheckShouldNotRun() {
$mock_cmd_runner->expects($this->never())
->method('warn');
- $script_runner = $this->getMock(
- 'TryLib_Precheck_GitCopyBehind',
- array('shouldRunCheck'),
- array(array('master'))
- );
+ $script_runner = $this->getMockBuilder('TryLib\Precheck\GitCopyBehind')
+ ->setMethods(['shouldRunCheck'])
+ ->setConstructorArgs([['master']])
+ ->getMock();
$script_runner->expects($this->once())
->method('shouldRunCheck')
diff --git a/tests/phpunit/Precheck/GitWarnOnBlocklistedTest.php b/tests/Precheck/GitWarnOnBlocklistedTest.php
similarity index 88%
rename from tests/phpunit/Precheck/GitWarnOnBlocklistedTest.php
rename to tests/Precheck/GitWarnOnBlocklistedTest.php
index c47b9ec..6e4057b 100644
--- a/tests/phpunit/Precheck/GitWarnOnBlocklistedTest.php
+++ b/tests/Precheck/GitWarnOnBlocklistedTest.php
@@ -1,15 +1,18 @@
mock_cmd_runner = $this->getMock('TryLib_CommandRunner');
+ $this->mock_cmd_runner = $this->getMockBuilder('TryLib\CommandRunner')
+ ->getMock();
}
function testNoChanges() {
- $script_runner = new TryLib_Precheck_GitWarnOnBlocklisted(
+ $script_runner = new GitWarnOnBlocklisted(
array(),
null,
false
@@ -32,7 +35,7 @@ function testNoChanges() {
}
function testNoBlockListedFiles() {
- $script_runner = new TryLib_Precheck_GitWarnOnBlocklisted(
+ $script_runner = new GitWarnOnBlocklisted(
array('my/foo.php'),
false,
false
@@ -55,7 +58,7 @@ function testNoBlockListedFiles() {
}
function testWithBlockListedFiles() {
- $script_runner = new TryLib_Precheck_GitWarnOnBlocklisted(
+ $script_runner = new GitWarnOnBlocklisted(
array('my/foo.php', 'my/bar.php'),
null,
false
@@ -78,7 +81,7 @@ function testWithBlockListedFiles() {
}
function testWithSafeListedFiles() {
- $script_runner = new TryLib_Precheck_GitWarnOnBlocklisted(
+ $script_runner = new GitWarnOnBlocklisted(
array(),
array('my/foo.php', 'my/bar.php'),
false
@@ -101,7 +104,7 @@ function testWithSafeListedFiles() {
}
function testWithSafeListedAndBlockListedFiles() {
- $script_runner = new TryLib_Precheck_GitWarnOnBlocklisted(
+ $script_runner = new GitWarnOnBlocklisted(
array('my/bar.php'),
array('my/foo.php', 'my/bar.php'),
false
@@ -123,7 +126,7 @@ function testWithSafeListedAndBlockListedFiles() {
}
function testStagedOnly() {
- $script_runner = new TryLib_Precheck_GitWarnOnBlocklisted(
+ $script_runner = new GitWarnOnBlocklisted(
array('my/foo.php', 'my/bar.php'),
null,
true
diff --git a/tests/phpunit/Precheck/ScriptRunnerTest.php b/tests/Precheck/ScriptRunnerTest.php
similarity index 75%
rename from tests/phpunit/Precheck/ScriptRunnerTest.php
rename to tests/Precheck/ScriptRunnerTest.php
index 269f8f5..cd72dff 100644
--- a/tests/phpunit/Precheck/ScriptRunnerTest.php
+++ b/tests/Precheck/ScriptRunnerTest.php
@@ -1,22 +1,26 @@
mock_cmd_runner = $this->getMock('TryLib_CommandRunner');
+ $this->mock_cmd_runner = $this->getMockBuilder('TryLib\CommandRunner')
+ ->getMock();
vfsStream::setup('testDir');
}
function testScriptDoesNotExists() {
- $script_runner = new TryLib_Precheck_ScriptRunner(vfsStream::url('testDir/script'));
+ $script_runner = new ScriptRunner(vfsStream::url('testDir/script'));
$this->mock_cmd_runner->expects($this->never())
->method('run');
@@ -31,7 +35,7 @@ function testScriptExistsAndSucceeds() {
vfsStream::newFile('script')
->at(vfsStreamWrapper::getRoot());
- $script_runner = new TryLib_Precheck_ScriptRunner(vfsStream::url('testDir/script'));
+ $script_runner = new ScriptRunner(vfsStream::url('testDir/script'));
$this->mock_cmd_runner->expects($this->once())
->method('run')
@@ -48,7 +52,7 @@ function testScriptExistsAndFails() {
vfsStream::newFile('script')
->at(vfsStreamWrapper::getRoot());
- $script_runner = new TryLib_Precheck_ScriptRunner(vfsStream::url('testDir/script'));
+ $script_runner = new ScriptRunner(vfsStream::url('testDir/script'));
$this->mock_cmd_runner->expects($this->once())
->method('run')
diff --git a/tests/phpunit/RepoManager/GitTest.php b/tests/RepoManager/GitTest.php
similarity index 74%
rename from tests/phpunit/RepoManager/GitTest.php
rename to tests/RepoManager/GitTest.php
index aabfa5e..e7a0674 100644
--- a/tests/phpunit/RepoManager/GitTest.php
+++ b/tests/RepoManager/GitTest.php
@@ -1,8 +1,10 @@
mock_cmd_runner = $this->getMock('TryLib_CommandRunner');
+ $this->mock_cmd_runner = $this->getMockBuilder('TryLib\CommandRunner')
+ ->getMock();
}
function testGenerateDiffStagedSuccessfull() {
- $repo_manager = $this->getMock(
- 'TryLib_RepoManager_Git',
- array('getUpstream'),
- array(self::REPO_PATH, $this->mock_cmd_runner)
- );
+ $repo_manager = $this->getMockBuilder('TryLib\RepoManager\Git')
+ ->setMethods(['getUpstream'])
+ ->setConstructorArgs([self::REPO_PATH, $this->mock_cmd_runner])
+ ->getMock();
$repo_manager->expects($this->once())
->method('getUpstream')
@@ -47,11 +49,10 @@ function testGenerateDiffStagedSuccessfull() {
}
function testGenerateDiffFailure() {
- $repo_manager = $this->getMock(
- 'TryLib_RepoManager_Git',
- array('getUpstream'),
- array(self::REPO_PATH, $this->mock_cmd_runner)
- );
+ $repo_manager = $this->getMockBuilder('TryLib\RepoManager\Git')
+ ->setMethods(['getUpstream'])
+ ->setConstructorArgs([self::REPO_PATH, $this->mock_cmd_runner])
+ ->getMock();
$repo_manager->expects($this->once())
->method('getUpstream')
@@ -79,7 +80,7 @@ function testGenerateDiffFailure() {
function testParseLocalBranchSuccess() {
- $repo_manager = new TryLib_RepoManager_Git(
+ $repo_manager = new Git(
self::REPO_PATH, $this->mock_cmd_runner
);
@@ -100,7 +101,7 @@ function testParseLocalBranchSuccess() {
}
function testParseLocalBranchFailure() {
- $repo_manager = new TryLib_RepoManager_Git(
+ $repo_manager = new Git(
self::REPO_PATH, $this->mock_cmd_runner
);
@@ -121,12 +122,11 @@ function testParseLocalBranchFailure() {
}
function testGetRemoteSuccess() {
- $repo_manager = $this->getMock(
- 'TryLib_RepoManager_Git',
- array('getLocalBranch', 'getConfig'),
- array(self::REPO_PATH, $this->mock_cmd_runner)
- );
-
+ $repo_manager = $this->getMockBuilder('TryLib\RepoManager\Git')
+ ->setMethods(['getLocalBranch', 'getConfig'])
+ ->setConstructorArgs([self::REPO_PATH, $this->mock_cmd_runner])
+ ->getMock();
+
$repo_manager->expects($this->once())
->method('getLocalBranch')
->will($this->returnValue('master'));
@@ -140,11 +140,10 @@ function testGetRemoteSuccess() {
}
function testGetRemoteFailWithDefault() {
- $repo_manager = $this->getMock(
- 'TryLib_RepoManager_Git',
- array('getLocalBranch', 'getConfig'),
- array(self::REPO_PATH, $this->mock_cmd_runner)
- );
+ $repo_manager = $this->getMockBuilder('TryLib\RepoManager\Git')
+ ->setMethods(['getLocalBranch', 'getConfig'])
+ ->setConstructorArgs([self::REPO_PATH, $this->mock_cmd_runner])
+ ->getMock();
$repo_manager->expects($this->once())
->method('getLocalBranch')
@@ -159,12 +158,11 @@ function testGetRemoteFailWithDefault() {
}
function testGetRemoteFailNoDefault() {
- $repo_manager = $this->getMock(
- 'TryLib_RepoManager_Git',
- array('getLocalBranch', 'getConfig'),
- array(self::REPO_PATH, $this->mock_cmd_runner)
- );
-
+ $repo_manager = $this->getMockBuilder('TryLib\RepoManager\Git')
+ ->setMethods(['getLocalBranch', 'getConfig'])
+ ->setConstructorArgs([self::REPO_PATH, $this->mock_cmd_runner])
+ ->getMock();
+
$repo_manager->expects($this->once())
->method('getLocalBranch')
->will($this->returnValue('master'));
@@ -179,11 +177,10 @@ function testGetRemoteFailNoDefault() {
function testGetRemoteBranchFromTrackingConfig() {
- $repo_manager = $this->getMock(
- 'TryLib_RepoManager_Git',
- array('getLocalBranch', 'getConfig'),
- array(self::REPO_PATH, $this->mock_cmd_runner)
- );
+ $repo_manager = $this->getMockBuilder('TryLib\RepoManager\Git')
+ ->setMethods(['getLocalBranch', 'getConfig'])
+ ->setConstructorArgs([self::REPO_PATH, $this->mock_cmd_runner])
+ ->getMock();
$repo_manager->expects($this->once())
->method('getLocalBranch')
@@ -198,11 +195,10 @@ function testGetRemoteBranchFromTrackingConfig() {
}
function testGetRemoteBranchNoTrackingRemoteWithSameName() {
- $repo_manager = $this->getMock(
- 'TryLib_RepoManager_Git',
- array('getLocalBranch', 'getConfig'),
- array(self::REPO_PATH, $this->mock_cmd_runner)
- );
+ $repo_manager = $this->getMockBuilder('TryLib\RepoManager\Git')
+ ->setMethods(['getLocalBranch', 'getConfig'])
+ ->setConstructorArgs([self::REPO_PATH, $this->mock_cmd_runner])
+ ->getMock();
$repo_manager->expects($this->at(0))
->method('getLocalBranch')
@@ -227,15 +223,16 @@ function testGetRemoteBranchNoTrackingRemoteWithSameName() {
$this->assertEquals('local_branch', $repo_manager->getRemoteBranch());
}
-
- function testGetRemoteBranchNoTrackingNoRemote() {
- $this->setExpectedException('RuntimeException', 'No remote branch was found');
- $repo_manager = $this->getMock(
- 'TryLib_RepoManager_Git',
- array('getLocalBranch', 'getConfig'),
- array(self::REPO_PATH, $this->mock_cmd_runner)
- );
+ /**
+ * @expectedException RuntimeException
+ * @expectedExceptionMessage No remote branch was found
+ */
+ function testGetRemoteBranchNoTrackingNoRemote() {
+ $repo_manager = $this->getMockBuilder('TryLib\RepoManager\Git')
+ ->setMethods(['getLocalBranch', 'getConfig'])
+ ->setConstructorArgs([self::REPO_PATH, $this->mock_cmd_runner])
+ ->getMock();
$repo_manager->expects($this->at(0))
->method('getLocalBranch')
diff --git a/tests/phpunit/TryRunner/RunnerTest.php b/tests/TryRunner/RunnerTest.php
similarity index 80%
rename from tests/phpunit/TryRunner/RunnerTest.php
rename to tests/TryRunner/RunnerTest.php
index 2a3b9aa..01161c2 100644
--- a/tests/phpunit/TryRunner/RunnerTest.php
+++ b/tests/TryRunner/RunnerTest.php
@@ -1,27 +1,33 @@
assertEquals($expected_params, $actual_params);
}
}
diff --git a/try b/try
index 7ffd61e..1355b1b 100755
--- a/try
+++ b/try
@@ -1,7 +1,7 @@
#!/usr/bin/php
parse($argv);
# [Jenkins MasterProject only] - Get the subjobs list
$subjobs = array_slice($extra, 1);
-$cmd_runner = new TryLib_CommandRunner($options->verbose);
+$cmd_runner = new TryLib\CommandRunner($options->verbose);
-$repo_manager = new TryLib_RepoManager_Git($options->wcpath, $cmd_runner);
+$repo_manager = new TryLib\RepoManager\Git($options->wcpath, $cmd_runner);
$remote_branch = $options->branch;
$repo_manager->setRemoteBranch($remote_branch);
# [Jenkins Freestyle project]
-#$jenkins_runner = new TryLib_JenkinsRunner_FreeStyleProject(
+#$jenkins_runner = new TryLib\JenkinsRunner\FreeStyleProject(
# $options->jenkinsserver,
# $jenkins_cli_jar,
# $options->jenkinsjob,
@@ -73,7 +73,7 @@ $repo_manager->setRemoteBranch($remote_branch);
#);
# [Jenkins MasterProject only]
-$jenkins_runner = new TryLib_JenkinsRunner_MasterProject(
+$jenkins_runner = new TryLib\JenkinsRunner\MasterProject(
$options->jenkinsserver,
$jenkins_cli_jar,
$options->jenkinsjob,
@@ -87,8 +87,8 @@ if (is_string($safelist)) {
}
$pre_checks = array(
- new TryLib_Precheck_GitCopyBehind(array('master')),
- new TryLib_Precheck_GitReportUntracked(),
+ new TryLib\Precheck\GitCopyBehind(array('master')),
+ new TryLib\Precheck\GitReportUntracked(),
);
$repo_manager->runPrechecks($pre_checks);
@@ -108,7 +108,7 @@ $jenkins_runner->setSshKey( getenv('HOME') . '/.ssh/try_id_rsa');
$jenkins_runner->setParam('branch', $remote_branch);
$jenkins_runner->setParam('guid', $user . time());
-$extra_params = TryLib_Util_OptionsUtil::parseExtraParameters($options->extra_param);
+$extra_params = TryLib\Util\OptionsUtil::parseExtraParameters($options->extra_param);
foreach($extra_params as $param) {
$jenkins_runner->setParam($param[0], $param[1]);
}
diff --git a/try-with-runner b/try-with-runner
index 63c3ed4..c16dcfc 100755
--- a/try-with-runner
+++ b/try-with-runner
@@ -1,26 +1,26 @@
#!/usr/bin/env php
optionsTuple($options_tuple)
->jenkinsCliJarPath("/usr/etsy/jenkins-cli.jar")
->prechecks(array(
- new TryLib_Precheck_GitCopyBehind(array('master')),
- new TryLib_Precheck_GitReportUntracked(),
+ new TryLib\Precheck\GitCopyBehind(array('master')),
+ new TryLib\Precheck\GitReportUntracked(),
))
->build();