Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: c266faabd0
Fetching contributors…

Cannot retrieve contributors at this time

file 39 lines (30 sloc) 1.834 kb
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
# Creates a zip file of the Foundation template and the compessed assets

VERSION_STRING = '2.1.3'

def prepend_text(file_name, text)
  `exec 3<> '#{file_name}' && awk -v TEXT="#{text}" 'BEGIN {print TEXT}{print}' '#{file_name}' >&3`
end

`rm -rf public marketing/files/foundation-download.zip`
`jammit`
`mkdir public/src public/src/javascripts public/src/stylesheets`
`cp -R humans.txt images index.html robots.txt public/src`
`cp public/assets/foundation.js public/src/javascripts`
`cp stylesheets/ie.css public/src/stylesheets/ie.css`
`cp stylesheets/app.css public/src/stylesheets/app.css`
`cp javascripts/app.js public/src/javascripts/app.js`

File.open('public/src/stylesheets/foundation.css', "w") do |file|
  %w{stylesheets/globals.css stylesheets/typography.css stylesheets/grid.css stylesheets/ui.css stylesheets/forms.css stylesheets/orbit.css stylesheets/reveal.css stylesheets/mobile.css}.each do |stylesheet|
    file.puts File.read(stylesheet)
  end
end

file_name = 'public/src/index.html'

text = File.read(file_name)
text.gsub!(/<!-- Combine and Compress These CSS Files -->.+<!-- End Combine and Compress These CSS Files -->/m, "<link rel=\"stylesheet\" href=\"stylesheets/foundation.css\">")
text.gsub!(/<!-- Combine and Compress These JS Files -->.+<!-- End Combine and Compress These JS Files -->/m, "<script src=\"javascripts/foundation.js\"></script>")

File.open(file_name, "w") do |file|
  file.puts text
end

%w{public/src/javascripts/app.js public/src/javascripts/foundation.js public/src/stylesheets/app.css public/src/stylesheets/foundation.css public/src/stylesheets/ie.css}.each do |file_name|
  prepend_text(file_name, "/* Foundation v#{VERSION_STRING} http://foundation.zurb.com */")
end

`cd public/src && zip -r ../../marketing/files/foundation-download-#{VERSION_STRING}.zip *`
`rm -rf public`
Something went wrong with that request. Please try again.