Skip to content

Commit

Permalink
Add bower dependency search
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarchena committed May 20, 2015
1 parent e300c93 commit 03fc848
Show file tree
Hide file tree
Showing 12 changed files with 437 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/json/config-json-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ConfigJsonFactory.prototype = (function () {
var createConfigJson = function createConfigJson(filePath, packageManager) {
var ConfigClass,
jsonObject;

if (packageManager === 'bower') {
ConfigClass = BowerJson;
} else if (packageManager === 'npm') {
Expand Down
11 changes: 8 additions & 3 deletions lib/search/search-engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ var Dependency = require('../dependency.js'),
path = require('path');

function SearchEngine(tree) {
this.basePath = tree.path;
this.dependenciesManager = tree.dependenciesManager;
this.dependenciesType = tree.dependenciesType;
this.dependenciesDirname =
(this.dependenciesManager === 'bower') ?
'components' :
'bower_components' :
'node_modules';
this.filterBy = tree.filterBy;
}
Expand All @@ -25,7 +26,11 @@ SearchEngine.prototype = (function () {
*/
var scan = function scan(current, dependent) {

var isNotFirstScan = (dependent instanceof Dependency),
var currentDepBasePath =
(this.dependenciesManager === 'npm')?
current.path:
this.basePath,
isNotFirstScan = (dependent instanceof Dependency),
doesntPassTheFilter = checkIf.
configJson(current.configJson, this.dependenciesManager).
doesntPassTheFilter(this.filterBy);
Expand All @@ -43,7 +48,7 @@ SearchEngine.prototype = (function () {
for (var k in current.json[t]) {
scan.call(this,
new Dependency(
path.join(current.path, this.dependenciesDirname, k), // Dependency path
path.join(currentDepBasePath, this.dependenciesDirname, k), // Dependency path
this.dependenciesManager // Dependency type
),
current);
Expand Down
27 changes: 27 additions & 0 deletions test/scenarios/bower/data/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "test-project",
"version": "0.1.0",
"authors": [
"dmarchena <dvmarchena@gmail.com>"
],
"description": "Test bower dependencies",
"keywords": [
"dependency",
"dependency-info",
"bower"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"jquery-file-upload": "~9.9.4",
"fontawesome": "~4.3.0",
"angularjs": "~1.3.15",
"bootstrap": "~3.3.4"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "angular",
"version": "1.3.15",
"main": "./angular.js",
"ignore": [],
"dependencies": {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "blueimp-canvas-to-blob",
"version": "2.1.1",
"title": "JavaScript Canvas to Blob",
"description": "JavaScript Canvas to Blob is a function to convert canvas elements into Blob objects.",
"keywords": [
"javascript",
"canvas",
"blob",
"convert",
"conversion"
],
"homepage": "https://github.com/blueimp/JavaScript-Canvas-to-Blob",
"author": {
"name": "Sebastian Tschan",
"url": "https://blueimp.net"
},
"maintainers": [
{
"name": "Sebastian Tschan",
"url": "https://blueimp.net"
}
],
"repository": {
"type": "git",
"url": "git://github.com/blueimp/JavaScript-Canvas-to-Blob.git"
},
"bugs": "https://github.com/blueimp/JavaScript-Canvas-to-Blob/issues",
"licenses": [
{
"type": "MIT",
"url": "http://www.opensource.org/licenses/MIT"
}
],
"main": "js/canvas-to-blob.js",
"ignore": [
"/*.*",
"test"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"name": "blueimp-load-image",
"version": "1.13.0",
"title": "JavaScript Load Image",
"description": "JavaScript Load Image is a library to load images provided as File or Blob objects or via URL. It returns an optionally scaled and/or cropped HTML img or canvas element. It also provides a method to parse image meta data to extract Exif tags and thumbnails and to restore the complete image header after resizing.",
"keywords": [
"javascript",
"load",
"loading",
"image",
"file",
"blob",
"url",
"scale",
"crop",
"img",
"canvas",
"meta",
"exif",
"thumbnail",
"resizing"
],
"homepage": "https://github.com/blueimp/JavaScript-Load-Image",
"author": {
"name": "Sebastian Tschan",
"url": "https://blueimp.net"
},
"maintainers": [
{
"name": "Sebastian Tschan",
"url": "https://blueimp.net"
}
],
"repository": {
"type": "git",
"url": "git://github.com/blueimp/JavaScript-Load-Image.git"
},
"bugs": "https://github.com/blueimp/JavaScript-Load-Image/issues",
"licenses": [
{
"type": "MIT",
"url": "http://www.opensource.org/licenses/MIT"
}
],
"main": [
"js/load-image.js",
"js/load-image-ios.js",
"js/load-image-orientation.js",
"js/load-image-meta.js",
"js/load-image-exif.js",
"js/load-image-exif-map.js"
],
"ignore": [
"/*.*",
"css",
"js/vendor",
"js/demo.js",
"test"
]
}
40 changes: 40 additions & 0 deletions test/scenarios/bower/data/bower_components/blueimp-tmpl/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "blueimp-tmpl",
"version": "2.5.4",
"title": "JavaScript Templates",
"description": "< 1KB lightweight, fast & powerful JavaScript templating engine with zero dependencies. Compatible with server-side environments like node.js, module loaders like RequireJS and all web browsers.",
"keywords": [
"javascript",
"templates",
"templating"
],
"homepage": "https://github.com/blueimp/JavaScript-Templates",
"author": {
"name": "Sebastian Tschan",
"url": "https://blueimp.net"
},
"maintainers": [
{
"name": "Sebastian Tschan",
"url": "https://blueimp.net"
}
],
"repository": {
"type": "git",
"url": "git://github.com/blueimp/JavaScript-Templates.git"
},
"bugs": "https://github.com/blueimp/JavaScript-Templates/issues",
"licenses": [
{
"type": "MIT",
"url": "http://www.opensource.org/licenses/MIT"
}
],
"main": "js/tmpl.js",
"ignore": [
"/*.*",
"css",
"js/demo.js",
"test"
]
}
39 changes: 39 additions & 0 deletions test/scenarios/bower/data/bower_components/bootstrap/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "bootstrap",
"description": "The most popular front-end framework for developing responsive, mobile first projects on the web.",
"version": "3.3.4",
"keywords": [
"css",
"js",
"less",
"mobile-first",
"responsive",
"front-end",
"framework",
"web"
],
"homepage": "http://getbootstrap.com",
"main": [
"less/bootstrap.less",
"dist/css/bootstrap.css",
"dist/js/bootstrap.js",
"dist/fonts/glyphicons-halflings-regular.eot",
"dist/fonts/glyphicons-halflings-regular.svg",
"dist/fonts/glyphicons-halflings-regular.ttf",
"dist/fonts/glyphicons-halflings-regular.woff",
"dist/fonts/glyphicons-halflings-regular.woff2"
],
"ignore": [
"/.*",
"_config.yml",
"CNAME",
"composer.json",
"CONTRIBUTING.md",
"docs",
"js/tests",
"test-infra"
],
"dependencies": {
"jquery": ">= 1.9.1"
}
}
23 changes: 23 additions & 0 deletions test/scenarios/bower/data/bower_components/fontawesome/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "font-awesome",
"description": "Font Awesome",
"version": "4.3.0",
"keywords": [],
"homepage": "http://fontawesome.io",
"dependencies": {},
"devDependencies": {},
"license": ["OFL-1.1", "MIT", "CC-BY-3.0"],
"main": [
"./css/font-awesome.css",
"./fonts/*"
],
"ignore": [
"*/.*",
"*.json",
"src",
"*.yml",
"Gemfile",
"Gemfile.lock",
"*.md"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"name": "blueimp-file-upload",
"version": "9.9.4",
"title": "jQuery File Upload",
"description": "File Upload widget with multiple file selection, drag&amp;drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.",
"keywords": [
"jquery",
"file",
"upload",
"widget",
"multiple",
"selection",
"drag",
"drop",
"progress",
"preview",
"cross-domain",
"cross-site",
"chunk",
"resume",
"gae",
"go",
"python",
"php",
"bootstrap"
],
"homepage": "https://github.com/blueimp/jQuery-File-Upload",
"author": {
"name": "Sebastian Tschan",
"url": "https://blueimp.net"
},
"maintainers": [
{
"name": "Sebastian Tschan",
"url": "https://blueimp.net"
}
],
"repository": {
"type": "git",
"url": "git://github.com/blueimp/jQuery-File-Upload.git"
},
"bugs": "https://github.com/blueimp/jQuery-File-Upload/issues",
"licenses": [
{
"type": "MIT",
"url": "http://www.opensource.org/licenses/MIT"
}
],
"dependencies": {
"jquery": ">=1.6",
"blueimp-tmpl": ">=2.5.4",
"blueimp-load-image": ">=1.13.0",
"blueimp-canvas-to-blob": ">=2.1.1"
},
"main": [
"css/jquery.fileupload.css",
"css/jquery.fileupload-ui.css",
"css/jquery.fileupload-noscript.css",
"css/jquery.fileupload-ui-noscript.css",
"js/cors/jquery.postmessage-transport.js",
"js/cors/jquery.xdr-transport.js",
"js/vendor/jquery.ui.widget.js",
"js/jquery.fileupload.js",
"js/jquery.fileupload-process.js",
"js/jquery.fileupload-validate.js",
"js/jquery.fileupload-image.js",
"js/jquery.fileupload-audio.js",
"js/jquery.fileupload-video.js",
"js/jquery.fileupload-ui.js",
"js/jquery.fileupload-jquery-ui.js",
"js/jquery.fileupload-angular.js",
"js/jquery.iframe-transport.js"
],
"ignore": [
"/*.*",
"/cors",
"css/demo-ie8.css",
"css/demo.css",
"css/style.css",
"js/app.js",
"js/main.js",
"server",
"test"
]
}
Loading

0 comments on commit 03fc848

Please sign in to comment.