Skip to content

Commit

Permalink
Merge pull request #10 from statonlab/make-installable
Browse files Browse the repository at this point in the history
Make the package globally installable via composer
  • Loading branch information
almasaeed2010 authored Aug 21, 2017
2 parents fb6eecd + b297eda commit 3550a22
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 31 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
.idea
.idea/
vendor/
24 changes: 24 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "statonlab/fields_generator",
"homepage": "https://github.com/statonlab/fields_generator",
"license": "GPL-2.0",
"authors": [
{
"name": "Abdullah Almsaeed",
"email": "[email protected]"
},
{
"name": "Bradford Condon",
"email": "[email protected]"
}
],
"require": {},
"autoload": {
"psr-4": {
"StatonLab\\FieldGenerator\\": "src/"
}
},
"bin" : [
"makefield"
]
}
21 changes: 0 additions & 21 deletions generate.php

This file was deleted.

23 changes: 23 additions & 0 deletions makefield
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env php
<?php

if (file_exists(__DIR__.'/../../autoload.php')) {
require __DIR__.'/../../autoload.php';
} elseif (file_exists(__DIR__.'/vendor/autoload.php')) {
require __DIR__.'/vendor/autoload.php';
} else {
require __DIR__.'/src/bootstrap.php';
}

$app = new StatonLab\FieldGenerator\Generator();
$prompt = $app->prompt();

try {
$path = $app->run();
} catch (Exception $exception) {
$prompt->error($exception->getMessage());
exit(1);
}

$prompt->success('Field generated successfully.');
$prompt->success("The field can be found at {$path['field']}");
6 changes: 3 additions & 3 deletions src/CLIPrompt.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace FieldGenerator\Src;
namespace StatonLab\FieldGenerator;

/**
* Class CLIPrompt.
Expand All @@ -13,14 +13,14 @@ class CLIPrompt
/**
* Input File Resource.
*
* @var bool|resource
* @var Resource
*/
protected $input;

/**
* Holds the prompt colors generator.
*
* @var \FieldGenerator\Src\Colors
* @var \StatonLab\FieldGenerator\Colors
*/
protected $colored;

Expand Down
2 changes: 1 addition & 1 deletion src/Colors.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace FieldGenerator\Src;
namespace StatonLab\FieldGenerator;

class Colors
{
Expand Down
8 changes: 4 additions & 4 deletions src/Generator.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace FieldGenerator\Src;
namespace StatonLab\FieldGenerator;

use Exception;

Expand Down Expand Up @@ -72,7 +72,7 @@ class Generator
/**
* Holds the prompt output/input handler.
*
* @var \FieldGenerator\Src\CLIPrompt
* @var \StatonLab\FieldGenerator\CLIPrompt
*/
protected $prompt;

Expand All @@ -91,7 +91,7 @@ class Generator
/**
* CLI Options Parser.
*
* @var \FieldGenerator\Src\OptionsParser
* @var \StatonLab\FieldGenerator\OptionsParser
*/
protected $options;

Expand Down Expand Up @@ -276,7 +276,7 @@ protected function createFromOutputPath()
/**
* Give public access to the prompt.
*
* @return \FieldGenerator\Src\CLIPrompt
* @return \StatonLab\FieldGenerator\CLIPrompt
*/
public function prompt()
{
Expand Down
2 changes: 1 addition & 1 deletion src/OptionsParser.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace FieldGenerator\Src;
namespace StatonLab\FieldGenerator;

class OptionsParser
{
Expand Down

0 comments on commit 3550a22

Please sign in to comment.