Skip to content
This repository has been archived by the owner on Apr 26, 2023. It is now read-only.

Commit

Permalink
Rakefile task for vendoring Foundation 6.
Browse files Browse the repository at this point in the history
  • Loading branch information
pwnall committed Nov 14, 2015
1 parent 649f360 commit 9326136
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ RSpec::Core::RakeTask.new(:rspec)

desc 'Run the test suite'
task :default => :rspec

import 'tasks/import.rake'
34 changes: 34 additions & 0 deletions tasks/import.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
require 'fileutils'

desc 'Copy the files from a Foundation 6 distribution to vendor/'
task :import6 do
base = ENV['DIR']
unless base && File.exist?(base)
puts 'Could not find Foundation distribution directory'
exit 1
end

FileUtils.rm_r 'vendor'
FileUtils.mkdir_p 'vendor/assets/javascripts/foundation'
FileUtils.mkdir_p 'vendor/assets/stylesheets'

js_files = Dir.entries(File.join(base, 'js')).sort.select do |entry|
next false if File.directory? File.join(base, 'js', entry)
/^foundation\..*\.js$/ =~ entry
end
# foundation.core must be loaded before the rest of the JS files.
js_files.delete 'foundation.core.js'
js_files.unshift 'foundation.core.js'

File.open 'vendor/assets/javascripts/foundation.js', 'wb' do |f|
js_files.each do |file|
f.write "//= require foundation/#{file}\n"
FileUtils.cp File.join(base, 'js', file),
'vendor/assets/javascripts/foundation'
end
end

FileUtils.cp_r File.join(base, 'scss'), 'vendor/assets/stylesheets/'
FileUtils.mv 'vendor/assets/stylesheets/scss',
'vendor/assets/stylesheets/foundation'
end

0 comments on commit 9326136

Please sign in to comment.