tighten up the rakefile
This commit is contained in:
parent
024d2c91e3
commit
05be98db93
35
Rakefile
35
Rakefile
|
@ -2,13 +2,28 @@ require "bundler/gem_tasks"
|
||||||
require 'httparty'
|
require 'httparty'
|
||||||
require 'zip/zip'
|
require 'zip/zip'
|
||||||
|
|
||||||
def process_zip_url(url, &block)
|
def process_zip_url(url, entries = {})
|
||||||
mkdir_p 'tmp'
|
mkdir_p 'tmp'
|
||||||
|
|
||||||
response = HTTParty.get(url)
|
response = HTTParty.get(url)
|
||||||
File.open(target = 'tmp/elastic.zip', 'wb') { |fh| fh.print response.body }
|
File.open(target = 'tmp/elastic.zip', 'wb') { |fh| fh.print response.body }
|
||||||
|
|
||||||
Zip::ZipFile.foreach(target, &block)
|
Zip::ZipFile.foreach(target) do |entry|
|
||||||
|
entries.each do |search_entry, target_filename|
|
||||||
|
if entry.name[search_entry]
|
||||||
|
case File.extname(search_entry)
|
||||||
|
when '.js'
|
||||||
|
target = 'vendor/assets/javascripts'
|
||||||
|
when '.css'
|
||||||
|
target = 'vendor/assets/stylesheets'
|
||||||
|
end
|
||||||
|
|
||||||
|
entry.extract(File.join(target, target_filename))
|
||||||
|
end
|
||||||
|
|
||||||
|
yield entry if block_given?
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
sources = {
|
sources = {
|
||||||
|
@ -16,11 +31,9 @@ sources = {
|
||||||
'http://cookies.googlecode.com/svn/trunk/jquery.cookies.js'
|
'http://cookies.googlecode.com/svn/trunk/jquery.cookies.js'
|
||||||
],
|
],
|
||||||
'jquery-elastic' => lambda {
|
'jquery-elastic' => lambda {
|
||||||
process_zip_url('http://jquery-elastic.googlecode.com/files/jquery.elastic-1.6.11.zip') do |entry|
|
process_zip_url('http://jquery-elastic.googlecode.com/files/jquery.elastic-1.6.11.zip', {
|
||||||
if entry.name['jquery.elastic.source.js']
|
'jquery.elastic.source.js' => 'jquery.elastic.js'
|
||||||
entry.extract('vendor/assets/javascripts/jquery.elastic.js') { true }
|
})
|
||||||
end
|
|
||||||
end
|
|
||||||
},
|
},
|
||||||
'jquery-viewport' => [
|
'jquery-viewport' => [
|
||||||
'http://www.appelsiini.net/download/jquery.viewport.js'
|
'http://www.appelsiini.net/download/jquery.viewport.js'
|
||||||
|
@ -33,11 +46,9 @@ sources = {
|
||||||
'https://raw.github.com/timrwood/moment/master/moment.js'
|
'https://raw.github.com/timrwood/moment/master/moment.js'
|
||||||
],
|
],
|
||||||
'ajaxfileuploader' => lambda {
|
'ajaxfileuploader' => lambda {
|
||||||
process_zip_url('http://phpletter.com/download_project_version.php?version_id=34') do |entry|
|
process_zip_url('http://phpletter.com/download_project_version.php?version_id=34', {
|
||||||
if entry.name['ajaxfileupload.js']
|
'ajaxfileupload.js' => 'ajaxfileupload.js'
|
||||||
entry.extract('vendor/assets/javascripts/ajaxfileupload.js') { true }
|
})
|
||||||
end
|
|
||||||
end
|
|
||||||
},
|
},
|
||||||
'jquery-ui-timepicker' => [
|
'jquery-ui-timepicker' => [
|
||||||
'http://trentrichardson.com/examples/timepicker/js/jquery-ui-timepicker-addon.js'
|
'http://trentrichardson.com/examples/timepicker/js/jquery-ui-timepicker-addon.js'
|
||||||
|
|
Loading…
Reference in New Issue