bower-rails 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4ef492a2a98874b7cada24b2c7ed2f07a8a3eef
4
- data.tar.gz: b669749e25008d4156955d52737d802d76f942ef
3
+ metadata.gz: 84fc241b4ebeecdb5a9c34fcfbd69bbed2d77d10
4
+ data.tar.gz: e8e7f5e1c99aebc58a621a909b08e44d83549326
5
5
  SHA512:
6
- metadata.gz: 46f2239173c06b472b628861afb68b52474f1e6513b56ea2be4cab21f0b7690541544bedec6496ceb0cc64bdfdce26d4afe1b063ebfbbc5952e1000974b1c5e9
7
- data.tar.gz: de4a5b73737347a9b163492abcd9a756e41a847de7dda2f1a2895afd767beb98c605f35ff2c3d1a3d881d4949228d57d3e2848b274e4962eed7adacf873c3853
6
+ metadata.gz: 4749301128115d7ef40779640b4b1e7235a97e6bae3627085f3190a0c1f222d9bb002238dd28515d167d620ddb74cf046e963c50e2bcae1ad8f6b3b9e464b3df
7
+ data.tar.gz: 42dbd5f4c81d57302031bdb1202473ba83b4118d958b77e8000658c5f4f34b9c3c92cdb945fe28ef13d53147c220321624dc34def3011397d9499d78e8f2ed07
data/README.md CHANGED
@@ -8,7 +8,9 @@ bower-rails
8
8
  [![Coverage Status](https://coveralls.io/repos/42dev/bower-rails/badge.png)](https://coveralls.io/r/42dev/bower-rails)
9
9
 
10
10
  Bower support for Rails projects. Dependency file is bower.json in Rails root dir or Bowerfile if you use DSL.
11
- Check out Changelog.md for the latest changes and releases.
11
+ Check out [changelog][] for the latest changes and releases.
12
+
13
+ [changelog]: https://github.com/42dev/bower-rails/blob/master/CHANGELOG.md
12
14
 
13
15
  **Requirements**
14
16
 
@@ -20,7 +22,7 @@ Check out Changelog.md for the latest changes and releases.
20
22
  in Gemfile
21
23
 
22
24
  ``` Ruby
23
- gem "bower-rails", "~> 0.6.1"
25
+ gem "bower-rails", "~> 0.7.0"
24
26
  ```
25
27
 
26
28
  ##JSON configuration
@@ -125,4 +127,12 @@ will ignore the `directory` property and instead will use the automatically gene
125
127
 
126
128
  Some bower components (eg. [Bootstrap](https://github.com/twbs/bootstrap/blob/0016c17f9307bc71fc96d8d4680a9c861f137cae/dist/css/bootstrap.css#L2263)) have relative urls in the CSS files for imports, images, etc. Rails prefers using [helper methods](http://guides.rubyonrails.org/asset_pipeline.html#coding-links-to-assets) for linking to assets within CSS. Relative paths can cause issues when assets are precompiled for production.
127
129
 
128
- Before the `rake assets:precompile` task is run, the bower assets will be reinstalled with the relative paths replaced with calls to `asset_path` so that all asset links work in production.
130
+ If you would like the bower assets to be reinstalled with the relative paths on every deploy, provide an option for `bower-rails` so it do it automatically before the `rake assets:precompile` task is run:
131
+
132
+ ``` ruby
133
+ BowerRails.configure do |bower_rails|
134
+ # By default this option is false
135
+ bower_rails.resolve_before_precompile = true
136
+ end
137
+ ```
138
+ Remember that you should have [bower installed](#bower-installation) either locally in your project or on a remote server.
data/lib/bower-rails.rb CHANGED
@@ -1,4 +1,17 @@
1
1
  module BowerRails
2
2
  require 'bower-rails/railtie' if defined?(Rails)
3
- require "bower-rails/dsl"
3
+ require 'bower-rails/dsl'
4
+
5
+ class << self
6
+ # If set to true then rake bower:install && rake bower:resolve tasks
7
+ # are invoked before assets precompilation
8
+ attr_accessor :resolve_before_precompile
9
+
10
+ def configure &block
11
+ yield self if block_given?
12
+ end
13
+ end
14
+
15
+ # Set default values for options
16
+ @resolve_before_precompile = false
4
17
  end
data/lib/tasks/bower.rake CHANGED
@@ -49,8 +49,8 @@ namespace :bower do
49
49
  end
50
50
  end
51
51
 
52
- # Install bower assets before precompile
53
- # Rake::Task['assets:precompile'].enhance ['bower:install', 'bower:resolve']
52
+ # Install bower assets before precompile if an corresponding option provided
53
+ Rake::Task['assets:precompile'].enhance ['bower:install', 'bower:resolve'] if BowerRails.resolve_before_precompile
54
54
 
55
55
  def perform remove_components = true, &block
56
56
  entries = Dir.entries(get_bower_root_path)
@@ -163,7 +163,7 @@ end
163
163
  def resolve_asset_paths
164
164
  # Resolve relative paths in CSS
165
165
  Dir['bower_components/**/*.css'].each do |filename|
166
- contents = File.read(filename)
166
+ contents = File.read(filename) if FileTest.file?(filename)
167
167
  # http://www.w3.org/TR/CSS2/syndata.html#uri
168
168
  url_regex = /url\(\s*['"]?(?![a-z]+:)([^'"\)]*)['"]?\s*\)/
169
169
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bower-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ross Harrison
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: coveralls
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description: Rails integration for bower.
42
56
  email: rtharrison86@gmail.com
43
57
  executables: []
@@ -77,3 +91,4 @@ signing_key:
77
91
  specification_version: 4
78
92
  summary: Bower for Rails
79
93
  test_files: []
94
+ has_rdoc: