Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
0a243d3c
Commit
0a243d3c
authored
Apr 17, 2011
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed compilation to only get the version once
parent
3b313ff4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
src/Silex/Compiler.php
src/Silex/Compiler.php
+9
-5
No files found.
src/Silex/Compiler.php
View file @
0a243d3c
...
...
@@ -22,12 +22,20 @@ use Symfony\Component\Process\Process;
*/
class
Compiler
{
protected
$version
;
public
function
compile
(
$pharFile
=
'silex.phar'
)
{
if
(
file_exists
(
$pharFile
))
{
unlink
(
$pharFile
);
}
$process
=
new
Process
(
'git log --pretty="%h %ci" -n1 HEAD'
);
if
(
$process
->
run
()
>
0
)
{
throw
new
\RuntimeException
(
'The git binary cannot be found.'
);
}
$this
->
version
=
trim
(
$process
->
getOutput
());
$phar
=
new
\Phar
(
$pharFile
,
0
,
'Silex'
);
$phar
->
setSignatureAlgorithm
(
\Phar
::
SHA1
);
...
...
@@ -77,11 +85,7 @@ class Compiler
$content
=
Kernel
::
stripComments
(
$content
);
}
$process
=
new
Process
(
'git log --pretty="%h %ci" -n1 HEAD'
);
if
(
$process
->
run
()
>
0
)
{
throw
new
\RuntimeException
(
'The git binary cannot be found.'
);
}
$content
=
str_replace
(
'@package_version@'
,
$process
->
getOutput
(),
$content
);
$content
=
str_replace
(
'@package_version@'
,
$this
->
version
,
$content
);
$phar
->
addFromString
(
$path
,
$content
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment