Handle frameworks without a templates directory.

This commit is contained in:
Chris Eppstein 2011-11-06 18:01:07 -08:00
parent 720cc891ae
commit 4183a60e31
12 changed files with 137 additions and 4 deletions

View File

@ -28,3 +28,9 @@ Feature: Extensions
And and I have a fake extension at ~/.compass/extensions/testing And and I have a fake extension at ~/.compass/extensions/testing
When I run: compass frameworks When I run: compass frameworks
Then the list of frameworks includes "testing" Then the list of frameworks includes "testing"
@listframeworks
Scenario: Frameworks without templates
Given I am using the existing project in test/fixtures/stylesheets/uses_only_stylesheets_ext
When I run: compass frameworks
Then the list of frameworks includes "only_stylesheets"

View File

@ -10,6 +10,8 @@ include Compass::RailsHelper
Before do Before do
Compass.reset_configuration! Compass.reset_configuration!
Compass::Frameworks::ALL.clear
Compass::Frameworks.discover :defaults
@cleanup_directories = [] @cleanup_directories = []
@original_working_directory = Dir.pwd @original_working_directory = Dir.pwd
end end

View File

@ -13,11 +13,17 @@ module Compass
options = arguments.last.is_a?(Hash) ? arguments.pop : {} options = arguments.last.is_a?(Hash) ? arguments.pop : {}
self.path = path = options[:path] || arguments.shift self.path = path = options[:path] || arguments.shift
@name = name @name = name
@templates_directory = options[:templates_directory] || File.join(path, 'templates') @templates_directory = options[:templates_directory]
@stylesheets_directory = options[:stylesheets_directory] || File.join(path, 'stylesheets') @templates_directory ||= File.join(path, 'templates') if path
@stylesheets_directory = options[:stylesheets_directory]
@stylesheets_directory ||= File.join(path, 'stylesheets') if path
end end
def template_directories def template_directories
if templates_directory
Dir.glob(File.join(templates_directory, "*")).map{|f| File.basename(f)} Dir.glob(File.join(templates_directory, "*")).map{|f| File.basename(f)}
else
[]
end
end end
def manifest_file(pattern) def manifest_file(pattern)
File.join(templates_directory, pattern.to_s, "manifest.rb") File.join(templates_directory, pattern.to_s, "manifest.rb")
@ -76,7 +82,7 @@ module Compass
def template_exists?(template) def template_exists?(template)
framework_name, template = template.split(%r{/}, 2) framework_name, template = template.split(%r{/}, 2)
template ||= "project" template ||= "project"
if framework = self[framework_name] if (framework = self[framework_name]) && framework.templates_directory
return File.directory?(File.join(framework.templates_directory, template)) return File.directory?(File.join(framework.templates_directory, template))
end end
false false

View File

@ -0,0 +1 @@
Compass::Frameworks.register("only-stylesheets", :stylesheets_dir => File.join(File.dirname(__FILE__),"scss"))

View File

@ -0,0 +1,3 @@
@mixin only-stylesheets {
color: red;
}

View File

@ -0,0 +1,25 @@
# Require any additional compass plugins here.
load '../../extensions/only_stylesheets/'
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "stylesheets"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "javascripts"
# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
# To disable debugging comments that display the original location of your selectors. Uncomment:
# line_comments = false
# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
# preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass

View File

@ -0,0 +1,5 @@
/* Welcome to Compass. Use this file to write IE specific override styles.
* Import this file using the following HTML or equivalent:
* <!--[if IE]>
* <link href="/stylesheets/ie.css" media="screen, projection" rel="stylesheet" type="text/css" />
* <![endif]--> */

View File

@ -0,0 +1,3 @@
/* Welcome to Compass. Use this file to define print styles.
* Import this file using the following HTML or equivalent:
* <link href="/stylesheets/print.css" media="print" rel="stylesheet" type="text/css" /> */

View File

@ -0,0 +1,6 @@
/* Welcome to Compass.
* In this file you should write your main styles. (or centralize your imports)
* Import this file using the following HTML or equivalent:
* <link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css" /> */
@import "compass/reset";

View File

@ -0,0 +1,5 @@
/* Welcome to Compass. Use this file to write IE specific override styles.
* Import this file using the following HTML or equivalent:
* <!--[if IE]>
* <link href="/stylesheets/ie.css" media="screen, projection" rel="stylesheet" type="text/css" />
* <![endif]--> */

View File

@ -0,0 +1,3 @@
/* Welcome to Compass. Use this file to define print styles.
* Import this file using the following HTML or equivalent:
* <link href="/stylesheets/print.css" media="print" rel="stylesheet" type="text/css" /> */

View File

@ -0,0 +1,68 @@
/* Welcome to Compass.
* In this file you should write your main styles. (or centralize your imports)
* Import this file using the following HTML or equivalent:
* <link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css" /> */
/* line 17, ../../../../../../../.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/compass-0.12.alpha.0/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* line 20, ../../../../../../../.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/compass-0.12.alpha.0/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
body {
line-height: 1;
}
/* line 22, ../../../../../../../.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/compass-0.12.alpha.0/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
ol, ul {
list-style: none;
}
/* line 24, ../../../../../../../.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/compass-0.12.alpha.0/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
table {
border-collapse: collapse;
border-spacing: 0;
}
/* line 26, ../../../../../../../.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/compass-0.12.alpha.0/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
caption, th, td {
text-align: left;
font-weight: normal;
vertical-align: middle;
}
/* line 28, ../../../../../../../.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/compass-0.12.alpha.0/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
q, blockquote {
quotes: none;
}
/* line 101, ../../../../../../../.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/compass-0.12.alpha.0/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
q:before, q:after, blockquote:before, blockquote:after {
content: "";
content: none;
}
/* line 30, ../../../../../../../.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/compass-0.12.alpha.0/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
a img {
border: none;
}
/* line 114, ../../../../../../../.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/compass-0.12.alpha.0/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary {
display: block;
}