Skip to content

Commit

Permalink
Merge pull request #21 from kenips/master
Browse files Browse the repository at this point in the history
Add support for bower 1.0.0
  • Loading branch information
rharriso committed Jul 25, 2013
2 parents 6feae48 + 24bbcf8 commit 4c0358c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 18 deletions.
19 changes: 5 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,17 @@ bower-rails

rake tasks for bower on rails. Dependency file is bower.json in Rails root dir.

**Asset Pipeline**

As of version 0.3.0 bower-rails installs components in the asset directory, rather than assets/javascripts. This is because some of these packages also include stylesheets, or images. As such you may have to add components to your asset pipeline.

``` Ruby
# config/application.rb

config.assets.paths << Rails.root.join("lib", "assets", "components")
config.assets.paths << Rails.root.join("vendor", "assets", "components")
```

**Requirements**

* [node](http://nodejs.org) ([on github](https://github.com/joyent/node))
* [bower](https://github.com/bower/bower) (>= 0.9) installed with npm
* [bower](https://github.com/bower/bower) (>= 0.10.0) installed with npm

**Install**

in Gemfile

``` Ruby
gem "bower-rails", "~> 0.3.2"
gem "bower-rails", "~> 0.4.0"
```

**Initialize**
Expand All @@ -44,14 +33,16 @@ The bower.json file is two seperate bower [component.js](https://github.com/twit
``` javascript
{
"lib": {
"name": "bower-rails generated lib assets",
"dependencies": {
"threex" : "git@github.com:rharriso/threex.git",
"gsvpano.js" : "https://github.com/rharriso/GSVPano.js/blob/master/src/GSVPano.js"
}
},
"vendor": {
"name": "bower-rails generated vendor assets",
"dependencies": {
"three.js" : "https://raw.github.com/mrdoob/three.js/master/build/three.js"
"three.js" : "https://raw.github.com/mrdoob/three.js/master/build/three.js"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion bower-rails.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|
s.name = "bower-rails"
s.homepage = "https://github.com/rharriso/bower-rails"
s.version = "0.3.3"
s.version = "0.4.0"
s.date = "2013-05-08"
s.summary = "Bower for Rails"
s.description = "Bower for Rails"
Expand Down
4 changes: 2 additions & 2 deletions lib/bower-rails/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ class Railtie < Rails::Railtie

config.after_initialize do |app|
["lib", "vendor"].each do |dir|
app.config.assets.paths << Rails.root.join(dir, 'assets', 'components')
app.config.assets.paths << Rails.root.join(dir, 'assets', 'bower_components')
end
end

rake_tasks do
load "tasks/bower.rake"
end
end
end
end
2 changes: 2 additions & 0 deletions lib/generators/bower_rails/initialize/templates/bower.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"lib": {
"name": "bower-rails generated lib assets",
"dependencies": {
}
},
"vendor": {
"name": "bower-rails generated vendor assets",
"dependencies": {
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/bower.rake
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def perform_command remove_components = true
Dir.chdir(dir) do

#remove old components
FileUtils.rm_rf("components") if remove_components
FileUtils.rm_rf("bower_components") if remove_components

#create bower json
File.open("bower.json","w") do |f|
Expand Down

0 comments on commit 4c0358c

Please sign in to comment.