See #563 #585 #586

Adds `rake bower:spec` to automatically generate main and version fields
for bower.json.
This commit is contained in:
Gleb Mazovetskiy 2014-04-14 13:21:21 +02:00
Родитель 4dfc9219c9
Коммит 328973b548
3 изменённых файлов: 133 добавлений и 2 удалений

Просмотреть файл

@ -1,3 +1,5 @@
load './tasks/bower.rake'
require 'rake/testtask'
Rake::TestTask.new do |t|
t.libs << "test"

Просмотреть файл

@ -9,7 +9,96 @@
"Gleb Mazovetskiy"
],
"description": "bootstrap-sass is a Sass-powered version of Bootstrap, ready to drop right into your Sass powered applications.",
"main": ["vendor/assets/stylesheets/bootstrap.scss", "vendor/assets/javascripts/bootstrap.js"],
"main": [
"vendor/assets/stylesheets/_bootstrap-mincer.scss",
"vendor/assets/stylesheets/bootstrap/_alerts.scss",
"vendor/assets/stylesheets/bootstrap/_badges.scss",
"vendor/assets/stylesheets/bootstrap/_breadcrumbs.scss",
"vendor/assets/stylesheets/bootstrap/_button-groups.scss",
"vendor/assets/stylesheets/bootstrap/_buttons.scss",
"vendor/assets/stylesheets/bootstrap/_carousel.scss",
"vendor/assets/stylesheets/bootstrap/_close.scss",
"vendor/assets/stylesheets/bootstrap/_code.scss",
"vendor/assets/stylesheets/bootstrap/_component-animations.scss",
"vendor/assets/stylesheets/bootstrap/_dropdowns.scss",
"vendor/assets/stylesheets/bootstrap/_forms.scss",
"vendor/assets/stylesheets/bootstrap/_glyphicons.scss",
"vendor/assets/stylesheets/bootstrap/_grid.scss",
"vendor/assets/stylesheets/bootstrap/_input-groups.scss",
"vendor/assets/stylesheets/bootstrap/_jumbotron.scss",
"vendor/assets/stylesheets/bootstrap/_labels.scss",
"vendor/assets/stylesheets/bootstrap/_list-group.scss",
"vendor/assets/stylesheets/bootstrap/_media.scss",
"vendor/assets/stylesheets/bootstrap/_mixins.scss",
"vendor/assets/stylesheets/bootstrap/_modals.scss",
"vendor/assets/stylesheets/bootstrap/_navbar.scss",
"vendor/assets/stylesheets/bootstrap/_navs.scss",
"vendor/assets/stylesheets/bootstrap/_normalize.scss",
"vendor/assets/stylesheets/bootstrap/_pager.scss",
"vendor/assets/stylesheets/bootstrap/_pagination.scss",
"vendor/assets/stylesheets/bootstrap/_panels.scss",
"vendor/assets/stylesheets/bootstrap/_popovers.scss",
"vendor/assets/stylesheets/bootstrap/_print.scss",
"vendor/assets/stylesheets/bootstrap/_progress-bars.scss",
"vendor/assets/stylesheets/bootstrap/_responsive-embed.scss",
"vendor/assets/stylesheets/bootstrap/_responsive-utilities.scss",
"vendor/assets/stylesheets/bootstrap/_scaffolding.scss",
"vendor/assets/stylesheets/bootstrap/_tables.scss",
"vendor/assets/stylesheets/bootstrap/_theme.scss",
"vendor/assets/stylesheets/bootstrap/_thumbnails.scss",
"vendor/assets/stylesheets/bootstrap/_tooltip.scss",
"vendor/assets/stylesheets/bootstrap/_type.scss",
"vendor/assets/stylesheets/bootstrap/_utilities.scss",
"vendor/assets/stylesheets/bootstrap/_variables.scss",
"vendor/assets/stylesheets/bootstrap/_wells.scss",
"vendor/assets/stylesheets/bootstrap/bootstrap.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_alerts.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_background-variant.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_border-radius.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_buttons.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_center-block.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_clearfix.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_forms.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_gradients.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_grid-framework.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_grid.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_hide-text.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_image.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_labels.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_list-group.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_nav-divider.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_nav-vertical-align.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_opacity.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_pagination.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_panels.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_progress-bar.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_reset-filter.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_resize.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_responsive-visibility.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_size.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_tab-focus.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_table-row.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_text-overflow.scss",
"vendor/assets/stylesheets/bootstrap/mixins/_vendor-prefixes.scss",
"vendor/assets/stylesheets/bootstrap.scss",
"vendor/assets/fonts/bootstrap/glyphicons-halflings-regular.eot",
"vendor/assets/fonts/bootstrap/glyphicons-halflings-regular.svg",
"vendor/assets/fonts/bootstrap/glyphicons-halflings-regular.ttf",
"vendor/assets/fonts/bootstrap/glyphicons-halflings-regular.woff",
"vendor/assets/javascripts/bootstrap/affix.js",
"vendor/assets/javascripts/bootstrap/alert.js",
"vendor/assets/javascripts/bootstrap/button.js",
"vendor/assets/javascripts/bootstrap/carousel.js",
"vendor/assets/javascripts/bootstrap/collapse.js",
"vendor/assets/javascripts/bootstrap/dropdown.js",
"vendor/assets/javascripts/bootstrap/tab.js",
"vendor/assets/javascripts/bootstrap/transition.js",
"vendor/assets/javascripts/bootstrap/scrollspy.js",
"vendor/assets/javascripts/bootstrap/modal.js",
"vendor/assets/javascripts/bootstrap/tooltip.js",
"vendor/assets/javascripts/bootstrap/popover.js"
],
"keywords": [
"twbs",
"bootstrap",
@ -17,6 +106,13 @@
],
"license": "MIT",
"ignore": [
"**/.*", "lib", "tasks", "templates", "test", "*.gemspec", "Rakefile", "Gemfile"
"**/.*",
"lib",
"tasks",
"templates",
"test",
"*.gemspec",
"Rakefile",
"Gemfile"
]
}

33
tasks/bower.rake Normal file
Просмотреть файл

@ -0,0 +1,33 @@
require 'find'
require 'bootstrap-sass'
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 :spec do
Dir.chdir Bootstrap.gem_path do
spec = JSON.parse(File.read 'bower.json')
js_paths = File.read(File.join Bootstrap.javascripts_path, 'bootstrap.js').lines.map do |line|
line.strip if line.sub!(%r(//\s*=\s*require\s*(.*)\s*), 'vendor/assets/javascripts/\1.js')
end.compact
spec['main'] = find_files.(Bootstrap.stylesheets_path) +
find_files.(Bootstrap.fonts_path) +
js_paths
spec['version'] = Bootstrap::VERSION[0..-3]
File.open('bower.json', 'w') do |f|
f.puts JSON.pretty_generate(spec)
end
end
end
end