Skip to content

Loading…

Semver support #35

Closed
wants to merge 6 commits into from

2 participants

@logicalparadox

Added semver support using node-semver.

Got'cha's:

  • As not all assets listed use x.x.x version notation, if a semver comparison comes up empty, it will assume a literal version number and attempt to download at the most recent url using that version number.
  • Most recent url is grabbed from index 0 in the array of versions for a given asset.

The following work:

$ asset install move.js@'>0.0.2'
// installs move.js@0.0.3

$ asset install move.js@0.0.x
// installs move.js@0.0.3

Dependancies can also use semver notation.

Let me know if you have any questions/suggestions.

@tj
Owner
tj commented

awesome :D with all the array madness, it's probably time that we come up with some kind of repo for these. I want to say gists, because then it's easily managed by the community, but at the same time that could get ugly

@logicalparadox

Array madness is right :P The alternative, which may be better depending on how we proceed, is to just list version numbers that are available. Set that aside for a moment though.

Gists could get a little out of hand. I still think the current model (fork/pull request) is best provided we drop the single repo file for a more segmented approach to assets. Homebrew uses formula, for example. But then again, currently you would be managing those pull requests so that is up to you.

Let me know your thoughts, but I will start there for now.

@tj
Owner
tj commented

yeah, the issue with that is when projects evolve and gain deps etc it'll be pretty messy. the fork thing is pretty annoying, even for myself to release every time there's new data. I can set up a simple registry on my linode. I was thinking something easy/quick would be to allow anyone to manipulate the registry but only a few of us moderate it and just ok changes made

@logicalparadox

Are you thinking more of command line like npm or something web based?

Let me know how I can help.

@tj
Owner
tj commented

something web would be better i think. less crap. this way they can just authenticate via twitter, change any of the packages but we would have to just take a quick look to make sure they're not just defacing packages

@logicalparadox

How about authentication via github? If you own the package you can register it and modify its details. If so, its locked from public editing. I realize this wouldn't cover all packages but it would handle a considerable amount of oversight.

@tj
Owner
tj commented

i think that's the thing though, the owners of these packages might not care to edit these things, so I think it's something the community needs to take care of, we just need an easier way of doing it, and an easier way to update (no update at all :D) to expose new packages / changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Showing with 458 additions and 383 deletions.
  1. +413 −363 assets.json
  2. +22 −16 bin/asset
  3. +3 −2 lib/asset.js
  4. +19 −1 lib/installer.js
  5. +1 −1 package.json
View
776 assets.json
@@ -1,364 +1,414 @@
{
- "blueprint": {
- "base": "https://github.com/joshuaclayton/blueprint-css/raw/v{version}/blueprint",
- "description": "css framework",
- "tags": ["css"],
- "files": [
- "ie.css",
- "print.css",
- "screen.css",
- "src/forms.css",
- "src/grid.css",
- "src/grid.png",
- "src/ie.css",
- "src/print.css",
- "src/reset.css",
- "src/typography.css"
- ],
- "version": "1.0"
- },
- "bootstrap": {
- "url": "https://github.com/twitter/bootstrap/raw/v{version}/bootstrap-{version}.css",
- "compressed": "bootstrap-{version}.min.css",
- "description": "CSS toolkit from Twitter",
- "tags": ["css", "twitter"],
- "version": "1.1.1"
- },
- "bootstrap-less": {
- "base": "https://github.com/twitter/bootstrap/raw/v{version}",
- "description": "CSS toolkit from Twitter (LESS Source)",
- "tags": ["css", "twitter", "less"],
- "files": [
- "lib/bootstrap.less",
- "lib/forms.less",
- "lib/patterns.less",
- "lib/preboot.less",
- "lib/reset.less",
- "lib/scaffolding.less",
- "lib/tables.less",
- "lib/type.less"
- ],
- "version": "1.1.1"
- },
- "eventemitter2": {
- "url": "https://github.com/hij1nx/EventEmitter2/blob/v{version}/lib/eventemitter2.js",
- "description": "nodejs-style event emitter with namespaces, wildcards, TTL etc",
- "tags": ["events", "emitter", "node"],
- "version": "0.4.1"
- },
- "superagent": {
- "url": "https://raw.github.com/visionmedia/superagent/{version}/superagent.js",
- "description": "Ajax with less suck",
- "tags": ["request", "ajax"],
- "version": "0.1.1"
- },
- "caustic": {
- "url": "https://github.com/visionmedia/caustic/raw/{version}/build/caustic.js",
- "description": "Experimental view system for jQuery",
- "tags": ["templates", "view"],
- "version": "0.0.5"
- },
- "move.js": {
- "url": "https://github.com/visionmedia/move.js/raw/{version}/move.js",
- "description": "CSS3 JavaScript animation framework",
- "tags": ["css", "animation"],
- "version": "0.0.2"
- },
- "jade": {
- "url": "https://github.com/visionmedia/jade/raw/{version}/jade.js",
- "description": "jade template engine",
- "tags": ["template"],
- "version": "0.10.4"
- },
- "three.js": {
- "url": "https://github.com/mrdoob/three.js/raw/r{version}/build/Three.js",
- "description": "3d javascript engine",
- "tags": ["js", "3d"],
- "filename": "three.js",
- "version": "42"
- },
- "underscore": {
- "url": "https://github.com/documentcloud/underscore/raw/{version}/underscore.js",
- "description": "javascript's utility belt",
- "compressed": "underscore-min.js",
- "tags": ["js", "utilities"],
- "version": "1.1.7"
- },
- "mootools": {
- "url": "http://mootools.net/download/get/mootools-core-{version}-full-compat.js",
- "description": "mootools core javascript framework",
- "compressed": "mootools-core-{version}-full-compat-yc.js",
- "filename": "mootools.js",
- "tags": ["js"],
- "version": "1.3.1"
- },
- "raphael": {
- "url": "https://github.com/DmitryBaranovskiy/raphael/raw/v{version}/raphael.js",
- "description": "raphael vector library",
- "compressed": "raphael-min.js",
- "tags": ["js"],
- "version": "1.4.7"
- },
- "g.raphael": {
- "url": "https://github.com/DmitryBaranovskiy/g.raphael/raw/v{version}/g.raphael.js",
- "description": "charting for raphael",
- "compressed": "g.raphael-min.js",
- "tags": ["js", "raphael"],
- "version": "0.4.1",
- "dependencies": {
- "raphael": "1.4.7"
- }
- },
- "g.bar": {
- "url": "https://github.com/DmitryBaranovskiy/g.raphael/raw/v{version}/g.bar.js",
- "description": "bar charting for raphael",
- "compressed": "g.bar-min.js",
- "tags": ["js", "raphael"],
- "version": "0.4.1",
- "dependencies": {
- "g.raphael": "0.4.1"
- }
- },
- "g.dot": {
- "url": "https://github.com/DmitryBaranovskiy/g.raphael/raw/v{version}/g.dot.js",
- "description": "dot charting for raphael",
- "compressed": "g.dot-min.js",
- "tags": ["js", "raphael"],
- "version": "0.4.1",
- "dependencies": {
- "g.raphael": "0.4.1"
- }
- },
- "g.line": {
- "url": "https://github.com/DmitryBaranovskiy/g.raphael/raw/v{version}/g.line.js",
- "description": "line charting for raphael",
- "compressed": "g.line-min.js",
- "tags": ["js", "raphael"],
- "version": "0.4.1",
- "dependencies": {
- "g.raphael": "0.4.1"
- }
- },
- "g.pie": {
- "url": "https://github.com/DmitryBaranovskiy/g.raphael/raw/v{version}/g.pie.js",
- "description": "pie charting for raphael",
- "compressed": "g.pie-min.js",
- "tags": ["js", "raphael"],
- "version": "0.4.1",
- "dependencies": {
- "g.raphael": "0.4.1"
- }
- },
- "jquery": {
- "url": "http://code.jquery.com/jquery-{version}.js",
- "description": "jquery core framework",
- "compressed": "jquery-{version}.min.js",
- "tags": ["js", "jquery"],
- "filename": "jquery.js",
- "version": "1.6.2"
- },
- "jquery.validate": {
- "url":"http://ajax.aspnetcdn.com/ajax/jquery.validate/{version}/jquery.validate.js",
- "compressed": "jquery.validate.min.js",
- "description": "form validation for jquery",
- "tags": ["js", "jquery"],
- "version": "1.8",
- "dependencies": {
- "jquery": "1.5.1"
- }
- },
- "prototype": {
- "url": "http://prototypejs.org/assets/2008/9/29/prototype-{version}.js",
- "description": "prototype core framework",
- "filename": "prototype.js",
- "tags": ["js"],
- "version": "1.6.0.3"
- },
- "script.js": {
- "url": "https://github.com/ded/script.js/blob/master/dist/script.js",
- "description": "Asyncronous JavaScript loader and dependency manager",
- "tags": ["js"],
- "version": "1.3"
- },
- "jquery-mobile": {
- "url": "http://code.jquery.com/mobile/{version}/jquery.mobile-{version}.js",
- "description": "touch-optimized web framework for smartphones & tablets",
- "filename": "jquery.mobile.js",
- "tags": ["js", "jquery"],
- "version": "1.0a4",
- "dependencies": {
- "jquery": "1.5.1"
- }
- },
- "processing.js": {
- "url": "http://processingjs.org/content/download/processing-js-{version}/processing-{version}.js",
- "description": "a port of the Processing visualization language",
- "filename": "processing.js",
- "tags": ["js"],
- "version": "1.1.0"
- },
- "d3": {
- "url": "https://github.com/mbostock/d3/raw/v{version}/d3.js",
- "description": "A JavaScript visualization library for HTML and SVG.",
- "filename": "d3.js",
- "tags": ["js", "svg"],
- "version": "1.17.0"
- },
- "d3.behavior": {
- "url": "https://github.com/mbostock/d3/raw/v{version}/d3.behavior.js",
- "description": "Event module for d3. A JavaScript visualization library for HTML and SVG.",
- "tags": ["js", "svg"],
- "version": "1.11.0",
- "dependencies": {
- "d3": "1.17.0"
- }
- },
- "d3.chart": {
- "url": "https://github.com/mbostock/d3/raw/v{version}/d3.chart.js",
- "description": "Chart module for d3. A JavaScript visualization library for HTML and SVG.",
- "tags": ["js", "svg"],
- "version": "1.11.0",
- "dependencies": {
- "d3": "1.17.0"
- }
- },
- "d3.csv": {
- "url": "https://github.com/mbostock/d3/raw/v{version}/d3.csv.js",
- "description": "CSV parser module for d3. A JavaScript visualization library for HTML and SVG.",
- "tags": ["js", "svg"],
- "version": "1.11.0",
- "dependencies": {
- "d3": "1.17.0"
- }
- },
- "d3.geo": {
- "url": "https://github.com/mbostock/d3/raw/v{version}/d3.geo.js",
- "description": "Geo module for d3. A JavaScript visualization library for HTML and SVG.",
- "tags": ["js", "svg"],
- "version": "1.11.0",
- "dependencies": {
- "d3": "1.17.0"
- }
- },
- "d3.geom": {
- "url": "https://github.com/mbostock/d3/raw/v{version}/d3.geom.js",
- "description": "Geometry module for d3. A JavaScript visualization library for HTML and SVG.",
- "tags": ["js", "svg"],
- "version": "1.11.0",
- "dependencies": {
- "d3": "1.17.0"
- }
- },
- "d3.layout": {
- "url": "https://github.com/mbostock/d3/raw/v{version}/d3.layout.js",
- "description": "Layout module for d3. A JavaScript visualization library for HTML and SVG.",
- "tags": ["js", "svg"],
- "version": "1.11.0",
- "dependencies": {
- "d3": "1.17.0"
- }
- },
- "d3.time": {
- "url": "https://github.com/mbostock/d3/raw/v{version}/d3.time.js",
- "description": "Time module for d3. A JavaScript visualization library for HTML and SVG.",
- "tags": ["js", "svg"],
- "version": "1.11.0",
- "dependencies": {
- "d3": "1.17.0"
- }
- },
- "protovis": {
- "url": "https://github.com/mbostock/protovis/raw/v{version}/protovis.js",
- "description": "A visualization toolkit for JavaScript using SVG.",
- "tags": ["js", "svg"],
- "version": "3.3.1"
- },
- "polymaps": {
- "url": "https://github.com/simplegeo/polymaps/raw/v{version}/polymaps.js",
- "description": "Polymaps is a free JavaScript library for making dynamic, interactive maps in modern web browsers.",
- "tags": ["js", "maps", "mapping"],
- "version": "2.5.0"
- },
- "date.js": {
- "url": "http://datejs.googlecode.com/files/date.js",
- "description": "Datejs is an open source JavaScript Date library for parsing, formatting and processing.",
- "tags": ["js", "date", "time"],
- "version": "1.0 Alpha-1"
- },
- "backbone": {
- "url": "https://github.com/documentcloud/backbone/raw/{version}/backbone.js",
- "compressed": "backbone-min.js",
- "description": "Backbone supplies structure to Javascript Apps by providing models, views, collections, and events",
- "tags": ["js"],
- "version": "0.5.1"
- },
- "zepto": {
- "url": "https://github.com/madrobby/zepto/raw/v{version}/src/zepto.js",
- "description": "zepto.js is a minimalist inlinable framework for mobile WebKit browsers, with a jQuery-like chaining syntax",
- "tags": ["js"],
- "version": "0.5"
- },
- "iscroll": {
- "url": "https://github.com/cubiq/iscroll/raw/master/src/iscroll.js",
- "description": "Hardware accelerated scroll for mobile webkit",
- "tags": ["js"],
- "version": "4.0"
- },
- "iscroll-lite": {
- "url": "https://github.com/cubiq/iscroll/raw/master/src/iscroll-lite.js",
- "description": "Hardware accelerated scroll for mobile webkit",
- "tags": ["js"],
- "version": "4.0"
- },
- "modernizr": {
- "url": "https://github.com/Modernizr/Modernizr/raw/v{version}/modernizr.js",
- "description": "Feature detection to test browsers against upcoming features",
- "tags": ["js", "css", "detection"],
- "version": "1.7"
- },
- "yepnope": {
- "url": "https://github.com/SlexAxton/yepnope.js/raw/v{version}/yepnope.js",
- "description": "Conditional loader for polyfills",
- "tags": ["js", "detection"],
- "version": "1.0.1"
- },
- "live.js": {
- "url": "http://livejs.com/live.js",
- "description": "Live.js makes sure you're always looking at the latest version of the page you're working on, whether you're writing HTML, CSS or Javascript",
- "tags": ["js"],
- "version": "3.0"
- },
- "fidel": {
- "url": "https://raw.github.com/jgallen23/fidel/master/fidel.js",
- "compressed": "fidel.min.js",
- "description": "Fidel is a simple, lightweight ui controller library",
- "tags": ["js"],
- "version": "1.1.2"
- },
- "str.js": {
- "url": "https://raw.github.com/jgallen23/str.js/master/str.js",
- "description": "A string utility library",
- "tags": ["js", "string", "template", "format"],
- "version": "1.0.3"
- },
- "resistance": {
- "url": "https://raw.github.com/jgallen23/resistance/master/resistance.js",
- "compressed": "resistance.min.js",
- "description": "A simple async flow control library",
- "tags": ["js", "flow", "async"],
- "version": "1.0.1"
- },
- "pagie": {
- "url": "https://raw.github.com/jgallen23/pagie/master/pagie.js",
- "compressed": "pagie.min.js",
- "description": "A simple pagination class",
- "tags": ["js", "pagination"],
- "version": "0.0.1"
- },
- "mustache.js": {
- "url": "https://raw.github.com/janl/mustache.js/{version}/mustache.js",
- "description": "Minimal templating with {{mustaches}} in JavaScript",
- "version": "0.3.0",
- "tags": ["js", "templates", "templating"]
- }
-}
+ "blueprint": [
+ {
+ "base": "https://github.com/joshuaclayton/blueprint-css/raw/v{version}/blueprint",
+ "description": "css framework",
+ "tags": ["css"],
+ "files": [
+ "ie.css",
+ "print.css",
+ "screen.css",
+ "src/forms.css",
+ "src/grid.css",
+ "src/grid.png",
+ "src/ie.css",
+ "src/print.css",
+ "src/reset.css",
+ "src/typography.css"
+ ],
+ "version": "1.0"
+ }
+ ],
+ "bootstrap": [
+ {
+ "url": "https://github.com/twitter/bootstrap/raw/v{version}/bootstrap-{version}.css",
+ "compressed": "bootstrap-{version}.min.css",
+ "description": "CSS toolkit from Twitter",
+ "tags": ["css", "twitter"],
+ "version": "1.1.1"
+ }
+ ],
+ "bootstrap-less": [
+ {
+ "base": "https://github.com/twitter/bootstrap/raw/v{version}",
+ "description": "CSS toolkit from Twitter (LESS Source)",
+ "tags": ["css", "twitter", "less"],
+ "files": [
+ "lib/bootstrap.less",
+ "lib/forms.less",
+ "lib/patterns.less",
+ "lib/preboot.less",
+ "lib/reset.less",
+ "lib/scaffolding.less",
+ "lib/tables.less",
+ "lib/type.less"
+ ],
+ "version": "1.1.1"
+ }
+ ],
+ "eventemitter2": [
+ {
+ "url": "https://github.com/hij1nx/EventEmitter2/blob/v{version}/lib/eventemitter2.js",
+ "description": "nodejs-style event emitter with namespaces, wildcards, TTL etc",
+ "tags": ["events", "emitter", "node"],
+ "version": "0.4.1"
+ }
+ ],
+ "superagent": [
+ {
+ "url": "https://raw.github.com/visionmedia/superagent/{version}/superagent.js",
+ "description": "Ajax with less suck",
+ "tags": ["request", "ajax"],
+ "version": "0.1.1"
+ },
+ {
+ "url": "https://raw.github.com/visionmedia/superagent/{version}/superagent.js",
+ "description": "Ajax with less suck",
+ "tags": ["request", "ajax"],
+ "version": "0.1.0"
+ },
+ {
+ "url": "https://raw.github.com/visionmedia/superagent/{version}/superagent.js",
+ "description": "Ajax with less suck",
+ "tags": ["request", "ajax"],
+ "version": "0.0.1"
+ }
+ ],
+ "caustic": [
+ {
+ "url": "https://github.com/visionmedia/caustic/raw/{version}/build/caustic.js",
+ "description": "Experimental view system for jQuery",
+ "tags": ["templates", "view"],
+ "version": "0.0.5"
+ }
+ ],
+ "move.js": [
+ {
+ "url": "https://github.com/visionmedia/move.js/raw/{version}/move.js",
+ "description": "CSS3 JavaScript animation framework",
+ "tags": ["css", "animation"],
+ "version": "0.0.3"
+ },
+ {
+ "url": "https://github.com/visionmedia/move.js/raw/{version}/move.js",
+ "description": "CSS3 JavaScript animation framework",
+ "tags": ["css", "animation"],
+ "version": "0.0.2"
+ },
+ {
+ "url": "https://github.com/visionmedia/move.js/raw/{version}/move.js",
+ "description": "CSS3 JavaScript animation framework",
+ "tags": ["css", "animation"],
+ "version": "0.0.1"
+ }
+ ],
+ "jade": [
+ {
+ "url": "https://github.com/visionmedia/jade/raw/{version}/jade.js",
+ "description": "jade template engine",
+ "tags": ["template"],
+ "version": "0.10.4"
+ }
+ ],
+ "three.js": [
+ {
+ "url": "https://github.com/mrdoob/three.js/raw/r{version}/build/Three.js",
+ "description": "3d javascript engine",
+ "tags": ["js", "3d"],
+ "filename": "three.js",
+ "version": "42"
+ }
+ ],
+ "underscore": [
+ {
+ "url": "https://github.com/documentcloud/underscore/raw/{version}/underscore.js",
+ "description": "javascript's utility belt",
+ "compressed": "underscore-min.js",
+ "tags": ["js", "utilities"],
+ "version": "1.1.7"
+ }
+ ],
+ "mootools": [
+ {
+ "url": "http://mootools.net/download/get/mootools-core-{version}-full-compat.js",
+ "description": "mootools core javascript framework",
+ "compressed": "mootools-core-{version}-full-compat-yc.js",
+ "filename": "mootools.js",
+ "tags": ["js"],
+ "version": "1.3.1"
+ }
+ ],
+ "raphael": [
+ {
+ "url": "https://github.com/DmitryBaranovskiy/raphael/raw/v{version}/raphael.js",
+ "description": "raphael vector library",
+ "compressed": "raphael-min.js",
+ "tags": ["js"],
+ "version": "1.4.7"
+ }
+ ],
+ "g.raphael": [
+ {
+ "url": "https://github.com/DmitryBaranovskiy/g.raphael/raw/v{version}/g.raphael.js",
+ "description": "charting for raphael",
+ "compressed": "g.raphael-min.js",
+ "tags": ["js", "raphael"],
+ "version": "0.4.1",
+ "dependencies": {
+ "raphael": "1.4.7"
+ }
+ }
+ ],
+ "g.bar": [
+ {
+ "url": "https://github.com/DmitryBaranovskiy/g.raphael/raw/v{version}/g.bar.js",
+ "description": "bar charting for raphael",
+ "compressed": "g.bar-min.js",
+ "tags": ["js", "raphael"],
+ "version": "0.4.1",
+ "dependencies": {
+ "g.raphael": "0.4.1"
+ }
+ }
+ ],
+ "g.dot": [
+ {
+ "url": "https://github.com/DmitryBaranovskiy/g.raphael/raw/v{version}/g.dot.js",
+ "description": "dot charting for raphael",
+ "compressed": "g.dot-min.js",
+ "tags": ["js", "raphael"],
+ "version": "0.4.1",
+ "dependencies": {
+ "g.raphael": "0.4.1"
+ }
+ }
+ ],
+ "g.line": [
+ {
+ "url": "https://github.com/DmitryBaranovskiy/g.raphael/raw/v{version}/g.line.js",
+ "description": "line charting for raphael",
+ "compressed": "g.line-min.js",
+ "tags": ["js", "raphael"],
+ "version": "0.4.1",
+ "dependencies": {
+ "g.raphael": "0.4.1"
+ }
+ }
+ ],
+ "g.pie": [
+ {
+ "url": "https://github.com/DmitryBaranovskiy/g.raphael/raw/v{version}/g.pie.js",
+ "description": "pie charting for raphael",
+ "compressed": "g.pie-min.js",
+ "tags": ["js", "raphael"],
+ "version": "0.4.1",
+ "dependencies": {
+ "g.raphael": "0.4.1"
+ }
+ }
+ ],
+ "jquery": [
+ {
+ "url": "http://code.jquery.com/jquery-{version}.js",
+ "description": "jquery core framework",
+ "compressed": "jquery-{version}.min.js",
+ "tags": ["js", "jquery"],
+ "filename": "jquery.js",
+ "version": "1.6.2"
+ }
+ ],
+ "jquery.validate": [
+ {
+ "url":"http://ajax.aspnetcdn.com/ajax/jquery.validate/{version}/jquery.validate.js",
+ "compressed": "jquery.validate.min.js",
+ "description": "form validation for jquery",
+ "tags": ["js", "jquery"],
+ "version": "1.8",
+ "dependencies": {
+ "jquery": "1.5.1"
+ }
+ }
+ ],
+ "prototype": [
+ {
+ "url": "http://prototypejs.org/assets/2008/9/29/prototype-{version}.js",
+ "description": "prototype core framework",
+ "filename": "prototype.js",
+ "tags": ["js"],
+ "version": "1.6.0.3"
+ }
+ ],
+ "script.js": [
+ {
+ "url": "https://github.com/ded/script.js/blob/master/dist/script.js",
+ "description": "Asyncronous JavaScript loader and dependency manager",
+ "tags": ["js"],
+ "version": "1.3"
+ }
+ ],
+ "jquery-mobile": [
+ {
+ "url": "http://code.jquery.com/mobile/{version}/jquery.mobile-{version}.js",
+ "description": "touch-optimized web framework for smartphones & tablets",
+ "filename": "jquery.mobile.js",
+ "tags": ["js", "jquery"],
+ "version": "1.0b2",
+ "dependencies": {
+ "jquery": "1.6.x"
+ }
+ }
+ ],
+ "processing.js": [
+ {
+ "url": "http://processingjs.org/content/download/processing-js-{version}/processing-{version}.js",
+ "description": "a port of the Processing visualization language",
+ "filename": "processing.js",
+ "tags": ["js"],
+ "version": "1.1.0"
+ }
+ ],
+ "d3": [
+ {
+ "base": "https://github.com/mbostock/d3/raw/v{version}",
+ "description": "A JavaScript visualization library for HTML and SVG.",
+ "tags": ["js", "svg"],
+ "files": [
+ "d3.js",
+ "d3.chart.js",
+ "d3.csv.js",
+ "d3.geo.js",
+ "d3.geom.js",
+ "d3.layout.js",
+ "d3.time.js"
+ ],
+ "version": "2.1.2"
+ }
+ ],
+ "protovis": [
+ {
+ "url": "https://github.com/mbostock/protovis/raw/v{version}/protovis.js",
+ "description": "A visualization toolkit for JavaScript using SVG.",
+ "tags": ["js", "svg"],
+ "version": "3.3.1"
+ }
+ ],
+ "polymaps": [
+ {
+ "url": "https://github.com/simplegeo/polymaps/raw/v{version}/polymaps.js",
+ "description": "Polymaps is a free JavaScript library for making dynamic, interactive maps in modern web browsers.",
+ "tags": ["js", "maps", "mapping"],
+ "version": "2.5.0"
+ }
+ ],
+ "date.js": [
+ {
+ "url": "http://datejs.googlecode.com/files/date.js",
+ "description": "Datejs is an open source JavaScript Date library for parsing, formatting and processing.",
+ "tags": ["js", "date", "time"],
+ "version": "1.0 Alpha-1"
+ }
+ ],
+ "backbone": [
+ {
+ "url": "https://github.com/documentcloud/backbone/raw/{version}/backbone.js",
+ "compressed": "backbone-min.js",
+ "description": "Backbone supplies structure to Javascript Apps by providing models, views, collections, and events",
+ "tags": ["js"],
+ "version": "0.5.1",
+ "dependencies": {
+ "underscore": "1.1.x"
+ }
+ }
+ ],
+ "zepto": [
+ {
+ "url": "https://github.com/madrobby/zepto/raw/v{version}/src/zepto.js",
+ "description": "zepto.js is a minimalist inlinable framework for mobile WebKit browsers, with a jQuery-like chaining syntax",
+ "tags": ["js"],
+ "version": "0.5"
+ }
+ ],
+ "iscroll": [
+ {
+ "url": "https://github.com/cubiq/iscroll/raw/master/src/iscroll.js",
+ "description": "Hardware accelerated scroll for mobile webkit",
+ "tags": ["js"],
+ "version": "4.0"
+ }
+ ],
+ "iscroll-lite": [
+ {
+ "url": "https://github.com/cubiq/iscroll/raw/master/src/iscroll-lite.js",
+ "description": "Hardware accelerated scroll for mobile webkit",
+ "tags": ["js"],
+ "version": "4.0"
+ }
+ ],
+ "modernizr": [
+ {
+ "url": "https://github.com/Modernizr/Modernizr/raw/v{version}/modernizr.js",
+ "description": "Feature detection to test browsers against upcoming features",
+ "tags": ["js", "css", "detection"],
+ "version": "1.7"
+ }
+ ],
+ "yepnope": [
+ {
+ "url": "https://github.com/SlexAxton/yepnope.js/raw/v{version}/yepnope.js",
+ "description": "Conditional loader for polyfills",
+ "tags": ["js", "detection"],
+ "version": "1.0.1"
+ }
+ ],
+ "live.js": [
+ {
+ "url": "http://livejs.com/live.js",
+ "description": "Live.js makes sure you're always looking at the latest version of the page you're working on, whether you're writing HTML, CSS or Javascript",
+ "tags": ["js"],
+ "version": "3.0"
+ }
+ ],
+ "fidel": [
+ {
+ "url": "https://raw.github.com/jgallen23/fidel/master/fidel.js",
+ "compressed": "fidel.min.js",
+ "description": "Fidel is a simple, lightweight ui controller library",
+ "tags": ["js"],
+ "version": "1.1.2"
+ }
+ ],
+ "str.js": [
+ {
+ "url": "https://raw.github.com/jgallen23/str.js/master/str.js",
+ "description": "A string utility library",
+ "tags": ["js", "string", "template", "format"],
+ "version": "1.0.3"
+ }
+ ],
+ "resistance": [
+ {
+ "url": "https://raw.github.com/jgallen23/resistance/master/resistance.js",
+ "compressed": "resistance.min.js",
+ "description": "A simple async flow control library",
+ "tags": ["js", "flow", "async"],
+ "version": "1.0.1"
+ }
+ ],
+ "pagie": [
+ {
+ "url": "https://raw.github.com/jgallen23/pagie/master/pagie.js",
+ "compressed": "pagie.min.js",
+ "description": "A simple pagination class",
+ "tags": ["js", "pagination"],
+ "version": "0.0.1"
+ }
+ ],
+ "mustache.js": [
+ {
+ "url": "https://raw.github.com/janl/mustache.js/{version}/mustache.js",
+ "description": "Minimal templating with {{mustaches}} in JavaScript",
+ "version": "0.3.0",
+ "tags": ["js", "templates", "templating"]
+ }
+ ]
+}
View
38 bin/asset
@@ -7,6 +7,7 @@
var asset = require('../')
, exec = require('child_process').exec
, tty = require('tty')
+ , path = require('path')
, fs = require('fs');
/**
@@ -157,7 +158,7 @@ process.on('exit', function(){ console.log(); });
function assetsFromObject(obj) {
var arr = [];
for (var asset in obj) {
- arr.push({ name: asset, version: obj[asset] });
+ arr.push({ name: asset });
}
return arr;
}
@@ -169,7 +170,11 @@ function assetsFromObject(obj) {
*/
function install(assets) {
- var install = asset.install(assets, repo, options.out);
+ var outpath = (options.out.charAt(0) != '/') ?
+ path.normalize(process.cwd() + '/' + options.out) :
+ options.out;
+
+ var install = asset.install(assets, repo, outpath);
install.on('unknown', function(asset){
abort('unregistered asset ' + asset.name);
@@ -184,15 +189,15 @@ function install(assets) {
});
install.on('file download', function(asset, file, res){
- log('download', name(asset) + ' ' + file);
+ log('download', name(asset) + ' ' + options.out + '/' + file);
});
install.on('dependency', function(asset, dep){
log('dependency', name(dep));
});
- install.on('complete', function(asset, path){
- log('complete', name(asset) + ' ' + path);
+ install.on('complete', function(asset, file){
+ log('complete', name(asset) + ' ' + options.out + '/' + path.basename(file));
});
install.on('complete files', function(asset, files){
@@ -207,18 +212,20 @@ function install(assets) {
/**
* Display info for asset `name`.
*
- * @param {String} name
+ * @param {String} query
*/
-function info(name){
- var asset = repo[name];
- if (!asset) abort('failed to lookup asset "' + name + '"');
- log('name', name);
- log('description', asset.description);
- log('url', asset.url);
- if (asset.version) log('version', asset.version);
- if (asset.filename) log('filename', asset.filename);
- if (asset.dependencies) log('dependencies', Object.keys(asset.dependencies).join(', '));
+function info(query){
+ asset.search(repo, query, function(name, entry) {
+ if(query == name) {
+ log('name', name);
+ log('description', entry.description);
+ log('url', entry.url);
+ if (entry.version) log('version', entry.version);
+ if (entry.filename) log('filename', entry.filename);
+ if (entry.dependencies) log('dependencies', Object.keys(entry.dependencies).join(', '));
+ }
+ });
}
/**
@@ -232,7 +239,6 @@ function search(query) {
, padding = 30
, height = size.shift()
, width = size.shift() - padding;
-
asset.search(repo, query, function(name, entry){
var desc = entry.description;
if (desc.length > width) {
View
5 lib/asset.js
@@ -39,7 +39,7 @@ exports.install = function(assets, repo, dest){
/**
* Search `repo` for `query`, invoking `fn(name, entry)`
- * per matching entry.
+ * per matching entry. Only searches most recent version's tags
*
* @param {Object} repo
* @param {String} query
@@ -49,8 +49,9 @@ exports.install = function(assets, repo, dest){
exports.search = function(repo, query, fn){
var names = Object.keys(repo);
+ var installer = new Installer(repo);
names.forEach(function(name){
- var entry = repo[name]
+ var entry = installer.lookup({ name: name })
, match = !query
|| ~name.indexOf(query)
|| ~entry.tags.indexOf(query);
View
20 lib/installer.js
@@ -10,6 +10,7 @@
*/
var EventEmitter = require('events').EventEmitter
+ , semver = require('semver')
, dirname = require('path').dirname
, basename = require('path').basename
, extname = require('path').extname
@@ -87,6 +88,23 @@ Installer.prototype.lookup = function(asset){
var entry = this.repo[asset.name];
if (!entry) return;
+ // versioning
+ var bestv = semver.maxSatisfying(
+ entry.map(function(v) {
+ return semver.clean(v.version);
+ }), asset.version);
+
+ // If not using semver valid versioning, return to first version in the array
+ // Side effect: can force a specific version that is not registered.
+ if (bestv) {
+ entry = entry.filter(function(a) {
+ return a.version == bestv;
+ })[0];
+ asset.version = bestv;
+ } else {
+ entry = entry[0];
+ }
+
// normalize filename
entry.filename = entry.filename || basename(entry.url);
@@ -165,7 +183,7 @@ Installer.prototype.downloadFile = function(asset, file, dest, fn){
var err = new Error('failed to download ' + url);
fn(err);
} else {
- self.emit('file download', asset, path, res);
+ self.emit('file download', asset, file, res);
mkdir(dest, 0755, function(err){
if (err) return fn(err);
fs.writeFile(path, body, function(err){
View
2 package.json
@@ -3,7 +3,7 @@
, "description": "Asset manager"
, "keywords": ["assets", "javascript", "css", "package manager"]
, "author": "TJ Holowaychuk <tj@vision-media.ca>"
- , "dependencies": { "request": "1.9.5", "mkdirp": "0.0.5" }
+ , "dependencies": { "request": "1.9.5", "mkdirp": "0.0.5", "semver": "1.0.9" }
, "bin": { "asset": "./bin/asset" }
, "main": "index"
, "engines": { "node": "0.4.x" }
Something went wrong with that request. Please try again.