This repository has been archived by the owner on Apr 26, 2023. It is now read-only.
forked from foundation/foundation-rails
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rakefile task for vendoring Foundation 6.
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,5 @@ RSpec::Core::RakeTask.new(:rspec) | |
|
||
desc 'Run the test suite' | ||
task :default => :rspec | ||
|
||
import 'tasks/import.rake' |
This file contains 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 characters
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 |