Version 1
[yaffs-website] / vendor / twbs / bootstrap-sass / tasks / bower.rake
1 require 'find'
2 require 'json'
3 require 'pathname'
4
5 namespace :bower do
6
7   find_files = ->(path) {
8     Find.find(Pathname.new(path).relative_path_from(Pathname.new Dir.pwd).to_s).map do |path|
9       path if File.file?(path)
10     end.compact
11   }
12
13   desc 'update main and version in bower.json'
14   task :generate do
15     require 'bootstrap-sass'
16     Dir.chdir Bootstrap.gem_path do
17       spec       = JSON.parse(File.read 'bower.json')
18
19       spec['main'] =
20           find_files.(File.join(Bootstrap.stylesheets_path, '_bootstrap.scss')) +
21           find_files.(Bootstrap.fonts_path) +
22           %w(assets/javascripts/bootstrap.js)
23
24       spec['version'] = Bootstrap::VERSION
25
26       File.open('bower.json', 'w') do |f|
27         f.puts JSON.pretty_generate(spec)
28       end
29     end
30   end
31 end