Code Monkey home page Code Monkey logo

asset's Introduction

Asset

Asset manager for lazy people (think homebrew for assets). Somewhat defunct unless someone wants to maintain it, otherwise I recommend component, a more robust successor.

Installation

$ npm install -g asset

Usage

 Usage: asset [command] [options]

 Commands:

   install <name ...>   installs the given asset <name ...>
   search  [query]      search available assets with optional [query]
   info  <name ...>     display verbose information for the given asset <name ...>
   none                 install dependencies from ./assets.json

 Options:

   -c, --compress    compress assets
   -o, --out <dir>   output directory defaulting to ./public
   -V, --version     output program version
   -h, --help        display help information

Examples

Installing Several Assets

By default asset installs to ./public.

  $ asset raphael jquery

   install : [email protected]
   install : [email protected]
  download : [email protected]
  complete : [email protected] public/jquery.js
  download : [email protected]
  complete : [email protected] public/raphael.js

Asset names accept an optional version and modifiers, taking the form:

<name> ['@' version] [':' 'compress']

To install all assets (that support compression) as compressed, we can use the --compress flag:

  $ asset jquery raphael --compress

However this can be done at the asset-level as well using the :compress modifier:

  $ asset [email protected]:compress raphael

        install : [email protected]
        install : [email protected]
       download : [email protected]
       complete : [email protected] public/jquery.min.js
       download : [email protected]
       complete : [email protected] public/raphael.js

Install Destination

Tweak the output directory with -o, --out <dir>.

  $ asset raphael g.raphael g.pie -o public/javascripts

   install : [email protected]
   install : [email protected]
   install : [email protected]
  download : [email protected]
  complete : [email protected] public/javascripts/raphael.js
  download : [email protected]
  complete : [email protected] public/javascripts/g.raphael.js
  download : [email protected]
  complete : [email protected] public/javascripts/g.pie.js

Alternatively passing a directory name containing "/" will work as well, since asset knows this is not an asset, and becomes equivalent to --out <dir>:

   $ asset raphael jquery public/javascripts

Dependency Resolution

Asset currently supports extremely basic dependency mapping, for example below is the output of installing g.pie, which depends on g.raphael, which in turn depends on raphael itself.

$ asset g.pie

      install : [email protected]
   dependency : [email protected]
      install : [email protected]
   dependency : [email protected]
      install : [email protected]
     download : [email protected]
     complete : [email protected] public/raphael.js
     download : [email protected]
     complete : [email protected] public/g.raphael.js
     download : [email protected]
     complete : [email protected] public/g.pie.js

Asset Information

Inspect verbose asset information:

$ asset info jquery g.raphael

         name : jquery
  description : jquery core framework
          url : http://code.jquery.com/jquery-{version}.min.js
      version : 1.5.2
     filename : jquery.js

         name : g.raphael
  description : charting for raphael
          url : https://github.com/DmitryBaranovskiy/g.raphael/raw/v{version}/g.raphael-min.js
      version : 0.4.1
     filename : g.raphael.js
 dependencies : raphael

Installation Destination

To install a specific version, we can use the @ character:

Search Repository

We can search the repository with an optional query, listing available assets and their default versions:

 $ asset raphael

  install : [email protected]
 download : [email protected]
 complete : [email protected] public/raphael.js

assets.json

By adding ./assets.json you can store application dependencies, and install them quickly and easily with a single command asset. For example this file may contain one or more deps:

 {
     "g.raphael": "0.4.1"
   , "jquery": "1.5.2"
   , "modernizr": "1.7"
 }

Installed with the command:

 $ asset
 
    install : [email protected]
 dependency : [email protected]
    install : [email protected]
    install : [email protected]
    install : [email protected]
   download : [email protected]
   complete : [email protected] public/jquery.js
   download : [email protected]
   complete : [email protected] public/raphael.js
   download : [email protected]
   complete : [email protected] public/g.raphael.js
   download : [email protected]
   complete : [email protected] public/modernizr.js

Configuration

By default options must be passed via the CLI, however asset will also check the ./.asset and ~/.asset JSON configuration files, so for example a project may set { "out": "public/javascripts" } if we are mainly working with javascript, however the CLI options will always take precedence.

The Repository

By default the repo bundled with asset is used, however the ~/.assets configuration file is checked first. Perhaps down the road if/when asset becomes more flexible a repo will be hosted, for now simply fork the project edit ./assets.json, and send a pull request.

License

(The MIT License)

Copyright (c) 2011 TJ Holowaychuk <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

asset's People

Contributors

caged avatar garrensmith avatar jgallen23 avatar mcantelon avatar nulltask avatar rricard avatar tj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

asset's Issues

Fetch / update repo from HEAD

any version should be able to update the repo, without updating the program, this will allow me to constantly push new data without releasing all the time

asset update

Would be great to use asset like a package manager for assets. I really like the way bundler handles dependencies and scoped versions for updating.

Still alive

Did you replace this in your workflow with something better?

assets.json sort

For ease of scanning as the assets.json file scales (there are many many assets yet to come), should this file be sorted alphabetically?

uninstall option

And, while we're at it, could we also have clean to remove outdated versions?

Respect deps of others

currently when installing two assets that have the same or similar deps, they are installed several times

asset none

local file ./assets.json

{
    "g.raphael": "0.4.1"
  , "jquery": "1.5.2"
  , "modernizr": "1.7"
}

and issuing

$ asset
    asset <name ...> required

does not install any assets

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.