Skip to content

Commit

Permalink
3.06
Browse files Browse the repository at this point in the history
fix apm icon
add cordova
  • Loading branch information
willfarrell committed Oct 21, 2015
1 parent f675fcf commit 17a9432
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 3 deletions.
Binary file modified Package Managers.alfredworkflow
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Package Managers ([Download v3.05](https://github.com/willfarrell/alfred-pkgman-workflow/releases/download/3.05/Package.Managers.alfredworkflow))
# Package Managers ([Download v3.06](https://github.com/willfarrell/alfred-pkgman-workflow/releases/download/3.06/Package.Managers.alfredworkflow))

Package Repo Search

Expand Down
2 changes: 1 addition & 1 deletion current-version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": 3.04,
"version": 3.06,
"download_url": "https://github.com/willfarrell/alfred-pkgman-workflow/releases/download/3.04/Package.Managers.alfredworkflow",
"description": "Package Repo Search"
}
Binary file added icon-cache/cordova.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icon-src/cordova.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions src/Cordova.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php
namespace WillFarrell\AlfredPkgMan;

require_once('Cache.php');
require_once('Repo.php');

class Cordova extends Repo
{
protected $id = 'cordova';
protected $kind = 'plugins';
protected $url = 'https://cordova.apache.org/plugins/?q=';
protected $search_url = 'https://npmsearch.com/query?fields=name,keywords,license,description,author,modified,homepage,version,rating&q=keywords:%22ecosystem:cordova%22&sort=rating:desc&size=20&start=0&q=';
//protected $has_db = true;

public function search($query)
{
if (!$this->hasMinQueryLength($query)) {
return $this->xml();
}

$this->pkgs = $this->cache->get_query_json(
$this->id,
$query,
"{$this->search_url}{$query}"
);

foreach($this->pkgs->results as $pkg) {

$title = str_replace('gulp-', '', $pkg->name[0]); // remove gulp- from title

// add version to title
if (isset($pkg->version)) {
$title .= " v{$pkg->version[0]}";
}
// add author to title
if (isset($pkg->author)) {
$title .= " by {$pkg->author[0]}";
}

// skip DEPRECATED repos
// if (strpos($plugin->description, "DEPRECATED") !== false) {
// continue;
// }

$this->cache->w->result(
$pkg->name[0],
$this->makeArg($pkg->name[0], $pkg->homepage[0]),
$title,
$pkg->description[0],
"icon-cache/{$this->id}.png"
);

// only search till max return reached
if ( count ( $this->cache->w->results() ) == $this->max_return ) {
break;
}
}

$this->noResults($query, "{$this->search_url}{$query}");

return $this->xml();
}
}

// Test code, uncomment to debug this script from the command-line
// $repo = new Cordova();
// echo $repo->search('min');
?>
1 change: 0 additions & 1 deletion src/Gulp.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public function search($query)
);

foreach($this->pkgs->results as $pkg) {
print_r($pkg);

$title = str_replace('gulp-', '', $pkg->name[0]); // remove gulp- from title

Expand Down

0 comments on commit 17a9432

Please sign in to comment.