bower-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +28 -0
  3. data/lib/tasks/bower.rake +32 -0
  4. metadata +47 -0
@@ -0,0 +1,20 @@
1
+ Copyright 2012 Ross Harrison
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,28 @@
1
+ bower-rails
2
+ ===========
3
+
4
+ rake tasks for bower on rails. Dependency file is bower.json in Rails root dir.
5
+
6
+ **example config file**
7
+ ``` javascript
8
+ {
9
+ "lib": {
10
+ "dependencies": {
11
+ "threex" : "git@github.com:rharriso/threex.git",
12
+ "gsvpano.js" : "https://github.com/rharriso/GSVPano.js/blob/master/src/GSVPano.js"
13
+ }
14
+ },
15
+ "vendor": {
16
+ "dependencies": {
17
+ "three.js" : "https://raw.github.com/mrdoob/three.js/master/build/three.js"
18
+ }
19
+ }
20
+ }
21
+ ```
22
+
23
+
24
+ **To install javascript files to correspondign directories**
25
+
26
+ ``` bash
27
+ rake bower:install
28
+ ```
@@ -0,0 +1,32 @@
1
+ require 'json'
2
+ require 'pp'
3
+
4
+ namespace :bower do
5
+
6
+ desc "install files from bower"
7
+ task :install do
8
+ #load in bower json file
9
+ txt = File.read("#{Rails.root}/bower.json")
10
+ json = JSON.parse(txt)
11
+
12
+ #install to corresponding directories
13
+ install_components "lib", json["lib"]
14
+ install_components "vendor", json["vendor"]
15
+ end
16
+ end
17
+
18
+ def install_components dir, data = nil
19
+ Dir.chdir("#{Rails.root}/#{dir}/assets/javascripts") do
20
+ #remove old components
21
+ FileUtils.rm_rf("components")
22
+ #create component json
23
+ File.open("component.json","w") do |f|
24
+ f.write(data.to_json)
25
+ end
26
+
27
+ #install
28
+ %x[bower install]
29
+ #remove component file
30
+ FileUtils.rm("component.json")
31
+ end if data
32
+ end
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bower-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ross Harrison
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-21 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Bower for Rails
15
+ email: rtharrison86@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/tasks/bower.rake
21
+ - MIT-LICENSE
22
+ - README.md
23
+ homepage: https://github.com/rharriso/bower-rails
24
+ licenses: []
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ! '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 1.8.24
44
+ signing_key:
45
+ specification_version: 3
46
+ summary: Bower
47
+ test_files: []