Skip to content

Commit

Permalink
Merge pull request #45 from technodelight/feature/fix-issues-and-refa…
Browse files Browse the repository at this point in the history
…ctor

Fix issues and refactor
  • Loading branch information
technodelight authored Feb 27, 2017
2 parents 1313dc2 + 9d1fc2d commit a358d09
Show file tree
Hide file tree
Showing 22 changed files with 925 additions and 519 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ jira.phar
jira*.phar
.jira.yml
bin/.version
/builds/*
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
language: php
php:
- 5.6
- 7.0
- 7.1
before_script: composer install
script: bin/phpspec run
34 changes: 25 additions & 9 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<?php

$start = microtime(true);
require './vendor/autoload.php';
require __DIR__ . '/vendor/autoload.php';

function formatBytes($size, $precision = 4)
{
Expand All @@ -12,6 +12,17 @@ function formatBytes($size, $precision = 4)
return round(pow(1024, $base - floor($base)), $precision) .' '. $suffixes[floor($base)];
}

function cp($in, $out, $mod = null)
{
echo sprintf("Copy %s to %s", $in, $out) . PHP_EOL;
$out = copy($in, $out);
if (!$out) {
echo sprintf(' Something bad happened...') . PHP_EOL,
}
if ($mod) chmod($out, $mod);
return $out;
}

$tools = ['git', 'box', 'unzip', 'composer', 'wget'];
foreach ($tools as $tool) {
if (!trim(`which $tool`)) {
Expand All @@ -32,21 +43,26 @@ $dir.= '/jira-master';
file_put_contents($dir . '/bin/.version', $version);


echo 'Building phar...'.PHP_EOL;
$buildfile = $dir . DIRECTORY_SEPARATOR . 'jira.phar';
echo 'Building phar... ';
`cd $dir && box build`;
$builtfile = $dir . DIRECTORY_SEPARATOR . 'jira.phar';
$outfile = __DIR__ . DIRECTORY_SEPARATOR . 'jira-' . $version . '-' . md5(file_get_contents($builtfile)) . '.phar';
copy($builtfile, $outfile);
chmod($outfile, 0755);
if (!is_file($buildfile)) die('Phar has not built!');
echo 'done.' . PHP_EOL;
echo 'Copying files' . PHP_EOL;
$releasefile = __DIR__ . DIRECTORY_SEPARATOR . 'builds' . DIRECTORY_SEPARATOR . 'jira-' . $version . '-' . md5(file_get_contents($buildfile)) . '.phar';
$currentbuildfile = __DIR__ . DIRECTORY_SEPARATOR . 'jira.phar';

cp($buildfile, $releasefile, 0755);
cp($releasefile, $currentbuildfile, 0755);

if (isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'install') {
if (!copy($outfile, '/usr/local/bin/jira')) {
if (!cp($outfile, '/usr/local/bin/jira')) {
die ("Cannot copy $outfile to /usr/local/bin/jira");
}
if (!copy($outfile, getenv('HOME') . '/Dropbox/jira.phar')) {
if (!cp($outfile, getenv('HOME') . '/Dropbox/jira.phar')) {
die ("Cannot copy $outfile to " . getenv('HOME') . "/Dropbox/jira.phar");
}
}
echo "Seems to be done!" . PHP_EOL . PHP_EOL;
echo "Seems to be done properly!" . PHP_EOL . PHP_EOL;

printf ('%s (%s), %.4f seconds', $outfile, formatBytes(filesize($outfile), 2), microtime(true) - $start);
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{
"name": "technodelight/jira",
"description": "JIRA PHP console application for day-to-day development",
"minimum-stability": "dev",
"license": "MIT",
"require": {
"php": "~5.6",
"php": ">= 5.6",
"symfony/console": "^2.7",
"stecman/symfony-console-completion": "^0.5.1",
"guzzlehttp/guzzle": "5.3",
"guzzlehttp/guzzle": "^6.2",
"technodelight/simplate": "dev-master",
"symfony/config": "^3.2",
"symfony/dependency-injection": "^2.7",
Expand Down
Loading

0 comments on commit a358d09

Please sign in to comment.