-
Notifications
You must be signed in to change notification settings - Fork 11
/
Rakefile
61 lines (48 loc) · 1.39 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env rake
require "bundler/gem_tasks"
require 'open-uri'
namespace :update do
task sources: [:js, :swf]
task :js do
puts 'Updating js files'
tpl = 'https://raw.githubusercontent.com/scottschiller/SoundManager2/master/script/%{file}'
[
'soundmanager2-jsmin.js',
'soundmanager2-nodebug-jsmin.js',
'soundmanager2-nodebug.js',
'soundmanager2.js'
].each do |f|
puts " #{f}"
File.write "vendor/assets/javascripts/#{f}", URI.parse(tpl % {file: f}).read
end
end
task :swf do
require 'zip/filesystem'
require 'tempfile'
puts 'Updating swf files'
source_zip = 'https://github.com/scottschiller/SoundManager2/raw/master/swf/soundmanager2_flash_xdomain.zip'
zip = Tempfile.new 'SoundManager2.zip'
begin
zip.write URI.parse(source_zip).read
zip.rewind
files = [
'soundmanager2.swf',
'soundmanager2_debug.swf',
'soundmanager2_flash9.swf',
'soundmanager2_flash9_debug.swf'
]
Zip::File.open zip do |zipfile|
puts " Content of #{source_zip}"
zipfile.each { |f| puts " #{f}" }
puts " Extracting"
files.each do |f|
puts " #{f}"
zipfile.extract("soundmanager2_flash_xdomain/#{f}", "vendor/assets/images/swf/#{f}") { true }
end
end
ensure
zip.close
zip.unlink
end
end
end