Permalink
Browse files

Updated for upstream Gaufrette compatibility

  • Loading branch information...
1 parent 8d5af4e commit 5cccd219d68c4c6dd3f5baf006030c43e3dcc178 @magnusnordlander magnusnordlander committed Dec 4, 2012
View
2 composer.json
@@ -10,7 +10,7 @@
},
"require-dev": {
- "knplabs/gaufrette": "*",
+ "knplabs/gaufrette": ">=0.1.2",
"mikey179/vfsStream": "*",
"mockery/mockery": "*"
},
View
10 src/Gittern/Gaufrette/GitternCommitishReadOnlyAdapter.php
@@ -7,12 +7,13 @@
use Gittern\Entity\GitObject\Commit;
use Gittern\Entity\GitObject\Tree;
-use Gaufrette\Adapter\Base as BaseAdapter;
+use Gaufrette\Adapter as AdapterInterface;
+use Gaufrette\Adapter\ChecksumCalculator;
/**
* @author Magnus Nordlander
**/
-class GitternCommitishReadOnlyAdapter extends BaseAdapter
+class GitternCommitishReadOnlyAdapter implements AdapterInterface, ChecksumCalculator
{
protected $repo;
protected $commit;
@@ -120,6 +121,11 @@ public function rename($key, $new)
throw new \RuntimeException("This adapter is read-only.");
}
+ public function isDirectory($key)
+ {
+ return $this->getGitObjectForKey($key) instanceof Tree;
+ }
+
public function supportsMetadata()
{
return false;
View
19 src/Gittern/Gaufrette/GitternIndexAdapter.php
@@ -6,12 +6,13 @@
use Gittern\Repository;
use Gittern\Entity\GitObject\Blob;
-use Gaufrette\Adapter\Base as BaseAdapter;
+use Gaufrette\Adapter as AdapterInterface;
+use Gaufrette\Adapter\ChecksumCalculator;
/**
* @author Magnus Nordlander
**/
-class GitternIndexAdapter extends BaseAdapter
+class GitternIndexAdapter implements AdapterInterface, ChecksumCalculator
{
protected $repo;
protected $autoflush = true;
@@ -132,6 +133,20 @@ public function rename($key, $new)
throw new \RuntimeException(sprintf('Could not read the \'%s\' file.', $key));
}
+ public function isDirectory($directory_key)
+ {
+ $directory_key = trim($directory_key, '/');
+ foreach ($this->getKeys() as $key)
+ {
+ if (strpos($key, $directory_key.'/') === 0)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
public function supportsMetadata()
{
return true;

0 comments on commit 5cccd21

Please sign in to comment.