diff --git a/features/extensions.feature b/features/extensions.feature index 5a31a902..89b3857c 100644 --- a/features/extensions.feature +++ b/features/extensions.feature @@ -28,3 +28,9 @@ Feature: Extensions And and I have a fake extension at ~/.compass/extensions/testing When I run: compass frameworks 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" diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb index fd45fdc9..d8abc970 100644 --- a/features/step_definitions/command_line_steps.rb +++ b/features/step_definitions/command_line_steps.rb @@ -10,6 +10,8 @@ include Compass::RailsHelper Before do Compass.reset_configuration! + Compass::Frameworks::ALL.clear + Compass::Frameworks.discover :defaults @cleanup_directories = [] @original_working_directory = Dir.pwd end diff --git a/lib/compass/frameworks.rb b/lib/compass/frameworks.rb index 734c31be..e22e21f6 100644 --- a/lib/compass/frameworks.rb +++ b/lib/compass/frameworks.rb @@ -13,11 +13,17 @@ module Compass options = arguments.last.is_a?(Hash) ? arguments.pop : {} self.path = path = options[:path] || arguments.shift @name = name - @templates_directory = options[:templates_directory] || File.join(path, 'templates') - @stylesheets_directory = options[:stylesheets_directory] || File.join(path, 'stylesheets') + @templates_directory = options[:templates_directory] + @templates_directory ||= File.join(path, 'templates') if path + @stylesheets_directory = options[:stylesheets_directory] + @stylesheets_directory ||= File.join(path, 'stylesheets') if path end def template_directories - Dir.glob(File.join(templates_directory, "*")).map{|f| File.basename(f)} + if templates_directory + Dir.glob(File.join(templates_directory, "*")).map{|f| File.basename(f)} + else + [] + end end def manifest_file(pattern) File.join(templates_directory, pattern.to_s, "manifest.rb") @@ -76,7 +82,7 @@ module Compass def template_exists?(template) framework_name, template = template.split(%r{/}, 2) template ||= "project" - if framework = self[framework_name] + if (framework = self[framework_name]) && framework.templates_directory return File.directory?(File.join(framework.templates_directory, template)) end false diff --git a/test/fixtures/extensions/only_stylesheets/compass_init.rb b/test/fixtures/extensions/only_stylesheets/compass_init.rb new file mode 100644 index 00000000..21728f74 --- /dev/null +++ b/test/fixtures/extensions/only_stylesheets/compass_init.rb @@ -0,0 +1 @@ +Compass::Frameworks.register("only-stylesheets", :stylesheets_dir => File.join(File.dirname(__FILE__),"scss")) diff --git a/test/fixtures/extensions/only_stylesheets/scss/only_stylesheets/foo.scss b/test/fixtures/extensions/only_stylesheets/scss/only_stylesheets/foo.scss new file mode 100644 index 00000000..f1cf0267 --- /dev/null +++ b/test/fixtures/extensions/only_stylesheets/scss/only_stylesheets/foo.scss @@ -0,0 +1,3 @@ +@mixin only-stylesheets { + color: red; +} diff --git a/test/fixtures/stylesheets/uses_only_stylesheets_ext/config.rb b/test/fixtures/stylesheets/uses_only_stylesheets_ext/config.rb new file mode 100644 index 00000000..95c72a59 --- /dev/null +++ b/test/fixtures/stylesheets/uses_only_stylesheets_ext/config.rb @@ -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 diff --git a/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/ie.scss b/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/ie.scss new file mode 100644 index 00000000..5cd5b6c5 --- /dev/null +++ b/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/ie.scss @@ -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: + * */ diff --git a/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/print.scss b/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/print.scss new file mode 100644 index 00000000..b0e9e456 --- /dev/null +++ b/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/print.scss @@ -0,0 +1,3 @@ +/* Welcome to Compass. Use this file to define print styles. + * Import this file using the following HTML or equivalent: + * */ diff --git a/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/screen.scss b/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/screen.scss new file mode 100644 index 00000000..81de8470 --- /dev/null +++ b/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/screen.scss @@ -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: + * */ + +@import "compass/reset"; diff --git a/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/ie.css b/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/ie.css new file mode 100644 index 00000000..5cd5b6c5 --- /dev/null +++ b/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/ie.css @@ -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: + * */ diff --git a/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/print.css b/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/print.css new file mode 100644 index 00000000..b0e9e456 --- /dev/null +++ b/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/print.css @@ -0,0 +1,3 @@ +/* Welcome to Compass. Use this file to define print styles. + * Import this file using the following HTML or equivalent: + * */ diff --git a/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/screen.css b/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/screen.css new file mode 100644 index 00000000..83e33536 --- /dev/null +++ b/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/screen.css @@ -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: + * */ +/* 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; +}