README.md in bower-rails-0.9.2 vs README.md in bower-rails-0.10.0

- old
+ new

@@ -2,15 +2,15 @@ =========== [![Gem Version](http://img.shields.io/gem/v/bower-rails.svg)][gem] [![Code Climate](http://img.shields.io/codeclimate/github/42dev/bower-rails.svg)][codeclimate] [![Dependency Status](http://img.shields.io/gemnasium/SergeyKishenin/bower-rails.svg)][gemnasium] -[![Build Status](https://travis-ci.org/42dev/bower-rails.svg?branch=master)][travis] +[![Build Status](https://travis-ci.org/rharriso/bower-rails.svg?branch=master)][travis] [![Coverage Status](https://coveralls.io/repos/42dev/bower-rails/badge.png)][coveralls] [gem]: https://rubygems.org/gems/bower-rails -[travis]: https://travis-ci.org/42dev/bower-rails +[travis]: https://travis-ci.org/rharriso/bower-rails [gemnasium]: https://gemnasium.com/SergeyKishenin/bower-rails [codeclimate]: https://codeclimate.com/github/42dev/bower-rails [coveralls]: https://coveralls.io/r/42dev/bower-rails Bower support for Rails projects. Dependency file is bower.json in Rails root dir or Bowerfile if you use DSL. @@ -21,16 +21,18 @@ **Requirements** * [node](http://nodejs.org) ([on github](https://github.com/joyent/node)) * [bower](https://github.com/bower/bower) (>= 0.10.0) installed with npm +NOTE: If you install `node` via package manager with `sudo apt-get install nodejs` you'll also need to install `nodejs-legacy` with `sudo apt-get install nodejs-legacy`. See [#91](https://github.com/42dev/bower-rails/issues/91) + **Install** in Gemfile ``` Ruby - gem "bower-rails", "~> 0.9.1" + gem "bower-rails", "~> 0.10.0" ``` ##JSON configuration Bower-rails now supports the standard [bower package](https://github.com/bower/bower#defining-a-package) format out-of-the-box. Simply place your bower.json file the Rails root directory to start. Using the standard format will default all bower components to be installed under the `vendor` directory. @@ -90,10 +92,13 @@ # get from a github repo asset "secret_logic", "1.0.0", github: "initech/secret_logic" # get a specific revision from a git endpoint asset "secret_logic", github: "initech/secret_logic", ref: '0adff' + +# get a single file +asset "three.js", "https://raw.github.com/mrdoob/three.js/master/build/three.js" ``` But the default value can be overridden by `assets_path` method: ``` ruby @@ -122,10 +127,27 @@ end ``` NOTE: Available groups are `:lib` and `:vendor`. Others are not allowed according to the Rails convention. NOTE: All the assets should be stored in `/assets` subdirectory so putting it under `./vendor/js` directory is unavailable +You can extend `main` directive to include some missing files using `main_files` +option as parameter or in a block: + +``` ruby +# via argument +asset "moment", "2.10.1", main_files: ["./locale/en-gb.js"] + +# or in block +asset "moment", "2.10.1" do + main_files [ + "./locale/en-gb.js", + "./locale/fr.js", + "./locale/lv.js" + ] +end +``` + And finally, you can specify the assets to be in the devDependencies block: ``` ruby asset "backbone", "1.1.1" @@ -199,10 +221,13 @@ # Invokes rake bower:clean before precompilation. Defaults to false bower_rails.clean_before_precompile = true # Invokes rake bower:install:deployment instead rake bower:install. Defaults to false bower_rails.use_bower_install_deployment = true + + # Passes the -F option to rake bower:install or rake bower:install:deployment. Defaults to false. + bower_rails.force_install = true end ``` If you are using Rails version < 4.0.0 then you are to require `bower_rails.rb` initializer manually in `application.rb`: @@ -234,10 +259,28 @@ ```bash rake bower:install['-f'] ``` +##Capistrano 3 Configuration + +While using Capistrano 3 and Capistrano Rails gem, it's needed to run bower install before assets compile. Add the following code to your deploy.rb, it will run `rake bower:install` before compiling the assets. CI=true flag is used not to ask for the analytics at the first bower install. + +``` +namespace :bower do + desc 'Install bower' + task :install do + on roles(:web) do + within release_path do + execute :rake, 'bower:install CI=true' + end + end + end +end +before 'deploy:compile_assets', 'bower:install' +``` + ##Bower Configuration If you provide a `.bowerrc` in the rails project root, bower-rails will use it for bower configuration. Some .bowerrc options are not supported: `directory`, `cwd`, and `interactive`. Bower-rails will ignore the `directory` property and instead will use the automatically generated asset path. @@ -252,6 +295,13 @@ Remember that you should have [bower installed](#bower-installation) either locally in your project or on a remote server. ##Bower Main Files -Each bower component should follow the [bower.json spec](https://github.com/bower/bower.json-spec) which designates a recommended `main` directive that lists the primary files of that component. You may choose to reference these files if you are using the asset pipeline, in which case other extraneous includes of the bower component are not needed. The `rake bower:clean` task removes every file that isn't listed in the `main` directive, if the component specifies a `main` directive. Otherwise, the library will remain as bower installed it. It supports wildcards in files listed in `main` directive. +Each bower component should follow the [bower.json spec](https://github.com/bower/bower.json-spec) +which designates a recommended `main` directive that lists the primary files of +that component. You may choose to reference these files if you are using the asset +pipeline, in which case other extraneous includes of the bower component are not needed. +The `rake bower:clean` task removes every file that isn't listed in the `main` directive, +if the component specifies a `main` directive. Remember that you can extend the `main` directive +in [ruby DSL configuration](#ruby-dsl-configuration). Otherwise, the library will remain as bower installed it. It supports wildcards +in files listed in `main` directive.