Created
January 5, 2012 17:27
-
-
Save mattbrictson/1566248 to your computer and use it in GitHub Desktop.
Revisions
-
mattbrictson created this gist
Jan 5, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,55 @@ # Vendorfile for use with vendorer command. https://github.com/grosser/vendorer # Run `vendorer` to install jQuery and jQuery UI dependencies into vendor/assets/javascripts. JQUERY_VER = "1.7.1" JQUERY_UI_VER = "1.8.16" # Helper methods to extend vendorer functionality # ################################################### # Given a path to a clone of the jQuery UI repo, build and minify the code, # then prune the directory so that it contains only the .js and .min.js build products. # The result will be .js and .min.js files for all the jQuery UI components. def build_and_assemble_jquery_ui(path) Dir.chdir("#{path}/build") do puts "Building jQuery UI. This will take a few minutes..." run "ant" end Dir.chdir(path) do Dir["*", ".gitignore"].each { |f| run "rm -rf '#{f}'" unless f == "build" } run "mv build/dist/jquery-ui-#{JQUERY_UI_VER}/ui/* ." run "rm -rf build" end end # Given a path to a jQuery UI CSS theme file, find all the images referenced # by the CSS and fetch them as vendor dependencies. def fetch_jquery_theme_images(theme_css) IO.readlines(theme_css).each do |line| if (m = line.match /url\((images\/[^\)]+)\)/) file m[1], "http://code.jquery.com/ui/#{JQUERY_UI_VER}/themes/redmond/#{m[1]}" end end end # Vendorfile # ############## folder "vendor/assets/javascripts" do file "jquery.js" , "http://code.jquery.com/jquery-#{JQUERY_VER}.js" file "jquery.min.js" , "http://code.jquery.com/jquery-#{JQUERY_VER}.min.js" file "jquery-ui.js" , "http://code.jquery.com/ui/#{JQUERY_UI_VER}/jquery-ui.js" file "jquery-ui.min.js", "http://code.jquery.com/ui/#{JQUERY_UI_VER}/jquery-ui.min.js" folder "jquery-ui", "git://github.com/jquery/jquery-ui.git", :tag => JQUERY_UI_VER do |path| build_and_assemble_jquery_ui(path) end folder "jquery-ui/themes/redmond" do file "jquery-ui.redmond.css", "http://code.jquery.com/ui/#{JQUERY_UI_VER}/themes/redmond/jquery-ui.css" do |css| fetch_jquery_theme_images(css) end end end