Permalink
Browse files

add command for initializing .sauce/ondemand.yml with your username a…

…nd access key
  • Loading branch information...
1 parent 32673df commit 87b4eb074ead97744e9bb073ebe674112463f4af Joe Mathes committed Jan 20, 2011
Showing with 265 additions and 4 deletions.
  1. +2 −2 PHPUnit/Extensions/SeleniumTestCase/SauceOnDemandTestCase.php
  2. +44 −2 package.xml
  3. +50 −0 pearsauce.bat
  4. +79 −0 pearsauce.php
  5. +44 −0 sauce.bat
  6. +46 −0 sauce.php
@@ -164,7 +164,7 @@ protected function getDriver(array $browser)
} elseif($yml_found && isset($pearsauce_config['username'])) {
$driver->setUsername($pearsauce_config['username']);
} else {
- error_log('Warning: no username provided. This may result in "Could not connect to Selenium RC serve". Run "pearsauce init <username> <accesskey>" or call $this->setUsername to fix');
+ error_log('Warning: no username provided. This may result in "Could not connect to Selenium RC serve". Run "sauce configure <username> <accesskey>" or call $this->setUsername to fix');
}
if (isset($browser['accessKey'])) {
@@ -178,7 +178,7 @@ protected function getDriver(array $browser)
} elseif($yml_found && isset($pearsauce_config['access_key'])) {
$driver->setAccessKey($pearsauce_config['access_key']);
} else {
- error_log('Warning: no access key provided. This may result in "Could not connect to Selenium RC serve". Run "pearsauce init <username> <accesskey>" or call $this->setAccessKey to fix');
+ error_log('Warning: no access key provided. This may result in "Could not connect to Selenium RC serve". Run "sauce configure <username> <accesskey>" or call $this->setAccessKey to fix');
}
if (isset($browser['os'])) {
View
@@ -23,9 +23,9 @@
<email>jmathes@gmail.com</email>
<active>yes</active>
</developer>
- <date>2011-01-16</date>
+ <date>2011-01-19</date>
<version>
- <release>1.1.1</release>
+ <release>1.2.0</release>
<api>1.0.0</api>
</version>
<stability>
@@ -50,6 +50,26 @@
</dir>
</dir>
</dir>
+ <file baseinstalldir="/" name="pearsauce.php" role="script">
+ <tasks:replace from="/usr/bin/env php" to="php_bin" type="pear-config" />
+ <tasks:replace from="@php_bin@" to="php_bin" type="pear-config" />
+ <tasks:replace from="@package_version@" to="version" type="package-info" />
+ </file>
+ <file baseinstalldir="/" name="pearsauce.bat" role="script">
+ <tasks:replace from="@php_bin@" to="php_bin" type="pear-config" />
+ <tasks:replace from="@bin_dir@" to="bin_dir" type="pear-config" />
+ <tasks:replace from="@package_version@" to="version" type="package-info" />
+ </file>
+ <file baseinstalldir="/" name="sauce.php" role="script">
+ <tasks:replace from="/usr/bin/env php" to="php_bin" type="pear-config" />
+ <tasks:replace from="@php_bin@" to="php_bin" type="pear-config" />
+ <tasks:replace from="@package_version@" to="version" type="package-info" />
+ </file>
+ <file baseinstalldir="/" name="sauce.bat" role="script">
+ <tasks:replace from="@php_bin@" to="php_bin" type="pear-config" />
+ <tasks:replace from="@bin_dir@" to="bin_dir" type="pear-config" />
+ <tasks:replace from="@package_version@" to="version" type="package-info" />
+ </file>
</dir>
</contents>
<dependencies>
@@ -68,8 +88,30 @@
<package>
<name>YAML</name>
<channel>pear.symfony-project.com</channel>
+ <min>1.0.2</min>
</package>
</required>
</dependencies>
+ <phprelease>
+ <installconditions>
+ <os>
+ <name>windows</name>
+ </os>
+ </installconditions>
+ <filelist>
+ <install as="pearsauce" name="pearsauce.php" />
+ <install as="sauce" name="sauce.php" />
+ <install as="pearsauce.bat" name="pearsauce.bat" />
+ <install as="sauce.bat" name="sauce.bat" />
+ </filelist>
+ </phprelease>
+ <phprelease>
+ <filelist>
+ <install as="pearsauce" name="pearsauce.php" />
+ <install as="sauce" name="sauce.php" />
+ <ignore name="pearsauce.bat" />
+ <ignore name="sauce.bat" />
+ </filelist>
+ </phprelease>
<phprelease/>
</package>
View
@@ -0,0 +1,50 @@
+@echo off
+REM
+REM PHPUnit
+REM
+REM Copyright (c) 2010-2011, Sebastian Bergmann <sb@sebastian-bergmann.de>.
+REM All rights reserved.
+REM
+REM Redistribution and use in source and binary forms, with or without
+REM modification, are permitted provided that the following conditions
+REM are met:
+REM
+REM REM Redistributions of source code must retain the above copyright
+REM notice, this list of conditions and the following disclaimer.
+REM
+REM REM Redistributions in binary form must reproduce the above copyright
+REM notice, this list of conditions and the following disclaimer in
+REM the documentation and/or other materials provided with the
+REM distribution.
+REM
+REM REM Neither the name of Sebastian Bergmann nor the names of his
+REM contributors may be used to endorse or promote products derived
+REM from this software without specific prior written permission.
+REM
+REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+REM "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+REM LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+REM FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+REM COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+REM INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+REM BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+REM LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+REM CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+REM LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+REM ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+REM POSSIBILITY OF SUCH DAMAGE.
+REM
+REM @package PHPUnit_Selenium
+REM @author Jan Sorgalla <jan.sorgalla@dotsunited.de>
+REM @copyright 2010-2011 Sebastian Bergmann <sb@sebastian-bergmann.de>
+REM @license http://www.opensource.org/licenses/bsd-license.php BSD License
+REM @link http://www.phpunit.de/
+REM @since File available since Release 3.5.0
+
+if "%PHPBIN%" == "" set PHPBIN=@php_bin@
+if not exist "%PHPBIN%" if "%PHP_PEAR_PHP_BIN%" neq "" goto USE_PEAR_PATH
+GOTO RUN
+:USE_PEAR_PATH
+set PHPBIN=%PHP_PEAR_PHP_BIN%
+:RUN
+"%PHPBIN%" "@bin_dir@\pearsauce" %*
View
@@ -0,0 +1,79 @@
+#!/usr/bin/env php
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2010-2011, Sebastian Bergmann <sb@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @package PHPUnit_Selenium
+ * @author Jan Sorgalla <jan.sorgalla@dotsunited.de>
+ * @copyright 2010-2011 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @link http://www.phpunit.de/
+ * @since File available since Release 3.5.0
+ */
+
+require_once('SymfonyComponents/YAML/sfYamlDumper.php');
+
+
+// loop through each element in the $argv array
+$message = "Usage: sauce [options] COMMAND [options] [COMMAND [options] ...] [args]\n" .
+ "\n" .
+ "Available commands:\n" .
+ "configure Configure Sauce OnDemand credentials\n" .
+ "help Provide help for individual commands\n";
+if(count($argv) >= 3) {
+ if($argv[1] == 'help') {
+ if($argv[2] == 'help') {
+ $message = "help: Provide help for individual commands\n" .
+ "This command prints the program help if no arguments are given. If one or more command names are given as arguments, these arguments are interpreted as a hierachy of commands and the help for the right most command is show.\n" .
+ "\n" .
+ "Usage: sauce help [COMMAND SUBCOMMAND ...]\n";
+ } elseif($argv[2] == 'configure') {
+ $message = "configure: Configure Sauce OnDemand credentials\n" .
+ "\n" .
+ "Usage: sauce configure USERNAME ACCESS_KEY\n";
+ }
+ } elseif($argv[1] == 'configure' && count($argv) >= 1) {
+ $dumper_lol = new sfYamlDumper();
+ $config = array('username' => $argv[2], 'access_key' => $argv[3]);
+ $yaml = $dumper_lol->dump($config);
+ if(!(file_exists($_SERVER['HOME'] . '/.sauce'))) {
+ mkdir($_SERVER['HOME'] . '/.sauce');
+ }
+ file_put_contents($_SERVER['HOME'] . '/.sauce/ondemand.yml', $yaml);
+ $message = "Account configured. You are now ready to run saucy tests. You feel very hot and saucy.\n";
+ }
+}
+
+echo $message;
View
@@ -0,0 +1,44 @@
+@echo off
+REM
+REM PHPUnit
+REM
+REM Copyright (c) 2010-2011, Sebastian Bergmann <sb@sebastian-bergmann.de>.
+REM All rights reserved.
+REM
+REM Redistribution and use in source and binary forms, with or without
+REM modification, are permitted provided that the following conditions
+REM are met:
+REM
+REM REM Redistributions of source code must retain the above copyright
+REM notice, this list of conditions and the following disclaimer.
+REM
+REM REM Redistributions in binary form must reproduce the above copyright
+REM notice, this list of conditions and the following disclaimer in
+REM the documentation and/or other materials provided with the
+REM distribution.
+REM
+REM REM Neither the name of Sebastian Bergmann nor the names of his
+REM contributors may be used to endorse or promote products derived
+REM from this software without specific prior written permission.
+REM
+REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+REM "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+REM LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+REM FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+REM COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+REM INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+REM BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+REM LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+REM CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+REM LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+REM ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+REM POSSIBILITY OF SUCH DAMAGE.
+REM
+REM @package PHPUnit_Selenium
+REM @author Jan Sorgalla <jan.sorgalla@dotsunited.de>
+REM @copyright 2010-2011 Sebastian Bergmann <sb@sebastian-bergmann.de>
+REM @license http://www.opensource.org/licenses/bsd-license.php BSD License
+REM @link http://www.phpunit.de/
+REM @since File available since Release 3.5.0
+
+pearsauce.bat %*
View
@@ -0,0 +1,46 @@
+#!/usr/bin/env php
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2010-2011, Sebastian Bergmann <sb@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @package PHPUnit_Selenium
+ * @author Jan Sorgalla <jan.sorgalla@dotsunited.de>
+ * @copyright 2010-2011 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @link http://www.phpunit.de/
+ * @since File available since Release 3.5.0
+ */
+
+require_once('./pearsauce.php');

0 comments on commit 87b4eb0

Please sign in to comment.