Sha256: cba32cc775d9bf44fe91bcad4295c213f2718259858bdab2290dbe45a3fbdde6

Contents?: true

Size: 734 Bytes

Versions: 4

Compression:

Stored size: 734 Bytes

Contents

require 'json'
require 'pp'

namespace :bower do
  
  desc "install files from bower"
  task :install do
    #load in bower json file
    txt  = File.read("#{Rails.root}/bower.json")
    json = JSON.parse(txt)

    #install to corresponding directories
    install_components "lib", json["lib"]
    install_components "vendor", json["vendor"]
  end
end

def install_components dir, data = nil
  Dir.chdir("#{Rails.root}/#{dir}/assets/javascripts") do
    #remove old components
    FileUtils.rm_rf("components")
    #create component json
    File.open("component.json","w") do |f|
      f.write(data.to_json)
    end

    #install
    %x[bower install]
    #remove component file
    FileUtils.rm("component.json")
  end if data
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bower-rails-0.0.4 lib/tasks/bower.rake
bower-rails-0.0.3 lib/tasks/bower.rake
bower-rails-0.0.2 lib/tasks/bower.rake
bower-rails-0.0.1 lib/tasks/bower.rake