Skip to content

Commit

Permalink
Added experimental windows version (issue netz98#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmuench committed Sep 27, 2012
1 parent 44b418b commit 350ae07
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 18 deletions.
8 changes: 8 additions & 0 deletions _cli_stub_windows.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

$autoloader = require_once 'phar://' . __FILE__ . '/vendor/autoload.php';

$application = new N98\Magento\Application($autoloader);
$application->run();

__HALT_COMPILER();
61 changes: 44 additions & 17 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
<?xml version="1.0"?>
<project name="n98-magerun" default="dist">

<fileset dir="." id="root_folder">
<include name="config.yaml" />
<include name="MIT-LICENSE.txt" />
</fileset>
<fileset dir="src" id="src_folder">
<include name="**/**" />
</fileset>
<fileset dir="res" id="res_folder">
<include name="**/**" />
</fileset>
<fileset dir="vendor" id="vendor_folder">
<include name="**/**" />
<exclude name=".git/**" />
<exclude name=".svn/**" />
<exclude name="**/Tests/**" />
</fileset>

<target name="dist">
<phingcall target="dist_unix" />
<phingcall target="dist_win" />
</target>

<target name="dist_unix">
<pharpackage basedir="./" stub="_cli_stub.php" signature="sha512" compression="bzip2" destfile="./n98-magerun.phar">
<fileset dir=".">
<include name="config.yaml" />
<include name="MIT-LICENSE.txt" />
</fileset>
<fileset dir="src">
<include name="**/**" />
</fileset>
<fileset dir="res">
<include name="**/**" />
</fileset>
<fileset dir="vendor">
<include name="**/**" />
<exclude name=".git/**" />
<exclude name=".svn/**" />
<exclude name="**/Tests/**" />
</fileset>
<metadata>
<element name="version" value="1.0.0" />
<element name="authors">
Expand All @@ -27,6 +33,27 @@
</element>
</element>
</metadata>
<fileset refid="root_folder" />
<fileset refid="src_folder" />
<fileset refid="res_folder" />
<fileset refid="vendor_folder" />
</pharpackage>
</target>

<target name="dist_win">
<pharpackage basedir="./" stub="_cli_stub_windows.php" signature="sha512" compression="bzip2" destfile="./n98-magerun-windows.phar">
<metadata>
<element name="version" value="1.0.0" />
<element name="authors">
<element name="Christian Münch">
<element name="e-mail" value="c.muench@netz98.de" />
</element>
</element>
</metadata>
<fileset refid="root_folder" />
<fileset refid="src_folder" />
<fileset refid="res_folder" />
<fileset refid="vendor_folder" />
</pharpackage>
</target>

Expand All @@ -35,4 +62,4 @@
<exec command="sudo chmod a+x /usr/local/bin/n98-magerun.phar;" />
</target>

</project>
</project>
Binary file added n98-magerun-windows.phar
Binary file not shown.
Binary file modified n98-magerun.phar
Binary file not shown.
9 changes: 8 additions & 1 deletion src/N98/Magento/Command/SelfUpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace N98\Magento\Command;

use N98\Magento\Command\AbstractMagentoCommand;
use N98\Util\OperatingSystem;
use Composer\Util\RemoteFilesystem;
use Composer\IO\ConsoleIO;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -39,7 +40,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
if ($this->getApplication()->getVersion() !== $latest) {
$output->writeln(sprintf("Updating to version <info>%s</info>.", $latest));

$remoteFilename = 'https://raw.github.com/netz98/n98-magerun/master/n98-magerun.phar';
$os = new OperatingSystem();
if ($os->isWindows()) {
$remoteFilename = 'https://raw.github.com/netz98/n98-magerun/master/n98-magerun-windows.phar';
} else {
$remoteFilename = 'https://raw.github.com/netz98/n98-magerun/master/n98-magerun.phar';
}

$localFilename = $_SERVER['argv'][0];
$tempFilename = basename($localFilename, '.phar').'-temp.phar';

Expand Down

0 comments on commit 350ae07

Please sign in to comment.