Skip to content
Browse files

added license and phar builder

1 parent d55f44c commit 5d16f4e8a0a9e3f9fa6a3f699bb2d479345a756a @everzet everzet committed May 6, 2012
Showing with 93 additions and 0 deletions.
  1. +22 −0 LICENSE
  2. +50 −0 build.php
  3. +21 −0 init.php
View
22 LICENSE
@@ -0,0 +1,22 @@
+Copyright (c) 2012 Konstantin Kudryashov <ever.zet@gmail.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
View
50 build.php
@@ -0,0 +1,50 @@
+<?php
+
+/*
+ * This file is part of the Behat\MinkExtension
+ *
+ * (c) Konstantin Kudryashov <ever.zet@gmail.com>
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+$phar = new \Phar('behat-mink-extension.phar', 0, 'behat-mink-extension.phar');
+$phar->setSignatureAlgorithm(\Phar::SHA1);
+$phar->startBuffering();
+
+addFileToPhar($phar, 'src/Behat/MinkExtension/Compiler/SelectorsPass.php');
+addFileToPhar($phar, 'src/Behat/MinkExtension/Compiler/SessionsPass.php');
+addFileToPhar($phar, 'src/Behat/MinkExtension/Context/MinkAwareContextInterface.php');
+addFileToPhar($phar, 'src/Behat/MinkExtension/Context/MinkAwareContextInitializer.php');
+addFileToPhar($phar, 'src/Behat/MinkExtension/Context/RawMinkContext.php');
+addFileToPhar($phar, 'src/Behat/MinkExtension/Context/MinkContext.php');
+addFileToPhar($phar, 'src/Behat/MinkExtension/Configuration.php');
+addFileToPhar($phar, 'src/Behat/MinkExtension/Extension.php');
@stof
Behat member
stof added a note May 6, 2012

this is dangerous IMO as it will be really easy to forgot to update the list when adding a new file, thus leading to a broken phar. Wouldn't it be better to use a DirectoryIterator to find them ?

@everzet
Behat member
everzet added a note May 7, 2012

Yup, you're right.

@everzet
Behat member
everzet added a note May 7, 2012

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
+$phar->setStub(<<<STUB
+<?php
+
+/*
+ * This file is part of the Behat\MinkExtension
+ *
+ * (c) Konstantin Kudryashov <ever.zet@gmail.com>
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+Phar::mapPhar('behat-mink-extension.phar');
+
+return require_once 'phar://behat-mink-extension.phar/init.php';
+
+__HALT_COMPILER();
+STUB
+);
+$phar->stopBuffering();
+
+unset($phar);
+
+function addFileToPhar($phar, $path) {
+ $phar->addFromString($path, __DIR__.'/'.$path);
+}
View
21 init.php
@@ -0,0 +1,21 @@
+<?php
+
+/*
+ * This file is part of the Behat\MinkExtension
+ *
+ * (c) Konstantin Kudryashov <ever.zet@gmail.com>
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+require_once __DIR__.'/src/Behat/MinkExtension/Compiler/SelectorsPass.php';
+require_once __DIR__.'/src/Behat/MinkExtension/Compiler/SessionsPass.php';
+require_once __DIR__.'/src/Behat/MinkExtension/Context/MinkAwareContextInterface.php';
+require_once __DIR__.'/src/Behat/MinkExtension/Context/MinkAwareContextInitializer.php';
+require_once __DIR__.'/src/Behat/MinkExtension/Context/RawMinkContext.php';
+require_once __DIR__.'/src/Behat/MinkExtension/Context/MinkContext.php';
+require_once __DIR__.'/src/Behat/MinkExtension/Configuration.php';
+require_once __DIR__.'/src/Behat/MinkExtension/Extension.php';
+
+return new Behat\MinkExtension\Extension;

0 comments on commit 5d16f4e

Please sign in to comment.
Something went wrong with that request. Please try again.