Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

release script

  • Loading branch information...
commit d2c7627231f3cd13a268e29e7444634a9e8c9b40 1 parent 08254c3
@everzet everzet authored
Showing with 160 additions and 0 deletions.
  1. +1 −0  .gitignore
  2. +90 −0 bin/release
  3. +3 −0  libpath.php
  4. +66 −0 package.xml.tpl
View
1  .gitignore
@@ -1,2 +1,3 @@
i18n_p
speedtest
+*.tgz
View
90 bin/release
@@ -0,0 +1,90 @@
+#!/usr/bin/env php
+<?php
+
+/*
+ * This file is part of the Behat Gherkin.
+ * (c) Konstantin Kudryashov <ever.zet@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * Release script.
+ *
+ * Usage: bin/release 1.0.0RC1 beta
+ *
+ * @author Konstantin Kudryashov <ever.zet@gmail.com>
+ */
+
+if (is_file(__DIR__ . '/../autoload.php')) {
+ require_once __DIR__ . '/../autoload.php';
+} else {
+ require_once __DIR__ . '/../autoload.php.dist';
+}
+
+if (!isset($argv[1])) {
+ throw new Exception('You must provide version.');
+}
+
+if (!isset($argv[2])) {
+ throw new Exception('You must provide stability status (alpha/beta/stable).');
+}
+
+$version = $argv[1];
+$stability = $argv[2];
+
+print sprintf("Releasing gherkin version \"%s\".\n", $version);
+
+if (is_file('package.xml')) {
+ unlink(getcwd().'/package.xml');
+}
+
+copy(getcwd().'/package.xml.tpl', getcwd().'/package.xml');
+
+$dirs = array(
+ 'src',
+ 'i18n',
+ 'tests',
+ 'vendor/symfony/src/Symfony/Component/Translation',
+ 'vendor/symfony/src/Symfony/Component/Finder',
+ 'vendor/symfony/src/Symfony/Component/Yaml',
+);
+
+$xmlSourceFiles = '';
+foreach ($dirs as $dir) {
+ $finder = new Symfony\Component\Finder\Finder();
+ $sourceFiles = $finder->files()->in($dir);
+
+ foreach ($sourceFiles as $file) {
+ $xmlSourceFiles .= '<file role="php" baseinstalldir="gherkin" install-as="'.$file->getPathName().'" name="'.$file->getPathName().'" />'."\n";
+ }
+}
+
+function replaceTokens($files, $beginToken, $endToken, $tokens)
+{
+ if (!is_array($files)) {
+ $files = array($files);
+ }
+
+ foreach ($files as $file) {
+ $content = file_get_contents($file);
+ foreach ($tokens as $key => $value) {
+ $content = str_replace($beginToken.$key.$endToken, $value, $content, $count);
+ }
+
+ file_put_contents($file, $content);
+ }
+}
+
+replaceTokens(getcwd().'/package.xml', '##', '##', array(
+ 'GHERKIN_VERSION' => $version
+ , 'CURRENT_DATE' => date('Y-m-d')
+ , 'SOURCE_FILES' => $xmlSourceFiles
+ , 'STABILITY' => $stability
+));
+
+system('pear package');
+unlink(getcwd().'/package.xml');
+
+exit(0);
View
3  libpath.php
@@ -0,0 +1,3 @@
+<?php
+
+return __DIR__;
View
66 package.xml.tpl
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package packagerversion="1.8.0" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
+ http://pear.php.net/dtd/tasks-1.0.xsd
+ http://pear.php.net/dtd/package-2.0
+ http://pear.php.net/dtd/package-2.0.xsd">
+ <name>gherkin</name>
+ <channel>pear.behat.org</channel>
+ <summary>Behat\Gherkin is a BDD DSL for PHP</summary>
+ <description>
+ Behat\Gherkin is an open source behavior driven development DSL for php 5.3.
+ </description>
+ <lead>
+ <name>Konstantin Kudryashov</name>
+ <user>everzet</user>
+ <email>ever.zet@gmail.com</email>
+ <active>yes</active>
+ </lead>
+ <date>##CURRENT_DATE##</date>
+ <version>
+ <release>##GHERKIN_VERSION##</release>
+ <api>1.0.0</api>
+ </version>
+ <stability>
+ <release>##STABILITY##</release>
+ <api>##STABILITY##</api>
+ </stability>
+ <license uri="http://www.opensource.org/licenses/mit-license.php">MIT</license>
+ <notes>-</notes>
+ <contents>
+ <dir name="/">
+
+ ##SOURCE_FILES##
+
+ <file role="php" baseinstalldir="gherkin" name="autoload.php.dist" />
+
+ <file role="php" baseinstalldir="gherkin" name="libpath.php" />
+ <file role="php" baseinstalldir="gherkin" name="CHANGES.md" />
+ <file role="php" baseinstalldir="gherkin" name="LICENSE" />
+ <file role="php" baseinstalldir="gherkin" name="README.md" />
+
+ </dir>
+ </contents>
+ <dependencies>
+ <required>
+ <php>
+ <min>5.3.1</min>
+ </php>
+ <pearinstaller>
+ <min>1.4.0</min>
+ </pearinstaller>
+ <extension>
+ <name>pcre</name>
+ </extension>
+ <extension>
+ <name>simplexml</name>
+ </extension>
+ <extension>
+ <name>xml</name>
+ </extension>
+ <extension>
+ <name>mbstring</name>
+ </extension>
+ </required>
+ </dependencies>
+ <phprelease />
+</package>
Please sign in to comment.
Something went wrong with that request. Please try again.