Merge pull request #90 from shurastik/master

added some configuration options
This commit is contained in:
Dan Cryer 2013-07-25 04:13:43 -07:00
commit 65770c8fe2
4 changed files with 16 additions and 4 deletions

View file

@ -50,6 +50,7 @@ class InstallCommand extends Command
$conf['phpci']['email_settings']['smtp_address'] = $this->ask('(Optional) Smtp server address: ', true);
$conf['phpci']['email_settings']['smtp_port'] = $this->ask('(Optional) Smtp port: ', true);
$conf['phpci']['email_settings']['smtp_encryption'] = $this->ask('(Optional) Smtp encryption: ', true);
$conf['phpci']['email_settings']['smtp_username'] = $this->ask('(Optional) Smtp Username: ', true);
$conf['phpci']['email_settings']['smtp_password'] = $this->ask('(Optional) Smtp Password: ', true);
$conf['phpci']['email_settings']['from_address'] = $this->ask('(Optional) Email address to send from: ', true);

View file

@ -19,6 +19,7 @@ class Composer implements \PHPCI\Plugin
{
protected $directory;
protected $action;
protected $preferDist;
protected $phpci;
public function __construct(\PHPCI\Builder $phpci, array $options = array())
@ -27,6 +28,7 @@ class Composer implements \PHPCI\Plugin
$this->phpci = $phpci;
$this->directory = isset($options['directory']) ? $path . '/' . $options['directory'] : $path;
$this->action = isset($options['action']) ? $options['action'] : 'update';
$this->preferDist = isset($options['prefer_dist']) ? $options['prefer_dist'] : true;
}
/**
@ -34,7 +36,7 @@ class Composer implements \PHPCI\Plugin
*/
public function execute()
{
$cmd = PHPCI_DIR . 'composer.phar --prefer-dist --working-dir="%s" %s';
$cmd = PHPCI_DIR . 'composer.phar '. ($this->preferDist ? '--prefer-dist' : null) .' --working-dir="%s" %s';
return $this->phpci->executeCommand($cmd, $this->directory, $this->action);
}
}

View file

@ -140,7 +140,8 @@ class Email implements \PHPCI\Plugin
/** @var \Swift_SmtpTransport $transport */
$transport = \Swift_SmtpTransport::newInstance(
$this->getMailConfig('smtp_address'),
$this->getMailConfig('smtp_port')
$this->getMailConfig('smtp_port'),
$this->getMailConfig('smtp_encryption')
);
$transport->setUsername($this->getMailConfig('smtp_username'));
$transport->setPassword($this->getMailConfig('smtp_password'));
@ -164,6 +165,8 @@ class Email implements \PHPCI\Plugin
return null;
case 'smtp_port':
return '25';
case 'smtp_encryption':
return null;
case 'from_address':
return "notifications-ci@phptesting.org";
default:

View file

@ -18,10 +18,16 @@ namespace PHPCI\Plugin;
class PhpMessDetector implements \PHPCI\Plugin
{
protected $directory;
/**
* Array of PHPMD rules. Possible values: codesize, unusedcode, naming, design, controversial
* @var array
*/
protected $rules;
public function __construct(\PHPCI\Builder $phpci, array $options = array())
{
$this->phpci = $phpci;
$this->rules = isset($options['rules']) ? (array)$options['rules'] : array('codesize', 'unusedcode', 'naming');
}
/**
@ -35,7 +41,7 @@ class PhpMessDetector implements \PHPCI\Plugin
$ignore = ' --exclude ' . implode(',', $this->phpci->ignore);
}
$cmd = PHPCI_BIN_DIR . 'phpmd "%s" text codesize,unusedcode,naming %s';
return $this->phpci->executeCommand($cmd, $this->phpci->buildPath, $ignore);
$cmd = PHPCI_BIN_DIR . 'phpmd "%s" text %s %s';
return $this->phpci->executeCommand($cmd, $this->phpci->buildPath, implode(',', $this->rules), $ignore);
}
}