Added an example for the ninesixty plugin using local extensions.

This commit is contained in:
Chris Eppstein 2009-07-26 22:57:22 -07:00
parent 44e810e840
commit 9105d5a8de
6 changed files with 78 additions and 0 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@ tmp/*
examples/*/stylesheets/* examples/*/stylesheets/*
examples/*/*.html examples/*/*.html
examples/*/*/*.html examples/*/*/*.html
examples/*/extensions/*
examples/*/src/.sass-cache examples/*/src/.sass-cache
test/tmp test/tmp
test/fixtures/stylesheets/*/tmp test/fixtures/stylesheets/*/tmp

View File

@ -58,6 +58,7 @@ begin
gemspec.files += Dir.glob("examples/**/*.*") gemspec.files += Dir.glob("examples/**/*.*")
gemspec.files -= Dir.glob("examples/**/*.css") gemspec.files -= Dir.glob("examples/**/*.css")
gemspec.files -= Dir.glob("examples/**/*.html") gemspec.files -= Dir.glob("examples/**/*.html")
gemspec.files -= Dir.glob("examples/*/extensions/**")
gemspec.files += Dir.glob("frameworks/**/*.*") gemspec.files += Dir.glob("frameworks/**/*.*")
gemspec.files += Dir.glob("lib/**/*") gemspec.files += Dir.glob("lib/**/*")
gemspec.files += Dir.glob("test/**/*.*") gemspec.files += Dir.glob("test/**/*.*")
@ -107,6 +108,8 @@ task :examples do
next unless File.directory?(example) next unless File.directory?(example)
puts "\nCompiling #{example}" puts "\nCompiling #{example}"
puts "=" * "Compiling #{example}".length puts "=" * "Compiling #{example}".length
bootstrap_file = File.join(example, "bootstrap.rb")
load bootstrap_file if File.exists?(bootstrap_file)
# compile any haml templates to html # compile any haml templates to html
FileList["#{example}/**/*.haml"].each do |haml_file| FileList["#{example}/**/*.haml"].each do |haml_file|
basename = haml_file[0..-6] basename = haml_file[0..-6]

View File

@ -0,0 +1,39 @@
require 'net/http'
require 'fileutils'
require 'rubygems'
require 'zip/zip'
extdir = File.join(File.dirname(__FILE__),'extensions')
download_link = "http://github.com/chriseppstein/compass-960-plugin/zipball/master"
def fetch(uri_str, limit = 10)
raise ArgumentError, 'HTTP redirect too deep' if limit == 0
response = Net::HTTP.get_response(URI.parse(uri_str))
case response
when Net::HTTPSuccess then response
when Net::HTTPRedirection then fetch(response['location'], limit - 1)
else
response.error!
end
end
if !File.exists?(extdir)
puts "Downloading and unpacking the ninesixty plugin."
FileUtils.mkdir(extdir)
zipfile = File.join(extdir, "ninesixty.zip")
open(zipfile, "wb") do |tgz|
tgz << fetch(download_link).body
end
Zip::ZipFile::open(zipfile) { |zf|
zf.each { |e|
fpath = File.join(extdir, e.name)
FileUtils.mkdir_p(File.dirname(fpath))
zf.extract(e, fpath)
}
}
File.unlink(zipfile)
funky_directory = Dir.glob(File.join(extdir,'chriseppstein-compass-960-plugin-*'))[0]
FileUtils.mv(funky_directory, File.join(extdir,'ninesixty'))
end

View File

@ -0,0 +1,9 @@
project_type = :stand_alone
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "stylesheets"
sass_dir = "src"
images_dir = "images"
output_style = :compact
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true

View File

@ -0,0 +1,16 @@
/*
960 Grid System ~ Core CSS.
Learn more ~ http://960.gs/
Licensed under GPL and MIT.
@import compass/utilities/general/reset.sass
@import 960/grid.sass
+global-reset
.container_12
+grid-system(12)
.container_16
+grid-system(16)

View File

@ -0,0 +1,10 @@
/*
960 Grid System ~ Text CSS.
Learn more ~ http://960.gs/
Licensed under GPL and MIT.
@import 960/text.sass
+text