Sha256: 914b17b13caad6d751f03cded53967b74fd844a741657b551c8d8bb1e01316aa

Contents?: true

Size: 782 Bytes

Versions: 22

Compression:

Stored size: 782 Bytes

Contents

require 'find'
require 'json'
require 'pathname'

namespace :bower do

  find_files = ->(path) {
    Find.find(Pathname.new(path).relative_path_from(Pathname.new Dir.pwd).to_s).map do |path|
      path if File.file?(path)
    end.compact
  }

  desc 'update main and version in bower.json'
  task :generate do
    require 'bootstrap-sass'
    Dir.chdir Bootstrap.gem_path do
      spec       = JSON.parse(File.read 'bower.json')

      spec['main'] =
          find_files.(File.join(Bootstrap.stylesheets_path, '_bootstrap.scss')) +
          find_files.(Bootstrap.fonts_path) +
          %w(assets/javascripts/bootstrap.js)

      spec['version'] = Bootstrap::VERSION

      File.open('bower.json', 'w') do |f|
        f.puts JSON.pretty_generate(spec)
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 5 rubygems

Version Path
bootstrap-sass-3.3.4.1 tasks/bower.rake
bootstrap-sass-3.3.3 tasks/bower.rake