Sha256: 18aa689856b1946113f930808e9ffe868daf5366ee55744f545b92f5ecc8f3c8

Contents?: true

Size: 1.29 KB

Versions: 11

Compression:

Stored size: 1.29 KB

Contents

#!/usr/bin/env rake
require "bundler/gem_tasks"

desc "Update Twitter's Bootstrap"
task "update-twitter" do
  boostrap_version = Bootstrap::Rails::VERSION.split("\.")[0..2].join(".")
  Dir["vendor/assets/stylesheets/*.*"].each {|f| FileUtils.rm(f)}
  Dir["vendor/twitter/lib/*.scss"].each do |file|
    cp file, "vendor/assets/stylesheets/", :verbose => true
  end
  bootstrap_scss = File.read("vendor/assets/stylesheets/bootstrap.scss")

  bootstrap_scss.gsub!(/@VERSION/, "v#{boostrap_version}")
  bootstrap_scss.gsub!(/^.*@DATE.*/, " *")

  File.open("vendor/assets/stylesheets/bootstrap.scss", "w") do |f|
    f.write(bootstrap_scss)
  end

  Dir["vendor/assets/javascripts/*.*"].each {|f| FileUtils.rm(f)}
  js_files = Dir["vendor/twitter/js/*.js"].map()
  js_files.each do |file|
    cp file, "vendor/assets/javascripts/", :verbose => true
  end

  js_priorities = {}
  js_files.each {|f| js_priorities[File.basename(f)] = 0}

  # popover depend on twipsy
  js_priorities["bootstrap-twipsy.js"]  = 1
  js_priorities["bootstrap-popover.js"] = 2
  
  js_list = js_priorities.to_a.sort {|a,b| a[1] <=> b[1]}.map{|p| p[0]}
  
  File.open("vendor/assets/javascripts/bootstrap.js", "w") do |f|
    f.write "// Bootstrap v#{boostrap_version}\n"
    js_list.each do |js|
      f.write "//= require #{js}\n"
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
anjlab-bootstrap-rails-1.4.0.12 Rakefile
anjlab-bootstrap-rails-1.4.0.11 Rakefile
anjlab-bootstrap-rails-1.4.0.10 Rakefile
anjlab-bootstrap-rails-1.4.0.9 Rakefile
anjlab-bootstrap-rails-1.4.0.8 Rakefile
anjlab-bootstrap-rails-1.4.0.7 Rakefile
anjlab-bootstrap-rails-1.4.0.6 Rakefile
anjlab-bootstrap-rails-1.4.0.5 Rakefile
anjlab-bootstrap-rails-1.4.0.4 Rakefile
anjlab-bootstrap-rails-1.4.0.3 Rakefile
anjlab-bootstrap-rails-1.4.0.2 Rakefile