App\Console\Commands\Versioning Class Reference
Inheritance diagram for App\Console\Commands\Versioning:

Public Member Functions

 __construct ()
 Create a new command instance. More...
 
 fire ()
 Execute the console command. More...
 

Protected Member Functions

 getArguments ()
 Get the console command arguments. More...
 
 getOptions ()
 Get the console command options. More...
 

Protected Attributes

 $name = 'versioning:update'
 
 $description = 'Generate and update app\'s version via git.'
 

Detailed Description

Definition at line 9 of file Versioning.php.

Constructor & Destructor Documentation

App\Console\Commands\Versioning::__construct ( )

Create a new command instance.

Returns
void

Definition at line 30 of file Versioning.php.

31  {
32  parent::__construct();
33  }

Member Function Documentation

App\Console\Commands\Versioning::fire ( )

Execute the console command.

Returns
void

Definition at line 40 of file Versioning.php.

41  {
42  // Path to the file containing your version
43  // This will be overwritten everything you commit a message
44  $versionFile = app_path().'/config/version.php';
45 
46  // The git's output
47  // get the argument passed in the git command
48  $hash_version = $this->argument('app_version');
49 
50  // discard the commit hash
51  $version = explode('-', $hash_version);
52  $realVersion = $version[0] . '-' . $version[1];
53 
54  // save the version array to a variable
55  $array = var_export(array('app_version' => $realVersion,'hash_version' => $hash_version), true);
56 
57 
58  // Construct our file content
59  $content = <<<CON
60 <?php
61 return $array;
62 CON;
63 
64  // And finally write the file and output the current version
65  \File::put($versionFile, $content);
66  $this->line('Setting version: '. \config('version.latest'));
67  }
App\Console\Commands\Versioning::getArguments ( )
protected

Get the console command arguments.

Returns
array

Definition at line 74 of file Versioning.php.

75  {
76  return array(
77  array('app_version', InputArgument::REQUIRED, 'version number is required.'),
78  );
79  }
App\Console\Commands\Versioning::getOptions ( )
protected

Get the console command options.

Returns
array

Definition at line 86 of file Versioning.php.

87  {
88  return array(
89  );
90  }

Member Data Documentation

App\Console\Commands\Versioning::$description = 'Generate and update app\'s version via git.'
protected

Definition at line 23 of file Versioning.php.

App\Console\Commands\Versioning::$name = 'versioning:update'
protected

Definition at line 16 of file Versioning.php.


The documentation for this class was generated from the following file: