README.md in bower-rails-0.7.3 vs README.md in bower-rails-0.8.0
- old
+ new
@@ -1,14 +1,20 @@
bower-rails
===========
-[![Gem Version](https://badge.fury.io/rb/bower-rails.png)](http://badge.fury.io/rb/bower-rails)
-[![Code Climate](https://codeclimate.com/github/42dev/bower-rails.png)](https://codeclimate.com/github/42dev/bower-rails)
-[![Dependency Status](https://gemnasium.com/SergeyKishenin/bower-rails.png)](https://gemnasium.com/SergeyKishenin/bower-rails)
-[![Build Status](https://travis-ci.org/42dev/bower-rails.png?branch=master)](https://travis-ci.org/42dev/bower-rails)
-[![Coverage Status](https://coveralls.io/repos/42dev/bower-rails/badge.png)](https://coveralls.io/r/42dev/bower-rails)
+[![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](http://img.shields.io/travis/mbj/concord/master.svg)][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/mbj/concord
+[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.
Check out [changelog][] for the latest changes and releases.
[changelog]: https://github.com/42dev/bower-rails/blob/master/CHANGELOG.md
@@ -20,11 +26,11 @@
**Install**
in Gemfile
``` Ruby
- gem "bower-rails", "~> 0.7.3"
+ gem "bower-rails", "~> 0.8.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.
@@ -82,11 +88,11 @@
asset "secret_logic", "1.0.0", git: "git@github.com:initech/secret_logic"
# get from a github repo
asset "secret_logic", "1.0.0", github: "initech/secret_logic"
-# get a specific revision from a git endpoint
+# get a specific revision from a git endpoint
asset "secret_logic", github: "initech/secret_logic", ref: '0adff'
```
But the default value can be overridden by `assets_path` method:
@@ -96,11 +102,11 @@
# Puts to ./vendor/assets/my_javascripts/bower_components
asset "backbone"
asset "moment"
```
-And finally, the `assets_path` method can be overridden by an option in a `group` call:
+The `assets_path` method can be overridden by an option in a `group` call:
``` ruby
assets_path "assets/javascript"
# Puts files under ./vendor/assets/js/bower_components
@@ -116,20 +122,60 @@
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
+And finally, you can specify the assets to be in the devDependencies block:
+
+``` ruby
+asset "backbone", "1.1.1"
+
+# Adds jasmine-sinon and jasmine-matchers to devDependencies
+dependency :dev_dependencies do
+ asset "jasmine-sinon" # Defaults to 'latest'
+ asset "jasmine-matchers" # Defaults to 'latest'
+end
+
+# Explicit dependency group notation ( not neccessary )
+dependency_group :dependencies do
+ asset "emberjs" # Defaults to 'latest'
+end
+```
+results in the following bower.json file:
+
+```
+{
+ "name": "dsl-generated dependencies",
+ "dependencies": {
+ "backbone": "1.1.1"
+ "angular": "1.2.18",
+ },
+ "devDependencies": {
+ "jasmine-sinon": "latest",
+ "jasmine-matchers": "latest"
+ }
+}
+```
+NOTE: Available dependency groups are `:dependencies` (default) and `:dev_dependencies`. Others are not allowed according to the Rails convention.
+
##Configuration
Change options in your `config/initializers/bower_rails.rb`:
``` ruby
BowerRails.configure do |bower_rails|
- # By default options are false
- bower_rails.install_before_precompile = true # invokes rake bower:install before precompilation
- bower_rails.resolve_before_precompile = true # invokes rake bower:resolve before precompilation
- bower_rails.clean_before_precompile = true # invokes rake bower:clean before precompilation
+ # Tell bower-rails what path should be considered as root. Defaults to Dir.pwd
+ bower_rails.root_path = Dir.pwd
+
+ # Invokes rake bower:install before precompilation. Defaults to false
+ bower_rails.install_before_precompile = true
+
+ # Invokes rake bower:resolve before precompilation. Defaults to false
+ bower_rails.resolve_before_precompile = true
+
+ # Invokes rake bower:clean before precompilation. Defaults to false
+ bower_rails.clean_before_precompile = true
end
```
If you are using Rails version < 4.0.0 then you are to require `bower_rails.rb` initializer manually in `application.rb`:
@@ -146,11 +192,12 @@
##Rake tasks
Once you are done with `bower.json` or `Bowerfile` you can run
-* `rake bower:install` to install js components
-* `rake bower:update` to update js components
+* `rake bower:install` to install packages
+* `rake bower:install:deployment` to install packages from bower.json
+* `rake bower:update` to update packages
* `rake bower:update:prune` to update components and uninstall extraneous packages
* `rake bower:list` to list all packages
* `rake bower:clean` to remove all files not listed as [main files](#bower-main-files) (if specified)
* `rake bower:resolve` to resolve [relative asset paths](#relative-asset-paths) in components