diff --git a/.gitignore b/.gitignore index 81e3a86b..d85e13a5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ tmp/* examples/*/stylesheets/* examples/*/*.html examples/*/*/*.html +examples/*/extensions/* examples/*/src/.sass-cache test/tmp test/fixtures/stylesheets/*/tmp @@ -10,3 +11,4 @@ test/fixtures/stylesheets/*/saved test/fixtures/stylesheets/empty test/fixtures/stylesheets/*/sass/.sass-cache pkg/* +coverage* diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown index ce689ca3..d817b566 100644 --- a/CHANGELOG.markdown +++ b/CHANGELOG.markdown @@ -1,6 +1,130 @@ COMPASS CHANGELOG ================= +0.10.0 (UNRELEASED) +------------ + +Command-Line: + +* The compass command-line tool has been re-written to allow be easier to + use and be more flexible. The old command line is still supported at + this time. "compass help" will get you started on using the new + command line syntax. +* Allow specification of a height for the grid image +* For the truly hardcore compass users, you may now create a + compass project using "compass create my_project --bare" + and you'll have a completely bare project created for you with no + sass files provided for you. +* Get stats on your compass project with "compass stats". You'll + need to install the "css_parser" ruby gem to get stats on your + css files. + +Configuration: + +* The entire configuration infrastructure has been re-written to make it + easier to support the various sources of configuration data (project type, + config file, command line, and hard coded defaults) +* Whether to generate relative links to assets is now controlled by a + separate boolean configuration flag called `relative_assets` in the + configuration file and `--relative-assets` on the command line. + Setting `http_images_path` to `:relative` is deprecated. +* You may now configure the http locations for your project by simply setting + `http_path` for the top level path of the project. You + may also set `http_images_dir`, `http_stylesheets_dir`, and + `http_javascripts_dir` relative to the `http_path` instead of + setting the absolute `http_XXX_path` counterparts. + +Compass Core: + +* A new helper function `stylesheet_url(path)` can now be used to refer + to assets that are relative to the css directory. +* Compass sprite mixins are now more flexible and feature rich. +* Fixed the append_selector function to allow comma-delimited selectors + for both arguments instead of just the first +* There is no longer any outline on unstyled links in the :active and :focused states. +* IE6 bug fixes for sticky-footer +* New CSS3 Compatibility Mixins. You can import them all with `@import compass/css3` + * `+opacity(amount)` where amount should be between 0 and 1, where 0 is transparent and 1 is opaque. + * `+opaque` and `+transparent` mixins for convenience. Built on top of the opacity mixin. + * `+border-radius(amount)` as well as the following convenience mixins: + * `+border-top-left-radius(amount)` + * `+border-top-right-radius(amount)` + * `+border-top-right-radius(amount)`, + * `+border-bottom-left-radius(amount)` + * `+border-bottom-right-radius(amount)` + * `+border-top-radius(amount)` + * `+border-right-radius(amount)` + * `+border-left-radius(amount)` + * `+border-bottom-radius(amount)` + * `+box-shadow(!horiz_offset, !vert_offset, !blur, !color)` + * `+box-sizing(!sizing_mode)` + * Column support via the following mixins: + * `+column-count` + * `+column-gap` + * `+column-width` + * `+column-rule-width` + * `+column-rule-style` + * `+column-rule-color` + * `+column-rule` + * The import for `+inline-block` has moved from compass/utilities/general/inline_block + to compass/css3/inline_block + * The import for `+opacity` has moved from compass/utilities/general/opacity + to compass/css3/opacity + * Note: If you are using the `+opacity` or `+inline-block` mixins, + you may need to update your imports. + +Blueprint: + +* Make the primary blueprint mixins easier to use by allowing them to be nested when passing true as the first argument. + The old approach of passing a selector as the first argument is now deprecated in favor of a simple flag to indicate nesting or not. + +YUI: + +* YUI was upgraded to 2.7.0 +* Yahoo has deprecated the YUI CSS framework, as such YUI has been extracted to a plugin. + If you use it, please install it with: `sudo gem install compass-yui` + +Extensions: + +* Extensions can now be installed locally by unpacking them into a project's + "extensions" directory. Rails projects use "vendor/plugins/compass/extenstions". +* Extensions can deliver html to projects if they like. The html can be in + haml and will be transformed to html and can contain inline, compass-enabled + sass. +* All files can be processed using ERB before being copied into the user's + project. +* Compass extensions can now add support for other application frameworks. + These extensions can help compass understand the project structure of that + framework as well as provide runtime integration for ruby-based apps. + Contact me if you plan to do this -- the first couple times may be a little + rough. +* Compass extensions can now add new command line commands. Contact me if you + plan to do this -- the first couple times may be a little rough. +* Extensions can now provide help documentation just after a project is + created and on demand when the user uses the command line help system. + This can be done via the manifest file or by adding a USAGE.markdown file + at the top level of the framework template. + +Miscellaneous: + +* The compass configuration object is no longer a singleton, this makes it + possible for other ruby software to manage multiple compass projects at a + time. +* Compass no longer requires rubygems in order to work, this is a ruby + best-practice. +* All sass provided by compass now uses css-style property syntax. +* The command line tool is now tested using the cucumber testing framework. + +Many thanks to the following Contributors: + + * Brandon Mathis - CSS3 (+opacity, +border-radius) and sprites + * Eric Meyer - CSS3 (+box-shadow, +columns, +box-sizing) + * Jacques Crocker - Merb Compatibility fixes + * Gabriel Mansour - Fixes to +unstyled-link + * John Debs - IE6 Fixes for +sticky-footer + * Brian Johnson - Upgraded to YUI 2.7.0 + * Beau Smith - fixing my dyslexia. + 0.8.17 (September 24, 2009) --------------------------- diff --git a/README.markdown b/README.markdown index 77c8de67..be93d85f 100644 --- a/README.markdown +++ b/README.markdown @@ -5,6 +5,7 @@ A [Sass][sass]-based CSS Meta-Framework that allows you to mix and match any of - [Blueprint][blueprint_website] - [Wiki Documentation][bleuprint_wiki] - [YUI][yui_website] - [Wiki Documentation][yui_wiki] - [960][ninesixty_website] - [Wiki Documentation][ninesixty_wiki] +- New frameworks and extensions are [tracked on the wiki][plugins_wiki] as they are created. - Other frameworks can be added relatively easily. Create your own! ## Compass Provides @@ -25,13 +26,14 @@ Copyright (c) 2008-2009 Christopher M. Eppstein
All Rights Reserved.
Released under a [slightly modified MIT License][license]. -[sass]: http://haml.hamptoncatlin.com/docs/rdoc/classes/Sass.html "Syntactically Awesome StyleSheets" +[sass]: http://sass-lang.com/ "Syntactically Awesome StyleSheets" [compass_core_website]: http://github.com/chriseppstein/compass/tree/master/frameworks/compass [compass_core_wiki]: http://github.com/chriseppstein/compass/wikis/compass-core-documentation [blueprint_website]: http://blueprintcss.org/ [bleuprint_wiki]: http://github.com/chriseppstein/compass/wikis/blueprint-documentation [yui_website]: http://developer.yahoo.com/yui/grids/ [yui_wiki]: http://github.com/chriseppstein/compass/wikis/yui-documentation +[plugins_wiki]: http://github.com/chriseppstein/compass/wikis/compass-plugins [ninesixty_website]: http://960.gs/ [ninesixty_wiki]: http://github.com/chriseppstein/compass/wikis/960gs-documentation [command_line_wiki]: http://wiki.github.com/chriseppstein/compass/command-line-tool diff --git a/Rakefile b/Rakefile index ac940261..9e76c21b 100644 --- a/Rakefile +++ b/Rakefile @@ -12,7 +12,9 @@ end require 'rubygems' require 'rake' -require 'lib/compass' +$:.unshift File.join(File.dirname(__FILE__), 'lib') +require 'compass' +require 'rcov/rcovtask' # ----- Default: Testing ------ @@ -23,6 +25,7 @@ require 'fileutils' Rake::TestTask.new :run_tests do |t| t.libs << 'lib' + t.libs << 'test' t.libs << 'haml/lib' if ENV["RUN_CODE_RUN"] test_files = FileList['test/**/*_test.rb'] test_files.exclude('test/rails/*', 'test/haml/*') @@ -58,12 +61,13 @@ begin gemspec.files += Dir.glob("examples/**/*.*") gemspec.files -= Dir.glob("examples/**/*.css") gemspec.files -= Dir.glob("examples/**/*.html") - gemspec.files += Dir.glob("frameworks/**/*.*") + gemspec.files -= Dir.glob("examples/*/extensions/**") gemspec.files += Dir.glob("lib/**/*") gemspec.files += Dir.glob("test/**/*.*") gemspec.files -= Dir.glob("test/fixtures/stylesheets/*/saved/**/*.*") gemspec.test_files = Dir.glob("test/**/*.*") gemspec.test_files -= Dir.glob("test/fixtures/stylesheets/*/saved/**/*.*") + gemspec.test_files += Dir.glob("features/**/*.*") end rescue LoadError puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com" @@ -89,6 +93,8 @@ end task :release => :commit_revision +task :gem => :build + desc "Compile Examples into HTML and CSS" task :examples do linked_haml = "tests/haml" @@ -105,6 +111,10 @@ task :examples do next unless File.directory?(example) puts "\nCompiling #{example}" puts "=" * "Compiling #{example}".length + Dir.chdir example do + load "bootstrap.rb" if File.exists?("bootstrap.rb") + Compass::Exec::SwitchUI.new(["--force"]).run! + end # compile any haml templates to html FileList["#{example}/**/*.haml"].each do |haml_file| basename = haml_file[0..-6] @@ -114,9 +124,6 @@ task :examples do output.write(engine.render) output.close end - Dir.chdir example do - Compass::Exec::Compass.new(["--force"]).run! - end end end @@ -125,3 +132,34 @@ namespace :git do sh "git", "clean", "-fdx" end end + +require 'cucumber/rake/task' + +namespace :rcov do + Cucumber::Rake::Task.new(:cucumber) do |t| + t.rcov = true + t.rcov_opts = %w{--exclude osx\/objc,gems\/,spec\/,features\/ --aggregate coverage.data} + t.rcov_opts << %[-o "coverage"] + end + + Rcov::RcovTask.new(:units) do |rcov| + rcov.libs << 'lib' + rcov.libs << 'haml/lib' if ENV["RUN_CODE_RUN"] + test_files = FileList['test/**/*_test.rb'] + test_files.exclude('test/rails/*', 'test/haml/*') + rcov.pattern = test_files + rcov.output_dir = 'coverage' + rcov.verbose = true + rcov.rcov_opts = %w{--exclude osx\/objc,gems\/,spec\/,features\/ --aggregate coverage.data} + rcov.rcov_opts << %[-o "coverage" --sort coverage] + end + + + desc "Run both specs and features to generate aggregated coverage" + task :all do |t| + rm "coverage.data" if File.exist?("coverage.data") + Rake::Task["rcov:units"].invoke + Rake::Task["rcov:cucumber"].invoke + end +end + diff --git a/TODO.md b/TODO.md new file mode 100644 index 00000000..14c37fdc --- /dev/null +++ b/TODO.md @@ -0,0 +1,7 @@ +MUST: +* A proper welcome page for blueprint projects (or delete it) + +NICE: +* some extension commands +* Better help for commands and patterns + diff --git a/VERSION.yml b/VERSION.yml index 0bd37399..679fea09 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -1,4 +1,5 @@ --- -:patch: 17 +:patch: 0 :major: 0 -:minor: 8 +:minor: 10 +:build: 0 diff --git a/bin/compass b/bin/compass index fb94e65f..f816f3e9 100755 --- a/bin/compass +++ b/bin/compass @@ -1,8 +1,26 @@ #!/usr/bin/env ruby # The compass command line utility -require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'compass')) -require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'compass', 'exec')) +# This allows compass to run easily from a git checkout without install. +def fallback_load_path(path) + retried = false + begin + yield + rescue LoadError + unless retried + $: << path + retried = true + retry + end + raise + end +end -command = Compass::Exec::Compass.new(ARGV) -exit command.run! +fallback_load_path(File.join(File.dirname(__FILE__), '..', 'lib')) do + require 'compass' + require 'compass/exec' +end + + +command_line_class = Compass::Exec::Helpers.select_appropriate_command_line_ui(ARGV) +exit command_line_class.new(ARGV).run! diff --git a/compass.gemspec b/compass.gemspec index 6a2d352f..a6d394f2 100644 --- a/compass.gemspec +++ b/compass.gemspec @@ -1,3 +1,6 @@ +# Generated by jeweler +# DO NOT EDIT THIS FILE DIRECTLY +# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command # -*- encoding: utf-8 -*- Gem::Specification.new do |s| @@ -13,326 +16,367 @@ Gem::Specification.new do |s| s.executables = ["compass"] s.extra_rdoc_files = [ "LICENSE.markdown", - "README.markdown" + "README.markdown" ] s.files = [ "CHANGELOG.markdown", - "LICENSE.markdown", - "README.markdown", - "REVISION", - "Rakefile", - "VERSION.yml", - "bin/compass", - "deps.rip", - "examples/README.markdown", - "examples/blueprint_default/config.rb", - "examples/blueprint_default/images/grid.png", - "examples/blueprint_default/index.html.haml", - "examples/blueprint_default/parts/elements.html.haml", - "examples/blueprint_default/parts/forms.html.haml", - "examples/blueprint_default/parts/grid.html.haml", - "examples/blueprint_default/parts/test-small.jpg", - "examples/blueprint_default/parts/test.jpg", - "examples/blueprint_default/parts/valid.png", - "examples/blueprint_default/src/ie.sass", - "examples/blueprint_default/src/images/grid.png", - "examples/blueprint_default/src/print.sass", - "examples/blueprint_default/src/screen.sass", - "examples/blueprint_plugins/config.rb", - "examples/blueprint_plugins/images/buttons/cross.png", - "examples/blueprint_plugins/images/buttons/key.png", - "examples/blueprint_plugins/images/buttons/tick.png", - "examples/blueprint_plugins/images/grid.png", - "examples/blueprint_plugins/images/link_icons/doc.png", - "examples/blueprint_plugins/images/link_icons/email.png", - "examples/blueprint_plugins/images/link_icons/external.png", - "examples/blueprint_plugins/images/link_icons/feed.png", - "examples/blueprint_plugins/images/link_icons/im.png", - "examples/blueprint_plugins/images/link_icons/pdf.png", - "examples/blueprint_plugins/images/link_icons/visited.png", - "examples/blueprint_plugins/images/link_icons/xls.png", - "examples/blueprint_plugins/images/test-small.jpg", - "examples/blueprint_plugins/images/test.jpg", - "examples/blueprint_plugins/images/valid.png", - "examples/blueprint_plugins/index.html.haml", - "examples/blueprint_plugins/plugins/buttons.html.haml", - "examples/blueprint_plugins/plugins/fancy_type.html.haml", - "examples/blueprint_plugins/plugins/link_icons.html.haml", - "examples/blueprint_plugins/plugins/rtl.html.haml", - "examples/blueprint_plugins/src/buttons.sass", - "examples/blueprint_plugins/src/ie.sass", - "examples/blueprint_plugins/src/images/grid.png", - "examples/blueprint_plugins/src/link_icons.sass", - "examples/blueprint_plugins/src/print.sass", - "examples/blueprint_plugins/src/rtl_screen.sass", - "examples/blueprint_plugins/src/screen.sass", - "examples/blueprint_scoped/images/grid.png", - "examples/blueprint_scoped/src/ie.sass", - "examples/blueprint_scoped/src/print.sass", - "examples/blueprint_scoped/src/screen.sass", - "examples/blueprint_scoped_form/images/grid.png", - "examples/blueprint_scoped_form/src/ie.sass", - "examples/blueprint_scoped_form/src/print.sass", - "examples/blueprint_scoped_form/src/screen.sass", - "examples/blueprint_semantic/config.rb", - "examples/blueprint_semantic/images/grid.png", - "examples/blueprint_semantic/index.html.haml", - "examples/blueprint_semantic/parts/fancy_type.html.haml", - "examples/blueprint_semantic/parts/liquid.html.haml", - "examples/blueprint_semantic/parts/test-small.jpg", - "examples/blueprint_semantic/parts/test.jpg", - "examples/blueprint_semantic/parts/valid.png", - "examples/blueprint_semantic/src/ie.sass", - "examples/blueprint_semantic/src/images/grid.png", - "examples/blueprint_semantic/src/liquid.sass", - "examples/blueprint_semantic/src/print.sass", - "examples/blueprint_semantic/src/screen.sass", - "examples/compass/compass.html.haml", - "examples/compass/config.rb", - "examples/compass/images/blue_arrow.gif", - "examples/compass/src/compass.sass", - "examples/compass/src/images/blue_arrow.gif", - "examples/compass/src/sticky_footer.sass", - "examples/compass/src/utilities.sass", - "examples/compass/sticky_footer.html.haml", - "examples/compass/utilities.html.haml", - "examples/logo/logo.html.haml", - "examples/logo/src/ie.sass", - "examples/logo/src/print.sass", - "examples/logo/src/screen.sass", - "examples/yui/divisions.html.haml", - "examples/yui/index.html.haml", - "examples/yui/src/screen.sass", - "examples/yui/sub_divisions.html.haml", - "examples/yui/templates.html.haml", - "examples/yui/test.jpg", - "examples/yui/typography.html.haml", - "frameworks/blueprint.rb", - "frameworks/blueprint/stylesheets/_blueprint.sass", - "frameworks/blueprint/stylesheets/blueprint/_ie.sass", - "frameworks/blueprint/stylesheets/blueprint/_print.sass", - "frameworks/blueprint/stylesheets/blueprint/_reset.sass", - "frameworks/blueprint/stylesheets/blueprint/_screen.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_form.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass", - "frameworks/blueprint/templates/buttons/buttons.sass", - "frameworks/blueprint/templates/buttons/buttons/cross.png", - "frameworks/blueprint/templates/buttons/buttons/key.png", - "frameworks/blueprint/templates/buttons/buttons/tick.png", - "frameworks/blueprint/templates/buttons/manifest.rb", - "frameworks/blueprint/templates/link_icons/link_icons.sass", - "frameworks/blueprint/templates/link_icons/link_icons/doc.png", - "frameworks/blueprint/templates/link_icons/link_icons/email.png", - "frameworks/blueprint/templates/link_icons/link_icons/external.png", - "frameworks/blueprint/templates/link_icons/link_icons/feed.png", - "frameworks/blueprint/templates/link_icons/link_icons/im.png", - "frameworks/blueprint/templates/link_icons/link_icons/pdf.png", - "frameworks/blueprint/templates/link_icons/link_icons/visited.png", - "frameworks/blueprint/templates/link_icons/link_icons/xls.png", - "frameworks/blueprint/templates/link_icons/manifest.rb", - "frameworks/blueprint/templates/project/grid.png", - "frameworks/blueprint/templates/project/ie.sass", - "frameworks/blueprint/templates/project/manifest.rb", - "frameworks/blueprint/templates/project/partials/_base.sass", - "frameworks/blueprint/templates/project/print.sass", - "frameworks/blueprint/templates/project/screen.sass", - "frameworks/compass.rb", - "frameworks/compass/stylesheets/_compass.sass", - "frameworks/compass/stylesheets/compass/_layout.sass", - "frameworks/compass/stylesheets/compass/_misc.sass", - "frameworks/compass/stylesheets/compass/_reset.sass", - "frameworks/compass/stylesheets/compass/_utilities.sass", - "frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass", - "frameworks/compass/stylesheets/compass/utilities/_general.sass", - "frameworks/compass/stylesheets/compass/utilities/_links.sass", - "frameworks/compass/stylesheets/compass/utilities/_lists.sass", - "frameworks/compass/stylesheets/compass/utilities/_print.sass", - "frameworks/compass/stylesheets/compass/utilities/_sprites.sass", - "frameworks/compass/stylesheets/compass/utilities/_tables.sass", - "frameworks/compass/stylesheets/compass/utilities/_text.sass", - "frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass", - "frameworks/compass/stylesheets/compass/utilities/general/_float.sass", - "frameworks/compass/stylesheets/compass/utilities/general/_hacks.sass", - "frameworks/compass/stylesheets/compass/utilities/general/_inline_block.sass", - "frameworks/compass/stylesheets/compass/utilities/general/_reset.sass", - "frameworks/compass/stylesheets/compass/utilities/general/_tabs.sass", - "frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass", - "frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass", - "frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass", - "frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass", - "frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass", - "frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass", - "frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass", - "frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass", - "frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass", - "frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass", - "frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass", - "frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.sass", - "frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass", - "frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass", - "frameworks/compass/templates/ellipsis/ellipsis.sass", - "frameworks/compass/templates/ellipsis/manifest.rb", - "frameworks/compass/templates/ellipsis/xml/ellipsis.xml", - "frameworks/compass/templates/project/ie.sass", - "frameworks/compass/templates/project/manifest.rb", - "frameworks/compass/templates/project/print.sass", - "frameworks/compass/templates/project/screen.sass", - "frameworks/yui.rb", - "frameworks/yui/stylesheets/_yui.sass", - "frameworks/yui/stylesheets/yui/modules/_base.sass", - "frameworks/yui/stylesheets/yui/modules/_fonts.sass", - "frameworks/yui/stylesheets/yui/modules/_grids.sass", - "frameworks/yui/stylesheets/yui/modules/_reset.sass", - "frameworks/yui/templates/project/manifest.rb", - "frameworks/yui/templates/project/screen.sass", - "lib/compass.rb", - "lib/compass/actions.rb", - "lib/compass/app_integration.rb", - "lib/compass/app_integration/merb.rb", - "lib/compass/app_integration/rails.rb", - "lib/compass/app_integration/rails/action_controller.rb", - "lib/compass/app_integration/rails/sass_plugin.rb", - "lib/compass/app_integration/rails/templates/compass-install-rails.rb", - "lib/compass/app_integration/rails/urls.rb", - "lib/compass/commands/base.rb", - "lib/compass/commands/create_project.rb", - "lib/compass/commands/generate_grid_background.rb", - "lib/compass/commands/installer_command.rb", - "lib/compass/commands/list_frameworks.rb", - "lib/compass/commands/print_version.rb", - "lib/compass/commands/project_base.rb", - "lib/compass/commands/stamp_pattern.rb", - "lib/compass/commands/update_project.rb", - "lib/compass/commands/validate_project.rb", - "lib/compass/commands/watch_project.rb", - "lib/compass/commands/write_configuration.rb", - "lib/compass/compiler.rb", - "lib/compass/configuration.rb", - "lib/compass/core_ext.rb", - "lib/compass/dependencies.rb", - "lib/compass/errors.rb", - "lib/compass/exec.rb", - "lib/compass/frameworks.rb", - "lib/compass/grid_builder.rb", - "lib/compass/installers.rb", - "lib/compass/installers/base.rb", - "lib/compass/installers/manifest.rb", - "lib/compass/installers/rails.rb", - "lib/compass/installers/stand_alone.rb", - "lib/compass/logger.rb", - "lib/compass/sass_extensions.rb", - "lib/compass/sass_extensions/functions.rb", - "lib/compass/sass_extensions/functions/display.rb", - "lib/compass/sass_extensions/functions/enumerate.rb", - "lib/compass/sass_extensions/functions/inline_image.rb", - "lib/compass/sass_extensions/functions/selectors.rb", - "lib/compass/sass_extensions/functions/urls.rb", - "lib/compass/sass_extensions/monkey_patches.rb", - "lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb", - "lib/compass/test_case.rb", - "lib/compass/validator.rb", - "lib/compass/version.rb", - "lib/vendor/fssm.rb", - "lib/vendor/fssm/backends/fsevents.rb", - "lib/vendor/fssm/backends/polling.rb", - "lib/vendor/fssm/cache.rb", - "lib/vendor/fssm/ext.rb", - "lib/vendor/fssm/fsevents.rb", - "lib/vendor/fssm/monitor.rb", - "lib/vendor/fssm/path.rb", - "lib/vendor/fssm/state.rb", - "lib/vendor/fssm/support.rb", - "lib/vendor/fssm/tree.rb", - "test/command_line_helper.rb", - "test/command_line_test.rb", - "test/compass_test.rb", - "test/configuration_test.rb", - "test/fixtures/stylesheets/blueprint/config.rb", - "test/fixtures/stylesheets/blueprint/css/typography.css", - "test/fixtures/stylesheets/blueprint/images/grid.png", - "test/fixtures/stylesheets/blueprint/sass/ie.sass", - "test/fixtures/stylesheets/blueprint/sass/print.sass", - "test/fixtures/stylesheets/blueprint/sass/screen.sass", - "test/fixtures/stylesheets/blueprint/sass/typography.sass", - "test/fixtures/stylesheets/compass/config.rb", - "test/fixtures/stylesheets/compass/css/layout.css", - "test/fixtures/stylesheets/compass/css/print.css", - "test/fixtures/stylesheets/compass/css/reset.css", - "test/fixtures/stylesheets/compass/css/utilities.css", - "test/fixtures/stylesheets/compass/sass/layout.sass", - "test/fixtures/stylesheets/compass/sass/print.sass", - "test/fixtures/stylesheets/compass/sass/reset.sass", - "test/fixtures/stylesheets/compass/sass/utilities.sass", - "test/fixtures/stylesheets/image_urls/config.rb", - "test/fixtures/stylesheets/image_urls/css/screen.css", - "test/fixtures/stylesheets/image_urls/images/grid.png", - "test/fixtures/stylesheets/image_urls/sass/screen.sass", - "test/fixtures/stylesheets/yui/config.rb", - "test/fixtures/stylesheets/yui/css/mixins.css", - "test/fixtures/stylesheets/yui/sass/base.sass", - "test/fixtures/stylesheets/yui/sass/fonts.sass", - "test/fixtures/stylesheets/yui/sass/grids.sass", - "test/fixtures/stylesheets/yui/sass/mixins.sass", - "test/rails_integration_test.rb", - "test/sass_extensions_test.rb", - "test/test_case_helper.rb", - "test/test_helper.rb", - "test/test_rails_helper.rb" + "LICENSE.markdown", + "README.markdown", + "REVISION", + "Rakefile", + "VERSION.yml", + "bin/compass", + "deps.rip", + "examples/README.markdown", + "examples/blueprint_default/config.rb", + "examples/blueprint_default/images/grid.png", + "examples/blueprint_default/index.html.haml", + "examples/blueprint_default/parts/elements.html.haml", + "examples/blueprint_default/parts/forms.html.haml", + "examples/blueprint_default/parts/grid.html.haml", + "examples/blueprint_default/parts/test-small.jpg", + "examples/blueprint_default/parts/test.jpg", + "examples/blueprint_default/parts/valid.png", + "examples/blueprint_default/src/ie.sass", + "examples/blueprint_default/src/images/grid.png", + "examples/blueprint_default/src/print.sass", + "examples/blueprint_default/src/screen.sass", + "examples/blueprint_plugins/config.rb", + "examples/blueprint_plugins/images/buttons/cross.png", + "examples/blueprint_plugins/images/buttons/key.png", + "examples/blueprint_plugins/images/buttons/tick.png", + "examples/blueprint_plugins/images/grid.png", + "examples/blueprint_plugins/images/link_icons/doc.png", + "examples/blueprint_plugins/images/link_icons/email.png", + "examples/blueprint_plugins/images/link_icons/external.png", + "examples/blueprint_plugins/images/link_icons/feed.png", + "examples/blueprint_plugins/images/link_icons/im.png", + "examples/blueprint_plugins/images/link_icons/pdf.png", + "examples/blueprint_plugins/images/link_icons/visited.png", + "examples/blueprint_plugins/images/link_icons/xls.png", + "examples/blueprint_plugins/images/test-small.jpg", + "examples/blueprint_plugins/images/test.jpg", + "examples/blueprint_plugins/images/valid.png", + "examples/blueprint_plugins/index.html.haml", + "examples/blueprint_plugins/plugins/buttons.html.haml", + "examples/blueprint_plugins/plugins/fancy_type.html.haml", + "examples/blueprint_plugins/plugins/link_icons.html.haml", + "examples/blueprint_plugins/plugins/rtl.html.haml", + "examples/blueprint_plugins/src/buttons.sass", + "examples/blueprint_plugins/src/ie.sass", + "examples/blueprint_plugins/src/images/grid.png", + "examples/blueprint_plugins/src/link_icons.sass", + "examples/blueprint_plugins/src/print.sass", + "examples/blueprint_plugins/src/rtl_screen.sass", + "examples/blueprint_plugins/src/screen.sass", + "examples/blueprint_scoped/images/grid.png", + "examples/blueprint_scoped/src/ie.sass", + "examples/blueprint_scoped/src/print.sass", + "examples/blueprint_scoped/src/screen.sass", + "examples/blueprint_scoped_form/images/grid.png", + "examples/blueprint_scoped_form/src/ie.sass", + "examples/blueprint_scoped_form/src/print.sass", + "examples/blueprint_scoped_form/src/screen.sass", + "examples/blueprint_semantic/config.rb", + "examples/blueprint_semantic/images/grid.png", + "examples/blueprint_semantic/index.html.haml", + "examples/blueprint_semantic/parts/fancy_type.html.haml", + "examples/blueprint_semantic/parts/liquid.html.haml", + "examples/blueprint_semantic/parts/test-small.jpg", + "examples/blueprint_semantic/parts/test.jpg", + "examples/blueprint_semantic/parts/valid.png", + "examples/blueprint_semantic/src/ie.sass", + "examples/blueprint_semantic/src/images/grid.png", + "examples/blueprint_semantic/src/liquid.sass", + "examples/blueprint_semantic/src/print.sass", + "examples/blueprint_semantic/src/screen.sass", + "examples/compass/compass.html.haml", + "examples/compass/config.rb", + "examples/compass/images/blue_arrow.gif", + "examples/compass/src/compass.sass", + "examples/compass/src/images/blue_arrow.gif", + "examples/compass/src/sticky_footer.sass", + "examples/compass/src/utilities.sass", + "examples/compass/sticky_footer.html.haml", + "examples/compass/utilities.html.haml", + "examples/downloader.rb", + "examples/logo/logo.html.haml", + "examples/logo/src/ie.sass", + "examples/logo/src/print.sass", + "examples/logo/src/screen.sass", + "examples/ninesixty/bootstrap.rb", + "examples/ninesixty/config.rb", + "examples/ninesixty/extensions/ninesixty/README.mkdn", + "examples/ninesixty/extensions/ninesixty/compass-960-plugin.gemspec", + "examples/ninesixty/extensions/ninesixty/lib/ninesixty.rb", + "examples/ninesixty/extensions/ninesixty/lib/ninesixty/compass_plugin.rb", + "examples/ninesixty/extensions/ninesixty/sass/960/_grid.sass", + "examples/ninesixty/extensions/ninesixty/sass/960/_text.sass", + "examples/ninesixty/extensions/ninesixty/templates/project/grid.sass", + "examples/ninesixty/extensions/ninesixty/templates/project/manifest.rb", + "examples/ninesixty/extensions/ninesixty/templates/project/text.sass", + "examples/ninesixty/src/grid.sass", + "examples/ninesixty/src/text.sass", + "examples/yui/bootstrap.rb", + "examples/yui/divisions.html.haml", + "examples/yui/extensions/yui/stylesheets/_yui.sass", + "examples/yui/extensions/yui/stylesheets/yui/modules/_base.sass", + "examples/yui/extensions/yui/stylesheets/yui/modules/_fonts.sass", + "examples/yui/extensions/yui/stylesheets/yui/modules/_grids.sass", + "examples/yui/extensions/yui/stylesheets/yui/modules/_reset.sass", + "examples/yui/extensions/yui/templates/project/manifest.rb", + "examples/yui/extensions/yui/templates/project/screen.sass", + "examples/yui/index.html.haml", + "examples/yui/src/screen.sass", + "examples/yui/sub_divisions.html.haml", + "examples/yui/templates.html.haml", + "examples/yui/test.jpg", + "examples/yui/typography.html.haml", + "lib/compass.rb", + "lib/compass/actions.rb", + "lib/compass/app_integration.rb", + "lib/compass/app_integration/merb.rb", + "lib/compass/app_integration/merb/runtime.rb", + "lib/compass/app_integration/rails.rb", + "lib/compass/app_integration/rails/action_controller.rb", + "lib/compass/app_integration/rails/configuration_defaults.rb", + "lib/compass/app_integration/rails/installer.rb", + "lib/compass/app_integration/rails/runtime.rb", + "lib/compass/app_integration/rails/sass_plugin.rb", + "lib/compass/app_integration/rails/templates/compass-install-rails.rb", + "lib/compass/app_integration/rails/urls.rb", + "lib/compass/app_integration/stand_alone.rb", + "lib/compass/app_integration/stand_alone/configuration_defaults.rb", + "lib/compass/app_integration/stand_alone/installer.rb", + "lib/compass/commands.rb", + "lib/compass/commands/base.rb", + "lib/compass/commands/create_project.rb", + "lib/compass/commands/generate_grid_background.rb", + "lib/compass/commands/help.rb", + "lib/compass/commands/installer_command.rb", + "lib/compass/commands/list_frameworks.rb", + "lib/compass/commands/print_version.rb", + "lib/compass/commands/project_base.rb", + "lib/compass/commands/project_stats.rb", + "lib/compass/commands/registry.rb", + "lib/compass/commands/stamp_pattern.rb", + "lib/compass/commands/update_project.rb", + "lib/compass/commands/validate_project.rb", + "lib/compass/commands/watch_project.rb", + "lib/compass/commands/write_configuration.rb", + "lib/compass/compiler.rb", + "lib/compass/configuration.rb", + "lib/compass/configuration/adapters.rb", + "lib/compass/configuration/comments.rb", + "lib/compass/configuration/data.rb", + "lib/compass/configuration/defaults.rb", + "lib/compass/configuration/helpers.rb", + "lib/compass/configuration/inheritance.rb", + "lib/compass/configuration/serialization.rb", + "lib/compass/core_ext.rb", + "lib/compass/dependencies.rb", + "lib/compass/errors.rb", + "lib/compass/exec.rb", + "lib/compass/exec/command_option_parser.rb", + "lib/compass/exec/global_options_parser.rb", + "lib/compass/exec/helpers.rb", + "lib/compass/exec/project_options_parser.rb", + "lib/compass/exec/sub_command_ui.rb", + "lib/compass/exec/switch_ui.rb", + "lib/compass/frameworks.rb", + "lib/compass/frameworks/blueprint/stylesheets/_blueprint.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/_ie.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/_print.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/_reset.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/_screen.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass", + "lib/compass/frameworks/blueprint/templates/buttons/buttons.sass", + "lib/compass/frameworks/blueprint/templates/buttons/buttons/cross.png", + "lib/compass/frameworks/blueprint/templates/buttons/buttons/key.png", + "lib/compass/frameworks/blueprint/templates/buttons/buttons/tick.png", + "lib/compass/frameworks/blueprint/templates/buttons/manifest.rb", + "lib/compass/frameworks/blueprint/templates/link_icons/link_icons.sass", + "lib/compass/frameworks/blueprint/templates/link_icons/link_icons/doc.png", + "lib/compass/frameworks/blueprint/templates/link_icons/link_icons/email.png", + "lib/compass/frameworks/blueprint/templates/link_icons/link_icons/external.png", + "lib/compass/frameworks/blueprint/templates/link_icons/link_icons/feed.png", + "lib/compass/frameworks/blueprint/templates/link_icons/link_icons/im.png", + "lib/compass/frameworks/blueprint/templates/link_icons/link_icons/pdf.png", + "lib/compass/frameworks/blueprint/templates/link_icons/link_icons/visited.png", + "lib/compass/frameworks/blueprint/templates/link_icons/link_icons/xls.png", + "lib/compass/frameworks/blueprint/templates/link_icons/manifest.rb", + "lib/compass/frameworks/blueprint/templates/project/grid.png", + "lib/compass/frameworks/blueprint/templates/project/ie.sass", + "lib/compass/frameworks/blueprint/templates/project/manifest.rb", + "lib/compass/frameworks/blueprint/templates/project/partials/_base.sass", + "lib/compass/frameworks/blueprint/templates/project/print.sass", + "lib/compass/frameworks/blueprint/templates/project/screen.sass", + "lib/compass/frameworks/blueprint/templates/project/welcome.html.haml", + "lib/compass/frameworks/compass/stylesheets/_compass.sass", + "lib/compass/frameworks/compass/stylesheets/compass/_layout.sass", + "lib/compass/frameworks/compass/stylesheets/compass/_misc.sass", + "lib/compass/frameworks/compass/stylesheets/compass/_reset.sass", + "lib/compass/frameworks/compass/stylesheets/compass/_utilities.sass", + "lib/compass/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/_css3.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/_general.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/_links.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/_lists.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/_print.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/_sprites.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/_tables.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/_text.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_border_radius.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_box_shadow.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_box_sizing.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_columns.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_inline_block.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_opacity.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_float.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_hacks.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_tabs.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass", + "lib/compass/frameworks/compass/templates/ellipsis/ellipsis.sass", + "lib/compass/frameworks/compass/templates/ellipsis/manifest.rb", + "lib/compass/frameworks/compass/templates/ellipsis/xml/ellipsis.xml", + "lib/compass/frameworks/compass/templates/extension/manifest.rb", + "lib/compass/frameworks/compass/templates/extension/stylesheets/main.sass", + "lib/compass/frameworks/compass/templates/extension/templates/project/manifest.rb", + "lib/compass/frameworks/compass/templates/extension/templates/project/screen.sass", + "lib/compass/frameworks/compass/templates/project/ie.sass", + "lib/compass/frameworks/compass/templates/project/manifest.rb", + "lib/compass/frameworks/compass/templates/project/print.sass", + "lib/compass/frameworks/compass/templates/project/screen.sass", + "lib/compass/grid_builder.rb", + "lib/compass/installers.rb", + "lib/compass/installers/bare_installer.rb", + "lib/compass/installers/base.rb", + "lib/compass/installers/manifest.rb", + "lib/compass/installers/manifest_installer.rb", + "lib/compass/installers/template_context.rb", + "lib/compass/logger.rb", + "lib/compass/sass_extensions.rb", + "lib/compass/sass_extensions/functions.rb", + "lib/compass/sass_extensions/functions/display.rb", + "lib/compass/sass_extensions/functions/enumerate.rb", + "lib/compass/sass_extensions/functions/inline_image.rb", + "lib/compass/sass_extensions/functions/selectors.rb", + "lib/compass/sass_extensions/functions/urls.rb", + "lib/compass/sass_extensions/monkey_patches.rb", + "lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb", + "lib/compass/sass_extensions/monkey_patches/traversal.rb", + "lib/compass/stats.rb", + "lib/compass/test_case.rb", + "lib/compass/validator.rb", + "lib/compass/version.rb", + "lib/vendor/fssm.rb", + "lib/vendor/fssm/backends/fsevents.rb", + "lib/vendor/fssm/backends/polling.rb", + "lib/vendor/fssm/ext.rb", + "lib/vendor/fssm/monitor.rb", + "lib/vendor/fssm/path.rb", + "lib/vendor/fssm/state.rb", + "lib/vendor/fssm/support.rb", + "test/command_line_helper.rb", + "test/command_line_test.rb", + "test/compass_test.rb", + "test/configuration_test.rb", + "test/fixtures/stylesheets/blueprint/config.rb", + "test/fixtures/stylesheets/blueprint/css/typography.css", + "test/fixtures/stylesheets/blueprint/images/grid.png", + "test/fixtures/stylesheets/blueprint/sass/ie.sass", + "test/fixtures/stylesheets/blueprint/sass/print.sass", + "test/fixtures/stylesheets/blueprint/sass/screen.sass", + "test/fixtures/stylesheets/blueprint/sass/typography.sass", + "test/fixtures/stylesheets/compass/config.rb", + "test/fixtures/stylesheets/compass/css/layout.css", + "test/fixtures/stylesheets/compass/css/print.css", + "test/fixtures/stylesheets/compass/css/reset.css", + "test/fixtures/stylesheets/compass/css/utilities.css", + "test/fixtures/stylesheets/compass/sass/layout.sass", + "test/fixtures/stylesheets/compass/sass/print.sass", + "test/fixtures/stylesheets/compass/sass/reset.sass", + "test/fixtures/stylesheets/compass/sass/utilities.sass", + "test/fixtures/stylesheets/image_urls/config.rb", + "test/fixtures/stylesheets/image_urls/css/screen.css", + "test/fixtures/stylesheets/image_urls/images/grid.png", + "test/fixtures/stylesheets/image_urls/sass/screen.sass", + "test/io_helper.rb", + "test/rails_helper.rb", + "test/rails_integration_test.rb", + "test/sass_extensions_test.rb", + "test/test_case_helper.rb", + "test/test_helper.rb", + "test/test_rails_helper.rb" ] s.homepage = %q{http://compass-style.org} s.rdoc_options = ["--charset=UTF-8"] s.require_paths = ["lib"] s.rubyforge_project = %q{compass} - s.rubygems_version = %q{1.3.3} + s.rubygems_version = %q{1.3.5} s.summary = %q{A Real Stylesheet Framework} s.test_files = [ "test/command_line_helper.rb", - "test/command_line_test.rb", - "test/compass_test.rb", - "test/configuration_test.rb", - "test/fixtures/stylesheets/blueprint/config.rb", - "test/fixtures/stylesheets/blueprint/css/typography.css", - "test/fixtures/stylesheets/blueprint/images/grid.png", - "test/fixtures/stylesheets/blueprint/sass/ie.sass", - "test/fixtures/stylesheets/blueprint/sass/print.sass", - "test/fixtures/stylesheets/blueprint/sass/screen.sass", - "test/fixtures/stylesheets/blueprint/sass/typography.sass", - "test/fixtures/stylesheets/compass/config.rb", - "test/fixtures/stylesheets/compass/css/layout.css", - "test/fixtures/stylesheets/compass/css/print.css", - "test/fixtures/stylesheets/compass/css/reset.css", - "test/fixtures/stylesheets/compass/css/utilities.css", - "test/fixtures/stylesheets/compass/sass/layout.sass", - "test/fixtures/stylesheets/compass/sass/print.sass", - "test/fixtures/stylesheets/compass/sass/reset.sass", - "test/fixtures/stylesheets/compass/sass/utilities.sass", - "test/fixtures/stylesheets/image_urls/config.rb", - "test/fixtures/stylesheets/image_urls/css/screen.css", - "test/fixtures/stylesheets/image_urls/images/grid.png", - "test/fixtures/stylesheets/image_urls/sass/screen.sass", - "test/fixtures/stylesheets/yui/config.rb", - "test/fixtures/stylesheets/yui/css/mixins.css", - "test/fixtures/stylesheets/yui/sass/base.sass", - "test/fixtures/stylesheets/yui/sass/fonts.sass", - "test/fixtures/stylesheets/yui/sass/grids.sass", - "test/fixtures/stylesheets/yui/sass/mixins.sass", - "test/rails_integration_test.rb", - "test/sass_extensions_test.rb", - "test/test_case_helper.rb", - "test/test_helper.rb", - "test/test_rails_helper.rb" + "test/command_line_test.rb", + "test/compass_test.rb", + "test/configuration_test.rb", + "test/fixtures/stylesheets/blueprint/config.rb", + "test/fixtures/stylesheets/blueprint/css/typography.css", + "test/fixtures/stylesheets/blueprint/images/grid.png", + "test/fixtures/stylesheets/blueprint/sass/ie.sass", + "test/fixtures/stylesheets/blueprint/sass/print.sass", + "test/fixtures/stylesheets/blueprint/sass/screen.sass", + "test/fixtures/stylesheets/blueprint/sass/typography.sass", + "test/fixtures/stylesheets/compass/config.rb", + "test/fixtures/stylesheets/compass/css/layout.css", + "test/fixtures/stylesheets/compass/css/print.css", + "test/fixtures/stylesheets/compass/css/reset.css", + "test/fixtures/stylesheets/compass/css/utilities.css", + "test/fixtures/stylesheets/compass/sass/layout.sass", + "test/fixtures/stylesheets/compass/sass/print.sass", + "test/fixtures/stylesheets/compass/sass/reset.sass", + "test/fixtures/stylesheets/compass/sass/utilities.sass", + "test/fixtures/stylesheets/image_urls/config.rb", + "test/fixtures/stylesheets/image_urls/css/screen.css", + "test/fixtures/stylesheets/image_urls/images/grid.png", + "test/fixtures/stylesheets/image_urls/sass/screen.sass", + "test/io_helper.rb", + "test/rails_helper.rb", + "test/rails_integration_test.rb", + "test/sass_extensions_test.rb", + "test/test_case_helper.rb", + "test/test_helper.rb", + "test/test_rails_helper.rb", + "features/command_line.feature", + "features/step_definitions/command_line_steps.rb" ] if s.respond_to? :specification_version then @@ -348,3 +392,4 @@ Gem::Specification.new do |s| s.add_dependency(%q, [">= 2.2.0"]) end end + diff --git a/docs/COMMAND_LINE.markdown b/docs/COMMAND_LINE.markdown new file mode 100644 index 00000000..540ee905 --- /dev/null +++ b/docs/COMMAND_LINE.markdown @@ -0,0 +1,68 @@ +Compass Command Line Documentation +================================== + +Extensions Commands +------------------- + + # install a global extension. probably requires sudo. + compass extension install extension_name + + # install an extension into a project + compass extension unpack extension_name [path/to/project] + + # uninstall a local or global extension. global extensions will require sudo. + compass extension uninstall extension_name [path/to/project] + + # list the extensions in the project + compass extensions list + + # list the extensions available for install + compass extensions available + +Project Commands +---------------- + + # Create a new compass project + compass create path/to/project [--using blueprint] [--sass-dir=sass ...] [--project-type=rails] + + # Initialize an existing project to work with compass + compass init rails path/to/project [--using blueprint] + + # Install a pattern from an extension into a project + compass install blueprint/buttons [path/to/project] + + # Compile the project's sass files into css + compass compile [path/to/project] + + # Watch the project for changes and compile whenever it does + compass watch [path/to/project] + + # Emit a configuration file at the location specified. + compass config [path/to/config] [--sass-dir=sass --css-dir=css ...] + + # Validate the generated CSS. + compass validate [path/to/project] + +misc commands +------------- + + # Generate a background image that can be used to verify grid alignment + compass grid-img W+GxH [path/to/grid.png] + + # Emit the version of compass + compass version + + # Get help on compass + compass help + + # Get help on an extension + compass help extension_name + + # Get help about an extension pattern + compass help extension_name/pattern_name + + # Get help about a particular sub command + compass help command_name + + + diff --git a/docs/EXTENSIONS.markdown b/docs/EXTENSIONS.markdown new file mode 100644 index 00000000..a3b4d8d3 --- /dev/null +++ b/docs/EXTENSIONS.markdown @@ -0,0 +1,183 @@ +Compass Extensions +================== + +Compass, at its heart, is a framework upon which sass-based stylesheet frameworks are built. It provides the tools for building, installing and using reusable stylesheets that provide anything from full-fledged layout frameworks to designs for widgets or even full page designs. All using the power of sass to keep the semantic meaning of the html pages clear and free of design details. + +This document describes the compass extension toolset so that you can build your own compass extension. + +Basic Extension Layout +---------------------- + +
+an_extension
+|
+|- stylesheets (this directory will be on the sass load path)
+|  |
+|  |- an_extension (not technically required, but it's good to scope imports by the name of the extension)
+|  |  |
+|  |  |- _module_one.sass (this file would be imported using @import an_extension/module_one.sass)
+|  |  |- _module_two.sass (this file would be imported using @import an_extension/module_two.sass)
+|  |  |- ...
+|  |
+|  |- _an_extension.sass (This file will import the entire extension using @import an_extension.sass)
+|
+|- templates (this is where templates/patterns go)
+|  |
+|  |- project (this should be provided if you'd like people to be able to base their project on the extension)
+|  |  |
+|  |  |- manifest.rb (this file should declare the contents of the template)
+|  |  |- screen.sass (this would be the main stylesheet, importing from your extension and demonstrating its use)
+|  |  |- print.sass (this file would set up basic print styles)
+|  |  |- ie.sass (if you want, you can provide custom styles for IE)
+|  |
+|  |- some_pattern
+|     |
+|     |- manifest.rb
+|     |- some.sass (some sass is probably in order, always import from the extension library as much as possible)
+|     |- some_script.js (yes, you can provide javascript code)
+|     |- some_image.png (and images)
+|     |- some_content.html.haml (and even html and haml)
+|     |- some_other_file.txt (and other arbitrary files)
+|
+|- lib (optional ruby code)
+   |
+   |- an_extension.rb (this code can register your framework if you deviate from conventions and require sass extensions, etc.)
+   |
+   |- an_extension
+      |
+      |- sass_extensions.rb (this is the standard location to place sass functions)
+
+ +Names in bold are part of the extension naming convention. + +Generating an Extension +----------------------- + +If you want a leg up to get started working on your extension, you can use compass to generate an extension with the following command: + + compass -p extension -n an_extension . + +This will create a few basic files and folders to get you started, use the -n option to specify the name of your extension. + +Advanced Layout Options +----------------------- + +### Library File Location + +The extension library file referenced above as `an_extension/lib/an_extension.rb` can actually be stored at any of the following three locations: + +1. `an_extension/compass_init.rb` +2. `an_extension/lib/an_extension.rb` +3. `an_extension/an_extension.rb` + +The first of those locations found (in the above order) will be loaded. The compass_init.rb file takes priority, so that extensions that want to work differently as compass extensions than they do as normal ruby libraries, have a way of targeting compass. + +### Stylesheet and Template Locations + +If you'd like to store your stylesheets and/or templates in a non-standard location within your extension, +you must provide a library file and register the extension explicitly like so: + + base_directory = File.join(File.dirname(__FILE__), '..') # assuming you're in the lib directory + stylesheets_dir = File.join(base_directory, 'my', 'stylesheets') # always use File.join for support on unix and windows + templates_dir = File.join(base_directory, 'my', 'templates') # always use File.join for support on unix and windows + Compass::Frameworks.register('an_extension', :stylesheets_directory => stylesheets_dir, :templates_directory => templates_dir) + +If you're following the standard naming convention, but the stylesheet and template directories are not at the top level, you can just do this instead: + + base_directory = File.join(File.dirname(__FILE__), '..', 'compass') # path from the library file to where you're keeping your compass stuff. + Compass::Frameworks.register('an_extension', :path => base_directory) + +Conventions to Follow +--------------------- + +The following are not required, but are standards that your framework should attempt to adhere to unless there's a good reason not to do so. + +1. Have a single import for your framework. +2. Break up your framework into modules so that people can import just smaller pieces for faster load times when they're not using everything. +3. Use partials (files starting with an underscore) for stylesheets that are meant to be imported. If you do not Sass will generate css + files for your libaries in some configurations. +4. Provide a project template. If you do not, your project should only be providing widgets or page designs, etc. + +Building a Template (a.k.a. Pattern) +==================================== + +Manifest Files +-------------- + +The manifest file declares the template contents and tells compass information about the files in the template. + +### An Example Manifest File + + stylesheet 'screen.sass', :media => 'screen, projection' + stylesheet 'partials/_base.sass' + stylesheet 'print.sass', :media => 'print' + stylesheet 'ie.sass', :media => 'screen, projection', :condition => "lt IE 8" + + image 'grid.png' + javascript 'script.js' + + html 'welcome.html.haml', :erb => true + file 'README' + +### Manifest Declarations + +There are five kinds of manifest declarations: + +1. `stylesheet` - Declares a sass file. +2. `image` - Declares an image. +3. `javascript` - Declares a javascript file. +4. `html` - Declares an html file. +5. `file` - Decares a random file. + +All declarations take the path to the file as their first argument. Note that the normal slash `/` can and should be used in a manifest. Compass will take care of the cross platform issues. The path to the file will be reproduced in the user's project, so please keep that in mind when creating folders. The location where files are going to be installed is dictated by the user's project configuration, however, a template can place things into subdirectories relative to + +Common options: + +* `:erb` - When set to true, the file will be processed via the ERB templating language. See the "Advanced Manifests" section below for more details. +* `:to` - The location where the file should be installed relative to the type-specific location. +* `:like` - Most often used with a `file` declaration, this option allows you to install into the location of another manifest type (and also :css). E.g. :like => :css + +Stylesheet options: + +* `:media` - this is used as a hint to the user about the media attribute of the stylesheet link tag. +* `:condition` - this is used to hint the user that a conditional comment should be used to import the stylesheet with the given condition. + +HTML files: + +You can provide html as haml or as plain html. If you provide haml, the haml will be converted to html when it is installed, unless the project allows haml files. Providing html files is usually done to demonstrate how to use a more complicated design and to get the user started off with working product. + +### Advanced Manifests and Templates + +* ERB Processing - This can be used to customize the contents of the file in an extension template. The template will be processed in the context of a TemplateContext instance, which gives you access to the full project configuration information as well as the command line options. Since it's unlikely many templates will need this functionality, I leave it as an exercise of the user to figure it out and if they can't to contact the compass-devs mailing list for assistance. +* `no_configuration_file!` - calling this method within the manifest will tell the installer to skip the creation of a configuration file. +* `skip_compilation!` - calling this method within the manifest will tell the installer to skip compilation of sass files to css. + +Distributing Extensions as Ruby Gems +------------------------------------ + +How to build and distribute ruby gems is outside the scope of this document. But delivering an extension as a ruby gem makes it easier to manage software dependencies, install, and uninstall. + +Tips for Developing Extensions +------------------------------ + +* If you're developing a simple extension, you may find it convenient to place your extension within an existing compass project in the extension folder. + +Installing Extensions +--------------------- + +TBD: How to install extensions that are not managed via ruby gems and when there's no existing project. Maybe in ~/.compass/extensions? + +TBD: How to install extensions for rails projects? Maybe in vendor/plugins/compass_extensions? + +To install via ruby gems: + + sudo gem install an-extension + compass -r `an_extension` -f an_extension my_project + +To install into an existing project, simply place the extension into a project's extension directory. This could be done via a git clone or by extracting an archive. + +To install via rubygems into an existing project: + + sudo gem install an-extension + # edit the project configuration file and add: + require 'an_extension' diff --git a/examples/blueprint_scoped/src/ie.sass b/examples/blueprint_scoped/src/ie.sass index badeb777..455f7597 100644 --- a/examples/blueprint_scoped/src/ie.sass +++ b/examples/blueprint_scoped/src/ie.sass @@ -1,3 +1,4 @@ @import blueprint.sass -+blueprint-ie("body.bp") \ No newline at end of file +body.bp + +blueprint-ie(true) \ No newline at end of file diff --git a/examples/blueprint_scoped/src/print.sass b/examples/blueprint_scoped/src/print.sass index 949e578e..f08fa0fd 100644 --- a/examples/blueprint_scoped/src/print.sass +++ b/examples/blueprint_scoped/src/print.sass @@ -1,3 +1,4 @@ @import blueprint.sass -+blueprint-print("body.bp") \ No newline at end of file +body.bp + +blueprint-print(true) \ No newline at end of file diff --git a/examples/blueprint_scoped/src/screen.sass b/examples/blueprint_scoped/src/screen.sass index 400f3314..0367fa59 100644 --- a/examples/blueprint_scoped/src/screen.sass +++ b/examples/blueprint_scoped/src/screen.sass @@ -1,4 +1,5 @@ @import blueprint.sass @import compass/reset.sass -+blueprint("body.bp") \ No newline at end of file +body.bp + +blueprint(true) \ No newline at end of file diff --git a/examples/blueprint_semantic/parts/fancy_type.html.haml b/examples/blueprint_semantic/parts/fancy_type.html.haml index 8aabaca2..6265521c 100644 --- a/examples/blueprint_semantic/parts/fancy_type.html.haml +++ b/examples/blueprint_semantic/parts/fancy_type.html.haml @@ -37,7 +37,7 @@ %hr.space #main %p - %img#test{ :src => "test.jpg", :alt => "test" } + %img#test.left{ :src => "test.jpg", :alt => "test" } Lorem ipsum dolor sit amet, %em consectetuer adipiscing elit diff --git a/examples/blueprint_semantic/src/liquid.sass b/examples/blueprint_semantic/src/liquid.sass index 04e500b9..85267c7c 100644 --- a/examples/blueprint_semantic/src/liquid.sass +++ b/examples/blueprint_semantic/src/liquid.sass @@ -7,9 +7,8 @@ .container +container -+blueprint-typography("body.blueprint") - body.blueprint + +blueprint-typography(true) +blueprint-scaffolding-body hr +colruler diff --git a/examples/blueprint_semantic/src/screen.sass b/examples/blueprint_semantic/src/screen.sass index 9ad7bd09..a348df2e 100644 --- a/examples/blueprint_semantic/src/screen.sass +++ b/examples/blueprint_semantic/src/screen.sass @@ -3,9 +3,8 @@ @import blueprint/modules/scaffolding.sass @import compass/reset.sass -+blueprint-typography("body.blueprint") - body.blueprint + +blueprint-typography(true) +blueprint-scaffolding-body .container +container diff --git a/examples/downloader.rb b/examples/downloader.rb new file mode 100644 index 00000000..eef35e4e --- /dev/null +++ b/examples/downloader.rb @@ -0,0 +1,57 @@ +require 'net/http' +require 'fileutils' +require 'rubygems' +require 'zip/zip' + + +def fetch(uri_str, limit = 10) + raise ArgumentError, 'HTTP redirect too deep' if limit == 0 + + url = URI.parse(uri_str) + http = Net::HTTP.new(url.host, url.port) + http.open_timeout = 2 + http.read_timeout = 30 + response = http.start do |http| + puts "getting #{url.path}" + http.request_get(url.path) + end + + case response + when Net::HTTPSuccess then response + when Net::HTTPRedirection then fetch(response['location'], limit - 1) + else + response.error! + end +end + +def install_from_github(user, project, ext_name, working_directory = Dir.pwd) + download_link = "http://github.com/#{user}/#{project}/zipball/master" + extdir = File.join(working_directory,'extensions') + + if !File.exists?(extdir) + begin + puts "Downloading the #{ext_name} plugin into #{extdir}." + FileUtils.mkdir(extdir) + zipfile = File.join(extdir, "#{ext_name}.zip") + open(zipfile, "wb") do |tgz| + tgz << fetch(download_link).body + end + puts "Unzipping the #{ext_name} plugin." + 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,"#{user}-#{project}-*"))[0] + FileUtils.mv(funky_directory, File.join(extdir, ext_name)) + puts "#{ext_name} installed." + rescue Exception => e + FileUtils.rm_rf(extdir) + raise + end + end + +end diff --git a/examples/ninesixty/bootstrap.rb b/examples/ninesixty/bootstrap.rb new file mode 100644 index 00000000..b2b52d70 --- /dev/null +++ b/examples/ninesixty/bootstrap.rb @@ -0,0 +1,4 @@ +require File.join(File.dirname(__FILE__), '..', 'downloader') + +install_from_github('chriseppstein', 'compass-960-plugin', 'ninesixty') + diff --git a/examples/ninesixty/config.rb b/examples/ninesixty/config.rb new file mode 100644 index 00000000..9f6e6154 --- /dev/null +++ b/examples/ninesixty/config.rb @@ -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 diff --git a/examples/ninesixty/src/grid.sass b/examples/ninesixty/src/grid.sass new file mode 100644 index 00000000..4198d85b --- /dev/null +++ b/examples/ninesixty/src/grid.sass @@ -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) diff --git a/examples/ninesixty/src/text.sass b/examples/ninesixty/src/text.sass new file mode 100644 index 00000000..0b69854a --- /dev/null +++ b/examples/ninesixty/src/text.sass @@ -0,0 +1,10 @@ +/* + 960 Grid System ~ Text CSS. + Learn more ~ http://960.gs/ + + Licensed under GPL and MIT. + + +@import 960/text.sass + ++text diff --git a/examples/yui/bootstrap.rb b/examples/yui/bootstrap.rb new file mode 100644 index 00000000..fcc0c7c4 --- /dev/null +++ b/examples/yui/bootstrap.rb @@ -0,0 +1,3 @@ +require File.join(File.dirname(__FILE__), '..', 'downloader') + +install_from_github('chriseppstein', 'yui-compass-plugin', 'yui') \ No newline at end of file diff --git a/features/command_line.feature b/features/command_line.feature new file mode 100644 index 00000000..03424ddd --- /dev/null +++ b/features/command_line.feature @@ -0,0 +1,226 @@ +Feature: Command Line + In order to manage my stylesheets + As a user on the command line + I want to create a new project + + Scenario: Install a project without a framework + When I create a project using: compass create my_project + Then a directory my_project/ is created + And a configuration file my_project/config.rb is created + And a sass file my_project/src/screen.sass is created + And a sass file my_project/src/print.sass is created + And a sass file my_project/src/ie.sass is created + And a sass file my_project/src/screen.sass is compiled + And a sass file my_project/src/print.sass is compiled + And a sass file my_project/src/ie.sass is compiled + And a css file my_project/stylesheets/screen.css is created + And a css file my_project/stylesheets/print.css is created + And a css file my_project/stylesheets/ie.css is created + And I am told how to link to /stylesheets/screen.css for media "screen, projection" + And I am told how to link to /stylesheets/print.css for media "print" + And I am told how to conditionally link "IE" to /stylesheets/ie.css for media "screen, projection" + + Scenario: Install a project with blueprint + When I create a project using: compass create bp_project --using blueprint + Then a directory bp_project/ is created + And a configuration file bp_project/config.rb is created + And a sass file bp_project/src/screen.sass is created + And a sass file bp_project/src/print.sass is created + And a sass file bp_project/src/ie.sass is created + And a sass file bp_project/src/screen.sass is compiled + And a sass file bp_project/src/print.sass is compiled + And a sass file bp_project/src/ie.sass is compiled + And a css file bp_project/stylesheets/screen.css is created + And a css file bp_project/stylesheets/print.css is created + And a css file bp_project/stylesheets/ie.css is created + And an image file bp_project/images/grid.png is created + And I am told how to link to /stylesheets/screen.css for media "screen, projection" + And I am told how to link to /stylesheets/print.css for media "print" + And I am told how to conditionally link "lt IE 8" to /stylesheets/ie.css for media "screen, projection" + + Scenario: Install a project with specific directories + When I create a project using: compass create custom_project --using blueprint --sass-dir sass --css-dir css --images-dir assets/imgs + Then a directory custom_project/ is created + And a directory custom_project/sass/ is created + And a directory custom_project/css/ is created + And a directory custom_project/assets/imgs/ is created + And a sass file custom_project/sass/screen.sass is created + And a css file custom_project/css/screen.css is created + And an image file custom_project/assets/imgs/grid.png is created + + Scenario: Perform a dry run of creating a project + When I create a project using: compass create my_project --dry-run + Then a directory my_project/ is not created + But a configuration file my_project/config.rb is reported created + And a sass file my_project/src/screen.sass is reported created + And a sass file my_project/src/print.sass is reported created + And a sass file my_project/src/ie.sass is reported created + And I am told how to link to /stylesheets/screen.css for media "screen, projection" + And I am told how to link to /stylesheets/print.css for media "print" + And I am told how to conditionally link "IE" to /stylesheets/ie.css for media "screen, projection" + + Scenario: Creating a bare project + When I create a project using: compass create bare_project --bare + Then a directory bare_project/ is created + And a configuration file bare_project/config.rb is created + And a directory bare_project/src/ is created + And a directory bare_project/stylesheets/ is not created + And I am congratulated + And I am told that I can place stylesheets in the src subdirectory + And I am told how to compile my sass stylesheets + + Scenario: Creating a bare project with a framework + When I create a project using: compass create bare_project --using blueprint --bare + Then an error message is printed out: A bare project cannot be created when a framework is specified. + And the command exits with a non-zero error code + + Scenario: Initializing a rails project + Given I'm in a newly created rails project: my_rails_project + When I initialize a project using: compass init rails --sass-dir app/stylesheets --css-dir public/stylesheets/compiled + Then a config file config/compass.rb is reported created + Then a config file config/compass.rb is created + And a sass file config/initializers/compass.rb is created + And a sass file app/stylesheets/screen.sass is created + And a sass file app/stylesheets/print.sass is created + And a sass file app/stylesheets/ie.sass is created + + Scenario: Compiling an existing project. + Given I am using the existing project in test/fixtures/stylesheets/compass + When I run: compass compile + Then a directory tmp/ is created + And a sass file sass/layout.sass is reported compiled + And a sass file sass/print.sass is reported compiled + And a sass file sass/reset.sass is reported compiled + And a sass file sass/utilities.sass is reported compiled + And a css file tmp/layout.css is created + And a css file tmp/print.css is created + And a css file tmp/reset.css is created + And a css file tmp/utilities.css is created + + Scenario: Compiling an existing project with a specified project + Given I am using the existing project in test/fixtures/stylesheets/compass + And I am in the parent directory + When I run: compass compile tmp_compass + Then a directory tmp_compass/tmp/ is created + And a sass file tmp_compass/sass/layout.sass is reported compiled + And a sass file tmp_compass/sass/print.sass is reported compiled + And a sass file tmp_compass/sass/reset.sass is reported compiled + And a sass file tmp_compass/sass/utilities.sass is reported compiled + And a css file tmp_compass/tmp/layout.css is created + And a css file tmp_compass/tmp/print.css is created + And a css file tmp_compass/tmp/reset.css is created + And a css file tmp_compass/tmp/utilities.css is created + + Scenario: Recompiling a project with no changes + Given I am using the existing project in test/fixtures/stylesheets/compass + When I run: compass compile + And I run: compass compile + Then a sass file sass/layout.sass is reported unchanged + And a sass file sass/print.sass is reported unchanged + And a sass file sass/reset.sass is reported unchanged + And a sass file sass/utilities.sass is reported unchanged + + Scenario: Installing a pattern into a project + Given I am using the existing project in test/fixtures/stylesheets/compass + When I run: compass install blueprint/buttons + Then a sass file sass/buttons.sass is created + And an image file images/buttons/cross.png is created + And an image file images/buttons/key.png is created + And an image file images/buttons/tick.png is created + And a css file tmp/buttons.css is created + + @now + Scenario: Basic help + When I run: compass help + Then I should see the following "primary" commands: + | compile | + | create | + | init | + | watch | + And I should see the following "other" commands: + | config | + | grid-img | + | help | + | install | + | interactive | + | stats | + | validate | + | version | + + Scenario: Recompiling a project with no material changes + Given I am using the existing project in test/fixtures/stylesheets/compass + When I run: compass compile + And I wait 1 second + And I touch sass/layout.sass + And I run: compass compile + Then a sass file sass/layout.sass is reported compiled + Then a css file tmp/layout.css is reported identical + And a sass file sass/print.sass is reported unchanged + And a sass file sass/reset.sass is reported unchanged + And a sass file sass/utilities.sass is reported unchanged + + Scenario: Recompiling a project with changes + Given I am using the existing project in test/fixtures/stylesheets/compass + When I run: compass compile + And I wait 1 second + And I add some sass to sass/layout.sass + And I run: compass compile + Then a sass file sass/layout.sass is reported compiled + And a css file tmp/layout.css is reported overwritten + And a sass file sass/print.sass is reported unchanged + And a sass file sass/reset.sass is reported unchanged + And a sass file sass/utilities.sass is reported unchanged + + Scenario: Watching a project for changes + Given I am using the existing project in test/fixtures/stylesheets/compass + When I run: compass compile + And I run in a separate process: compass watch + And I wait 1 second + And I touch sass/layout.sass + And I wait 2 seconds + And I shutdown the other process + Then a css file tmp/layout.css is reported identical + + Scenario: Generating a grid image so that I can debug my grid alignments + Given I am using the existing project in test/fixtures/stylesheets/compass + When I run: compass grid-img 30+10x24 + Then a png file images/grid.png is created + + Scenario: Generating a grid image to a specified path with custom dimensions + Given I am using the existing project in test/fixtures/stylesheets/compass + When I run: compass grid-img 50+10x24 assets/wide_grid.png + Then a directory assets is created + Then a png file assets/wide_grid.png is created + + Scenario: Generating a grid image with invalid dimensions + Given I am using the existing project in test/fixtures/stylesheets/compass + When I run: compass grid-img 50x24 assets/wide_grid.png + Then a directory assets is not created + And a png file assets/wide_grid.png is not created + + Scenario: Generate a compass configuration file + Given I should clean up the directory: config + When I run: compass config config/compass.rb --sass-dir sass --css-dir assets/css + Then a configuration file config/compass.rb is created + And the following configuration properties are set in config/compass.rb: + | property | value | + | sass_dir | sass | + | css_dir | assets/css | + + Scenario: Validate the generated CSS + Given I am using the existing project in test/fixtures/stylesheets/compass + When I run: compass validate + Then my css is validated + And I am informed that my css is valid. + + Scenario: Get stats for my project + Given I am using the existing project in test/fixtures/stylesheets/compass + When I run: compass stats + Then I am told statistics for each file: + | Filename | Rules | Properties | Mixins Defs | Mixins Used | CSS Rules | CSS Properties | + | sass/layout.sass | 0 | 0 | 0 | 1 | 5 | 9 | + | sass/print.sass | 0 | 0 | 0 | 2 | 61 | 61 | + | sass/reset.sass | 4 | 1 | 0 | 2 | 191 | 665 | + | sass/utilities.sass | 2 | 0 | 0 | 2 | 5 | 11 | + | Total.* | 6 | 1 | 0 | 7 | 262 | 746 | + diff --git a/features/extensions.feature b/features/extensions.feature new file mode 100644 index 00000000..34c8c1e8 --- /dev/null +++ b/features/extensions.feature @@ -0,0 +1,20 @@ +Feature: Extensions + In order to have an open source ecosystem for stylesheets + As a compass user + I can install extensions that others have created + And I can create and publish my own extensions + + Scenario: Extensions directory for stand_alone projects + Given I am using the existing project in test/fixtures/stylesheets/compass + And the "extensions" directory exists + And and I have a fake extension at extensions/testing + When I run: compass --list-frameworks + Then the list of frameworks includes "testing" + + Scenario: Extensions directory for rails projects + Given I'm in a newly created rails project: my_rails_project + And the "my_rails_project/vendor/plugins/compass/extensions" directory exists + And and I have a fake extension at my_rails_project/vendor/plugins/compass/extensions/testing + When I run: compass --list-frameworks + Then the list of frameworks includes "testing" + diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb new file mode 100644 index 00000000..c0c19f00 --- /dev/null +++ b/features/step_definitions/command_line_steps.rb @@ -0,0 +1,223 @@ +require 'spec/expectations' +$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '../../test'))) + +require 'test_helper' + +require 'compass/exec' + +include Compass::CommandLineHelper +include Compass::IoHelper +include Compass::RailsHelper + +Before do + Compass.reset_configuration! + @cleanup_directories = [] + @original_working_directory = Dir.pwd +end + +After do + Dir.chdir @original_working_directory + @cleanup_directories.each do |dir| + FileUtils.rm_rf dir + end +end + +# Given Preconditions +Given %r{^I am using the existing project in ([^\s]+)$} do |project| + tmp_project = "tmp_#{File.basename(project)}" + @cleanup_directories << tmp_project + FileUtils.cp_r project, tmp_project + Dir.chdir tmp_project +end + +Given %r{^I am in the parent directory$} do + Dir.chdir ".." +end + +Given /^I'm in a newly created rails project: (.+)$/ do |project_name| + @cleanup_directories << project_name + begin + generate_rails_app project_name + Dir.chdir project_name + rescue LoadError + pending "Missing Ruby-on-rails gems: sudo gem install rails" + end +end + +Given /^I should clean up the directory: (\w+)$/ do |directory| + @cleanup_directories << directory +end + +# When Actions are performed +When /^I create a project using: compass create ([^\s]+) ?(.+)?$/ do |dir, args| + @cleanup_directories << dir + compass 'create', dir, *(args || '').split +end + +When /^I initialize a project using: compass init ?(.+)?$/ do |args| + compass 'init', *(args || '').split +end + +When /^I run: compass ([^\s]+) ?(.+)?$/ do |command, args| + compass command, *(args || '').split +end + +When /^I run in a separate process: compass ([^\s]+) ?(.+)?$/ do |command, args| + unless @other_process = fork + @last_result = '' + @last_error = '' + Signal.trap("HUP") do + open('/tmp/last_result.compass_test.txt', 'w') do |file| + file.puts $stdout.string + end + open('/tmp/last_error.compass_test.txt', 'w') do |file| + file.puts @stderr.string + end + exit! + end + # this command will run forever + # we kill it with a HUP signal from the parent process. + args = (args || '').split + args << { :wait => 5 } + compass command, *args + exit! + end +end + +When /^I shutdown the other process$/ do + Process.kill("HUP", @other_process) + Process.wait + @last_result = File.read('/tmp/last_result.compass_test.txt') + @last_error = File.read('/tmp/last_error.compass_test.txt') +end + +When /^I touch ([^\s]+)$/ do |filename| + FileUtils.touch filename +end + +When /^I wait ([\d.]+) seconds?$/ do |count| + sleep count.to_f +end + +When /^I add some sass to ([^\s]+)$/ do |filename| + open(filename, "w+") do |file| + file.puts ".added .some .arbitrary" + file.puts " sass: code" + end +end + +# Then postconditions +Then /^a directory ([^ ]+) is (not )?created$/ do |directory, negated| + File.directory?(directory).should == !negated +end + +Then /an? \w+ file ([^ ]+) is (not )?created/ do |filename, negated| + File.exists?(filename).should == !negated +end + +Then /an? \w+ file ([^ ]+) is reported created/ do |filename| + @last_result.should =~ /create #{Regexp.escape(filename)}/ +end + +Then /a \w+ file ([^ ]+) is (?:reported )?compiled/ do |filename| + @last_result.should =~ /compile #{Regexp.escape(filename)}/ +end + +Then /a \w+ file ([^ ]+) is reported unchanged/ do |filename| + @last_result.should =~ /unchanged #{Regexp.escape(filename)}/ +end + +Then /a \w+ file ([^ ]+) is reported identical/ do |filename| + @last_result.should =~ /identical #{Regexp.escape(filename)}/ +end + +Then /a \w+ file ([^ ]+) is reported overwritten/ do |filename| + @last_result.should =~ /overwrite #{Regexp.escape(filename)}/ +end + +Then /I am told how to link to ([^ ]+) for media "([^"]+)"/ do |stylesheet, media| + @last_result.should =~ %r{} +end + +Then /I am told how to conditionally link "([^"]+)" to ([^ ]+) for media "([^"]+)"/ do |condition, stylesheet, media| + @last_result.should =~ %r{}mi +end + +Then /^an error message is printed out: (.+)$/ do |error_message| + @last_error.should =~ Regexp.new(Regexp.escape(error_message)) +end + +Then /^the command exits with a non\-zero error code$/ do + @last_exit_code.should_not == 0 +end + + +Then /^I am congratulated$/ do + @last_result.should =~ /Congratulations!/ +end + +Then /^I am told that I can place stylesheets in the ([^\s]+) subdirectory$/ do |subdir| + @last_result.should =~ /You may now add sass stylesheets to the #{subdir} subdirectory of your project./ +end + +Then /^I am told how to compile my sass stylesheets$/ do + @last_result.should =~ /You must compile your sass stylesheets into CSS when they change.\nThis can be done in one of the following ways:/ +end + +Then /^I should be shown a list of "([^"]+)" commands$/ do |kind| + @last_result.should =~ /^#{kind.capitalize} Commands:$/ + @last_command_list = [] + found = false + indent = nil + @last_result.split("\n").each do |line| + if line =~ /^#{kind.capitalize} Commands:$/ + found = true + elsif found && line =~ /^\s+/ + @last_command_list << line + elsif found && line =~ /^$|^\w/ + break + end + end + +end + +Then /^the list of commands should describe the ([^ ]+) command$/ do |command| + @last_result.should =~ /^\s+\* #{command}\s+- [A-Z].+$/ +end + +Then /^the following configuration properties are set in ([^ ]+):$/ do |config_file, table| + + config = Compass::Configuration::Data.new_from_file(config_file) + table.hashes.each do |hash| + config.send(hash['property']).should == hash['value'] + end +end + +Then /^my css is validated$/ do + if @last_error =~ /The Compass CSS Validator could not be loaded/ + pending "Missing Dependency: sudo gem install chriseppstein-compass-validator" + else + @last_result.should =~ /Compass CSS Validator/ + end +end + +Then /^I am informed that my css is valid.$/ do + @last_result.should =~ /Your CSS files are valid\./ +end + +Then /^I am told statistics for each file:$/ do |table| + # table is a Cucumber::Ast::Table + table.raw.each do |row| + re = Regexp.new row.join(' *\| *') + @last_result.should =~ re + end +end + +Then /^I should see the following "([^"]+)" commands:$/ do |kind, table| + + + Then %Q{I should be shown a list of "#{kind}" commands} + + commands = @last_command_list.map{|c| c =~ /^\s+\* ([^ ]+)\s+- [A-Z].+$/; [$1]} + table.diff!(commands) +end diff --git a/features/step_definitions/extension_steps.rb b/features/step_definitions/extension_steps.rb new file mode 100644 index 00000000..f6216c1e --- /dev/null +++ b/features/step_definitions/extension_steps.rb @@ -0,0 +1,13 @@ +Given /^the "([^\"]*)" directory exists$/ do |directory| + FileUtils.mkdir_p directory +end + +Given /^and I have a fake extension at (.*)$/ do |directory| + FileUtils.mkdir_p File.join(directory, 'stylesheets') + FileUtils.mkdir_p File.join(directory, 'templates/project') +end + +Then /^the list of frameworks includes "([^\"]*)"$/ do |framework| + @last_result.split("\n").map{|f| f.strip}.should include(framework) +end + diff --git a/frameworks/blueprint.rb b/frameworks/blueprint.rb deleted file mode 100644 index 47b3c87b..00000000 --- a/frameworks/blueprint.rb +++ /dev/null @@ -1,2 +0,0 @@ -blueprint_dir = File.join(Compass.base_directory, 'frameworks', 'blueprint') -Compass::Frameworks.register('blueprint', blueprint_dir) diff --git a/frameworks/blueprint/stylesheets/blueprint/_ie.sass b/frameworks/blueprint/stylesheets/blueprint/_ie.sass deleted file mode 100644 index 9421d908..00000000 --- a/frameworks/blueprint/stylesheets/blueprint/_ie.sass +++ /dev/null @@ -1,93 +0,0 @@ -// The blueprint IE mixins should be mixed into a stylesheet that gets conditionally included -// into IE like so: -// - -// The +blueprint-ie mixin must be mixed into the top level of your stylesheet. -// However, you can customize the body selector if you wish to control the scope -// of this mixin. Examples: -// Apply to any page including the stylesheet: -// +blueprint-ie -// Scoped by a single presentational body class: -// +blueprint-ie("body.blueprint") -// Semantically: -// +blueprint-ie("body#page-1, body#page-2, body.a-special-page-type") -// Alternatively, you can use the +blueprint-ie-body and +blueprint-ie-defaults -// mixins to construct your own semantic style rules. - -=blueprint-ie(!body_selector = "body") - #{!body_selector} - +blueprint-ie-body - @if !body_selector != "body" - +blueprint-ie-defaults - @if !body_selector == "body" - +blueprint-ie-defaults - -=blueprint-ie-body - :text-align center - +blueprint-ie-hacks - -=blueprint-ie-hacks - * html & - legend - :margin 0px -8px 16px 0 - :padding 0 - html>& - p code - :*white-space normal - -// Fixes for Blueprint "inline" forms in IE -=blueprint-inline-form-ie - div, p - :vertical-align middle - label - :position relative - :top -0.25em - input - &.checkbox, &.radio, &.button, button - :margin 0.5em 0 - -=blueprint-ie-defaults - .container - :text-align left - ol - :margin-left 2em - sup - :vertical-align text-top - sub - :vertical-align text-bottom - hr - :margin -8px auto 11px - img - :-ms-interpolation-mode bicubic - fieldset - :padding-top 0 - input - &.text - :margin 0.5em 0 - :background-color #fff - :border 1px solid #bbb - &:focus - :border 1px solid #666 - &.title - :margin 0.5em 0 - :background-color #fff - :border 1px solid #bbb - &:focus - :border 1px solid #666 - &.checkbox - :position relative - :top 0.25em - &.radio - :position relative - :top 0.25em - &.button - :position relative - :top 0.25em - textarea - :margin 0.5em 0 - select - :margin 0.5em 0 - button - :position relative - :top 0.25em diff --git a/frameworks/blueprint/stylesheets/blueprint/_print.sass b/frameworks/blueprint/stylesheets/blueprint/_print.sass deleted file mode 100644 index d147bf7a..00000000 --- a/frameworks/blueprint/stylesheets/blueprint/_print.sass +++ /dev/null @@ -1,83 +0,0 @@ -@import modules/typography.sass -@import compass/utilities/general/float.sass - -// The +blueprint-print mixin must be mixed into the top level of your stylesheet. -// However, you can customize the body selector if you wish to control the scope -// of this mixin. Examples: -// Apply to any page including the stylesheet: -// +blueprint-print -// Scoped by a single presentational body class: -// +blueprint-print("body.blueprint") -// Semantically: -// +blueprint-print("body#page-1, body#page-2, body.a-special-page-type") -// Alternatively, you can use the +blueprint-print-body and +blueprint-print-defaults -// mixins to construct your own semantic style rules. - -=blueprint-print(!body_selector = "body") - #{!body_selector} - +blueprint-print-body - @if !body_selector != "body" - +blueprint-print-defaults - @if !body_selector == "body" - +blueprint-print-defaults - -// This style is in blueprint, but I think it's annoying and it doesn't work in all browsers. -// Feel free to mix it into anchors where you want it. -=blueprint-show-link-urls - &:after - :content " (" attr(href) ")" - :font-size 90% - -=blueprint-print-body - :line-height 1.5 - :font-family= !blueprint_font_family - :color #000 - :background none - :font-size 10pt - -=blueprint-print-defaults - .container - :background none - hr - :background #ccc - :color #ccc - :width 100% - :height 2px - :margin 2em 0 - :padding 0 - :border none - &.space - :background #fff - :color #fff - h1, h2, h3, h4, h5, h6 - :font-family= !blueprint_font_family - code - :font - :size .9em - :family= !blueprint_fixed_font_family - img - +float-left - :margin 1.5em 1.5em 1.5em 0 - a - img - :border none - &:link, - &:visited - :background transparent - :font-weight 700 - :text-decoration underline - p img.top - :margin-top 0 - blockquote - :margin 1.5em - :padding 1em - :font-style italic - :font-size .9em - .small - :font-size .9em - .large - :font-size 1.1em - .quiet - :color #999 - .hide - :display none diff --git a/frameworks/blueprint/stylesheets/blueprint/_screen.sass b/frameworks/blueprint/stylesheets/blueprint/_screen.sass deleted file mode 100644 index 15762552..00000000 --- a/frameworks/blueprint/stylesheets/blueprint/_screen.sass +++ /dev/null @@ -1,15 +0,0 @@ -@import modules/colors.sass -@import modules/grid.sass -@import modules/typography.sass -@import modules/utilities.sass -@import modules/form.sass -@import modules/interaction.sass -@import modules/debug.sass - -=blueprint(!body_selector = "body") - +blueprint-typography(!body_selector) - +blueprint-utilities - +blueprint-grid - +blueprint-debug - +blueprint-interaction - +blueprint-form diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass deleted file mode 100644 index c4b19f5f..00000000 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass +++ /dev/null @@ -1,58 +0,0 @@ -@import colors.sass - - -=blueprint-interaction - .error - +error - .notice - +notice - .success - +success - .hide - :display none - .highlight - +highlight - .added - +added - .removed - +removed - -=feedback-base - :padding .8em - :margin-bottom 1em - :border= 2px "solid" !feedback_border_color - -=error - +feedback-base - :background = !error_bg_color - :color = !error_color - :border-color = !error_border_color - a - :color = !error_color - -=notice - +feedback-base - :background = !notice_bg_color - :color = !notice_color - :border-color = !notice_border_color - a - :color = !notice_color - -=success - +feedback-base - :background = !success_bg_color - :color = !success_color - :border-color = !success_border_color - a - :color = !success_color - -=highlight - :background = !highlight_color - -=added - :background = !added_bg_color - :color = !added_color - -=removed - :background = !removed_bg_color - :color = !removed_color diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass deleted file mode 100644 index 1efaa2dc..00000000 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass +++ /dev/null @@ -1,104 +0,0 @@ -@import grid.sass -@import compass/utilities/general/float.sass - -// Main layout grid, override these constants to build your grid and container sizes. -!blueprint_grid_columns ||= 24 -!blueprint_grid_width ||= 30px -!blueprint_grid_margin ||= 10px - -!blueprint_grid_outer_width = !blueprint_grid_width + !blueprint_grid_margin -!blueprint_container_size = !blueprint_grid_outer_width * !blueprint_grid_columns - !blueprint_grid_margin - -// Columns -// Note: If you use this mixin without the class and want to support ie6 -// you must set text-align left on your container element in an IE stylesheet. -=container - :width = !blueprint_container_size - :margin 0 auto - :direction rtl - +clearfix - -// The last column in a row needs this mixin or it will end up on the next row. -// TODO add this to span mixin when we have optional arguments -=last - :margin-left 0 - -=column-base(!last = false) - +float-right - @if !last - +last - @else - :margin-left = !blueprint_grid_margin - * html & - :overflow-x hidden - -// Mixin to a column to append n empty cols. -=append(!n) - :padding-left = (!blueprint_grid_outer_width) * !n - -// Mixin to a column to prepend n empty cols. -=prepend(!n) - :padding-right = (!blueprint_grid_outer_width) * !n - -// mixin to a column to move it n columns to the left -=pull(!n, !last = false) - :position relative - @if !last - :margin-right = (-!blueprint_grid_outer_width * !n) + !blueprint_grid_margin - @else - :margin-right = -!blueprint_grid_outer_width * !n - -// mixin to a column to push it n columns to the right -=push(!n) - +float-right - :position relative - :margin - :top 0 - :left = -!blueprint_grid_outer_width * !n - :bottom 1.5em - :right = !blueprint_grid_outer_width * !n - -// Border on left hand side of a column. -=border - :padding-left = !blueprint_grid_margin / 2 - 1 - :margin-left = !blueprint_grid_margin / 2 - :border-left 1px solid #eee - -// Border with more whitespace, spans one column. -=colborder - :padding-left= (!blueprint_grid_width - 2 * !blueprint_grid_margin - 1)/2 - :margin-left= (!blueprint_grid_width - 2 * !blueprint_grid_margin)/2 - :border-left 1px solid #eee - -=rtl-typography(!body_selector = "body") - html #{!body_selector} - :font-family Arial, sans-serif - @if !body_selector != "body" - +rtl-typography-defaults - @if !body_selector == "body" - body - +rtl-typography-defaults - -=rtl-typography-defaults - h1, h2, h3, h4, h5, h6 - :font-family Arial, sans-serif - - pre, code, tt - :font-family monospace - - p - img.right - +float-left - :margin 1.5em 1.5em 1.5em 0 - :padding 0 - img.left - +float-right - :margin 1.5em 0 1.5em 1.5em - :padding 0 - - dd, ul, ol - :margin-left 0 - :margin-right 1.5em - - td, th - :text-align right diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass deleted file mode 100644 index bb11783e..00000000 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass +++ /dev/null @@ -1,155 +0,0 @@ -@import colors.sass -@import compass/utilities/links/link_colors.sass -@import compass/utilities/general/float.sass - -!blueprint_font_family ||= "Helvetica Neue, Arial, Helvetica, sans-serif" -!blueprint_fixed_font_family ||= "'andale mono', 'lucida console', monospace" -!blueprint_font_size ||= 12px - -// The +blueprint-typography mixin must be mixed into the top level of your stylesheet. -// However, you can customize the body selector if you wish to control the scope -// of this mixin. Examples: -// Apply to any page including the stylesheet: -// +blueprint-typography -// Scoped by a single presentational body class: -// +blueprint-typography("body.blueprint") -// Semantically: -// +blueprint-typography("body#page-1, body#page-2, body.a-special-page-type") -// Alternatively, you can use the +blueprint-typography-body and +blueprint-typography-defaults -// mixins to construct your own semantic style rules. - -=blueprint-typography(!body_selector = "body") - #{!body_selector} - +blueprint-typography-body - @if !body_selector != "body" - +blueprint-typography-defaults - @if !body_selector == "body" - +blueprint-typography-defaults - -=normal-text - :font-family= !blueprint_font_family - :color= !font_color - -=fixed-width-text - :font= 1em !blueprint_fixed_font_family - :line-height 1.5 - -=header-text - :font-weight normal - :color= !header_color - -=quiet - :color= !quiet_color - -=loud - :color= !loud_color - -=blueprint-typography-body(!font_size = !blueprint_font_size) - :line-height 1.5 - +normal-text - :font-size= 100% * !font_size / 16px - -=blueprint-typography-defaults - h1 - +header-text - :font-size 3em - :line-height 1 - :margin-bottom 0.5em - img - :margin 0 - h2 - +header-text - :font-size 2em - :margin-bottom 0.75em - h3 - +header-text - :font-size 1.5em - :line-height 1 - :margin-bottom 1em - h4 - +header-text - :font-size 1.2em - :line-height 1.25 - :margin-bottom 1.25em - h5 - +header-text - :font-size 1em - :font-weight bold - :margin-bottom 1.5em - h6 - +header-text - :font-size 1em - :font-weight bold - h2 img, h3 img, h4 img, h5 img, h6 img - :margin 0 - p - :margin 0 0 1.5em - img.left - +float-left - :margin 1.5em 1.5em 1.5em 0 - :padding 0 - img.right - +float-right - :margin 1.5em 0 1.5em 1.5em - :padding 0 - a - :text-decoration underline - +link-colors(!link_color, !link_hover_color, !link_active_color, !link_visited_color, !link_focus_color) - blockquote - :margin 1.5em - :color #666 - :font-style italic - strong - :font-weight bold - em - :font-style italic - dfn - :font-style italic - :font-weight bold - sup, sub - :line-height 0 - abbr, acronym - :border-bottom 1px dotted #666 - address - :margin 0 0 1.5em - :font-style italic - del - :color #666 - pre - :margin 1.5em 0 - :white-space pre - pre, code, tt - +fixed-width-text - li ul, li ol - :margin 0 1.5em - ul - :margin 0 1.5em 1.5em 1.5em - :list-style-type disc - ol - :margin 0 1.5em 1.5em 1.5em - :list-style-type decimal - dl - :margin 0 0 1.5em 0 - dt - :font-weight bold - dd - :margin-left 1.5em - table - :margin-bottom 1.4em - :width 100% - th - :font-weight bold - thead th - :background= !blueprint_table_header_color - th, td, caption - :padding 4px 10px 4px 5px - tr.even td - :background= !blueprint_table_stripe_color - tfoot - :font-style italic - caption - :background #eee - .quiet - +quiet - .loud - +loud diff --git a/frameworks/blueprint/templates/buttons/manifest.rb b/frameworks/blueprint/templates/buttons/manifest.rb deleted file mode 100644 index b097845b..00000000 --- a/frameworks/blueprint/templates/buttons/manifest.rb +++ /dev/null @@ -1,5 +0,0 @@ -stylesheet 'buttons.sass', :media => 'screen, projection' - -image 'buttons/cross.png' -image 'buttons/key.png' -image 'buttons/tick.png' diff --git a/frameworks/blueprint/templates/link_icons/manifest.rb b/frameworks/blueprint/templates/link_icons/manifest.rb deleted file mode 100644 index 5b8b4f9f..00000000 --- a/frameworks/blueprint/templates/link_icons/manifest.rb +++ /dev/null @@ -1,10 +0,0 @@ -stylesheet "link_icons.sass", :media => 'screen, projection' - -image 'link_icons/doc.png' -image 'link_icons/email.png' -image 'link_icons/external.png' -image 'link_icons/feed.png' -image 'link_icons/im.png' -image 'link_icons/pdf.png' -image 'link_icons/visited.png' -image 'link_icons/xls.png' diff --git a/frameworks/blueprint/templates/project/ie.sass b/frameworks/blueprint/templates/project/ie.sass deleted file mode 100644 index fad09158..00000000 --- a/frameworks/blueprint/templates/project/ie.sass +++ /dev/null @@ -1,15 +0,0 @@ -@import blueprint.sass - -+blueprint-ie - -// Note : -// -// Compass will center text to fix IE6 container centering. -// This means all your texts will be centered under all version of IE by default. -// Please don't forget to restore the correct behavior to your main container (but not the body tag!) -// -// Example : -// -// .container, .footer -// :text-align left - diff --git a/frameworks/blueprint/templates/project/manifest.rb b/frameworks/blueprint/templates/project/manifest.rb deleted file mode 100644 index 853b59b7..00000000 --- a/frameworks/blueprint/templates/project/manifest.rb +++ /dev/null @@ -1,6 +0,0 @@ -stylesheet 'screen.sass', :media => 'screen, projection' -stylesheet 'partials/_base.sass' -stylesheet 'print.sass', :media => 'print' -stylesheet 'ie.sass', :media => 'screen, projection', :condition => "lt IE 8" - -image 'grid.png' diff --git a/frameworks/blueprint/templates/project/print.sass b/frameworks/blueprint/templates/project/print.sass deleted file mode 100644 index 8e5d49d8..00000000 --- a/frameworks/blueprint/templates/project/print.sass +++ /dev/null @@ -1,3 +0,0 @@ -@import blueprint.sass - -+blueprint-print \ No newline at end of file diff --git a/frameworks/compass.rb b/frameworks/compass.rb deleted file mode 100644 index 3ad82710..00000000 --- a/frameworks/compass.rb +++ /dev/null @@ -1,2 +0,0 @@ -compass_dir = File.join(Compass.base_directory, 'frameworks', 'compass') -Compass::Frameworks.register('compass', compass_dir) diff --git a/frameworks/compass/stylesheets/_compass.sass b/frameworks/compass/stylesheets/_compass.sass deleted file mode 100644 index 79a50ab1..00000000 --- a/frameworks/compass/stylesheets/_compass.sass +++ /dev/null @@ -1 +0,0 @@ -@import compass/utilities.sass \ No newline at end of file diff --git a/frameworks/compass/stylesheets/compass/utilities/_print.sass b/frameworks/compass/stylesheets/compass/utilities/_print.sass deleted file mode 100644 index fc1caf4d..00000000 --- a/frameworks/compass/stylesheets/compass/utilities/_print.sass +++ /dev/null @@ -1,24 +0,0 @@ -// Classes that are useful for controlling what gets printed. -// You must mix +print-utilities into your print stylesheet -// and +print-utilities("screen") into your screen stylesheet. -// Note: these aren't semantic. -=print-utilities(!media = "print") - @if !media == "print" - .noprint, - .no-print - :display none - address, blockquote, center, dir, div, dd, dl, dt, - fieldset, form, frameset, h1, h2, h3, h4, h5, h6, hr, - isindex, li, menu, noframes, noscript, ol, p, pre, - table, tbody, td, tfoot, th, thead, tr, ul - &.print-only - :display block - a, abbr, acronym, b, basefont, bdo, big, br, cite, - code, dfn, em, font, i, img, input, kbd, label, q, s, - samp, select, small, span, strike, strong, sub, sup, - textarea, tt, u, var - &.print-only - :display inline - @else - .print-only - :display none diff --git a/frameworks/compass/stylesheets/compass/utilities/_sprites.sass b/frameworks/compass/stylesheets/compass/utilities/_sprites.sass deleted file mode 100644 index 48b42433..00000000 --- a/frameworks/compass/stylesheets/compass/utilities/_sprites.sass +++ /dev/null @@ -1 +0,0 @@ -@import sprites/sprite_img.sass \ No newline at end of file diff --git a/frameworks/compass/stylesheets/compass/utilities/general/_inline_block.sass b/frameworks/compass/stylesheets/compass/utilities/general/_inline_block.sass deleted file mode 100644 index 94cd1357..00000000 --- a/frameworks/compass/stylesheets/compass/utilities/general/_inline_block.sass +++ /dev/null @@ -1,6 +0,0 @@ -=inline-block - :zoom 1 - :display inline - :display -moz-inline-box - :display inline-block - :vertical-align top diff --git a/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass b/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass deleted file mode 100644 index 3f6665dc..00000000 --- a/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass +++ /dev/null @@ -1,19 +0,0 @@ -// Emits styles for a tag cloud -=tag-cloud(!base_size = 1em) - :font-size= !base_size - :line-height= 1.2 * !base_size - .xxs, .xs, .s, .l, .xl, .xxl - :line-height= 1.2 * !base_size - .xxs - :font-size= !base_size / 2.0 - .xs - :font-size= 2.0 * !base_size / 3.0 - .s - :font-size= 3.0 * !base_size / 4.0 - .l - :font-size= 4.0 * !base_size / 3.0 - .xl - :font-size= 3.0 * !base_size / 2.0 - .xxl - :font-size= 2.0 * !base_size - diff --git a/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass b/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass deleted file mode 100644 index 5f25ce39..00000000 --- a/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass +++ /dev/null @@ -1,5 +0,0 @@ -// A link that looks and acts like the text it is contained within -=unstyled-link - :color inherit - :text-decoration inherit - :cursor inherit diff --git a/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass b/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass deleted file mode 100644 index 2381dbd4..00000000 --- a/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass +++ /dev/null @@ -1,12 +0,0 @@ -!sprite_image_default_width ||= 32px -!sprite_image_default_height ||= 32px -!sprite_image_default_margin ||= 0px - -// Simplest use: +sprite-img("icons-32.png", 1) -=sprite-img(!img, !col, !row = 1, !width = !sprite_image_default_width, !height = !sprite_image_default_height, !margin = !sprite_image_default_margin) - !x = ((!col - 1) * -!width) - ((!col - 1) * !margin) - !y = ((!row - 1) * -!height) - ((!row - 1) * !margin) - :background= image_url(!img) "no-repeat" !x !y - :width= !width - :height= !height - :overflow hidden \ No newline at end of file diff --git a/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass b/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass deleted file mode 100644 index 4b0e9490..00000000 --- a/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass +++ /dev/null @@ -1,20 +0,0 @@ -=alternating-rows-and-columns(!even_row_color, !odd_row_color, !dark_intersection, !header_color = #FFF, !footer_color = #FFF) - th - :background-color= !header_color - &.even - :background-color= !header_color - !dark_intersection - tr.odd - td - :background-color= !odd_row_color - &.even - :background-color= !odd_row_color - !dark_intersection - tr.even - td - :background-color= !even_row_color - &.even - :background-color= !even_row_color - !dark_intersection - tfoot - th, td - :background-color= !footer_color - &.even - :background-color= !footer_color - !dark_intersection diff --git a/frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass b/frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass deleted file mode 100644 index 4073969c..00000000 --- a/frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass +++ /dev/null @@ -1,27 +0,0 @@ -=outer-table-borders(!width = 2px, !color = black) - :border= !width "solid" !color - thead - th - :border-bottom= !width "solid" !color - tfoot - th, td - :border-top= !width "solid" !color - th - &:first-child - :border-right= !width "solid" !color - -=inner-table-borders(!width = 2px, !color = black) - th, td - :border - :right= !width "solid" !color - :bottom= !width "solid" !color - :left-width 0px - :top-width 0px - &:last-child, - &.last - :border-right-width 0px - tbody, tfoot - tr:last-child, - tr.last - th, td - :border-bottom-width 0px diff --git a/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass b/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass deleted file mode 100644 index 96093fc0..00000000 --- a/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass +++ /dev/null @@ -1,9 +0,0 @@ -=table-scaffolding - th - :text-align center - :font-weight bold - td, - th - :padding 2px - &.numeric - :text-align right diff --git a/frameworks/compass/templates/ellipsis/manifest.rb b/frameworks/compass/templates/ellipsis/manifest.rb deleted file mode 100644 index de28fcec..00000000 --- a/frameworks/compass/templates/ellipsis/manifest.rb +++ /dev/null @@ -1,2 +0,0 @@ -file 'xml/ellipsis.xml', :like => :css -stylesheet 'ellipsis.sass' \ No newline at end of file diff --git a/frameworks/yui.rb b/frameworks/yui.rb deleted file mode 100644 index 00b41003..00000000 --- a/frameworks/yui.rb +++ /dev/null @@ -1,2 +0,0 @@ -yui_dir = File.join(Compass.base_directory, 'frameworks', 'yui') -Compass::Frameworks.register('yui', yui_dir) diff --git a/frameworks/yui/COPYRIGHT b/frameworks/yui/COPYRIGHT deleted file mode 100644 index a3971ceb..00000000 --- a/frameworks/yui/COPYRIGHT +++ /dev/null @@ -1,15 +0,0 @@ -Whatever parts of this port of YUI to Sass that are copyrightable, are Copyright (c) 2008, Christopher Eppstein. All Rights Reserved. - -The original CSS required this copyright notice to be present in redistributions, so to be on the safe side: - -Copyright (c) 2008, Yahoo! Inc. -All rights reserved. - -Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions and the - following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Yahoo! Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of Yahoo! Inc. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/frameworks/yui/stylesheets/_yui.sass b/frameworks/yui/stylesheets/_yui.sass deleted file mode 100644 index acc2006e..00000000 --- a/frameworks/yui/stylesheets/_yui.sass +++ /dev/null @@ -1,7 +0,0 @@ -@import yui/modules/base.sass -@import yui/modules/fonts.sass -@import yui/modules/grids.sass -=yui - +yui-base - +yui-base-fonts - +yui-grids \ No newline at end of file diff --git a/frameworks/yui/stylesheets/yui/modules/_base.sass b/frameworks/yui/stylesheets/yui/modules/_base.sass deleted file mode 100644 index 7f95b886..00000000 --- a/frameworks/yui/stylesheets/yui/modules/_base.sass +++ /dev/null @@ -1,60 +0,0 @@ -=yui-base - h1 - :font-size 138.5% - - h2 - :font-size 123.1% - - h3 - :font-size 108% - - h1, h2, h3 - :margin 1em 0 - - h1,h2, h3, h4, h5, h6, strong - :font-weight bold - - abbr, acronym - :border-bottom 1px dotted #000 - :cursor help - - em - :font-style italic - - blockquote - :margin 1em - - ul - :margin 1em - :margin-left 2em - li - :list-style disc outside - - ol - :margin 1em - :margin-left 2em - li - :list-style decimal outside - - dl - :margin 1em - :margin-left 2em - dd - :margin-left 1em - - th - :border 1px solid #000 - :padding .5em - :font-weight bold - :text-align center - - td - :border 1px solid #000 - :padding .5em - - caption - :margin-bottom .5em - :text-align center - - p, fieldset, table - :margin-bottom 1em diff --git a/frameworks/yui/stylesheets/yui/modules/_fonts.sass b/frameworks/yui/stylesheets/yui/modules/_fonts.sass deleted file mode 100644 index d84284ab..00000000 --- a/frameworks/yui/stylesheets/yui/modules/_fonts.sass +++ /dev/null @@ -1,38 +0,0 @@ -!yui_default_base_font_size ||= 13px -!yui_default_base_line_height ||= 1.231 -!yui_default_font_family ||= "arial,helvetica,clean,sans-serif" - -// Sets the font size specified in pixels using percents so that the base -// font size changes and 1em has the correct value. When nesting font size -// declarations, within the DOM tree, the base_font_size must be the parent's -// effective font-size in pixels. -// Usage Examples: -// .big -// +font-size(16px) -// .bigger -// +font-size(18px) -// .big .bigger -// +font-size(18px, 16px) -// -// For more information see the table found at http://developer.yahoo.com/yui/fonts/#fontsize -=font-size(!size, !base_font_size = !yui_default_base_font_size) - :font-size= percentage(!size / !base_font_size) - -// Sets the base fonts for a page, this should be mixed into the top level of a stylesheet. -=yui-base-fonts(!family = !yui_default_font_family, !size = !yui_default_base_font_size, !line_height = !yui_default_base_line_height) - body - :font - :size= !size - :family= !family - :line-height= !line_height - :*font-size small - :*font x-small - - table - :font-size inherit - :font 100% - - pre, code, kbd, samp, tt - :font-family monospace - :*font-size 108% - :line-height 100% diff --git a/frameworks/yui/stylesheets/yui/modules/_grids.sass b/frameworks/yui/stylesheets/yui/modules/_grids.sass deleted file mode 100644 index aa9a9c9d..00000000 --- a/frameworks/yui/stylesheets/yui/modules/_grids.sass +++ /dev/null @@ -1,341 +0,0 @@ -// This is a port of YUI Grids version 2.6.0 -// Note: This is not really tested yet. Use at your own risk. - -@import compass/utilities/general/float.sass -@import fonts.sass - -=yui-grids - +yui-grids-init - +yui-grid-templates - +yui-grid-divisions - -=yui-grid-templates - #doc - +yui-document(750px) - #doc2 - +yui-document(950px) - #doc3 - +yui-document("fluid") - #doc4 - +yui-document(974px) - .yui-t1 - +yui-two-column-left-template(160px) - .yui-t2 - +yui-two-column-left-template(180px) - .yui-t3 - +yui-two-column-left-template(300px) - .yui-t4 - +yui-two-column-right-template(180px) - .yui-t5 - +yui-two-column-right-template(240px) - .yui-t6 - +yui-two-column-right-template(300px) - -=yui-grids-footer - clear: both - -=yui-grids-body - +clearfix - -=yui-grids-init(!footer = "#ft", !body = "#bd") - body - :text-align center - @if !footer - #{!footer} - +yui-grids-footer - @if !body - #{!body} - +yui-grids-body - -=em-size(!style, !px_size, !base_font_size = !yui_default_base_font_size) - :#{!style}= 1em * !px_size / !base_font_size - -=em-size-hacked(!style, !px_size, !base_font_size = !yui_default_base_font_size) - +em-size(!style, !px_size, !base_font_size) - +em-size("*"+!style, !px_size * 39 / 40, !base_font_size) - -// All documents must have these styles. Setting a min-width is optional, but recommended. To omit it, pass false as the min_width value. -=yui-document-base(!min_width = 750px) - :margin auto - :text-align left - @if !min_width - :min-width= !min_width - -=yui-block-base - :position relative - :_position static - -=yui-main-block - :position static - :float none - :width auto - - -// Creates a fixed width document container -// Pass "fluid" for the width to create a document that grows with the width of the browser. -=yui-document(!width, !min_width = 750px, !base_font_size = !yui_default_base_font_size) - +yui-document-base(!min_width) - @if !width == "fluid" - :margin auto 10px - :width auto - @else - +em-size-hacked("width", !width, !base_font_size) - -=yui-two-column-left-template(!column_width, !main_selector = "#yui-main", !block_selector = ".yui-b", !document_width = 750px, !min_width = 750px, !base_font_size = !yui_default_base_font_size) - +yui-document(!document_width, !min_width, !base_font_size) - #{!main_selector} - :width 100% - :float right - +em-size("margin-left", -!column_width - 10px, !base_font_size) - #{!block_selector} - +yui-main-block - +em-size-hacked("margin-left", !column_width, !base_font_size) - #{!block_selector} - +yui-block-base - :float left - +em-size-hacked("width", !column_width, !base_font_size) - -=yui-two-column-right-template(!column_width, !main_selector = "#yui-main", !block_selector = ".yui-b", !document_width = 750px, !min_width = 750px, !base_font_size = !yui_default_base_font_size) - +yui-document(!document_width, !min_width, !base_font_size) - #{!main_selector} - :width 100% - :float left - +em-size("margin-right", -!column_width - 10px, !base_font_size) - #{!block_selector} - +yui-main-block - +em-size-hacked("margin-right", !column_width, !base_font_size) - #{!block_selector} - +yui-block-base - :float right - +em-size-hacked("width", !column_width, !base_font_size) - -=yui-one-column-template(!main_selector = "#yui-main", !block_selector = ".yui-b", !document_width = 750px, !min_width = 750px, !base_font_size = !yui_default_base_font_size) - +yui-document(!document_width, !min_width, !base_font_size) - #{!main_selector} - :width 100% - #{!block_selector} - +yui-main-block - :display block - :margin 0 0 1em 0 - #{!block_selector} - +yui-block-base - -=yui-custom-template(!main_selector = "#yui-main", !block_selector = ".yui-b") - #{!main_selector} - :width 100% - #{!block_selector} - +yui-main-block - #{!block_selector} - +yui-block-base - -=yui-grid-divisions(!unit = ".yui-u", !g_50_50 = ".yui-g", !g_33_33_33 = ".yui-gb", !g_67_33 = ".yui-gc", !g_33_67 = ".yui-gd", !g_75_25 = ".yui-ge", !g_25_75 = ".yui-gf") - #{nest(!g_50_50, !g_33_33_33, !unit)}, - #{nest(!g_67_33, !unit)}, - #{nest(!g_67_33, !g_50_50)}, - #{nest(!g_33_67, !unit)}, - #{nest(!g_33_33_33, !g_50_50)}, - #{nest(!g_33_33_33, !g_33_33_33)}, - #{nest(!g_33_33_33, !g_67_33)}, - #{nest(!g_33_33_33, !g_33_67)}, - #{nest(!g_33_33_33, !g_75_25)}, - #{nest(!g_33_33_33, !g_25_75)}, - #{nest(!g_33_33_33, !unit)} - float: left - margin-left: 2% - width: 32% - - #{!g_33_33_33} - #{!g_33_33_33}, - #{!g_67_33} - #{!unit} - *margin-left: 1.8% - _margin-left: 4% - - #{nest(!g_50_50, !g_33_33_33, !unit)} - _margin-left: .8% - - #{nest(!g_33_33_33, !unit)} - float: right - - #{nest(!g_33_33_33, "div.first")} - margin-left: 0 - float: left - - #{!g_50_50}, - #{!g_33_33_33} - #{!g_33_33_33} - div.first - *margin-right: 0 - *width: 32% - _width: 31.7% - - #{!g_33_33_33} - #{!g_67_33}, - #{!g_33_67} - div.first - *margin-right: 0 - - #{nest(!g_33_33_33, !g_33_67, !unit)} - *width: 66% - _width: 61.2% - - #{nest(!g_33_33_33, !g_33_67, "div.first")} - *width: 31% - _width: 29.5% - - #{!g_50_50}, - #{!g_33_33_33} - #{!g_67_33} - #{!unit} - width: 32% - _float: right - margin-right: 0 - _margin-left: 0 - - #{nest(!g_33_33_33, !g_67_33, "div.first")} - width: 66% - *float: left - *margin-left: 0 - - #{!g_33_33_33} - #{!g_75_25}, - #{!g_25_75} - #{!unit} - margin: 0 - - #{nest(!g_50_50, !unit)}, - #{nest(!g_50_50, !g_50_50)}, - #{nest(!g_50_50, !g_33_33_33)}, - #{nest(!g_50_50, !g_67_33)}, - #{nest(!g_50_50, !g_33_67)}, - #{nest(!g_50_50, !g_75_25)}, - #{nest(!g_50_50, !g_25_75)}, - #{nest(!g_67_33, !unit)}, - #{nest(!g_33_67, !g_50_50)}, - #{nest(!g_50_50, !g_67_33, !unit)}, - #{nest(!g_75_25, !unit)}, - #{nest(!g_75_25, !g_50_50)}, - #{nest(!g_25_75, !g_50_50)}, - #{nest(!g_25_75, !unit)} - float: right - - #{nest(!g_50_50, !g_67_33)}, - #{nest(!g_50_50, !g_75_25)}, - #{!g_50_50}, - #{!g_67_33}, - #{nest(!g_67_33, "div.first")}, - #{!g_33_67}, - #{!g_75_25}, - #{!g_25_75} - div.first - float: left - - #{!g_50_50}, - #{!g_33_33_33}, - #{!g_67_33}, - #{!g_33_67}, - #{!g_75_25}, - #{!g_25_75} - #{!g_50_50} - #{!unit} - width: 49% - *width: 48.1% - *margin-left: 0 - - #{nest(!g_50_50, !g_50_50, "div.first")} - *margin: 0 - - #{nest(!g_33_33_33, !g_50_50, "div.first")} - *margin-right: 4% - _margin-right: 1.3% - - #{nest(!g_33_33_33, !g_33_33_33, !unit)} - _margin-left: .7% - - #{nest(!g_33_33_33, !g_50_50)}, - #{nest(!g_33_33_33, !g_33_33_33)} - div.first - *margin-left: 0 - - #{!g_67_33}, - #{!g_33_67} - #{!g_50_50} - #{!unit} - *width: 48.1% - *margin-left: 0 - - #{!g_50_50} - #{!unit}, - #{!g_50_50}, - #{!g_33_33_33}, - #{!g_67_33}, - #{!g_33_67}, - #{!g_75_25}, - #{!g_25_75} - width: 49.1% - - #{nest(!g_50_50, !g_33_33_33)}, - #{!g_33_33_33}, - #{!g_67_33}, - #{!g_33_67} - div.first - margin-left: 0 - - #{nest(!g_50_50, !g_67_33, "div.first")}, - #{nest(!g_67_33, "div.first")}, - #{nest(!g_33_67, !g_50_50)}, - #{nest(!g_33_67, !unit)} - width: 66% - - #{!g_33_67}, - #{nest(!g_33_33_33, !g_33_67)} - div.first - width: 32% - - #{nest(!g_50_50, !g_33_67, "div.first")} - _width: 29.9% - - #{nest(!g_75_25, !unit)}, - #{nest(!g_75_25, !g_50_50)}, - #{nest(!g_25_75, "div.first")} - width: 24% - - #{!g_33_33_33} - #{!g_75_25}, - #{!g_25_75} - div#{!unit} - float: right - - #{!g_33_33_33} - #{!g_75_25}, - #{!g_25_75} - div.first - float: left - - #{nest(!g_75_25, "div.first")}, - #{nest(!g_25_75, !g_50_50)}, - #{nest(!g_25_75, !unit)} - width: 74.2% - - #{!g_33_33_33} - #{nest(!g_75_25, !unit)}, - #{nest(!g_25_75, "div.first")} - *width: 24% - _width: 20% - - #{!g_33_33_33} - #{nest(!g_75_25, "div.first")}, - #{nest(!g_25_75, !unit)} - *width: 73.5% - _width: 65.5% - - #{!g_50_50}, - #{!g_33_33_33}, - #{!g_67_33}, - #{!g_33_67}, - #{!g_75_25}, - #{!g_25_75} - +clearfix - - #{nest(!g_33_33_33, !unit)} - float: left diff --git a/frameworks/yui/stylesheets/yui/modules/_reset.sass b/frameworks/yui/stylesheets/yui/modules/_reset.sass deleted file mode 100644 index bf706e81..00000000 --- a/frameworks/yui/stylesheets/yui/modules/_reset.sass +++ /dev/null @@ -1,61 +0,0 @@ -/* - Copyright (c) 2008, Yahoo! Inc. All rights reserved. - Code licensed under the BSD License: - http://developer.yahoo.net/yui/license.txt - version: 3.0.0pr2 - -=reset - html - :color #000 - :background #FFF - - body, div, dl, dt, dd, ul, ol, li, - h1, h2, h3, h4, h5, h6, pre, code, - form, fieldset, legend,input, - textarea, p, blockquote, th, td - :margin 0 - :padding 0 - - li - :list-style none - - h1, h2, h3, h4, h5, h6 - :font-size 100% - :font-weight normal - - code, th, address, caption, - cite, dfn, em, strong, var - :font-style normal - :font-weight normal - - fieldset, img, abbr, acronym - :border 0 - - legend - :color #000 - - input, textarea, select - :font-family inherit - :font-size inherit - :font-weight inherit - :*font-size 100% - - th, caption - :text-align left - - table - :border-collapse collapse - :border-spacing 0 - - q - &:before, &:after - :content '' - - abbr, acronym - :font-variant normal - - sup - :vertical-align text-top - - sub - :vertical-align text-bottom diff --git a/frameworks/yui/templates/project/manifest.rb b/frameworks/yui/templates/project/manifest.rb deleted file mode 100644 index c7af4356..00000000 --- a/frameworks/yui/templates/project/manifest.rb +++ /dev/null @@ -1 +0,0 @@ -stylesheet 'screen.sass', :media => "screen, projection" diff --git a/frameworks/yui/templates/project/screen.sass b/frameworks/yui/templates/project/screen.sass deleted file mode 100644 index 40dab7fa..00000000 --- a/frameworks/yui/templates/project/screen.sass +++ /dev/null @@ -1,4 +0,0 @@ -@import yui.sass -@import compass/reset.sass - -+yui diff --git a/lib/compass.rb b/lib/compass.rb index d09dd6df..aeae12dd 100644 --- a/lib/compass.rb +++ b/lib/compass.rb @@ -1,12 +1,13 @@ module Compass end -['dependencies', 'sass_extensions', 'core_ext', 'version', 'errors'].each do |file| - require File.join(File.dirname(__FILE__), 'compass', file) +%w(dependencies sass_extensions core_ext version errors).each do |lib| + require "compass/#{lib}" end module Compass extend Compass::Version + VERSION = "#{version[:major]}.#{version[:minor]}.#{version[:patch]}" def base_directory File.expand_path(File.join(File.dirname(__FILE__), '..')) end @@ -16,8 +17,6 @@ module Compass module_function :base_directory, :lib_directory end -require File.join(File.dirname(__FILE__), 'compass', 'configuration') -require File.join(File.dirname(__FILE__), 'compass', 'frameworks') -require File.join(File.dirname(__FILE__), 'compass', 'app_integration') - - +%w(configuration frameworks app_integration).each do |lib| + require "compass/#{lib}" +end diff --git a/lib/compass/actions.rb b/lib/compass/actions.rb index 3959f7a2..2d2875d0 100644 --- a/lib/compass/actions.rb +++ b/lib/compass/actions.rb @@ -32,6 +32,7 @@ module Compass def write_file(file_name, contents, options = nil, binary = false) options ||= self.options if self.respond_to?(:options) skip_write = options[:dry_run] + contents = process_erb(contents, options[:erb]) if options[:erb] if File.exists?(file_name) existing_contents = IO.read(file_name) if existing_contents == contents @@ -47,7 +48,7 @@ module Compass logger.record :create, basename(file_name) end if skip_write - FileUtils.touch file_name + FileUtils.touch file_name unless options[:dry_run] else mode = "w" mode << "b" if binary @@ -57,6 +58,11 @@ module Compass end end + def process_erb(contents, ctx = nil) + ctx = Object.new.instance_eval("binding") unless ctx.is_a? Binding + ERB.new(contents).result(ctx) + end + # Compile one Sass file def compile(sass_filename, css_filename, options) if options[:force] || Sass::Plugin.exact_stylesheet_needs_update?(css_filename, sass_filename) diff --git a/lib/compass/app_integration.rb b/lib/compass/app_integration.rb index 58e55913..bede6075 100644 --- a/lib/compass/app_integration.rb +++ b/lib/compass/app_integration.rb @@ -1,5 +1,24 @@ -# If we're running inside Rails -require File.join(File.dirname(__FILE__), 'app_integration', 'rails') if defined?(ActionController::Base) +%w(stand_alone rails merb).each do |lib| + require "compass/app_integration/#{lib}" +end -# If we're running inside Merb -require File.join(File.dirname(__FILE__), 'app_integration', 'merb') if defined?(Merb::Plugins) +module Compass + module AppIntegration + module Helpers + def lookup(project_type) + eval "Compass::AppIntegration::#{camelize(project_type)}" + rescue NameError + raise Compass::Error, "No application integration exists for #{project_type}" + end + + protected + + # Stolen from ActiveSupport + def camelize(s) + s.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } + end + + end + extend Helpers + end +end diff --git a/lib/compass/app_integration/merb.rb b/lib/compass/app_integration/merb.rb index b8ff84b0..546ac987 100644 --- a/lib/compass/app_integration/merb.rb +++ b/lib/compass/app_integration/merb.rb @@ -1,43 +1 @@ -# To configure Merb to use compass do the following: -# Merb::BootLoader.after_app_loads do -# require 'merb-haml' -# require 'compass' -# end -# -# To use a different sass stylesheets locations as is recommended by compass -# add this configuration to your configuration block: -# -# Merb::Config.use do |c| -# c[:compass] = { -# :stylesheets => 'app/stylesheets', -# :compiled_stylesheets => 'public/stylesheets/compiled' -# } -# end - -Merb::BootLoader.after_app_loads do - #set up sass if haml load didn't do it -- this happens when using a non-default stylesheet location. - unless defined?(Sass::Plugin) - require "sass/plugin" - Sass::Plugin.options = Merb::Config[:sass] if Merb::Config[:sass] - end - - # default the compass configuration if they didn't set it up yet. - Merb::Config[:compass] ||= {} - - # default sass stylesheet location unless configured to something else - Merb::Config[:compass][:stylesheets] ||= Merb.dir_for(:stylesheet) / "sass" - - # default sass css location unless configured to something else - Merb::Config[:compass][:compiled_stylesheets] ||= Merb.dir_for(:stylesheet) - - #define the template hash for the project stylesheets as well as the framework stylesheets. - template_location = { - Merb::Config[:compass][:stylesheets] => Merb::Config[:compass][:compiled_stylesheets] - } - Compass::Frameworks::ALL.each do |framework| - template_location[framework.stylesheets_directory] = Merb::Config[:compass][:compiled_stylesheets] - end - - #configure Sass to know about all these sass locations. - Sass::Plugin.options[:template_location] = template_location -end +require 'compass/app_integration/merb/runtime' if defined?(Merb::Plugins) diff --git a/lib/compass/app_integration/merb/runtime.rb b/lib/compass/app_integration/merb/runtime.rb new file mode 100644 index 00000000..883c4de7 --- /dev/null +++ b/lib/compass/app_integration/merb/runtime.rb @@ -0,0 +1,63 @@ +# To configure Merb to use compass do the following: +# +# Add dependencies to config/dependencies.rb +# +# dependency "haml", ">=2.2.0" +# dependency "merb-haml", merb_gems_version +# dependency "chriseppstein-compass", :require_as => 'compass' +# +# +# To use a different sass stylesheets locations as is recommended by compass +# add this configuration to your configuration block: +# +# Merb::BootLoader.before_app_loads do +# Merb::Plugins.config[:compass] = { +# :stylesheets => "app/stylesheets", +# :compiled_stylesheets => "public/stylesheets/compiled" +# } +# end +# +module Compass + def self.setup_template_location + # default the compass configuration if they didn't set it up yet. + Merb::Plugins.config[:compass] ||= {} + + # default sass stylesheet location unless configured to something else + Merb::Plugins.config[:compass][:stylesheets] ||= Merb.dir_for(:stylesheet) / "sass" + + # default sass css location unless configured to something else + Merb::Plugins.config[:compass][:compiled_stylesheets] ||= Merb.dir_for(:stylesheet) + + #define the template hash for the project stylesheets as well as the framework stylesheets. + template_location = { + Merb::Plugins.config[:compass][:stylesheets] => Merb::Plugins.config[:compass][:compiled_stylesheets] + } + Compass::Frameworks::ALL.each do |framework| + template_location[framework.stylesheets_directory] = Merb::Plugins.config[:compass][:compiled_stylesheets] + end + + # merge existing template locations if present + if Merb::Plugins.config[:sass][:template_location].is_a?(Hash) + template_location.merge!(Merb::Plugins.config[:sass][:template_location]) + Merb::Plugins.config[:sass][:template_location] = template_location + end + + #configure Sass to know about all these sass locations. + Sass::Plugin.options[:template_location] = template_location + end +end + +Merb::BootLoader.after_app_loads do + #set up sass if haml load didn't do it -- this happens when using a non-default stylesheet location. + unless defined?(Sass::Plugin) + require "sass/plugin" + if Merb::Plugins.config[:sass] + Sass::Plugin.options = Merb::Plugins.config[:sass] + # support old (deprecatd Merb::Config[:sass] option) + elsif Merb::Config[:sass] + Sass::Plugin.options = Merb::Config[:sass] + end + end + + Compass.setup_template_location +end diff --git a/lib/compass/app_integration/rails.rb b/lib/compass/app_integration/rails.rb index 904be241..668fbd42 100644 --- a/lib/compass/app_integration/rails.rb +++ b/lib/compass/app_integration/rails.rb @@ -1,12 +1,26 @@ -unless defined?(Compass::RAILS_LOADED) - Compass::RAILS_LOADED = true - require File.join(File.dirname(__FILE__), 'rails', 'action_controller') - require File.join(File.dirname(__FILE__), 'rails', 'sass_plugin') - require File.join(File.dirname(__FILE__), 'rails', 'urls') - # Wierd that this has to be re-included to pick up sub-modules. Ruby bug? - class Sass::Script::Functions::EvaluationContext - include Sass::Script::Functions - private - include ActionView::Helpers::AssetTagHelper +%w(configuration_defaults installer).each do |lib| + require "compass/app_integration/rails/#{lib}" +end + +require 'compass/app_integration/rails/runtime' if defined?(ActionController::Base) + + +module Compass + module AppIntegration + module Rails + + extend self + + def installer(*args) + Installer.new(*args) + end + + def configuration + Compass::Configuration::Data.new('rails'). + extend(ConfigurationDefaults) + end + + end end end + diff --git a/lib/compass/app_integration/rails/configuration_defaults.rb b/lib/compass/app_integration/rails/configuration_defaults.rb new file mode 100644 index 00000000..93fe449a --- /dev/null +++ b/lib/compass/app_integration/rails/configuration_defaults.rb @@ -0,0 +1,37 @@ +module Compass + module AppIntegration + module Rails + module ConfigurationDefaults + + def default_project_type + :rails + end + + def default_images_dir + File.join("public", "images") + end + + def default_javascripts_dir + File.join("public", "javascripts") + end + + def default_http_images_path + "/images" + end + + def default_http_javascripts_path + "/javascripts" + end + + def default_http_stylesheets_path + "/stylesheets" + end + + def default_extensions_dir + "vendor/plugins/compass/extensions" + end + + end + end + end +end diff --git a/lib/compass/app_integration/rails/installer.rb b/lib/compass/app_integration/rails/installer.rb new file mode 100644 index 00000000..4b06a2a7 --- /dev/null +++ b/lib/compass/app_integration/rails/installer.rb @@ -0,0 +1,127 @@ +module Compass + module Installers + class Base + end + class ManifestInstaller < Base + end + end + + module AppIntegration + module Rails + class Installer < Compass::Installers::ManifestInstaller + + def completed_configuration + config = {} + config[:sass_dir] = prompt_sass_dir unless sass_dir_without_default + config[:css_dir] = prompt_css_dir unless css_dir_without_default + config unless config.empty? + end + + def write_configuration_files(config_file = nil) + config_file ||= targetize('config/compass.rb') + directory File.dirname(config_file) + write_file config_file, config_contents + directory File.dirname(targetize('config/initializers/compass.rb')) + write_file targetize('config/initializers/compass.rb'), initializer_contents + end + + def config_files_exist? + File.exists?(targetize('config/compass.config')) && + File.exists?(targetize('config/initializers/compass.rb')) + end + + def prepare + write_configuration_files unless config_files_exist? + end + + def finalize(options = {}) + if options[:create] + puts <<-NEXTSTEPS + + Congratulations! Your rails project has been configured to use Compass. + Sass will automatically compile your stylesheets during the next + page request and keep them up to date when they change. + Make sure you restart your server! + NEXTSTEPS + end + if manifest.has_stylesheet? + puts "\nNext add these lines to the head of your layouts:\n\n" + puts stylesheet_links + puts "\n(You are using haml, aren't you?)" + end + end + + + def install_location_for_html(to, options) + separate("public/#{pattern_name_as_dir}#{to}") + end + + def prompt_sass_dir + recommended_location = separate('app/stylesheets') + default_location = separate('public/stylesheets/sass') + print %Q{Compass recommends that you keep your stylesheets in #{recommended_location} + instead of the Sass default location of #{default_location}. + Is this OK? (Y/n) } + answer = gets.downcase[0] + answer == ?n ? default_location : recommended_location + end + + def prompt_css_dir + recommended_location = separate("public/stylesheets/compiled") + default_location = separate("public/stylesheets") + puts + print %Q{Compass recommends that you keep your compiled css in #{recommended_location}/ + instead the Sass default of #{default_location}/. + However, if you're exclusively using Sass, then #{default_location}/ is recommended. + Emit compiled stylesheets to #{recommended_location}/? (Y/n) } + answer = gets.downcase[0] + answer == ?n ? default_location : recommended_location + end + + def config_contents + Compass.configuration.serialize do |prop, value| + if prop == :project_path + "project_path = RAILS_ROOT if defined?(RAILS_ROOT)\n" + elsif prop == :output_style + "" + end + end + end + + def initializer_contents + %Q{require 'compass' + # If you have any compass plugins, require them here. + Compass.configuration.parse(File.join(RAILS_ROOT, "config", "compass.config")) + Compass.configuration.environment = RAILS_ENV.to_sym + Compass.configure_sass_plugin! + } + end + + def stylesheet_prefix + if css_dir.length >= 19 + "#{css_dir[19..-1]}/" + else + nil + end + end + + def stylesheet_links + html = "%head\n" + manifest.each_stylesheet do |stylesheet| + # Skip partials. + next if File.basename(stylesheet.from)[0..0] == "_" + ss_line = " = stylesheet_link_tag '#{stylesheet_prefix}#{stylesheet.to.sub(/\.sass$/,'.css')}'" + if stylesheet.options[:media] + ss_line += ", :media => '#{stylesheet.options[:media]}'" + end + if stylesheet.options[:condition] + ss_line = " /[if #{stylesheet.options[:condition]}]\n " + ss_line + end + html << ss_line + "\n" + end + html + end + end + end + end +end diff --git a/lib/compass/app_integration/rails/runtime.rb b/lib/compass/app_integration/rails/runtime.rb new file mode 100644 index 00000000..82a353d1 --- /dev/null +++ b/lib/compass/app_integration/rails/runtime.rb @@ -0,0 +1,14 @@ +unless defined?(Compass::RAILS_LOADED) + Compass::RAILS_LOADED = true + + %w(action_controller sass_plugin urls).each do |lib| + require "compass/app_integration/rails/#{lib}" + end + + # Wierd that this has to be re-included to pick up sub-modules. Ruby bug? + class Sass::Script::Functions::EvaluationContext + include Sass::Script::Functions + private + include ActionView::Helpers::AssetTagHelper + end +end diff --git a/lib/compass/app_integration/stand_alone.rb b/lib/compass/app_integration/stand_alone.rb new file mode 100644 index 00000000..2a00d195 --- /dev/null +++ b/lib/compass/app_integration/stand_alone.rb @@ -0,0 +1,22 @@ +%w(configuration_defaults installer).each do |lib| + require "compass/app_integration/stand_alone/#{lib}" +end + +module Compass + module AppIntegration + module StandAlone + + extend self + + def installer(*args) + Installer.new(*args) + end + + def configuration + Compass::Configuration::Data.new('stand_alone'). + extend(ConfigurationDefaults) + end + + end + end +end diff --git a/lib/compass/app_integration/stand_alone/configuration_defaults.rb b/lib/compass/app_integration/stand_alone/configuration_defaults.rb new file mode 100644 index 00000000..5eb364fa --- /dev/null +++ b/lib/compass/app_integration/stand_alone/configuration_defaults.rb @@ -0,0 +1,28 @@ +module Compass + module AppIntegration + module StandAlone + module ConfigurationDefaults + def default_project_type + :stand_alone + end + + def sass_dir_without_default + "src" + end + + def javascripts_dir_without_default + "javascripts" + end + + def css_dir_without_default + "stylesheets" + end + + def images_dir_without_default + "images" + end + end + + end + end +end diff --git a/lib/compass/app_integration/stand_alone/installer.rb b/lib/compass/app_integration/stand_alone/installer.rb new file mode 100644 index 00000000..84dc19dc --- /dev/null +++ b/lib/compass/app_integration/stand_alone/installer.rb @@ -0,0 +1,83 @@ +module Compass + module Installers + class Base + end + class ManifestInstaller < Base + end + end + + module AppIntegration + module StandAlone + class Installer < Compass::Installers::ManifestInstaller + + def init + directory targetize("") + super + end + + def write_configuration_files(config_file = nil) + config_file ||= targetize('config.rb') + write_file config_file, config_contents + end + + def config_files_exist? + File.exists? targetize('config.rb') + end + + def config_contents + project_path, Compass.configuration.project_path = Compass.configuration.project_path, nil + Compass.configuration.serialize + ensure + Compass.configuration.project_path = project_path + end + + def prepare + write_configuration_files unless config_files_exist? || !@manifest.generate_config? + end + + def completed_configuration + nil + end + + def finalize(options = {}) + if options[:create] && !manifest.welcome_message_options[:replace] + puts <<-NEXTSTEPS + +********************************************************************* +Congratulations! Your compass project has been created. + +You may now add and edit sass stylesheets in the #{Compass.configuration.sass_dir} subdirectory of your project. + +Sass files beginning with an underscore are called partials and won't be +compiled to CSS, but they can be imported into other sass stylesheets. + +You can configure your project by editing the config.rb configuration file. + +You must compile your sass stylesheets into CSS when they change. +This can be done in one of the following ways: + 1. To compile on demand: + compass compile [path/to/project] + 2. To monitor your project for changes and automatically recompile: + compass watch [path/to/project] + +More Resources: + * Wiki: http://wiki.github.com/chriseppstein/compass + * Sass: http://sass-lang.com + * Community: http://groups.google.com/group/compass-users/ + +NEXTSTEPS + end + puts manifest.welcome_message if manifest.welcome_message + if manifest.has_stylesheet? && !manifest.welcome_message_options[:replace] + puts "\nTo import your new stylesheets add the following lines of HTML (or equivalent) to your webpage:" + puts stylesheet_links + end + end + + def compilation_required? + @manifest.compile? + end + end + end + end +end diff --git a/lib/compass/commands.rb b/lib/compass/commands.rb new file mode 100644 index 00000000..ce22e296 --- /dev/null +++ b/lib/compass/commands.rb @@ -0,0 +1,11 @@ +module Compass::Commands +end + +require 'compass/commands/registry' + +%w(base generate_grid_background help list_frameworks project_base + update_project watch_project create_project installer_command + print_version project_stats stamp_pattern validate_project + write_configuration interactive).each do |lib| + require "compass/commands/#{lib}" +end diff --git a/lib/compass/commands/base.rb b/lib/compass/commands/base.rb index 94c17d57..91a0850f 100644 --- a/lib/compass/commands/base.rb +++ b/lib/compass/commands/base.rb @@ -1,6 +1,9 @@ module Compass module Commands class Base + def self.register(command_name) + Compass::Commands[command_name] = self + end include Actions @@ -30,4 +33,4 @@ module Compass end end -end \ No newline at end of file +end diff --git a/lib/compass/commands/create_project.rb b/lib/compass/commands/create_project.rb index 3605af1e..fa3d2dbe 100644 --- a/lib/compass/commands/create_project.rb +++ b/lib/compass/commands/create_project.rb @@ -1,13 +1,116 @@ require 'fileutils' -require File.join(File.dirname(__FILE__), 'stamp_pattern') -require File.join(File.dirname(__FILE__), 'update_project') +require 'compass/commands/stamp_pattern' module Compass module Commands + module CreateProjectOptionsParser + def set_options(opts) + + if $command == "create" + opts.banner = %Q{ + Usage: compass create path/to/project [options] + + Description: + Create a new compass project at the path specified. + + Options: + }.split("\n").map{|l| l.gsub(/^ */,'')}.join("\n") + + opts.on_tail("--bare", "Don't generate any Sass or CSS files.") do + self.options[:bare] = true + end + else + opts.banner = %Q{ + Usage: compass init project_type path/to/project [options] + + Description: + Initialize an existing project at the path specified. + + Supported Project Types: + * rails + + Options: + }.split("\n").map{|l| l.gsub(/^ */,'')}.join("\n").strip + end + + opts.on("--using FRAMEWORK", "Framework to use when creating the project.") do |framework| + framework = framework.split('/', 2) + self.options[:framework] = framework[0] + self.options[:pattern] = framework[1] + end + + super + end + end + class CreateProject < StampPattern - def initialize(working_path, options) - super(working_path, options.merge(:pattern => "project", :pattern_name => nil)) + register :create + register :init + + class << self + def option_parser(arguments) + parser = Compass::Exec::CommandOptionParser.new(arguments) + parser.extend(Compass::Exec::GlobalOptionsParser) + parser.extend(Compass::Exec::ProjectOptionsParser) + parser.extend(CreateProjectOptionsParser) + end + + def usage + option_parser([]).to_s + end + + def description(command) + if command.to_sym == :create + "Create a new compass project" + else + "Initialize an existing project" + end + end + + def primary; true; end + + def parse!(arguments) + parser = option_parser(arguments) + parse_options!(parser, arguments) + parse_arguments!(parser, arguments) + if parser.options[:framework] && parser.options[:bare] + raise Compass::Error, "A bare project cannot be created when a framework is specified." + end + set_default_arguments(parser) + parser.options + end + + def parse_init!(arguments) + parser = option_parser(arguments) + parse_options!(parser, arguments) + if arguments.size > 0 + parser.options[:project_type] = arguments.shift.to_sym + end + parse_arguments!(parser, arguments) + set_default_arguments(parser) + parser.options + end + + def parse_options!(parser, arguments) + parser.parse! + parser + end + + def parse_arguments!(parser, arguments) + if arguments.size == 1 + parser.options[:project_name] = arguments.shift + elsif arguments.size == 0 + # default to the current directory. + else + raise Compass::Error, "Too many arguments were specified." + end + end + + def set_default_arguments(parser) + parser.options[:framework] ||= :compass + parser.options[:pattern] ||= "project" + end end def is_project_creation? @@ -16,4 +119,4 @@ module Compass end end -end \ No newline at end of file +end diff --git a/lib/compass/commands/generate_grid_background.rb b/lib/compass/commands/generate_grid_background.rb index d294d030..2bd16d9a 100644 --- a/lib/compass/commands/generate_grid_background.rb +++ b/lib/compass/commands/generate_grid_background.rb @@ -1,19 +1,86 @@ -require File.join(File.dirname(__FILE__), 'project_base') -require File.join(File.dirname(__FILE__), 'update_project') -require File.join(File.dirname(__FILE__), '..', 'grid_builder') +require 'compass/commands/project_base' +require 'compass/commands/update_project' +require 'compass/grid_builder' module Compass module Commands + module GridBackgroundOptionsParser + def set_options(opts) + banner = %Q{Usage: compass grid-img W+GxH [path/to/grid.png] + +Description: + Generates a background image that can be used to check grid alignment. + + Height is optional and defaults to 20px + + By default, the image generated will be named "grid.png" + and be found in the images directory. + + This command requires that you have both ImageMagick and RMagick installed. + +Examples: + + compass grid-img 40+10 # 40px column, 10px gutter, 20px height + compass grid-img 40+20x28 # 40px column, 20px gutter, 28px height + compass grid-img 60+20x28 images/wide_grid.png + +Options: +} + opts.banner = banner + + super + end + end class GenerateGridBackground < ProjectBase + include Actions + + register :"grid-img" + + class << self + def option_parser(arguments) + parser = Compass::Exec::CommandOptionParser.new(arguments) + parser.extend(Compass::Exec::GlobalOptionsParser) + parser.extend(GridBackgroundOptionsParser) + end + + def usage + option_parser([]).to_s + end + + def description(command) + "Generates a grid background image." + end + + def parse!(arguments) + parser = option_parser(arguments) + parser.parse! + if arguments.size == 0 + raise OptionParser::ParseError, "Please specify the grid dimensions." + end + parser.options[:grid_dimensions] = arguments.shift + parser.options[:grid_filename] = arguments.shift + parser.options + end + end def initialize(working_path, options) super assert_project_directory_exists! + Compass.add_configuration(options, 'command_line') end def perform - column_width, gutter_width = options[:grid_dimensions].split(/\+/).map{|d| d.to_i} - unless GridBuilder.new(options.merge(:column_width => column_width, :gutter_width => gutter_width, :output_path => projectize(project_images_subdirectory), :working_path => self.working_path)).generate! + unless options[:grid_dimensions] =~ /^(\d+)\+(\d+)(?:x(\d+))?$/ + puts "ERROR: '#{options[:grid_dimensions]}' is not valid." + puts "Dimensions should be specified like: 30+10x20" + puts "where 30 is the column width, 10 is the gutter width, and 20 is the (optional) height." + return + end + column_width = $1.to_i + gutter_width = $2.to_i + height = $3.to_i if $3 + filename = options[:grid_filename] || projectize("#{project_images_subdirectory}/grid.png") + unless GridBuilder.new(options.merge(:column_width => column_width, :gutter_width => gutter_width, :height => height, :filename => filename, :working_path => self.working_path)).generate! puts "ERROR: Some library dependencies appear to be missing." puts "Have you installed rmagick? If not, please run:" puts "sudo gem install rmagick" @@ -21,4 +88,4 @@ module Compass end end end -end \ No newline at end of file +end diff --git a/lib/compass/commands/help.rb b/lib/compass/commands/help.rb new file mode 100644 index 00000000..2f5067e2 --- /dev/null +++ b/lib/compass/commands/help.rb @@ -0,0 +1,89 @@ +module Compass + module Commands + module HelpOptionsParser + def set_options(opts) + banner = %Q{Usage: compass help [command] + +Description: + The Compass Stylesheet Authoring Framework helps you + build and maintain your stylesheets and makes it easy + for you to use stylesheet libraries provided by others. + +To get help on a particular command please specify the command. + +} + + primary_commands = Compass::Commands.all.select do |c| + cmd = Compass::Commands[c] + cmd.respond_to?(:primary) && cmd.primary + end + other_commands = Compass::Commands.all - primary_commands + + banner << command_list("Primary Commands:", primary_commands) + banner << command_list("Other Commands:", other_commands) + + banner << "\nAvailable Frameworks & Patterns:\n\n" + Compass::Frameworks::ALL.each do |framework| + banner << " * #{framework.name}\n" + framework.template_directories.each do |pattern| + banner << " - #{framework.name}/#{pattern}" + if description = framework.manifest(pattern).description + banner << "\t- #{description}" + end + banner << "\n" + end + end + + opts.banner = banner + + super + end + + def command_list(header, commands) + list = "#{header}\n" + commands.sort_by{|c| c.to_s}.each do |command| + list << " * #{command}" + if Compass::Commands[command].respond_to? :description + list << "\t- #{Compass::Commands[command].description(command)}" + end + list << "\n" + end + list + end + end + class Help < Base + register :help + + class << self + def option_parser(arguments) + parser = Compass::Exec::CommandOptionParser.new(arguments) + parser.extend(HelpOptionsParser) + end + def usage + option_parser([]).to_s + end + def description(command) + "Get help on a compass command or extension" + end + def parse!(arguments) + parser = option_parser(arguments) + parser.parse! + parser.options[:help_command] = arguments.shift || 'help' + parser.options + end + end + + def execute + if Compass::Commands.command_exists? options[:help_command] + $command = options[:help_command] + puts Compass::Commands[options[:help_command]].usage + $command = "help" + elsif Compass::Frameworks.template_exists? options[:help_command] + puts Compass::Frameworks.template_usage(options[:help_command]) + else + raise OptionParser::ParseError, "No such command: #{options[:help_command]}" + end + end + end + end +end diff --git a/lib/compass/commands/installer_command.rb b/lib/compass/commands/installer_command.rb index b59d451b..b7245ec2 100644 --- a/lib/compass/commands/installer_command.rb +++ b/lib/compass/commands/installer_command.rb @@ -1,4 +1,4 @@ -require File.join(Compass.lib_directory, 'compass', 'installers') +require 'compass/installers' module Compass module Commands @@ -6,26 +6,33 @@ module Compass include Compass::Installers def configure! - read_project_configuration - Compass.configuration.set_maybe(options) - Compass.configuration.default_all(installer.configuration_defaults) - Compass.configuration.set_defaults! + if respond_to?(:is_project_creation?) && is_project_creation? + Compass.add_configuration(options.delete(:project_type) || :stand_alone) + else + Compass.add_project_configuration(:project_type => options.delete(:project_type)) + end + Compass.add_configuration(options, 'command_line') + if File.exists?(Compass.configuration.extensions_path) + Compass::Frameworks.discover(Compass.configuration.extensions_path) + end + Compass.add_configuration(installer.completed_configuration, 'installer') + end + + def app + @app ||= Compass::AppIntegration.lookup(Compass.configuration.project_type) end def installer - @installer ||= case options[:project_type] - when :stand_alone - StandAloneInstaller.new *installer_args - when :rails - RailsInstaller.new *installer_args + @installer ||= if options[:bare] + Compass::Installers::BareInstaller.new(*installer_args) else - raise "Unknown project type: #{options[:project_type].inspect}" + app.installer(*installer_args) end end def installer_args - [template_directory(options[:pattern]), project_directory, options] + [template_directory(options[:pattern] || "project"), project_directory, options] end end end -end \ No newline at end of file +end diff --git a/lib/compass/commands/interactive.rb b/lib/compass/commands/interactive.rb new file mode 100644 index 00000000..c0a0d46f --- /dev/null +++ b/lib/compass/commands/interactive.rb @@ -0,0 +1,61 @@ + +require 'compass/commands/project_base' +require 'compass/commands/update_project' + +module Compass + module Commands + module InteractiveOptionsParser + def set_options(opts) + opts.banner = %Q{ + Usage: compass interactive [path/to/project] [options] + + Description: + Interactively evaluate SassScript + + Options: + }.strip.split("\n").map{|l| l.gsub(/^ {0,10}/,'')}.join("\n") + + super + end + end + class Interactive < ProjectBase + + register :interactive + + def initialize(working_path, options) + super + end + + def perform + require 'sass/repl' + Sass::Repl.new.run + end + + class << self + + def option_parser(arguments) + parser = Compass::Exec::CommandOptionParser.new(arguments) + parser.extend(Compass::Exec::GlobalOptionsParser) + parser.extend(Compass::Exec::ProjectOptionsParser) + parser.extend(InteractiveOptionsParser) + end + + def usage + option_parser([]).to_s + end + + def description(command) + "Interactively evaluate SassScript" + end + + def parse!(arguments) + parser = option_parser(arguments) + parser.parse! + parser.options + end + + end + + end + end +end diff --git a/lib/compass/commands/list_frameworks.rb b/lib/compass/commands/list_frameworks.rb index 27801945..e9ffb409 100644 --- a/lib/compass/commands/list_frameworks.rb +++ b/lib/compass/commands/list_frameworks.rb @@ -1,9 +1,9 @@ module Compass module Commands - class ListFrameworks + class ListFrameworks < ProjectBase attr_accessor :options def initialize(working_path, options) - self.options = options + super end def execute diff --git a/lib/compass/commands/print_version.rb b/lib/compass/commands/print_version.rb index 1217f2c3..9ca5381d 100644 --- a/lib/compass/commands/print_version.rb +++ b/lib/compass/commands/print_version.rb @@ -1,14 +1,82 @@ module Compass module Commands - class PrintVersion + module VersionOptionsParser + def set_options(opts) + opts.banner = %Q{Usage: compass version [options] + +Options: +} + opts.on_tail("-?", "-h", "--help", "Print out this message.") do + puts opts + exit + end + opts.on("-q", "--quiet", "Just print the version string.") do + self.options[:quiet] = true + end + opts.on("--major", "Print the major version number") do + self.options[:major] = true + self.options[:custom] = true + end + opts.on("--minor", "Print up to the minor version number") do + self.options[:major] = true + self.options[:minor] = true + self.options[:custom] = true + end + opts.on("--patch", "Print up to the patch version number") do + self.options[:major] = true + self.options[:minor] = true + self.options[:patch] = true + self.options[:custom] = true + end + opts.on("--revision", "Include the source control revision") do + self.options[:revision] = true + self.options[:custom] = true + end + end + end + + class PrintVersion < Base + register :version + + class << self + def option_parser(arguments) + parser = Compass::Exec::CommandOptionParser.new(arguments) + parser.extend(VersionOptionsParser) + end + def usage + option_parser([]).to_s + end + def description(command) + "Print out version information" + end + def parse!(arguments) + parser = option_parser(arguments) + parser.parse! + parser.options + end + end + attr_accessor :options + def initialize(working_path, options) self.options = options end def execute - if options[:quiet] - # The quiet option may make scripting easier + if options[:custom] + version = "" + version << "#{Compass.version[:major]}" if options[:major] + version << ".#{Compass.version[:minor]}" if options[:minor] + version << ".#{Compass.version[:teeny]}" if options[:patch] + if options[:revision] + if version.size > 0 + version << " [#{Compass.version[:rev][0..6]}]" + else + version << Compass.version[:rev] + end + end + puts version + elsif options[:quiet] puts ::Compass.version[:string] else lines = [] @@ -20,4 +88,4 @@ module Compass end end end -end \ No newline at end of file +end diff --git a/lib/compass/commands/project_base.rb b/lib/compass/commands/project_base.rb index dc082eeb..5d5c3312 100644 --- a/lib/compass/commands/project_base.rb +++ b/lib/compass/commands/project_base.rb @@ -1,7 +1,7 @@ require 'fileutils' require 'pathname' -require File.join(File.dirname(__FILE__), 'base') -require File.join(File.dirname(__FILE__), 'installer_command') +require 'compass/commands/base' +require 'compass/commands/installer_command' module Compass module Commands @@ -11,24 +11,29 @@ module Compass def initialize(working_path, options = {}) super(working_path, options) self.project_name = determine_project_name(working_path, options) - Compass.configuration.project_path = determine_project_directory(working_path, options) + Compass.add_configuration({:project_path => determine_project_directory(working_path, options)}, "implied") + configure! end def execute - configure! super end protected def configure! - read_project_configuration - Compass.configuration.set_maybe(options) - Compass.configuration.set_defaults! + add_project_configuration + if File.exists?(Compass.configuration.extensions_path) + Compass::Frameworks.discover(Compass.configuration.extensions_path) + end + end + + def add_project_configuration + Compass.add_project_configuration(options[:configuration_file]) end def projectize(path) - File.join(project_directory, separate(path)) + Compass.projectize(path) end def project_directory @@ -47,31 +52,6 @@ module Compass Compass.configuration.images_dir end - # Read the configuration file for this project - def read_project_configuration - if file = detect_configuration_file - Compass.configuration.parse(file) if File.readable?(file) - end - end - - def explicit_config_file_must_be_readable? - true - end - - # TODO: Deprecate the src/config.rb location. - KNOWN_CONFIG_LOCATIONS = [".compass/config.rb", "config/compass.config", "config.rb", "src/config.rb"] - - # Finds the configuration file, if it exists in a known location. - def detect_configuration_file - if options[:configuration_file] - if explicit_config_file_must_be_readable? && !File.readable?(options[:configuration_file]) - raise Compass::Error, "Configuration file, #{file}, not found or not readable." - end - return options[:configuration_file] - end - KNOWN_CONFIG_LOCATIONS.map{|f| projectize(f)}.detect{|f| File.exists?(f)} - end - def assert_project_directory_exists! if File.exists?(project_directory) && !File.directory?(project_directory) raise Compass::FilesystemConflict.new("#{project_directory} is not a directory.") @@ -109,4 +89,4 @@ module Compass end end -end \ No newline at end of file +end diff --git a/lib/compass/commands/project_stats.rb b/lib/compass/commands/project_stats.rb new file mode 100644 index 00000000..81f958c9 --- /dev/null +++ b/lib/compass/commands/project_stats.rb @@ -0,0 +1,162 @@ +require 'compass/commands/project_base' +require 'compass/commands/update_project' + +module Compass + module Commands + module StatsOptionsParser + def set_options(opts) + opts.banner = %Q{ + Usage: compass stats [path/to/project] [options] + + Description: + Compile project at the path specified (or the current + directory if not specified) and then compute statistics + for the sass and css files in the project. + + Options: + }.strip.split("\n").map{|l| l.gsub(/^ {0,10}/,'')}.join("\n") + + super + end + end + class ProjectStats < UpdateProject + + register :stats + + def initialize(working_path, options) + super + assert_project_directory_exists! + end + + def perform + super + require 'compass/stats' + compiler = new_compiler_instance + sass_files = sorted_sass_files(compiler) + rows = [[ :-, :-, :-, :-, :-, :-, :- ], + [ 'Filename', 'Rules', 'Properties', 'Mixins Defs', 'Mixins Used', 'CSS Rules', 'CSS Properties' ], + [ :-, :-, :-, :-, :-, :-, :- ]] + maximums = [ 8, 5, 10, 14, 11, 9, 14 ] + alignments = [ :left, :right, :right, :right, :right, :right, :right ] + delimiters = [ ['| ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'] ] + totals = [ "Total (#{sass_files.size} files):", 0, 0, 0, 0, 0, 0 ] + + sass_files.each do |sass_file| + css_file = compiler.corresponding_css_file(sass_file) unless sass_file[0..0] == '_' + row = filename_columns(sass_file) + row += sass_columns(sass_file) + row += css_columns(css_file) + row.each_with_index do |c, i| + maximums[i] = [maximums[i].to_i, c.size].max + totals[i] = totals[i] + c.to_i if i > 0 + end + rows << row + end + rows << [:-] * 7 + rows << totals.map{|t| t.to_s} + rows << [:-] * 7 + rows.each do |row| + row.each_with_index do |col, i| + print pad(col, maximums[i], :align => alignments[i], :left => delimiters[i].first, :right => delimiters[i].last) + end + print "\n" + end + if @missing_css_parser + puts "\nInstall css_parser to enable stats on your css files:\n\n\tgem install css_parser" + end + end + + def pad(c, max, options = {}) + options[:align] ||= :left + if c == :- + filler = '-' + c = '' + else + filler = ' ' + end + spaces = max - c.size + filled = filler * [spaces,0].max + "#{options[:left]}#{filled if options[:align] == :right}#{c}#{filled if options[:align] == :left}#{options[:right]}" + end + + def sorted_sass_files(compiler) + sass_files = compiler.sass_files(:exclude_partials => false) + sass_files.map! do |s| + filename = Compass.deprojectize(s, File.join(Compass.configuration.project_path, Compass.configuration.sass_dir)) + [s, File.dirname(filename), File.basename(filename)] + end + sass_files = sass_files.sort_by do |s,d,f| + File.join(d, f[0] == ?_ ? f[1..-1] : f) + end + sass_files.map!{|s,d,f| s} + end + + def filename_columns(sass_file) + filename = Compass.deprojectize(sass_file, working_path) + [filename] + end + + def sass_columns(sass_file) + sf = Compass::Stats::SassFile.new(sass_file) + sf.analyze! + %w(rule_count prop_count mixin_def_count mixin_count).map do |t| + sf.send(t).to_s + end + end + + def css_columns(css_file) + if File.exists?(css_file) + cf = Compass::Stats::CssFile.new(css_file) + cf.analyze! + %w(selector_count prop_count).map do |t| + cf.send(t).to_s + end + else + return [ '--', '--' ] + end + rescue LoadError + @missing_css_parser = true + return [ 'DISABLED', 'DISABLED' ] + end + + class << self + + def option_parser(arguments) + parser = Compass::Exec::CommandOptionParser.new(arguments) + parser.extend(Compass::Exec::GlobalOptionsParser) + parser.extend(Compass::Exec::ProjectOptionsParser) + parser.extend(StatsOptionsParser) + end + + def usage + option_parser([]).to_s + end + + def description(command) + "Report statistics about your stylesheets" + end + + def primary; false; end + + def parse!(arguments) + parser = option_parser(arguments) + parser.parse! + parse_arguments!(parser, arguments) + parser.options + end + + def parse_arguments!(parser, arguments) + if arguments.size == 1 + parser.options[:project_name] = arguments.shift + elsif arguments.size == 0 + # default to the current directory. + else + raise Compass::Error, "Too many arguments were specified." + end + end + + end + + end + end +end diff --git a/lib/compass/commands/registry.rb b/lib/compass/commands/registry.rb new file mode 100644 index 00000000..ac3654d9 --- /dev/null +++ b/lib/compass/commands/registry.rb @@ -0,0 +1,22 @@ +module Compass::Commands + module Registry + def register(name, command_class) + @commands ||= Hash.new + @commands[name.to_sym] = command_class + end + def get(name) + @commands ||= Hash.new + @commands[name.to_sym] + end + def command_exists?(name) + @commands ||= Hash.new + name && @commands.has_key?(name.to_sym) + end + def all + @commands.keys + end + alias_method :[], :get + alias_method :[]=, :register + end + extend Registry +end diff --git a/lib/compass/commands/stamp_pattern.rb b/lib/compass/commands/stamp_pattern.rb index 47f02b84..97199a3c 100644 --- a/lib/compass/commands/stamp_pattern.rb +++ b/lib/compass/commands/stamp_pattern.rb @@ -1,11 +1,64 @@ require 'fileutils' -require File.join(File.dirname(__FILE__), 'base') -require File.join(File.dirname(__FILE__), 'update_project') +require 'compass/commands/base' +require 'compass/commands/update_project' module Compass module Commands + module StampPatternOptionsParser + def set_options(opts) + opts.banner = %Q{Usage: compass install extension/pattern [path/to/project] [options] + +Description: + Install an extension's pattern into your compass project + +Example: + compass install blueprint/buttons + +Options: +} + super + end + end + class StampPattern < ProjectBase + register :install + + class << self + def option_parser(arguments) + parser = Compass::Exec::CommandOptionParser.new(arguments) + parser.extend(Compass::Exec::GlobalOptionsParser) + parser.extend(Compass::Exec::ProjectOptionsParser) + parser.extend(StampPatternOptionsParser) + end + def usage + option_parser([]).to_s + end + def description(command) + "Install an extension's pattern into your compass project" + end + def parse!(arguments) + parser = option_parser(arguments) + parser.parse! + parse_arguments!(parser, arguments) + parser.options + end + def parse_arguments!(parser, arguments) + if arguments.size == 0 + raise OptionParser::ParseError, "Please specify a pattern." + end + pattern = arguments.shift.split('/', 2) + parser.options[:framework] = pattern[0] + parser.options[:pattern] = pattern[1] + if arguments.size > 0 + parser.options[:project_name] = arguments.shift + end + if arguments.size > 0 + raise OptionParser::ParseError, "Unexpected trailing arguments: #{arguments.join(" ")}" + end + end + + end include InstallerCommand def initialize(working_path, options) @@ -30,4 +83,4 @@ module Compass end end -end \ No newline at end of file +end diff --git a/lib/compass/commands/update_project.rb b/lib/compass/commands/update_project.rb index e00e7a8f..9ab8814b 100644 --- a/lib/compass/commands/update_project.rb +++ b/lib/compass/commands/update_project.rb @@ -1,18 +1,35 @@ -require File.join(File.dirname(__FILE__), 'project_base') -require File.join(Compass.lib_directory, 'compass', 'compiler') +require 'compass/commands/project_base' +require 'compass/compiler' module Compass module Commands + module CompileProjectOptionsParser + def set_options(opts) + opts.banner = %Q{ + Usage: compass compile [path/to/project] [options] + + Description: + compile project at the path specified or the current director if not specified. + + Options: + }.split("\n").map{|l| l.gsub(/^ */,'')}.join("\n") + + super + end + end + class UpdateProject < ProjectBase - + + register :compile + def initialize(working_path, options) super - assert_project_directory_exists! + assert_project_directory_exists! unless dry_run? end def perform compiler = new_compiler_instance - if compiler.sass_files.empty? + if compiler.sass_files.empty? && !dry_run? message = "Nothing to compile. If you're trying to start a new project, you have left off the directory argument.\n" message << "Run \"compass -h\" to get help." raise Compass::Error, message @@ -21,6 +38,10 @@ module Compass end end + def dry_run? + options[:dry_run] + end + def new_compiler_instance(additional_options = {}) Compass::Compiler.new(working_path, projectize(Compass.configuration.sass_dir), @@ -29,6 +50,39 @@ module Compass :force => options[:force]).merge(additional_options)) end + class << self + def option_parser(arguments) + parser = Compass::Exec::CommandOptionParser.new(arguments) + parser.extend(Compass::Exec::GlobalOptionsParser) + parser.extend(Compass::Exec::ProjectOptionsParser) + parser.extend(CompileProjectOptionsParser) + end + + def usage + option_parser([]).to_s + end + + def primary; true; end + + def description(command) + "Compile Sass stylesheets to CSS" + end + + def parse!(arguments) + parser = option_parser(arguments) + parser.parse! + parse_arguments!(parser, arguments) + parser.options + end + + def parse_arguments!(parser, arguments) + if arguments.size == 1 + parser.options[:project_name] = arguments.shift + elsif arguments.size > 1 + raise Compass::Error, "Too many arguments were specified." + end + end + end end end -end \ No newline at end of file +end diff --git a/lib/compass/commands/validate_project.rb b/lib/compass/commands/validate_project.rb index 13c06da9..2f024d36 100644 --- a/lib/compass/commands/validate_project.rb +++ b/lib/compass/commands/validate_project.rb @@ -1,21 +1,77 @@ -require File.join(File.dirname(__FILE__), 'project_base') -require File.join(File.dirname(__FILE__), 'update_project') +require 'compass/commands/project_base' +require 'compass/commands/update_project' module Compass module Commands + module ValidationOptionsParser + def set_options(opts) + opts.banner = %Q{ + Usage: compass validate [path/to/project] [options] + + Description: + Compile project at the path specified or the current + directory if not specified and then validate the + generated CSS. + + Options: + }.strip.split("\n").map{|l| l.gsub(/^ {0,10}/,'')}.join("\n") + + super + end + end class ValidateProject < ProjectBase - + + register :validate + def initialize(working_path, options) super assert_project_directory_exists! end def perform - require File.join(File.dirname(__FILE__), '..', 'validator') + require 'compass/validator' UpdateProject.new(working_path, options).perform - Validator.new(project_css_subdirectory).validate() + Dir.chdir Compass.configuration.project_path do + Validator.new(project_css_subdirectory).validate() + end + end + + class << self + + def option_parser(arguments) + parser = Compass::Exec::CommandOptionParser.new(arguments) + parser.extend(Compass::Exec::GlobalOptionsParser) + parser.extend(Compass::Exec::ProjectOptionsParser) + parser.extend(ValidationOptionsParser) + end + + def usage + option_parser([]).to_s + end + + def description(command) + "Validate your generated css." + end + + def parse!(arguments) + parser = option_parser(arguments) + parser.parse! + parse_arguments!(parser, arguments) + parser.options + end + + def parse_arguments!(parser, arguments) + if arguments.size == 1 + parser.options[:project_name] = arguments.shift + elsif arguments.size == 0 + # default to the current directory. + else + raise Compass::Error, "Too many arguments were specified." + end + end + end end end -end \ No newline at end of file +end diff --git a/lib/compass/commands/watch_project.rb b/lib/compass/commands/watch_project.rb index ee0528d8..0e5e90cd 100644 --- a/lib/compass/commands/watch_project.rb +++ b/lib/compass/commands/watch_project.rb @@ -1,12 +1,14 @@ require 'fileutils' require 'pathname' -require File.join(File.dirname(__FILE__), 'base') -require File.join(File.dirname(__FILE__), 'update_project') +require 'compass/commands/base' +require 'compass/commands/update_project' module Compass module Commands class WatchProject < UpdateProject + register :watch + attr_accessor :last_update_time, :last_sass_files def perform @@ -19,7 +21,12 @@ module Compass puts ">>> Compass is watching for changes. Press Ctrl-C to Stop." - require File.join(Compass.lib_directory, 'vendor', 'fssm') + begin + require 'fssm' + rescue LoadError + $: << File.join(Compass.lib_directory, 'vendor') + retry + end FSSM.monitor do |monitor| Compass.configuration.sass_load_paths.each do |load_path| @@ -61,4 +68,4 @@ module Compass end end -end \ No newline at end of file +end diff --git a/lib/compass/commands/write_configuration.rb b/lib/compass/commands/write_configuration.rb index 1c8c28fc..acf60301 100644 --- a/lib/compass/commands/write_configuration.rb +++ b/lib/compass/commands/write_configuration.rb @@ -1,9 +1,33 @@ -require File.join(File.dirname(__FILE__), 'project_base') +require 'compass/commands/project_base' module Compass module Commands + module ConfigurationOptionsParser + def set_options(opts) + opts.banner = %Q{ + Usage: compass config [path/to/config_file.rb] [options] + + Description: + Generate a configuration file for the options specified. + Compass will recognize configuration files in the + following locations relative to the project root: + * #{Compass::Configuration::Helpers::KNOWN_CONFIG_LOCATIONS.join(" + * ")} + Any other location, and you'll need to specify it when working with the command line tool using the -c option. + + Options: + }.strip.split("\n").map{|l| l.gsub(/^ {0,10}/,'')}.join("\n") + opts.on("--debug [PROPERTY]", "Debug your configuration by printing out details.") do |prop| + self.options[:debug] = prop.nil? ? true : prop.to_sym + end + + super + end + end class WriteConfiguration < ProjectBase - + + register :config + include InstallerCommand def initialize(working_path, options) @@ -11,8 +35,33 @@ module Compass assert_project_directory_exists! end + def add_project_configuration + Compass.add_project_configuration + end + def perform - installer.write_configuration_files(options[:configuration_file]) + if options[:debug] + puts "Configuration sources:" + c = Compass.configuration + while c + print c.name + c = c.inherited_data + print ", " if c + end + print "\n" + Compass.configuration.debug.each do |prop, values| + if options[:debug].is_a?(Symbol) + next unless prop == options[:debug] + end + puts "***** #{prop} = #{values.first[:resolved].inspect} *****" + [:default, :value, :raw, :resolved].each do |kind| + puts "#{kind}: " + values.inject([]){|m, v| m << v[kind]}.map{|v| v.nil? ? '-' : v.inspect}.join(", ") + end + end + else + directory File.dirname(options[:configuration_file]) + installer.write_configuration_files(options[:configuration_file]) + end end def installer_args @@ -23,6 +72,42 @@ module Compass false end + class << self + + def option_parser(arguments) + parser = Compass::Exec::CommandOptionParser.new(arguments) + parser.extend(Compass::Exec::GlobalOptionsParser) + parser.extend(Compass::Exec::ProjectOptionsParser) + parser.extend(ConfigurationOptionsParser) + end + + def usage + option_parser([]).to_s + end + + def description(command) + "Generate a configuration file for the provided command line options." + end + + def parse!(arguments) + parser = option_parser(arguments) + parser.parse! + parse_arguments!(parser, arguments) + parser.options + end + + def parse_arguments!(parser, arguments) + if arguments.size == 1 + parser.options[:configuration_file] = arguments.shift + elsif arguments.size == 0 + # default to the current directory. + else + raise Compass::Error, "Too many arguments were specified." + end + end + + end + end end -end \ No newline at end of file +end diff --git a/lib/compass/compiler.rb b/lib/compass/compiler.rb index c48b2b63..a38fba76 100644 --- a/lib/compass/compiler.rb +++ b/lib/compass/compiler.rb @@ -13,8 +13,9 @@ module Compass self.options[:cache_location] ||= File.join(from, ".sass-cache") end - def sass_files - @sass_files || Dir.glob(separate("#{from}/**/[^_]*.sass")) + def sass_files(options = {}) + exclude_partials = options.fetch(:exclude_partials, true) + @sass_files || Dir.glob(separate("#{from}/**/#{'[^_]' if exclude_partials}*.sass")) end def stylesheet_name(sass_file) @@ -51,4 +52,4 @@ module Compass end end end -end \ No newline at end of file +end diff --git a/lib/compass/configuration.rb b/lib/compass/configuration.rb index 9a39a7de..fdf686eb 100644 --- a/lib/compass/configuration.rb +++ b/lib/compass/configuration.rb @@ -1,324 +1,38 @@ -require 'singleton' - module Compass - class Configuration - include Singleton + module Configuration ATTRIBUTES = [ :project_type, :project_path, - :http_path, :css_dir, :sass_dir, :images_dir, :javascripts_dir, - :output_style, - :environment, - :relative_assets, + :extensions_dir, + :css_path, + :sass_path, + :images_path, + :javascripts_path, + :extensions_path, + :http_path, + :http_images_dir, + :http_stylesheets_dir, + :http_javascripts_dir, :http_images_path, :http_stylesheets_path, :http_javascripts_path, + :output_style, + :environment, + :relative_assets, :additional_import_paths, - :sass_options + :sass_options, + :asset_host, + :asset_cache_buster ] - attr_accessor *ATTRIBUTES - - attr_accessor :required_libraries - - def initialize - self.required_libraries = [] - end - - # parses a manifest file which is a ruby script - # evaluated in a Manifest instance context - def parse(config_file) - open(config_file) do |f| - parse_string(f.read, config_file) - end - end - - def parse_string(contents, filename) - bind = binding - eval(contents, bind, filename) - ATTRIBUTES.each do |prop| - value = eval(prop.to_s, bind) rescue nil - self.send("#{prop}=", value) if value - end - if @added_import_paths - self.additional_import_paths ||= [] - self.additional_import_paths += @added_import_paths - end - issue_deprecation_warnings - end - - def set_all(options) - ATTRIBUTES.each do |a| - self.send("#{a}=", options[a]) if options.has_key?(a) - end - end - - def set_maybe(options) - ATTRIBUTES.each do |a| - self.send("#{a}=", options[a]) if options[a] - end - end - - def default_all(options) - ATTRIBUTES.each do |a| - set_default_unless_set(a, options[a]) - end - end - - def set_default_unless_set(attribute, value) - self.send("#{attribute}=", value) unless self.send(attribute) - end - - def set_defaults! - ATTRIBUTES.each do |a| - set_default_unless_set(a, default_for(a)) - end - end - - def default_for(attribute) - method = "default_#{attribute}".to_sym - self.send(method) if respond_to?(method) - end - - def default_sass_dir - "src" - end - - def default_css_dir - "stylesheets" - end - - def default_images_dir - "images" - end - - def default_http_path - "/" - end - - def comment_for_http_path - "# Set this to the root of your project when deployed:\n" - end - - def relative_assets? - # the http_images_path is deprecated, but here for backwards compatibility. - relative_assets || http_images_path == :relative - end - - def comment_for_relative_assets - unless relative_assets - %q{# To enable relative paths to assets via compass helper functions. Uncomment: -# relative_assets = true -} - else - "" - end - end - - def default_output_style - if environment == :development - :expanded - else - :compact - end - end - - def default_line_comments - environment == :development - end - - def sass_path - if project_path && sass_dir - File.join(project_path, sass_dir) - end - end - - def css_path - if project_path && css_dir - File.join(project_path, css_dir) - end - end - - def root_relative(path) - hp = http_path || default_http_path - hp = hp[0..-2] if hp[-1..-1] == "/" - "#{hp}/#{path}" - end - - def add_import_path(*paths) - # The @added_import_paths variable works around an issue where - # the additional_import_paths gets overwritten during parse - @added_import_paths ||= [] - @added_import_paths += paths - self.additional_import_paths ||= [] - self.additional_import_paths += paths - end - - # When called with a block, defines the asset host url to be used. - # The block must return a string that starts with a protocol (E.g. http). - # The block will be passed the root-relative url of the asset. - # When called without a block, returns the block that was previously set. - def asset_host(&block) - if block_given? - @asset_host = block - else - @asset_host - end - end - - # When called with a block, defines the cache buster strategy to be used. - # The block must return nil or a string that can be appended to a url as a query parameter. - # The returned string must not include the starting '?'. - # The block will be passed the root-relative url of the asset. - # If the block accepts two arguments, it will also be passed a File object - # that points to the asset on disk -- which may or may not exist. - # When called without a block, returns the block that was previously set. - def asset_cache_buster(&block) - if block_given? - @asset_cache_buster = block - else - @asset_cache_buster - end - end - - - def serialize - if asset_cache_buster - raise Compass::Error, "Cannot serialize a configuration with asset_cache_buster set." - end - if asset_host - raise Compass::Error, "Cannot serialize a configuration with asset_host set." - end - contents = "" - required_libraries.each do |lib| - contents << %Q{require '#{lib}'\n} - end - contents << "# Require any additional compass plugins here.\n" - contents << "\n" if required_libraries.any? - ATTRIBUTES.each do |prop| - value = send(prop) - if respond_to?("comment_for_#{prop}") - contents << send("comment_for_#{prop}") - end - if block_given? && (to_emit = yield(prop, value)) - contents << to_emit - else - contents << Configuration.serialize_property(prop, value) unless value.nil? - end - end - contents - end - - def self.serialize_property(prop, value) - %Q(#{prop} = #{value.inspect}\n) - end - - def to_compiler_arguments(additional_options) - [project_path, sass_path, css_path, to_sass_engine_options.merge(additional_options)] - end - - def to_sass_plugin_options - locations = {} - locations[sass_path] = css_path if sass_path && css_path - Compass::Frameworks::ALL.each do |framework| - locations[framework.stylesheets_directory] = css_path || css_dir || "." - end - resolve_additional_import_paths.each do |additional_path| - locations[additional_path] = File.join(css_path || css_dir || ".", File.basename(additional_path)) - end - plugin_opts = {:template_location => locations} - plugin_opts[:style] = output_style if output_style - plugin_opts[:line_comments] = default_line_comments if environment - plugin_opts.merge!(sass_options || {}) - plugin_opts - end - - def resolve_additional_import_paths - (additional_import_paths || []).map do |path| - if project_path && !absolute_path?(path) - File.join(project_path, path) - else - path - end - end - end - - def to_sass_engine_options - engine_opts = {:load_paths => sass_load_paths} - engine_opts[:style] = output_style if output_style - engine_opts[:line_comments] = default_line_comments if environment - engine_opts.merge!(sass_options || {}) - end - - def sass_load_paths - load_paths = [] - load_paths << sass_path if sass_path - Compass::Frameworks::ALL.each do |framework| - load_paths << framework.stylesheets_directory if File.exists?(framework.stylesheets_directory) - end - load_paths += resolve_additional_import_paths - load_paths - end - - # Support for testing. - def reset! - ATTRIBUTES.each do |attr| - send("#{attr}=", nil) - end - @asset_cache_buster = nil - @asset_host = nil - @added_import_paths = nil - self.required_libraries = [] - end - - def issue_deprecation_warnings - if http_images_path == :relative - puts "DEPRECATION WARNING: Please set relative_assets = true to enable relative paths." - end - end - - def require(lib) - required_libraries << lib - super - end - - def absolute_path?(path) - # This is only going to work on unix, gonna need a better implementation. - path.index(File::SEPARATOR) == 0 - end end - - module ConfigHelpers - def configuration - if block_given? - yield Configuration.instance - end - Configuration.instance - end - - def sass_plugin_configuration - configuration.to_sass_plugin_options - end - - def configure_sass_plugin! - @sass_plugin_configured = true - Sass::Plugin.options.merge!(sass_plugin_configuration) - end - - def sass_plugin_configured? - @sass_plugin_configured - end - - def sass_engine_options - configuration.to_sass_engine_options - end - end - - extend ConfigHelpers - +end + +['adapters', 'comments', 'defaults', 'helpers', 'inheritance', 'serialization', 'data'].each do |lib| + require "compass/configuration/#{lib}" end diff --git a/lib/compass/configuration/adapters.rb b/lib/compass/configuration/adapters.rb new file mode 100644 index 00000000..d15c0079 --- /dev/null +++ b/lib/compass/configuration/adapters.rb @@ -0,0 +1,59 @@ +module Compass + module Configuration + # The adapters module provides methods that make configuration data from a compass project + # adapt to various consumers of configuration data + module Adapters + def to_compiler_arguments(additional_options) + [project_path, sass_path, css_path, to_sass_engine_options.merge(additional_options)] + end + + def to_sass_plugin_options + locations = {} + locations[sass_path] = css_path if sass_path && css_path + Compass::Frameworks::ALL.each do |framework| + locations[framework.stylesheets_directory] = css_path || css_dir || "." + end + resolve_additional_import_paths.each do |additional_path| + locations[additional_path] = File.join(css_path || css_dir || ".", File.basename(additional_path)) + end + plugin_opts = {:template_location => locations} + plugin_opts[:style] = output_style if output_style + plugin_opts[:line_comments] = line_comments if environment + plugin_opts.merge!(sass_options || {}) + plugin_opts + end + + def resolve_additional_import_paths + (additional_import_paths || []).map do |path| + if project_path && !absolute_path?(path) + File.join(project_path, path) + else + path + end + end + end + + def absolute_path?(path) + # This is only going to work on unix, gonna need a better implementation. + path.index(File::SEPARATOR) == 0 + end + + def to_sass_engine_options + engine_opts = {:load_paths => sass_load_paths} + engine_opts[:style] = output_style if output_style + engine_opts[:line_comments] = line_comments if environment + engine_opts.merge!(sass_options || {}) + end + + def sass_load_paths + load_paths = [] + load_paths << sass_path if sass_path + Compass::Frameworks::ALL.each do |framework| + load_paths << framework.stylesheets_directory if File.exists?(framework.stylesheets_directory) + end + load_paths += resolve_additional_import_paths + load_paths + end + end + end +end diff --git a/lib/compass/configuration/comments.rb b/lib/compass/configuration/comments.rb new file mode 100644 index 00000000..b62f6a92 --- /dev/null +++ b/lib/compass/configuration/comments.rb @@ -0,0 +1,22 @@ +module Compass + module Configuration + # Comments are emitted into the configuration file when serialized and make it easier to understand for new users. + module Comments + + def comment_for_http_path + "# Set this to the root of your project when deployed:\n" + end + + def comment_for_relative_assets + unless relative_assets + %q{# To enable relative paths to assets via compass helper functions. Uncomment: +# relative_assets = true +} + else + "" + end + end + + end + end +end diff --git a/lib/compass/configuration/data.rb b/lib/compass/configuration/data.rb new file mode 100644 index 00000000..42936045 --- /dev/null +++ b/lib/compass/configuration/data.rb @@ -0,0 +1,106 @@ +module Compass + module Configuration + # The Compass configuration data storage class manages configuration data that comes from a variety of + # different sources and aggregates them together into a consistent API + # Some of the possible sources of configuration data: + # * Compass default project structure for stand alone projects + # * App framework specific project structures for rails, etc. + # * User supplied explicit configuration + # * Configuration data provided via the command line interface + # + # There are two kinds of configuration data that doesn't come from the user: + # + # 1. Configuration data that is defaulted as if the user had provided it themselves. + # This is useful for providing defaults that the user is likely to want to edit + # but shouldn't have to provide explicitly when getting started + # 2. Configuration data that is defaulted behind the scenes because _some_ value is + # required. + class Data + + attr_accessor :required_libraries + attr_reader :name + + include Compass::Configuration::Inheritance + include Compass::Configuration::Serialization + include Compass::Configuration::Adapters + + inherited_accessor *ATTRIBUTES + + def initialize(name, attr_hash = nil) + raise "I need a name!" unless name + @name = name + self.required_libraries = [] + set_all(attr_hash) if attr_hash + self.top_level = self + end + + def set_all(attr_hash) + # assert_valid_keys!(attr_hash) + attr_hash.each do |a, v| + if self.respond_to?("#{a}=") + self.send("#{a}=", v) + end + end + end + + def add_import_path(*paths) + # The @added_import_paths variable works around an issue where + # the additional_import_paths gets overwritten during parse + @added_import_paths ||= [] + @added_import_paths += paths + self.additional_import_paths ||= [] + self.additional_import_paths += paths + end + + # When called with a block, defines the asset host url to be used. + # The block must return a string that starts with a protocol (E.g. http). + # The block will be passed the root-relative url of the asset. + # When called without a block, returns the block that was previously set. + def asset_host(&block) + if block_given? + @asset_host = block + else + @asset_host + end + end + + # When called with a block, defines the cache buster strategy to be used. + # The block must return nil or a string that can be appended to a url as a query parameter. + # The returned string must not include the starting '?'. + # The block will be passed the root-relative url of the asset. + # If the block accepts two arguments, it will also be passed a File object + # that points to the asset on disk -- which may or may not exist. + # When called without a block, returns the block that was previously set. + def asset_cache_buster(&block) + if block_given? + @asset_cache_buster = block + else + @asset_cache_buster + end + end + + # Require a compass plugin and capture that it occured so that the configuration serialization works next time. + def require(lib) + required_libraries << lib + super + end + + def relative_assets? + # the http_images_path is deprecated, but here for backwards compatibility. + relative_assets || http_images_path == :relative + end + + private + + def assert_valid_keys!(attr_hash) + illegal_attrs = attr_hash.keys - ATTRIBUTES + if illegal_attrs.size == 1 + raise Error, "#{illegal_attrs.first.inspect} is not a valid configuration attribute." + elsif illegal_attrs.size > 0 + raise Error, "Illegal configuration attributes: #{illegal_attrs.map{|a| a.inspect}.join(", ")}" + end + end + + end + end +end diff --git a/lib/compass/configuration/defaults.rb b/lib/compass/configuration/defaults.rb new file mode 100644 index 00000000..8dcad8b5 --- /dev/null +++ b/lib/compass/configuration/defaults.rb @@ -0,0 +1,108 @@ +module Compass + module Configuration + module Defaults + + def default_project_type + :stand_alone + end + + def http_path_without_default + "/" + end + + def default_extensions_dir + "extensions" + end + + def default_output_style + if top_level.environment == :development + :expanded + else + :compact + end + end + + def default_line_comments + top_level.environment == :development + end + + def default_sass_path + if (pp = top_level.project_path) && (dir = top_level.sass_dir) + File.join(pp, dir) + end + end + + def default_css_path + if (pp = top_level.project_path) && (dir = top_level.css_dir) + File.join(pp, dir) + end + end + + def default_images_path + if (pp = top_level.project_path) && (dir = top_level.images_dir) + File.join(pp, dir) + end + end + + def default_javascripts_path + if (pp = top_level.project_path) && (dir = top_level.javascripts_dir) + File.join(pp, dir) + end + end + + def default_extensions_path + if (pp = top_level.project_path) && (dir = top_level.extensions_dir) + File.join(pp, dir) + end + end + + + def default_http_images_dir + top_level.images_dir + end + + def default_http_images_path + http_root_relative top_level.http_images_dir + end + + def default_http_stylesheets_dir + top_level.css_dir + end + + def default_http_stylesheets_path + http_root_relative top_level.http_stylesheets_dir + end + + def default_http_javascripts_dir + top_level.javascripts_dir + end + + def default_http_javascripts_path + http_root_relative top_level.http_javascripts_dir + end + + # helper functions + + def http_join(*segments) + segments.map do |segment| + next unless segment + segment = http_pathify(segment) + segment[-1..-1] == "/" ? segment[0..-2] : segment + end.join("/") + end + + def http_pathify(path) + if File::SEPARATOR == "/" + path + else + path.gsub(File::SEPARATOR, "/") + end + end + + def http_root_relative(path) + http_join top_level.http_path, path + end + + end + end +end diff --git a/lib/compass/configuration/helpers.rb b/lib/compass/configuration/helpers.rb new file mode 100644 index 00000000..d1d983bb --- /dev/null +++ b/lib/compass/configuration/helpers.rb @@ -0,0 +1,120 @@ +module Compass + module Configuration + # The helpers are available as methods on the Compass module. E.g. Compass.configuration + module Helpers + def configuration + @configuration ||= default_configuration + if block_given? + yield @configuration + end + @configuration + end + + def default_configuration + Data.new('defaults').extend(Defaults).extend(Comments) + end + + def add_configuration(config, filename = nil) + return if config.nil? + + + data = configuration_for(config, filename) + + # puts "New configuration: #{data.name}" + # puts caller.join("\n") + data.inherit_from!(configuration) + data.on_top! + @configuration = data + end + + def configuration_for(config, filename = nil) + if config.is_a?(Compass::Configuration::Data) + config + elsif config.respond_to?(:read) + Compass::Configuration::Data.new_from_string(config.read, filename) + elsif config.is_a?(Hash) + Compass::Configuration::Data.new(filename, config) + elsif config.is_a?(String) + Compass::Configuration::Data.new_from_file(config) + elsif config.is_a?(Symbol) + Compass::AppIntegration.lookup(config).configuration + else + raise "I don't know what to do with: #{config.inspect}" + end + end + + # Support for testing. + def reset_configuration! + @configuration = nil + end + + def sass_plugin_configuration + configuration.to_sass_plugin_options + end + + def configure_sass_plugin! + @sass_plugin_configured = true + Sass::Plugin.options.merge!(sass_plugin_configuration) + end + + def sass_plugin_configured? + @sass_plugin_configured + end + + def sass_engine_options + configuration.to_sass_engine_options + end + + # Read the configuration file for this project + def add_project_configuration(*args) + options = args.last.is_a?(Hash) ? args.pop : {} + configuration_file_path = args.shift || detect_configuration_file + raise ArgumentError, "Too many arguments" if args.any? + if configuration_file_path + + data = configuration_for(configuration_file_path) + + if data.raw_project_type + add_configuration(data.raw_project_type.to_sym) + elsif options[:project_type] + add_configuration(options[:project_type]) + else + add_configuration(:stand_alone) + end + + add_configuration(data) + else + add_configuration(options[:project_type] || configuration.project_type || :stand_alone) + end + end + + # Returns a full path to the relative path to the project directory + def projectize(path, project_path = nil) + project_path ||= configuration.project_path + File.join(project_path, *path.split('/')) + end + + def deprojectize(path, project_path = nil) + project_path ||= configuration.project_path + if path[0..(project_path.size - 1)] == project_path + path[(project_path.size + 1)..-1] + else + path + end + end + + # TODO: Deprecate the src/config.rb location. + KNOWN_CONFIG_LOCATIONS = ['config/compass.rb', ".compass/config.rb", "config/compass.config", "config.rb", "src/config.rb"] + + # Finds the configuration file, if it exists in a known location. + def detect_configuration_file(project_path = nil) + possible_files = KNOWN_CONFIG_LOCATIONS.map{|f| projectize(f, project_path) } + possible_files.detect{|f| File.exists?(f)} + end + + end + end + + extend Configuration::Helpers + +end diff --git a/lib/compass/configuration/inheritance.rb b/lib/compass/configuration/inheritance.rb new file mode 100644 index 00000000..255749c2 --- /dev/null +++ b/lib/compass/configuration/inheritance.rb @@ -0,0 +1,170 @@ +module Compass + module Configuration + # The inheritance module makes it easy for configuration data to inherit from + # other instances of configuration data. This makes it easier for external code to layer + # bits of configuration from various sources. + module Inheritance + + def self.included(base) + # inherited_data stores configuration data that this configuration object will + # inherit if not provided explicitly. + base.send :attr_accessor, :inherited_data, :set_attributes, :top_level + + base.send(:include, InstanceMethods) + base.extend(ClassMethods) + end + + module ClassMethods + def inherited_writer(*attributes) + attributes.each do |attribute| + line = __LINE__ + 1 + class_eval %Q{ + def #{attribute}=(value) # def css_dir=(value) + @set_attributes ||= {} # @set_attributes ||= {} + @set_attributes[#{attribute.inspect}] = true # @set_attributes[:css_dir] = true + @#{attribute} = value # @css_dir = value + end # end + + def unset_#{attribute}! # def unset_css_dir! + unset!(#{attribute.inspect}) # unset!(:css_dir) + end # end + + def #{attribute}_set? # def css_dir_set? + set?(#{attribute.inspect}) # set?(:css_dir) + end # end + }, __FILE__, line + end + end + + # Defines the default reader to be an inherited_reader that will look at the inherited_data for its + # value when not set. The inherited reader calls to a raw reader that acts like a normal attribute + # reader but prefixes the attribute name with "raw_". + def inherited_reader(*attributes) + attributes.each do |attribute| + line = __LINE__ + 1 + class_eval %Q{ + def raw_#{attribute} # def raw_css_dir + @#{attribute} # @css_dir + end # end + def #{attribute}_without_default # def css_dir_without_default + read_without_default(#{attribute.inspect}) # read_without_default(:css_dir) + end # end + def #{attribute} # def css_dir + read(#{attribute.inspect}) # read(:css_dir) + end # end + }, __FILE__, line + end + end + + def inherited_accessor(*attributes) + inherited_reader(*attributes) + inherited_writer(*attributes) + end + + + end + + module InstanceMethods + + def on_top! + self.set_top_level(self) + end + + def set_top_level(new_top) + self.top_level = new_top + if self.inherited_data.respond_to?(:set_top_level) + self.inherited_data.set_top_level(new_top) + end + end + + + def inherit_from!(data) + if self.inherited_data + self.inherited_data.inherit_from!(data) + else + self.inherited_data = data + end + self + end + + def unset!(attribute) + @set_attributes ||= {} + send("#{attribute}=", nil) + @set_attributes.delete(attribute) + nil + end + + def set?(attribute) + @set_attributes ||= {} + @set_attributes[attribute] + end + + def default_for(attribute) + method = "default_#{attribute}".to_sym + if respond_to?(method) + send(method) + end + end + + # Read an explicitly set value that is either inherited or set on this instance + def read_without_default(attribute) + if set?(attribute) + send("raw_#{attribute}") + elsif inherited_data.respond_to?("#{attribute}_without_default") + inherited_data.send("#{attribute}_without_default") + elsif inherited_data.respond_to?(attribute) + inherited_data.send(attribute) + end + end + + # Read a value that is either inherited or set on this instance, if we get to the bottom-most configuration instance, + # we ask for the default starting at the top level. + def read(attribute) + if !(v = send("#{attribute}_without_default")).nil? + v + else + top_level.default_for(attribute) + end + end + + def method_missing(meth) + if inherited_data + inherited_data.send(meth) + else + raise NoMethodError, meth.to_s + end + end + + def respond_to?(meth) + if super + true + elsif inherited_data + inherited_data.respond_to?(meth) + else + false + end + end + + def debug + instances = [self] + instances << instances.last.inherited_data while instances.last.inherited_data + normalized_attrs = {} + ATTRIBUTES.each do |prop| + values = [] + instances.each do |instance| + values << { + :raw => (instance.send("raw_#{prop}") rescue nil), + :value => (instance.send("#{prop}_without_default") rescue nil), + :default => (instance.send("default_#{prop}") rescue nil), + :resolved => instance.send(prop) + } + end + normalized_attrs[prop] = values + end + normalized_attrs + end + + end + end + end +end diff --git a/lib/compass/configuration/serialization.rb b/lib/compass/configuration/serialization.rb new file mode 100644 index 00000000..829e3bb6 --- /dev/null +++ b/lib/compass/configuration/serialization.rb @@ -0,0 +1,86 @@ +module Compass + module Configuration + # The serialization module manages reading and writing the configuration file(s). + module Serialization + def self.included(base) + base.send(:include, InstanceMethods) + base.extend ClassMethods + end + + module ClassMethods + def new_from_file(config_file) + data = Data.new(config_file) + data.parse(config_file) + data + end + + def new_from_string(contents, filename) + data = Data.new(filename) + data.parse_string(contents, filename) + data + end + end + + module InstanceMethods + # parses a configuration file which is a ruby script + def parse(config_file) + unless File.readable?(config_file) + raise Compass::Error, "Configuration file, #{config_file}, not found or not readable." + end + open(config_file) do |f| + parse_string(f.read, config_file) + end + end + + def parse_string(contents, filename) + bind = binding + eval(contents, bind, filename) + ATTRIBUTES.each do |prop| + value = eval(prop.to_s, bind) rescue nil + self.send("#{prop}=", value) if value + end + if @added_import_paths + self.additional_import_paths ||= [] + self.additional_import_paths += @added_import_paths + end + issue_deprecation_warnings + end + + def serialize + contents = "" + required_libraries.each do |lib| + contents << %Q{require '#{lib}'\n} + end + contents << "# Require any additional compass plugins here.\n" + contents << "\n" if required_libraries.any? + ATTRIBUTES.each do |prop| + value = send("#{prop}_without_default") + if value.is_a?(Proc) + $stderr.puts "WARNING: #{prop} is code and cannot be written to a file. You'll need to copy it yourself." + end + if respond_to?("comment_for_#{prop}") + contents << send("comment_for_#{prop}") + end + if block_given? && (to_emit = yield(prop, value)) + contents << to_emit + else + contents << serialize_property(prop, value) unless value.nil? + end + end + contents + end + + def serialize_property(prop, value) + %Q(#{prop} = #{value.inspect}\n) + end + + def issue_deprecation_warnings + if http_images_path == :relative + $stderr.puts "DEPRECATION WARNING: Please set relative_assets = true to enable relative paths." + end + end + + end + end + end +end diff --git a/lib/compass/dependencies.rb b/lib/compass/dependencies.rb index 81eed158..5c697b3c 100644 --- a/lib/compass/dependencies.rb +++ b/lib/compass/dependencies.rb @@ -1,10 +1,6 @@ -unless defined?(Sass) - require 'rubygems' - begin - gem 'haml-edge', '>= 2.3.0' - $stderr.puts "Loading haml-edge gem." - rescue Exception - #pass - end +begin require 'sass' -end \ No newline at end of file +rescue LoadError + require 'rubygems' + require 'sass' +end diff --git a/lib/compass/errors.rb b/lib/compass/errors.rb index d0dccfcd..96695e34 100644 --- a/lib/compass/errors.rb +++ b/lib/compass/errors.rb @@ -4,4 +4,7 @@ module Compass class FilesystemConflict < Error end -end \ No newline at end of file + + class MissingDependency < Error + end +end diff --git a/lib/compass/exec.rb b/lib/compass/exec.rb index 9877e629..2547d376 100644 --- a/lib/compass/exec.rb +++ b/lib/compass/exec.rb @@ -1,251 +1,16 @@ -require File.join(Compass.lib_directory, 'compass', 'dependencies') +require 'compass/dependencies' require 'optparse' -require File.join(Compass.lib_directory, 'compass', 'logger') -require File.join(Compass.lib_directory, 'compass', 'errors') -require File.join(Compass.lib_directory, 'compass', 'actions') +require 'compass/logger' +require 'compass/errors' +require 'compass/actions' +require 'compass/installers' +require 'compass/commands' -module Compass - module Exec - - def report_error(e, options) - $stderr.puts "#{e.class} on line #{get_line e} of #{get_file e}: #{e.message}" - if options[:trace] - e.backtrace[1..-1].each { |t| $stderr.puts " #{t}" } - else - $stderr.puts "Run with --trace to see the full backtrace" - end - end - - def get_file(exception) - exception.backtrace[0].split(/:/, 2)[0] - end - - def get_line(exception) - exception.backtrace[0].scan(/:(\d+)/)[0] - end - module_function :report_error, :get_file, :get_line - - class Compass - - attr_accessor :args, :options, :opts - - def initialize(args) - self.args = args - self.options = {} - parse! - end - - def run! - begin - perform! - rescue Exception => e - raise e if e.is_a? SystemExit - if e.is_a?(::Compass::Error) || e.is_a?(OptionParser::ParseError) - $stderr.puts e.message - else - ::Compass::Exec.report_error(e, @options) - end - return 1 - end - return 0 - end - - protected - - def perform! - if options[:command] - do_command(options[:command]) - else - puts self.opts - end - end - - def parse! - self.opts = OptionParser.new(&method(:set_opts)) - self.opts.parse!(self.args) - if self.args.size > 0 - self.options[:project_name] = trim_trailing_separator(self.args.shift) - end - self.options[:command] ||= self.options[:project_name] ? :create_project : :update_project - self.options[:framework] ||= :compass - self.options[:project_type] ||= :stand_alone - end - - def trim_trailing_separator(path) - path[-1..-1] == File::SEPARATOR ? path[0..-2] : path - end - - def set_opts(opts) - opts.banner = <+.', - ' Defaults to 30+10.') do |dimensions| - self.options[:grid_dimensions] = dimensions || "30+10" - unless self.options[:grid_dimensions] =~ /^\d+\+\d+$/ - puts "Please enter your dimensions as +. E.g. 20+5 or 30+10." - exit - end - self.options[:command] = :generate_grid_background - end - - opts.separator '' - opts.separator 'Install/Pattern Options:' - - opts.on('-f FRAMEWORK', '--framework FRAMEWORK', 'Use the specified framework. Only one may be specified.') do |framework| - self.options[:framework] = framework - end - - opts.on('-n', '--pattern-name NAME', 'The name to use when stamping a pattern.', - ' Must be used in combination with -p.') do |name| - self.options[:pattern_name] = name - end - - opts.on('--rails', "Sets the project type to a rails project.") do - self.options[:project_type] = :rails - end - - opts.separator '' - opts.separator 'Configuration Options:' - - opts.on('-c', '--config CONFIG_FILE', 'Specify the location of the configuration file explicitly.') do |configuration_file| - self.options[:configuration_file] = configuration_file - end - - opts.on('--sass-dir SRC_DIR', "The source directory where you keep your sass stylesheets.") do |sass_dir| - self.options[:sass_dir] = sass_dir - end - - opts.on('--css-dir CSS_DIR', "The target directory where you keep your css stylesheets.") do |css_dir| - self.options[:css_dir] = css_dir - end - - opts.on('--images-dir IMAGES_DIR', "The directory where you keep your images.") do |images_dir| - self.options[:images_dir] = images_dir - end - - opts.on('--javascripts-dir JS_DIR', "The directory where you keep your javascripts.") do |javascripts_dir| - self.options[:javascripts_dir] = javascripts_dir - end - - opts.on('-e ENV', '--environment ENV', [:development, :production], 'Use sensible defaults for your current environment.', - ' One of: development, production (default)') do |env| - self.options[:environment] = env - end - - opts.on('-s STYLE', '--output-style STYLE', [:nested, :expanded, :compact, :compressed], 'Select a CSS output mode.', - ' One of: nested, expanded, compact, compressed') do |style| - self.options[:output_style] = style - end - - opts.on('--relative-assets', :NONE, 'Make compass asset helpers generate relative urls to assets.') do - self.options[:relative_assets] = true - end - - opts.separator '' - opts.separator 'General Options:' - - opts.on('-r LIBRARY', '--require LIBRARY', "Require the given ruby LIBRARY before running commands.", - " This is used to access compass plugins without having a", - " project configuration file.") do |library| - ::Compass.configuration.require library - end - - opts.on('-q', '--quiet', :NONE, 'Quiet mode.') do - self.options[:quiet] = true - end - - opts.on('--dry-run', :NONE, 'Dry Run. Tells you what it plans to do.') do - self.options[:dry_run] = true - end - - opts.on('--trace', :NONE, 'Show a full stacktrace on error') do - self.options[:trace] = true - end - - opts.on('--force', :NONE, 'Force. Allows some failing commands to succeed instead.') do - self.options[:force] = true - end - - opts.on('--imports', :NONE, 'Emit an imports suitable for passing to the sass command-line.', - ' Example: sass `compass --imports`', - ' Note: Compass\'s Sass extensions will not be available.') do - print ::Compass::Frameworks::ALL.map{|f| "-I #{f.stylesheets_directory}"}.join(' ') - exit - end - - opts.on('--install-dir', :NONE, 'Emit the location where compass is installed.') do - puts ::Compass.base_directory - exit - end - - opts.on_tail("-?", "-h", "--help", "Show this message") do - puts opts - exit - end - - opts.on_tail("-v", "--version", "Print version") do - self.options[:command] = :print_version - end - - end - - def do_command(command) - command_class_name = command.to_s.split(/_/).map{|p| p.capitalize}.join('') - command_class = eval("::Compass::Commands::#{command_class_name}") - command_class.new(Dir.getwd, options).execute - end - - end - end +module Compass::Exec end -Dir.glob(File.join(File.dirname(__FILE__), 'commands', "*.rb")).each do |file| - require file +%w(helpers switch_ui sub_command_ui + global_options_parser project_options_parser + command_option_parser).each do |lib| + require "compass/exec/#{lib}" end diff --git a/lib/compass/exec/command_option_parser.rb b/lib/compass/exec/command_option_parser.rb new file mode 100644 index 00000000..0475a8a5 --- /dev/null +++ b/lib/compass/exec/command_option_parser.rb @@ -0,0 +1,23 @@ +module Compass::Exec + class CommandOptionParser + attr_accessor :options, :arguments, :opts + def initialize(arguments) + self.arguments = arguments + self.options = {} + end + def parse! + opts.parse!(arguments) + end + def opts + OptionParser.new do |opts| + self.set_options(opts) + end + end + def set_options(opts) + + end + def to_s + opts.to_s + end + end +end diff --git a/lib/compass/exec/global_options_parser.rb b/lib/compass/exec/global_options_parser.rb new file mode 100644 index 00000000..955ee8e0 --- /dev/null +++ b/lib/compass/exec/global_options_parser.rb @@ -0,0 +1,37 @@ +module Compass::Exec::GlobalOptionsParser + def set_options(opts) + super + set_global_options(opts) + end + def set_global_options(opts) + opts.on('-r LIBRARY', '--require LIBRARY', + "Require the given ruby LIBRARY before running commands.", + " This is used to access compass plugins without having a", + " project configuration file.") do |library| + ::Compass.configuration.require library + end + + opts.on('-q', '--quiet', :NONE, 'Quiet mode.') do + self.options[:quiet] = true + end + + opts.on('--trace', :NONE, 'Show a full stacktrace on error') do + self.options[:trace] = true + end + + opts.on('--force', :NONE, 'Allows some failing commands to succeed instead.') do + self.options[:force] = true + end + + opts.on('--dry-run', :NONE, 'Dry Run. Tells you what it plans to do.') do + self.options[:dry_run] = true + end + + opts.on_tail("-?", "-h", "--help", "Show this message") do + puts opts + exit + end + + end + +end diff --git a/lib/compass/exec/helpers.rb b/lib/compass/exec/helpers.rb new file mode 100644 index 00000000..b10e2311 --- /dev/null +++ b/lib/compass/exec/helpers.rb @@ -0,0 +1,28 @@ +module Compass::Exec + module Helpers + extend self + def select_appropriate_command_line_ui(arguments) + if Compass::Commands.command_exists? arguments.first + SubCommandUI + else + SwitchUI + end + end + def report_error(e, options) + $stderr.puts "#{e.class} on line #{get_line e} of #{get_file e}: #{e.message}" + if options[:trace] + e.backtrace[1..-1].each { |t| $stderr.puts " #{t}" } + else + $stderr.puts "Run with --trace to see the full backtrace" + end + end + + def get_file(exception) + exception.backtrace[0].split(/:/, 2)[0] + end + + def get_line(exception) + exception.backtrace[0].scan(/:(\d+)/)[0] + end + end +end diff --git a/lib/compass/exec/project_options_parser.rb b/lib/compass/exec/project_options_parser.rb new file mode 100644 index 00000000..6ef5471a --- /dev/null +++ b/lib/compass/exec/project_options_parser.rb @@ -0,0 +1,46 @@ +module Compass::Exec::ProjectOptionsParser + def set_options(opts) + super + set_project_options(opts) + end + def set_project_options(opts) + opts.on('-c', '--config CONFIG_FILE', 'Specify the location of the configuration file explicitly.') do |configuration_file| + self.options[:configuration_file] = configuration_file + end + + opts.on('--app APP', 'Tell compass what kind of application it is integrating with. E.g. rails') do |project_type| + self.options[:project_type] = project_type.to_sym + end + + opts.on('--sass-dir SRC_DIR', "The source directory where you keep your sass stylesheets.") do |sass_dir| + self.options[:sass_dir] = sass_dir + end + + opts.on('--css-dir CSS_DIR', "The target directory where you keep your css stylesheets.") do |css_dir| + self.options[:css_dir] = css_dir + end + + opts.on('--images-dir IMAGES_DIR', "The directory where you keep your images.") do |images_dir| + self.options[:images_dir] = images_dir + end + + opts.on('--javascripts-dir JS_DIR', "The directory where you keep your javascripts.") do |javascripts_dir| + self.options[:javascripts_dir] = javascripts_dir + end + + opts.on('-e ENV', '--environment ENV', [:development, :production], 'Use sensible defaults for your current environment.', + ' One of: development, production (default)') do |env| + self.options[:environment] = env + end + + opts.on('-s STYLE', '--output-style STYLE', [:nested, :expanded, :compact, :compressed], 'Select a CSS output mode.', + ' One of: nested, expanded, compact, compressed') do |style| + self.options[:output_style] = style + end + + opts.on('--relative-assets', :NONE, 'Make compass asset helpers generate relative urls to assets.') do + self.options[:relative_assets] = true + end + end + +end diff --git a/lib/compass/exec/sub_command_ui.rb b/lib/compass/exec/sub_command_ui.rb new file mode 100644 index 00000000..45ff9c84 --- /dev/null +++ b/lib/compass/exec/sub_command_ui.rb @@ -0,0 +1,45 @@ +require 'compass/exec/global_options_parser' +require 'compass/exec/project_options_parser' + +module Compass::Exec + class SubCommandUI + + attr_accessor :args + + def initialize(args) + self.args = args + end + + def run! + begin + perform! + rescue Exception => e + raise e if e.is_a? SystemExit + if e.is_a?(::Compass::Error) || e.is_a?(OptionParser::ParseError) + $stderr.puts e.message + else + ::Compass::Exec::Helpers.report_error(e, @options || {}) + end + return 1 + end + return 0 + end + + protected + + def perform! + $command = args.shift + command_class = Compass::Commands[$command] + @options = if command_class.respond_to?("parse_#{$command}!") + command_class.send("parse_#{$command}!", args) + else + command_class.parse!(args) + end + command_class.new(Dir.getwd, @options).execute + rescue OptionParser::ParseError => e + puts "Error: #{e.message}" + puts command_class.usage + end + + end +end diff --git a/lib/compass/exec/switch_ui.rb b/lib/compass/exec/switch_ui.rb new file mode 100644 index 00000000..384092cd --- /dev/null +++ b/lib/compass/exec/switch_ui.rb @@ -0,0 +1,166 @@ +require 'compass/exec/global_options_parser' +require 'compass/exec/project_options_parser' + +module Compass::Exec + class SwitchUI + include GlobalOptionsParser + include ProjectOptionsParser + attr_accessor :args, :options, :opts + + def initialize(args) + self.args = args + self.options = {} + parse! + end + + def run! + begin + perform! + rescue Exception => e + raise e if e.is_a? SystemExit + if e.is_a?(::Compass::Error) || e.is_a?(OptionParser::ParseError) + $stderr.puts e.message + else + ::Compass::Exec::Helpers.report_error(e, @options) + end + return 1 + end + return 0 + end + + protected + + def perform! + if options[:command] + do_command(options[:command]) + else + puts self.opts + end + end + + def parse! + self.opts = OptionParser.new(&method(:set_opts)) + self.opts.parse!(self.args) + if self.args.size > 0 + self.options[:project_name] = trim_trailing_separator(self.args.shift) + end + self.options[:command] ||= self.options[:project_name] ? :create_project : :update_project + self.options[:framework] ||= :compass + end + + def trim_trailing_separator(path) + path[-1..-1] == File::SEPARATOR ? path[0..-2] : path + end + + def set_opts(opts) + opts.banner = <+x.', + ' Defaults to 30+10x20. Height is optional.') do |dimensions| + self.options[:grid_dimensions] = dimensions || "30+10" + self.options[:command] = :generate_grid_background + end + + opts.separator '' + opts.separator 'Install/Pattern Options:' + + opts.on('-f FRAMEWORK', '--framework FRAMEWORK', 'Use the specified framework. Only one may be specified.') do |framework| + self.options[:framework] = framework + end + + opts.on('-n', '--pattern-name NAME', 'The name to use when stamping a pattern.', + ' Must be used in combination with -p.') do |name| + self.options[:pattern_name] = name + end + + opts.on('--rails', "Sets the app type to a rails project (same as --app rails).") do + self.options[:project_type] = :rails + end + + opts.on('--app APP_TYPE', 'Specify the kind of application to integrate with.') do |project_type| + self.options[:project_type] = project_type.to_sym + end + + opts.separator '' + opts.separator 'Configuration Options:' + + set_project_options(opts) + + opts.separator '' + opts.separator 'General Options:' + + set_global_options(opts) + + opts.on('--imports', :NONE, 'Emit an imports suitable for passing to the sass command-line.', + ' Example: sass `compass --imports`', + ' Note: Compass\'s Sass extensions will not be available.') do + print ::Compass::Frameworks::ALL.map{|f| "-I #{f.stylesheets_directory}"}.join(' ') + exit + end + + opts.on('--install-dir', :NONE, 'Emit the location where compass is installed.') do + puts ::Compass.base_directory + exit + end + + opts.on_tail("-v", "--version", "Print version") do + self.options[:command] = :print_version + end + + end + + def do_command(command) + command_class_name = command.to_s.split(/_/).map{|p| p.capitalize}.join('') + command_class = eval("::Compass::Commands::#{command_class_name}") + command_class.new(Dir.getwd, options).execute + end + + end +end diff --git a/lib/compass/frameworks.rb b/lib/compass/frameworks.rb index e74c4529..d856bcfe 100644 --- a/lib/compass/frameworks.rb +++ b/lib/compass/frameworks.rb @@ -1,6 +1,10 @@ module Compass module Frameworks + extend self + ALL = [] + DEFAULT_FRAMEWORKS_PATH = File.join(Compass.lib_directory, 'compass', 'frameworks') + class Framework attr_accessor :name attr_accessor :templates_directory, :stylesheets_directory @@ -11,19 +15,78 @@ module Compass @templates_directory = options[:templates_directory] || File.join(path, 'templates') @stylesheets_directory = options[:stylesheets_directory] || File.join(path, 'stylesheets') end + def template_directories + Dir.glob(File.join(templates_directory, "*")).map{|f| File.basename(f)} + end + def manifest_file(pattern) + File.join(templates_directory, pattern.to_s, "manifest.rb") + end + def manifest(pattern, options = {}) + options[:pattern_name] ||= pattern + Compass::Installers::Manifest.new(manifest_file(pattern), options) + end end + def register(name, *arguments) - ALL << Framework.new(name, *arguments) + if idx = ALL.index{|f| f.name.to_s == name.to_s} + ALL[idx] = Framework.new(name, *arguments) + else + ALL << Framework.new(name, *arguments) + end end + def [](name) ALL.detect{|f| f.name.to_s == name.to_s} end - module_function :register, :[] + + def discover(frameworks_directory) + frameworks_directory = DEFAULT_FRAMEWORKS_PATH if frameworks_directory == :defaults + frameworks_directory = Dir.new(frameworks_directory) unless frameworks_directory.is_a?(Dir) + frameworks_directory.entries.reject{|e| e[0] == ?.}.each do |framework| + register_directory File.join(frameworks_directory.path, framework) + end + end + + def register_directory(directory) + loaders = [ + File.join(directory, "compass_init.rb"), + File.join(directory, 'lib', File.basename(directory)+".rb"), + File.join(directory, File.basename(directory)+".rb") + ] + loader = loaders.detect{|l| File.exists?(l)} + if loader + require loader + else + register File.basename(directory), directory + end + end + + def template_exists?(template) + framework_name, template = template.split(%r{/}, 2) + template ||= "project" + if framework = self[framework_name] + return File.directory?(File.join(framework.templates_directory, template)) + end + false + end + + def template_usage(template) + framework_name, template = template.split(%r{/}, 2) + framework = self[framework_name] + template ||= "project" + usage_file = File.join(framework.templates_directory, template, "USAGE.markdown") + if File.exists?(usage_file) + File.read(usage_file) + elsif help = framework.manifest(template).help + help + else + <<-END.gsub(/^ {8}/, '') + No Usage! + END + end + end + end end -# Import all of the default frameworks. -default_frameworks_directory = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'frameworks')) -Dir.glob(File.join(default_frameworks_directory, "*.rb")).each do |framework| - require framework -end +Compass::Frameworks.discover(:defaults) diff --git a/frameworks/blueprint/stylesheets/_blueprint.sass b/lib/compass/frameworks/blueprint/stylesheets/_blueprint.sass similarity index 100% rename from frameworks/blueprint/stylesheets/_blueprint.sass rename to lib/compass/frameworks/blueprint/stylesheets/_blueprint.sass diff --git a/lib/compass/frameworks/blueprint/stylesheets/blueprint/_ie.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/_ie.sass new file mode 100644 index 00000000..5f732316 --- /dev/null +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/_ie.sass @@ -0,0 +1,99 @@ +// The blueprint IE mixins should be mixed into a stylesheet that gets conditionally included +// into IE like so: +// + + +// Usage examples: +// As a top-level mixin, apply to any page that includes the stylesheet: +// +blueprint-ie +// Scoped by a presentational class: +// body.blueprint +// +blueprint-ie(true) +// Scoped by semantic selectors: +// body#page-1, body#page-2, body.a-special-page-type +// +blueprint-ie(true) +// Deprecated: +// You can pass the body selector as the first argument when used as a top-level mixin +// +blueprint-ie("body#page-1, body#page-2, body.a-special-page-type") +=blueprint-ie(!body_selector = "body") + @if !body_selector == true + +blueprint-ie-body + +blueprint-ie-defaults + @else + #{!body_selector} + +blueprint-ie-body + @if !body_selector != "body" + @debug "[DEPRECATED] To specify a the selector \"#{!body_selector}\" to +blueprint-ie, pass true as the first argument and mix it into #{!body_selector}." + +blueprint-ie-defaults + @if !body_selector == "body" + +blueprint-ie-defaults + +=blueprint-ie-body + text-align: center + +blueprint-ie-hacks + +=blueprint-ie-hacks + * html & + legend + margin: 0px -8px 16px 0 + padding: 0 + html>& + p code + *white-space: normal + +// Fixes for Blueprint "inline" forms in IE +=blueprint-inline-form-ie + div, p + vertical-align: middle + label + position: relative + top: -0.25em + input + &.checkbox, &.radio, &.button, button + margin: 0.5em 0 + +=blueprint-ie-defaults + .container + text-align: left + ol + margin-left: 2em + sup + vertical-align: text-top + sub + vertical-align: text-bottom + hr + margin: -8px auto 11px + img + -ms-interpolation-mode: bicubic + fieldset + padding-top: 0 + input + &.text + margin: 0.5em 0 + background-color: #fff + border: 1px solid #bbb + &:focus + border: 1px solid #666 + &.title + margin: 0.5em 0 + background-color: #fff + border: 1px solid #bbb + &:focus + border: 1px solid #666 + &.checkbox + position: relative + top: 0.25em + &.radio + position: relative + top: 0.25em + &.button + position: relative + top: 0.25em + textarea + margin: 0.5em 0 + select + margin: 0.5em 0 + button + position: relative + top: 0.25em diff --git a/lib/compass/frameworks/blueprint/stylesheets/blueprint/_print.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/_print.sass new file mode 100644 index 00000000..566aaa95 --- /dev/null +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/_print.sass @@ -0,0 +1,90 @@ +@import modules/typography.sass +@import compass/utilities/general/float.sass + + + +// Usage examples: +// As a top-level mixin, apply to any page that includes the stylesheet: +// +blueprint-print +// Scoped by a presentational class: +// body.blueprint +// +blueprint-print(true) +// Scoped by semantic selectors: +// body#page-1, body#page-2, body.a-special-page-type +// +blueprint-print(true) +// Deprecated: +// You can pass the body selector as the first argument when used as a top-level mixin +// +blueprint-print("body#page-1, body#page-2, body.a-special-page-type") +=blueprint-print(!body_selector = "body") + @if !body_selector == true + +blueprint-print-body + +blueprint-print-defaults + @else + #{!body_selector} + +blueprint-print-body + @if !body_selector != "body" + @debug "[DEPRECATED] To specify a the selector \"#{!body_selector}\" to +blueprint-print, pass true as the first argument and mix it into #{!body_selector}." + +blueprint-print-defaults + @if !body_selector == "body" + +blueprint-print-defaults + +// This style is in blueprint, but I think it's annoying and it doesn't work in all browsers. +// Feel free to mix it into anchors where you want it. +=blueprint-show-link-urls + &:after + content: " (" attr(href) ")" + font-size: 90% + +=blueprint-print-body + line-height: 1.5 + font-family= !blueprint_font_family + color: #000 + background: none + font-size: 10pt + +=blueprint-print-defaults + .container + background: none + hr + background: #ccc + color: #ccc + width: 100% + height: 2px + margin: 2em 0 + padding: 0 + border: none + &.space + background: #fff + color: #fff + h1, h2, h3, h4, h5, h6 + font-family= !blueprint_font_family + code + font: + size: .9em + family= !blueprint_fixed_font_family + img + +float-left + margin: 1.5em 1.5em 1.5em 0 + a + img + border: none + &:link, + &:visited + background: transparent + font-weight: 700 + text-decoration: underline + p img.top + margin-top: 0 + blockquote + margin: 1.5em + padding: 1em + font-style: italic + font-size: .9em + .small + font-size: .9em + .large + font-size: 1.1em + .quiet + color: #999 + .hide + display: none diff --git a/frameworks/blueprint/stylesheets/blueprint/_reset.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/_reset.sass similarity index 100% rename from frameworks/blueprint/stylesheets/blueprint/_reset.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/_reset.sass diff --git a/lib/compass/frameworks/blueprint/stylesheets/blueprint/_screen.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/_screen.sass new file mode 100644 index 00000000..824a62af --- /dev/null +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/_screen.sass @@ -0,0 +1,29 @@ +@import modules/colors.sass +@import modules/grid.sass +@import modules/typography.sass +@import modules/utilities.sass +@import modules/form.sass +@import modules/interaction.sass +@import modules/debug.sass + +// Usage examples: +// As a top-level mixin, apply to any page that includes the stylesheet: +// +blueprint +// Scoped by a presentational class: +// body.blueprint +// +blueprint(true) +// Scoped by semantic selectors: +// body#page-1, body#page-2, body.a-special-page-type +// +blueprint(true) +// Deprecated: +// You can pass the body selector as the first argument when used as a top-level mixin +// +blueprint("body#page-1, body#page-2, body.a-special-page-type") +=blueprint(!body_selector = "body") + @if not (!body_selector == "body" or !body_selector == true) + @debug "[DEPRECATED] To specify a the selector \"#{!body_selector}\" to +blueprint, pass true as the first argument and mix it into #{!body_selector}." + +blueprint-typography(!body_selector) + +blueprint-utilities + +blueprint-grid + +blueprint-debug + +blueprint-interaction + +blueprint-form diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass similarity index 76% rename from frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass index a59338a3..11932cfd 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass @@ -1,4 +1,4 @@ -@import compass/utilities/general/inline_block.sass +@import compass/css3/inline_block.sass @import compass/utilities/general/float.sass // Button Font @@ -24,9 +24,9 @@ @param border_highlight_color The highlight color defaults to whatever is the value of the border_color but it's one shade lighter. =button-colors(!font_color = !blueprint_button_font_color, !bg_color = !blueprint_button_background_color, !border_color = !blueprint_button_border_color, !border_highlight_color = !border_color + #101010) - :background-color= !bg_color - :border-color= !border_highlight_color !border_color !border_color !border_highlight_color - :color= !font_color + background-color= !bg_color + border-color= !border_highlight_color !border_color !border_color !border_highlight_color + color= !font_color //** Sets the colors for a button in the active state @@ -46,39 +46,39 @@ =button-base(!float = false) @if !float - :display block + display: block +float(!float) @else +inline-block - :margin 0.7em 0.5em 0.7em 0 - :border-width 1px - :border-style solid - :font-family= !blueprint_button_font_family - :font-size 100% - :line-height 130% - :text-decoration none - :font-weight bold - :cursor pointer + margin: 0.7em 0.5em 0.7em 0 + border-width: 1px + border-style: solid + font-family= !blueprint_button_font_family + font-size: 100% + line-height: 130% + text-decoration: none + font-weight: bold + cursor: pointer img - :margin 0 3px -3px 0 !important - :padding 0 - :border none - :width 16px - :height 16px - :float none + margin: 0 3px -3px 0 !important + padding: 0 + border: none + width: 16px + height: 16px + float: none =anchor-button(!float = false) +button-base(!float) - :padding 5px 10px 5px 7px + padding: 5px 10px 5px 7px =button-button(!float = false) +button-base(!float) - :width auto - :overflow visible - :padding 4px 10px 3px 7px + width: auto + overflow: visible + padding: 4px 10px 3px 7px &[type] - :padding 4px 10px 4px 7px - :line-height 17px + padding: 4px 10px 4px 7px + line-height: 17px *:first-child+html &[type] - :padding 4px 10px 3px 7px + padding: 4px 10px 3px 7px diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass similarity index 100% rename from frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass similarity index 86% rename from frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass index 8a4b5bc8..4b93f23f 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass @@ -1,9 +1,9 @@ =showgrid(!image = "grid.png") - :background= image_url(!image) + background= image_url(!image) =blueprint-debug(!grid_image = "grid.png") // Use this class on any column or container to see the grid. // TODO: prefix this with the project path. .showgrid +showgrid(!grid_image) - \ No newline at end of file + diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass similarity index 80% rename from frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass index 77ae86d1..71d8d6f0 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass @@ -18,11 +18,11 @@ // Indentation instead of line shifts for sibling paragraphs. Mixin to a style like p + p =sibling-indentation - :text-indent 2em - :margin-top -1.5em + text-indent: 2em + margin-top: -1.5em /* Don't want this in forms. form & - :text-indent 0 + text-indent: 0 // For great looking type, use this code instead of asdf: @@ -30,10 +30,10 @@ Best used on prepositions and ampersands. =alt - :color #666 - :font-family "Warnock Pro", "Goudy Old Style","Palatino","Book Antiqua", Georgia, serif - :font-style italic - :font-weight normal + color: #666 + font-family: "Warnock Pro", "Goudy Old Style","Palatino","Book Antiqua", Georgia, serif + font-style: italic + font-weight: normal // For great looking quote marks in titles, replace "asdf" with: @@ -41,7 +41,7 @@ (That is, when the title starts with a quote mark). (You may have to change this value depending on your font size). =dquo(!offset = 0.5em) - :margin-left -!offset + margin-left: -!offset // Reduced size type with incremental leading @@ -58,21 +58,21 @@ base_font_size - The base font size in pixels. Defaults to 12px old_line_height - The old line height. Defaults to 1.5 times the base_font_size =incr(!font_size = 10px, !base_font_size = !blueprint_font_size, !old_line_height = !base_font_size * 1.5) - :font-size= 1em * !font_size / !base_font_size - :line-height= 1em * !old_line_height / !font_size * 4 / 5 - :margin-bottom 1.5em + font-size= 1em * !font_size / !base_font_size + line-height= 1em * !old_line_height / !font_size * 4 / 5 + margin-bottom: 1.5em // Surround uppercase words and abbreviations with this class. Based on work by Jørgen Arnor Gårdsø Lom [http://twistedintellect.com/] =caps - :font-variant small-caps - :letter-spacing 1px - :text-transform lowercase - :font-size 1.2em - :line-height 1% - :font-weight bold - :padding 0 2px + font-variant: small-caps + letter-spacing: 1px + text-transform: lowercase + font-size: 1.2em + line-height: 1% + font-weight: bold + padding: 0 2px =fancy-paragraphs p + p diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass similarity index 56% rename from frameworks/blueprint/stylesheets/blueprint/modules/_form.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass index 1862c44a..1ff6c040 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass @@ -2,9 +2,9 @@ // Mixin for producing Blueprint "inline" forms. Should be used with the blueprint-form mixin. =blueprint-inline-form - :line-height 3 + line-height: 3 p - :margin-bottom 0 + margin-bottom: 0 =blueprint-form +blueprint-form-layout @@ -13,43 +13,43 @@ =blueprint-form-layout label - :font-weight bold + font-weight: bold fieldset - :padding 1.4em - :margin 0 0 1.5em 0 + padding: 1.4em + margin: 0 0 1.5em 0 legend - :font-weight bold - :font-size 1.2em + font-weight: bold + font-size: 1.2em input &.text, &.title, &[type=text] - :margin 0.5em 0 - :background-color #fff - :padding 5px + margin: 0.5em 0 + background-color: #fff + padding: 5px &.title - :font-size 1.5em + font-size: 1.5em &[type=checkbox], &.checkbox, &[type=radio], &.radio - :position relative - :top 0.25em + position: relative + top: 0.25em textarea - :margin 0.5em 0 - :padding 5px + margin: 0.5em 0 + padding: 5px select - :margin 0.5em 0 + margin: 0.5em 0 =blueprint-form-sizes(!input_width = 300px, !textarea_width = 390px, !textarea_height = 250px) input.text, input.title - :width= !input_width + width= !input_width textarea - :width= !textarea_width - :height= !textarea_height + width= !textarea_width + height= !textarea_height =blueprint-form-borders(!unfocused_border_color = #bbb, !focus_border_color = #666, !fieldset_border_color = #ccc) fieldset - :border= 1px "solid" !fieldset_border_color + border= 1px "solid" !fieldset_border_color input.text, input.title, textarea, select - :border= 1px "solid" !unfocused_border_color + border= 1px "solid" !unfocused_border_color &:focus - :border= 1px "solid" !focus_border_color \ No newline at end of file + border= 1px "solid" !focus_border_color diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass similarity index 77% rename from frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass index c9ca5bec..3edd3897 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass @@ -41,7 +41,7 @@ +span(!n) .span-#{!blueprint_grid_columns}, div.span-#{!blueprint_grid_columns} +span(!blueprint_grid_columns) - :margin 0 + margin: 0 input, textarea, select @for !n from 1 through !blueprint_grid_columns &.span-#{!n} @@ -76,30 +76,30 @@ // Note: If you use this mixin without the class and want to support ie6 // you must set text-align left on your container element in an IE stylesheet. =container - :width = !blueprint_container_size - :margin 0 auto + width= !blueprint_container_size + margin: 0 auto +clearfix // The last column in a row needs this mixin or it will end up on the next row. // TODO add this to span mixin when we have optional arguments =last - :margin-right 0 + margin-right: 0 =span(!n, !override = false) !width = !blueprint_grid_width * !n + (!blueprint_grid_margin * (!n - 1)) @if !override - :width = !width !important + width= !width !important @else - :width = !width + width= !width =column-base(!last = false) +float-left @if !last +last @else - :margin-right = !blueprint_grid_margin + margin-right= !blueprint_grid_margin * html & - :overflow-x hidden + overflow-x: hidden // Use this mixins to set the width of n columns. =column(!n, !last = false) @@ -109,27 +109,27 @@ // Mixin to a column to append n empty cols. =append(!n) - :padding-right = (!blueprint_grid_outer_width) * !n + padding-right= (!blueprint_grid_outer_width) * !n // Mixin to a column to prepend n empty cols. =prepend(!n) - :padding-left = (!blueprint_grid_outer_width) * !n + padding-left= (!blueprint_grid_outer_width) * !n =append-bottom(!amount = 1.5em) - :margin-bottom= !amount + margin-bottom= !amount =prepend-top(!amount = 1.5em) - :margin-top= !amount + margin-top= !amount =pull-base +float-left - :position relative + position: relative =pull-margins(!n, !last = false) @if !last - :margin-left = (-!blueprint_grid_outer_width * !n) + !blueprint_grid_margin + margin-left= (-!blueprint_grid_outer_width * !n) + !blueprint_grid_margin @else - :margin-left = -!blueprint_grid_outer_width * !n + margin-left= -!blueprint_grid_outer_width * !n // mixin to a column to move it n columns to the left =pull(!n, !last = false) @@ -138,10 +138,10 @@ =push-base +float-right - :position relative + position: relative =push-margins(!n) - :margin= 0 (-!blueprint_grid_outer_width * !n) 1.5em (!blueprint_grid_outer_width * !n) + margin= 0 (-!blueprint_grid_outer_width * !n) 1.5em (!blueprint_grid_outer_width * !n) // mixin to a column to push it n columns to the right =push(!n) @@ -150,29 +150,29 @@ // Border on right hand side of a column. =border(!border_color = #eee, !border_width = 1px) - :padding-right = !blueprint_grid_margin / 2 - !border_width - :margin-right = !blueprint_grid_margin / 2 - :border-right #{!border_width} solid #{!border_color} + padding-right= !blueprint_grid_margin / 2 - !border_width + margin-right= !blueprint_grid_margin / 2 + border-right: #{!border_width} solid #{!border_color} // Border with more whitespace, spans one column. =colborder(!border_color = #eee, !border_width = 1px) - :padding-right= floor((!blueprint_grid_width + 2 * !blueprint_grid_margin - !border_width)/2) - :margin-right= ceil((!blueprint_grid_width + 2 * !blueprint_grid_margin - !border_width)/2) - :border-right #{!border_width} solid #{!border_color} + padding-right= floor((!blueprint_grid_width + 2 * !blueprint_grid_margin - !border_width)/2) + margin-right= ceil((!blueprint_grid_width + 2 * !blueprint_grid_margin - !border_width)/2) + border-right: #{!border_width} solid #{!border_color} // Mixin this to an hr to make a horizontal ruler across a column. =colruler(!border_color = #ddd) - :background= !border_color - :color= !border_color - :clear both - :float none - :width 100% - :height .1em - :margin 0 0 1.45em - :border none + background= !border_color + color= !border_color + clear: both + float: none + width: 100% + height: .1em + margin: 0 0 1.45em + border: none // Mixin this to an hr to make a horizontal spacer across a column. =colspacer +colruler - :background #fff - :color #fff + background: #fff + color: #fff diff --git a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass new file mode 100644 index 00000000..ff5e4054 --- /dev/null +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass @@ -0,0 +1,58 @@ +@import colors.sass + + +=blueprint-interaction + .error + +error + .notice + +notice + .success + +success + .hide + display: none + .highlight + +highlight + .added + +added + .removed + +removed + +=feedback-base + padding: .8em + margin-bottom: 1em + border= 2px "solid" !feedback_border_color + +=error + +feedback-base + background= !error_bg_color + color= !error_color + border-color= !error_border_color + a + color= !error_color + +=notice + +feedback-base + background= !notice_bg_color + color= !notice_color + border-color= !notice_border_color + a + color= !notice_color + +=success + +feedback-base + background= !success_bg_color + color= !success_color + border-color= !success_border_color + a + color= !success_color + +=highlight + background= !highlight_color + +=added + background= !added_bg_color + color= !added_color + +=removed + background= !removed_bg_color + color= !removed_color diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass similarity index 72% rename from frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass index dd50ebf7..58933fed 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass @@ -1,18 +1,18 @@ =no-link-icon - :background transparent none !important - :padding 0 !important - :margin 0 !important + background: transparent none !important + padding: 0 !important + margin: 0 !important =link-icon-base - :padding 2px 22px 2px 0 - :margin -2px 0 - :background-repeat no-repeat - :background-position right center + padding: 2px 22px 2px 0 + margin: -2px 0 + background-repeat: no-repeat + background-position: right center =link-icon(!name, !include_base = true) @if !include_base +link-icon-base - :background-image= image_url("link_icons/#{!name}") + background-image= image_url("link_icons/#{!name}") =link-icons a[href^="http:"], @@ -41,4 +41,4 @@ a[href$=".rdf"] +link-icon("feed.png", false) a[href^="aim:"] - +link-icon("im.png", false) \ No newline at end of file + +link-icon("im.png", false) diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass similarity index 80% rename from frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass index 87043942..d21962a1 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass @@ -76,66 +76,66 @@ +push(!n) =container - :min-width= !blueprint_liquid_container_min_width - :width = !blueprint_liquid_container_width - :margin 0 auto + min-width= !blueprint_liquid_container_min_width + width= !blueprint_liquid_container_width + margin: 0 auto +clearfix =span(!n, !override = false) !width = (!blueprint_liquid_grid_width * !n) - ((!blueprint_liquid_grid_width * !n) % 1) @if !override - :width = !width !important + width= !width !important @else - :width = !width + width= !width =last - :margin-right 0 + margin-right: 0 =column(!n, !last = false) +float-left - :overflow hidden + overflow: hidden +span(!n) @if !last +last @else - :margin-right = !blueprint_liquid_grid_margin + margin-right= !blueprint_liquid_grid_margin =append(!n) - :padding-right= (!blueprint_liquid_grid_width * !n) - ((!blueprint_liquid_grid_width * !n) % 1) + padding-right= (!blueprint_liquid_grid_width * !n) - ((!blueprint_liquid_grid_width * !n) % 1) =prepend(!n) - :padding-left= (!blueprint_liquid_grid_width * !n) - ((!blueprint_liquid_grid_width * !n) % 1) + padding-left= (!blueprint_liquid_grid_width * !n) - ((!blueprint_liquid_grid_width * !n) % 1) =pull(!n, !last = false) - :margin-left= (!blueprint_liquid_grid_push_pull * !n) + margin-left= (!blueprint_liquid_grid_push_pull * !n) =push(!n) +float-right - :margin - :top 0 - :left 1.5em - :right= (!blueprint_liquid_grid_push_pull * !n) - :bottom 0 + margin: + top: 0 + left: 1.5em + right= (!blueprint_liquid_grid_push_pull * !n) + bottom: 0 =border - :border-right 1px solid #eee + border-right: 1px solid #eee =colborder - :padding-right 2% - :margin-right 2% + padding-right: 2% + margin-right: 2% +border =colruler - :background #ddd - :color #ddd - :clear both - :width 100% - :height 0.083em - :margin 0 0 1.583em - :border none + background: #ddd + color: #ddd + clear: both + width: 100% + height: 0.083em + margin: 0 0 1.583em + border: none =colspacer +colruler - :background #fff - :color #fff + background: #fff + color: #fff diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass similarity index 75% rename from frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass index fff5f3f5..2045a794 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass @@ -20,37 +20,37 @@ table +blueprint-reset-table a img - :border none + border: none =blueprint-reset-box-model - :margin 0 - :padding 0 - :border 0 + margin: 0 + padding: 0 + border: 0 =blueprint-reset +blueprint-reset-box-model - :font - :weight inherit - :style inherit - :size 100% - :family inherit - :vertical-align baseline + font: + weight: inherit + style: inherit + size: 100% + family: inherit + vertical-align: baseline =blueprint-reset-quotation +blueprint-reset - :quotes "" "" + quotes: "" "" &:before, &:after - :content "" + content: "" =blueprint-reset-table-cell +blueprint-reset - :text-align left - :font-weight normal - :vertical-align middle + text-align: left + font-weight: normal + vertical-align: middle =blueprint-reset-table +blueprint-reset - :border-collapse separate - :border-spacing 0 - :vertical-align middle + border-collapse: separate + border-spacing: 0 + vertical-align: middle diff --git a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass new file mode 100644 index 00000000..616b92f0 --- /dev/null +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass @@ -0,0 +1,122 @@ +@import grid.sass +@import compass/utilities/general/float.sass + +// Main layout grid, override these constants to build your grid and container sizes. +!blueprint_grid_columns ||= 24 +!blueprint_grid_width ||= 30px +!blueprint_grid_margin ||= 10px + +!blueprint_grid_outer_width = !blueprint_grid_width + !blueprint_grid_margin +!blueprint_container_size = !blueprint_grid_outer_width * !blueprint_grid_columns - !blueprint_grid_margin + +// Columns +// Note: If you use this mixin without the class and want to support ie6 +// you must set text-align left on your container element in an IE stylesheet. +=container + width= !blueprint_container_size + margin: 0 auto + direction: rtl + +clearfix + +// The last column in a row needs this mixin or it will end up on the next row. +// TODO add this to span mixin when we have optional arguments +=last + margin-left: 0 + +=column-base(!last = false) + +float-right + @if !last + +last + @else + margin-left= !blueprint_grid_margin + * html & + overflow-x: hidden + +// Mixin to a column to append n empty cols. +=append(!n) + padding-left= (!blueprint_grid_outer_width) * !n + +// Mixin to a column to prepend n empty cols. +=prepend(!n) + padding-right= (!blueprint_grid_outer_width) * !n + +// mixin to a column to move it n columns to the left +=pull(!n, !last = false) + position: relative + @if !last + margin-right= (-!blueprint_grid_outer_width * !n) + !blueprint_grid_margin + @else + margin-right= -!blueprint_grid_outer_width * !n + +// mixin to a column to push it n columns to the right +=push(!n) + +float-right + position: relative + margin: + top: 0 + left= -!blueprint_grid_outer_width * !n + bottom: 1.5em + right= !blueprint_grid_outer_width * !n + +// Border on left hand side of a column. +=border + padding-left= !blueprint_grid_margin / 2 - 1 + margin-left= !blueprint_grid_margin / 2 + border-left: 1px solid #eee + +// Border with more whitespace, spans one column. +=colborder + padding-left= (!blueprint_grid_width - 2 * !blueprint_grid_margin - 1)/2 + margin-left= (!blueprint_grid_width - 2 * !blueprint_grid_margin)/2 + border-left: 1px solid #eee + +// Usage examples: +// As a top-level mixin, apply to any page that includes the stylesheet: +// +rtl-typography +// Scoped by a presentational class: +// body.blueprint +// +rtl-typography(true) +// Scoped by semantic selectors: +// body#page-1, body#page-2, body.a-special-page-type +// +rtl-typography(true) +// Deprecated: +// You can pass the body selector as the first argument when used as a top-level mixin +// +rtl-typography("body#page-1, body#page-2, body.a-special-page-type") +=rtl-typography(!body_selector = "body") + @if !body_selector == true + html & + font-family: Arial, sans-serif + +rtl-typography-defaults + @else + html #{!body_selector} + font-family: Arial, sans-serif + @if !body_selector != "body" + @debug "[DEPRECATED] To specify a the selector \"#{!body_selector}\" to +rtl-typography, pass true as the first argument and mix it into #{!body_selector}." + +rtl-typography-defaults + @if !body_selector == "body" + body + +rtl-typography-defaults + +=rtl-typography-defaults + h1, h2, h3, h4, h5, h6 + font-family: Arial, sans-serif + + pre, code, tt + font-family: monospace + + p + img.right + +float-left + margin: 1.5em 1.5em 1.5em 0 + padding: 0 + img.left + +float-right + margin: 1.5em 0 1.5em 1.5em + padding: 0 + + dd, ul, ol + margin-left: 0 + margin-right: 1.5em + + td, th + text-align: right diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass similarity index 95% rename from frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass index a61c8ee8..fc597951 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass @@ -24,13 +24,13 @@ // The styles this mixin provides were deprecated in Blueprint 0.9 and is no longer part of the // main scaffolding, but the mixin is still available if you want to use it. =blueprint-scaffolding-body - :margin 1.5em 0 + margin: 1.5em 0 // Mixin +box to create a padded box inside a column. =box - :padding 1.5em - :margin-bottom 1.5em - :background #E5ECF9 + padding: 1.5em + margin-bottom: 1.5em + background: #E5ECF9 =blueprint-scaffolding-defaults .box diff --git a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass new file mode 100644 index 00000000..6f230bfb --- /dev/null +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass @@ -0,0 +1,160 @@ +@import colors.sass +@import compass/utilities/links/link_colors.sass +@import compass/utilities/general/float.sass + +!blueprint_font_family ||= "Helvetica Neue, Arial, Helvetica, sans-serif" +!blueprint_fixed_font_family ||= "'andale mono', 'lucida console', monospace" +!blueprint_font_size ||= 12px + +// Usage examples: +// As a top-level mixin, apply to any page that includes the stylesheet: +// +blueprint-typography +// Scoped by a presentational class: +// body.blueprint +// +blueprint-typography(true) +// Scoped by semantic selectors: +// body#page-1, body#page-2, body.a-special-page-type +// +blueprint-typography(true) +// Deprecated: +// You can pass the body selector as the first argument when used as a top-level mixin +// +blueprint-typography("body#page-1, body#page-2, body.a-special-page-type") +=blueprint-typography(!body_selector = "body") + @if !body_selector == true + +blueprint-typography-body + +blueprint-typography-defaults + @else + #{!body_selector} + +blueprint-typography-body + @if !body_selector != "body" + @debug "[DEPRECATED] To specify a the selector \"#{!body_selector}\" to +blueprint-typography, pass true as the first argument and mix it into #{!body_selector}." + +blueprint-typography-defaults + @if !body_selector == "body" + +blueprint-typography-defaults + +=normal-text + font-family= !blueprint_font_family + color= !font_color + +=fixed-width-text + font= 1em !blueprint_fixed_font_family + line-height: 1.5 + +=header-text + font-weight: normal + color= !header_color + +=quiet + color= !quiet_color + +=loud + color= !loud_color + +=blueprint-typography-body(!font_size = !blueprint_font_size) + line-height: 1.5 + +normal-text + font-size= 100% * !font_size / 16px + +=blueprint-typography-defaults + h1 + +header-text + font-size: 3em + line-height: 1 + margin-bottom: 0.5em + img + margin: 0 + h2 + +header-text + font-size: 2em + margin-bottom: 0.75em + h3 + +header-text + font-size: 1.5em + line-height: 1 + margin-bottom: 1em + h4 + +header-text + font-size: 1.2em + line-height: 1.25 + margin-bottom: 1.25em + h5 + +header-text + font-size: 1em + font-weight: bold + margin-bottom: 1.5em + h6 + +header-text + font-size: 1em + font-weight: bold + h2 img, h3 img, h4 img, h5 img, h6 img + margin: 0 + p + margin: 0 0 1.5em + img.left + +float-left + margin: 1.5em 1.5em 1.5em 0 + padding: 0 + img.right + +float-right + margin: 1.5em 0 1.5em 1.5em + padding: 0 + a + text-decoration: underline + +link-colors(!link_color, !link_hover_color, !link_active_color, !link_visited_color, !link_focus_color) + blockquote + margin: 1.5em + color: #666 + font-style: italic + strong + font-weight: bold + em + font-style: italic + dfn + font-style: italic + font-weight: bold + sup, sub + line-height: 0 + abbr, acronym + border-bottom: 1px dotted #666 + address + margin: 0 0 1.5em + font-style: italic + del + color: #666 + pre + margin: 1.5em 0 + white-space: pre + pre, code, tt + +fixed-width-text + li ul, li ol + margin: 0 1.5em + ul + margin: 0 1.5em 1.5em 1.5em + list-style-type: disc + ol + margin: 0 1.5em 1.5em 1.5em + list-style-type: decimal + dl + margin: 0 0 1.5em 0 + dt + font-weight: bold + dd + margin-left: 1.5em + table + margin-bottom: 1.4em + width: 100% + th + font-weight: bold + thead th + background= !blueprint_table_header_color + th, td, caption + padding: 4px 10px 4px 5px + tr.even td + background= !blueprint_table_stripe_color + tfoot + font-style: italic + caption + background: #eee + .quiet + +quiet + .loud + +loud diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass similarity index 65% rename from frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass index b46b9b50..e7812d2d 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass @@ -7,7 +7,7 @@ =blueprint-utilities // Regular clearing apply to column that should drop below previous ones. .clear - :clear both + clear: both // turn off text wrapping for the element. .nowrap +nowrap @@ -16,22 +16,22 @@ .clearfix +clearfix .small - :font-size .8em - :margin-bottom 1.875em - :line-height 1.875em + font-size: .8em + margin-bottom: 1.875em + line-height: 1.875em .large - :font-size 1.2em - :line-height 2.5em - :margin-bottom 1.25em + font-size: 1.2em + line-height: 2.5em + margin-bottom: 1.25em .first - :margin-left 0 - :padding-left 0 + margin-left: 0 + padding-left: 0 .last - :margin-right 0 - :padding-right 0 + margin-right: 0 + padding-right: 0 .top - :margin-top 0 - :padding-top 0 + margin-top: 0 + padding-top: 0 .bottom - :margin-bottom 0 - :padding-bottom 0 + margin-bottom: 0 + padding-bottom: 0 diff --git a/frameworks/blueprint/templates/buttons/buttons.sass b/lib/compass/frameworks/blueprint/templates/buttons/buttons.sass similarity index 97% rename from frameworks/blueprint/templates/buttons/buttons.sass rename to lib/compass/frameworks/blueprint/templates/buttons/buttons.sass index e8ca96e6..3e616150 100644 --- a/frameworks/blueprint/templates/buttons/buttons.sass +++ b/lib/compass/frameworks/blueprint/templates/buttons/buttons.sass @@ -38,12 +38,12 @@ button // We can change the colors for buttons of certain classes, etc. a.positive, button.positive - :color #529214 + color: #529214 +button-hover-colors(#529214, #E6EFC2, #C6D880) +button-active-colors(#FFF, #529214, #529214) a.negative, button.negative - :color #D12F19 + color: #D12F19 +button-hover-colors(#D12F19, #FBE3E4, #FBC2C4) +button-active-colors(#FFF, #D12F19, #D12F19) diff --git a/frameworks/blueprint/templates/buttons/buttons/cross.png b/lib/compass/frameworks/blueprint/templates/buttons/buttons/cross.png similarity index 100% rename from frameworks/blueprint/templates/buttons/buttons/cross.png rename to lib/compass/frameworks/blueprint/templates/buttons/buttons/cross.png diff --git a/frameworks/blueprint/templates/buttons/buttons/key.png b/lib/compass/frameworks/blueprint/templates/buttons/buttons/key.png similarity index 100% rename from frameworks/blueprint/templates/buttons/buttons/key.png rename to lib/compass/frameworks/blueprint/templates/buttons/buttons/key.png diff --git a/frameworks/blueprint/templates/buttons/buttons/tick.png b/lib/compass/frameworks/blueprint/templates/buttons/buttons/tick.png similarity index 100% rename from frameworks/blueprint/templates/buttons/buttons/tick.png rename to lib/compass/frameworks/blueprint/templates/buttons/buttons/tick.png diff --git a/lib/compass/frameworks/blueprint/templates/buttons/manifest.rb b/lib/compass/frameworks/blueprint/templates/buttons/manifest.rb new file mode 100644 index 00000000..e9821ca2 --- /dev/null +++ b/lib/compass/frameworks/blueprint/templates/buttons/manifest.rb @@ -0,0 +1,17 @@ +description "Button Plugin" +stylesheet 'buttons.sass', :media => 'screen, projection' + +image 'buttons/cross.png' +image 'buttons/key.png' +image 'buttons/tick.png' + +help %Q{ +To install the button plugin: + compass init --using blueprint/buttons + +The buttons.sass file is just a recommendation to show you how to use the button mixins. +} + +welcome_message %Q{ +The buttons.sass file is just a recommendation to show you how to use the button mixins. +} diff --git a/frameworks/blueprint/templates/link_icons/link_icons.sass b/lib/compass/frameworks/blueprint/templates/link_icons/link_icons.sass similarity index 100% rename from frameworks/blueprint/templates/link_icons/link_icons.sass rename to lib/compass/frameworks/blueprint/templates/link_icons/link_icons.sass diff --git a/frameworks/blueprint/templates/link_icons/link_icons/doc.png b/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/doc.png similarity index 100% rename from frameworks/blueprint/templates/link_icons/link_icons/doc.png rename to lib/compass/frameworks/blueprint/templates/link_icons/link_icons/doc.png diff --git a/frameworks/blueprint/templates/link_icons/link_icons/email.png b/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/email.png similarity index 100% rename from frameworks/blueprint/templates/link_icons/link_icons/email.png rename to lib/compass/frameworks/blueprint/templates/link_icons/link_icons/email.png diff --git a/frameworks/blueprint/templates/link_icons/link_icons/external.png b/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/external.png similarity index 100% rename from frameworks/blueprint/templates/link_icons/link_icons/external.png rename to lib/compass/frameworks/blueprint/templates/link_icons/link_icons/external.png diff --git a/frameworks/blueprint/templates/link_icons/link_icons/feed.png b/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/feed.png similarity index 100% rename from frameworks/blueprint/templates/link_icons/link_icons/feed.png rename to lib/compass/frameworks/blueprint/templates/link_icons/link_icons/feed.png diff --git a/frameworks/blueprint/templates/link_icons/link_icons/im.png b/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/im.png similarity index 100% rename from frameworks/blueprint/templates/link_icons/link_icons/im.png rename to lib/compass/frameworks/blueprint/templates/link_icons/link_icons/im.png diff --git a/frameworks/blueprint/templates/link_icons/link_icons/pdf.png b/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/pdf.png similarity index 100% rename from frameworks/blueprint/templates/link_icons/link_icons/pdf.png rename to lib/compass/frameworks/blueprint/templates/link_icons/link_icons/pdf.png diff --git a/frameworks/blueprint/templates/link_icons/link_icons/visited.png b/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/visited.png similarity index 100% rename from frameworks/blueprint/templates/link_icons/link_icons/visited.png rename to lib/compass/frameworks/blueprint/templates/link_icons/link_icons/visited.png diff --git a/frameworks/blueprint/templates/link_icons/link_icons/xls.png b/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/xls.png similarity index 100% rename from frameworks/blueprint/templates/link_icons/link_icons/xls.png rename to lib/compass/frameworks/blueprint/templates/link_icons/link_icons/xls.png diff --git a/lib/compass/frameworks/blueprint/templates/link_icons/manifest.rb b/lib/compass/frameworks/blueprint/templates/link_icons/manifest.rb new file mode 100644 index 00000000..9d0dc09a --- /dev/null +++ b/lib/compass/frameworks/blueprint/templates/link_icons/manifest.rb @@ -0,0 +1,23 @@ +description "Icons for common types of links" + +stylesheet "link_icons.sass", :media => 'screen, projection' + +image 'link_icons/doc.png' +image 'link_icons/email.png' +image 'link_icons/external.png' +image 'link_icons/feed.png' +image 'link_icons/im.png' +image 'link_icons/pdf.png' +image 'link_icons/visited.png' +image 'link_icons/xls.png' + +help %Q{ +To install the link_icons plugin: + compass init --using blueprint/link_icons + +The link_icons.sass file is just a recommendation to show you how to use the link mixins. +} + +welcome_message %Q{ +The link_icons.sass file is just a recommendation to show you how to use the link mixins. +} diff --git a/frameworks/blueprint/templates/project/grid.png b/lib/compass/frameworks/blueprint/templates/project/grid.png similarity index 100% rename from frameworks/blueprint/templates/project/grid.png rename to lib/compass/frameworks/blueprint/templates/project/grid.png diff --git a/lib/compass/frameworks/blueprint/templates/project/ie.sass b/lib/compass/frameworks/blueprint/templates/project/ie.sass new file mode 100644 index 00000000..31aad76a --- /dev/null +++ b/lib/compass/frameworks/blueprint/templates/project/ie.sass @@ -0,0 +1,16 @@ +@import blueprint.sass + +// To generate css equivalent to the blueprint css but with your configuration applied, uncomment: +// +blueprint-ie + +//Recommended Blueprint configuration with scoping and semantic layout: +body.bp + +blueprint-ie(true) + // Note: Blueprint centers text to fix IE6 container centering. + // This means all your texts will be centered under all version of IE by default. + // If your container does not have the .container class, don't forget to restore + // the correct behavior to your main container (but not the body tag!) + // Example: + // .my-container + // text-align: left + diff --git a/lib/compass/frameworks/blueprint/templates/project/manifest.rb b/lib/compass/frameworks/blueprint/templates/project/manifest.rb new file mode 100644 index 00000000..e637d521 --- /dev/null +++ b/lib/compass/frameworks/blueprint/templates/project/manifest.rb @@ -0,0 +1,32 @@ +description "The blueprint framework." + +stylesheet 'screen.sass', :media => 'screen, projection' +stylesheet 'partials/_base.sass' +stylesheet 'print.sass', :media => 'print' +stylesheet 'ie.sass', :media => 'screen, projection', :condition => "lt IE 8" + +image 'grid.png' + +html 'welcome.html.haml', :erb => true + +help %Q{ +Please see the blueprint website for documentation on how blueprint works: + + http://blueprintcss.org/ + +Docs on the compass port of blueprint can be found on the wiki: + + http://wiki.github.com/chriseppstein/compass/blueprint-documentation +} + +welcome_message %Q{ +Please see the blueprint website for documentation on how blueprint works: + + http://blueprintcss.org/ + +Docs on the compass port of blueprint can be found on the wiki: + + http://wiki.github.com/chriseppstein/compass/blueprint-documentation + +To get started, edit the screen.sass file and read the comments and code there. +} diff --git a/frameworks/blueprint/templates/project/partials/_base.sass b/lib/compass/frameworks/blueprint/templates/project/partials/_base.sass similarity index 100% rename from frameworks/blueprint/templates/project/partials/_base.sass rename to lib/compass/frameworks/blueprint/templates/project/partials/_base.sass diff --git a/lib/compass/frameworks/blueprint/templates/project/print.sass b/lib/compass/frameworks/blueprint/templates/project/print.sass new file mode 100644 index 00000000..e3727d9e --- /dev/null +++ b/lib/compass/frameworks/blueprint/templates/project/print.sass @@ -0,0 +1,8 @@ +@import blueprint.sass + +// To generate css equivalent to the blueprint css but with your configuration applied, uncomment: +// +blueprint-print + +//Recommended Blueprint configuration with scoping and semantic layout: +body.bp + +blueprint-print(true) \ No newline at end of file diff --git a/frameworks/blueprint/templates/project/screen.sass b/lib/compass/frameworks/blueprint/templates/project/screen.sass similarity index 90% rename from frameworks/blueprint/templates/project/screen.sass rename to lib/compass/frameworks/blueprint/templates/project/screen.sass index e3588dcd..87b36a52 100644 --- a/frameworks/blueprint/templates/project/screen.sass +++ b/lib/compass/frameworks/blueprint/templates/project/screen.sass @@ -11,9 +11,9 @@ // +blueprint //Recommended Blueprint configuration with scoping and semantic layout: -+blueprint-typography("body.bp") +blueprint-scaffolding("body.bp") body.bp + +blueprint-typography(true) +blueprint-utilities +blueprint-debug +blueprint-interaction @@ -38,3 +38,10 @@ body.three-col !content_columns = ceil(2 * !blueprint_grid_columns / 3) // true means it's the last column in the row +column(!content_columns, true) + +// This is just here to style the welcome page, please delete it. +body#welcome + #container + +container + h1 + +column(24) \ No newline at end of file diff --git a/lib/compass/frameworks/blueprint/templates/project/welcome.html.haml b/lib/compass/frameworks/blueprint/templates/project/welcome.html.haml new file mode 100644 index 00000000..032fb3f3 --- /dev/null +++ b/lib/compass/frameworks/blueprint/templates/project/welcome.html.haml @@ -0,0 +1,18 @@ +!!! Transition +/ Feel free to delete this, it's just here to act as an example +%html(xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en") + %head + %title Welcome to Compass & Blueprint + %link(rel="stylesheet" href="<%= http_stylesheets_path %>/screen.css" type="text/css" media="screen, projection") + %link(href="<%= http_stylesheets_path %>/print.css" media="print" rel="stylesheet" type="text/css") + /[if lt IE 8] + %link(href="<%= http_stylesheets_path %>/ie.css" media="screen, projection" rel="stylesheet" type="text/css") + %style(type="text/css") + :sass + @import blueprint.sass + .foo + +column(8) + %body#welcome.bp + #container + %h1 Welcome to Compass! + %p This is <%= "ERB" %> diff --git a/lib/compass/frameworks/compass/stylesheets/_compass.sass b/lib/compass/frameworks/compass/stylesheets/_compass.sass new file mode 100644 index 00000000..bbb7de73 --- /dev/null +++ b/lib/compass/frameworks/compass/stylesheets/_compass.sass @@ -0,0 +1,2 @@ +@import compass/utilities.sass +@import compass/css3.sass diff --git a/lib/compass/frameworks/compass/stylesheets/compass/_css3.sass b/lib/compass/frameworks/compass/stylesheets/compass/_css3.sass new file mode 100644 index 00000000..9e39e053 --- /dev/null +++ b/lib/compass/frameworks/compass/stylesheets/compass/_css3.sass @@ -0,0 +1,6 @@ +@import css3/border_radius.sass +@import css3/inline_block.sass +@import css3/opacity.sass +@import css3/box_shadow.sass +@import css3/columns.sass +@import css3/box_sizing.sass diff --git a/frameworks/compass/stylesheets/compass/_layout.sass b/lib/compass/frameworks/compass/stylesheets/compass/_layout.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/_layout.sass rename to lib/compass/frameworks/compass/stylesheets/compass/_layout.sass diff --git a/frameworks/compass/stylesheets/compass/_misc.sass b/lib/compass/frameworks/compass/stylesheets/compass/_misc.sass similarity index 56% rename from frameworks/compass/stylesheets/compass/_misc.sass rename to lib/compass/frameworks/compass/stylesheets/compass/_misc.sass index ce332ca5..03a810d1 100644 --- a/frameworks/compass/stylesheets/compass/_misc.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/_misc.sass @@ -6,19 +6,19 @@ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. =unobtrusive-logo(!size = 1em) - :font-family Monaco, Courier, "Lucida Sans Unicode", monospace - :font-size= !size - :color #888 + font-family: Monaco, Courier, "Lucida Sans Unicode", monospace + font-size= !size + color: #888 .selector - :vertical-align middle - :font-size= 1.3em + vertical-align: middle + font-size= 1.3em .brace - :vertical-align middle - :font bold 1.7em Georgia, "Times New Roman", serif - :color #CCC - :margin= 0 -0.2em + vertical-align: middle + font: bold 1.7em Georgia, "Times New Roman", serif + color: #CCC + margin= 0 -0.2em .rule - :vertical-align middle - :margin= 0 -0.2em + vertical-align: middle + margin= 0 -0.2em - \ No newline at end of file + diff --git a/frameworks/compass/stylesheets/compass/_reset.sass b/lib/compass/frameworks/compass/stylesheets/compass/_reset.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/_reset.sass rename to lib/compass/frameworks/compass/stylesheets/compass/_reset.sass diff --git a/frameworks/compass/stylesheets/compass/_utilities.sass b/lib/compass/frameworks/compass/stylesheets/compass/_utilities.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/_utilities.sass rename to lib/compass/frameworks/compass/stylesheets/compass/_utilities.sass diff --git a/lib/compass/frameworks/compass/stylesheets/compass/css3/_border_radius.sass b/lib/compass/frameworks/compass/stylesheets/compass/css3/_border_radius.sass new file mode 100644 index 00000000..475b66d5 --- /dev/null +++ b/lib/compass/frameworks/compass/stylesheets/compass/css3/_border_radius.sass @@ -0,0 +1,47 @@ +!default_border_radius ||= 5px + +// Round all borders by amount +=border-radius(!radius = !default_border_radius) + border-radius= !radius + -moz-border-radius= !radius + -webkit-border-radius= !radius + +// Round radius at position by amount. +// values for !vert: "top", "bottom" +// values for !horz: "left", "right +=border-corner-radius(!vert, !horz, !radius = !default_border_radius) + border-#{!vert}-#{!horz}-radius= !radius + -moz-border-radius-#{!vert}#{!horz}= !radius + -webkit-border-#{!vert}-#{!horz}-radius= !radius + +=border-top-left-radius(!radius = !default_border_radius) + +border-corner-radius("top", "left", !radius) + +=border-top-right-radius(!radius = !default_border_radius) + +border-corner-radius("top", "right", !radius) + +=border-bottom-left-radius(!radius = !default_border_radius) + +border-corner-radius("bottom", "left", !radius) + +=border-bottom-right-radius(!radius = !default_border_radius) + +border-corner-radius("bottom", "right", !radius) + +// Round top corners by amount +=border-top-radius(!radius = !default_border_radius) + +border-top-left-radius(!radius) + +border-top-right-radius(!radius) + +// Round right corners by amount +=border-right-radius(!radius = !default_border_radius) + +border-top-right-radius(!radius) + +border-bottom-right-radius(!radius) + +// Round bottom corners by amount +=border-bottom-radius(!radius = !default_border_radius) + +border-bottom-left-radius(!radius) + +border-bottom-right-radius(!radius) + +// Round left corners by amount +=border-left-radius(!radius = !default_border_radius) + +border-top-left-radius(!radius) + +border-bottom-left-radius(!radius) \ No newline at end of file diff --git a/lib/compass/frameworks/compass/stylesheets/compass/css3/_box_shadow.sass b/lib/compass/frameworks/compass/stylesheets/compass/css3/_box_shadow.sass new file mode 100644 index 00000000..91e476d0 --- /dev/null +++ b/lib/compass/frameworks/compass/stylesheets/compass/css3/_box_shadow.sass @@ -0,0 +1,12 @@ +//** + Provides cross-browser css box shadows + for Webkit and the future + arguments are horizontal offset, vertical offset, blur and color + +=box-shadow(!ho, !vo, !b, !c ) + /* Webkit (Safari, Chrome) + -webkit-box-shadow= !ho !vo !b !c + /* Mozilla (Firefox, Camino) + -moz-box-shadow= !ho !vo !b !c + /* CSS3 + box-shadow= !ho !vo !b !c diff --git a/lib/compass/frameworks/compass/stylesheets/compass/css3/_box_sizing.sass b/lib/compass/frameworks/compass/stylesheets/compass/css3/_box_sizing.sass new file mode 100644 index 00000000..c63076d4 --- /dev/null +++ b/lib/compass/frameworks/compass/stylesheets/compass/css3/_box_sizing.sass @@ -0,0 +1,13 @@ +//** + Change the box model for Mozilla, Webkit, IE8 and the future + @param !bs + [ content-box | border-box ] +=box-sizing(!bs) + /* Mozilla (FireFox, Camino) + -moz-box-sizing= !bs + /* Webkit (Safari, Chrome) + -webkit-box-sizing= !bs + /* IE (8) + -ms-box-sizing= !bs + /* CSS3 + box-sizing= !bs \ No newline at end of file diff --git a/lib/compass/frameworks/compass/stylesheets/compass/css3/_columns.sass b/lib/compass/frameworks/compass/stylesheets/compass/css3/_columns.sass new file mode 100644 index 00000000..c2ef3c28 --- /dev/null +++ b/lib/compass/frameworks/compass/stylesheets/compass/css3/_columns.sass @@ -0,0 +1,37 @@ +//** + CSS3 columns for Mozilla, Webkit and the Future + +=column-count(!n) + -moz-column-count= !n + -webkit-column-count= !n + column-count= !n + +=column-gap(!u) + -moz-column-gap= !u + -webkit-column-gap= !u + column-gap= !u + +=column-width(!u) + -moz-column-width= !u + -webkit-column-width= !u + column-width= !u + +=column-rule-width(!w) + -moz-column-rule-width= !w + -webkit-column-rule-width= !w + column-rule-width= !w + +=column-rule-style(!s) + -moz-column-rule-style= !s + -webkit-column-rule-style= !s + column-rule-style= !s + +=column-rule-color(!c) + -moz-column-rule-color= !c + -webkit-column-rule-color= !c + column-rule-color= !c + +=column-rule(!w, !s = "solid", !c = " ") + +column-rule-width(!w) + +column-rule-style(!s) + +column-rule-color(!c) diff --git a/lib/compass/frameworks/compass/stylesheets/compass/css3/_inline_block.sass b/lib/compass/frameworks/compass/stylesheets/compass/css3/_inline_block.sass new file mode 100644 index 00000000..1ace87fd --- /dev/null +++ b/lib/compass/frameworks/compass/stylesheets/compass/css3/_inline_block.sass @@ -0,0 +1,7 @@ +=inline-block + display: -moz-inline-box + -moz-box-orient: vertical + display: inline-block + vertical-align: middle + #display: inline + #vertical-align: auto diff --git a/lib/compass/frameworks/compass/stylesheets/compass/css3/_opacity.sass b/lib/compass/frameworks/compass/stylesheets/compass/css3/_opacity.sass new file mode 100644 index 00000000..e47ab9a7 --- /dev/null +++ b/lib/compass/frameworks/compass/stylesheets/compass/css3/_opacity.sass @@ -0,0 +1,18 @@ +//** + Provides cross-browser css opacity. + @param !opacity + A number between 0 and 1, where 0 is transparent and 1 is opaque. +=opacity(!opacity) + opacity= !opacity + -moz-opacity= !opacity + -khtml-opacity= !opacity + -ms-filter= "progid:DXImageTransform.Microsoft.Alpha(Opacity=" + round(!opacity*100) + ")" + filter= "alpha(opacity=" + round(!opacity*100) + ")" + +// Make an element completely transparent. +=transparent + +opacity(0) + +// Make an element completely opaque. +=opaque + +opacity(1) diff --git a/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass b/lib/compass/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass similarity index 65% rename from frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass rename to lib/compass/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass index 8b8c4b04..7ab874ca 100644 --- a/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass @@ -5,13 +5,15 @@ =sticky-footer(!footer_height, !root_selector = "#root", !root_footer_selector = "#root_footer", !footer_selector = "#footer") html, body - :height 100% + height: 100% #{!root_selector} - :min-height 100% - :margin-bottom= -!footer_height + min-height: 100% + height: auto !important + height: 100% + margin-bottom= -!footer_height #{!root_footer_selector} - :height= !footer_height + height= !footer_height #{!footer_selector} - :clear both - :position relative - :height= !footer_height + clear: both + position: relative + height= !footer_height diff --git a/frameworks/compass/stylesheets/compass/utilities/_general.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_general.sass similarity index 80% rename from frameworks/compass/stylesheets/compass/utilities/_general.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/_general.sass index a09b235a..3b105f8a 100644 --- a/frameworks/compass/stylesheets/compass/utilities/_general.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_general.sass @@ -2,5 +2,4 @@ @import general/clearfix.sass @import general/float.sass @import general/tag_cloud.sass -@import general/inline_block.sass @import general/hacks.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/_links.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_links.sass similarity index 64% rename from frameworks/compass/stylesheets/compass/utilities/_links.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/_links.sass index afd4e369..41b15b45 100644 --- a/frameworks/compass/stylesheets/compass/utilities/_links.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_links.sass @@ -1,3 +1,3 @@ @import links/hover_link.sass @import links/link_colors.sass -@import links/unstyled_link.sass \ No newline at end of file +@import links/unstyled_link.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/_lists.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_lists.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/_lists.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/_lists.sass diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/_print.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_print.sass new file mode 100644 index 00000000..77c2a13c --- /dev/null +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_print.sass @@ -0,0 +1,18 @@ +// Classes that are useful for controlling what gets printed. +// You must mix +print-utilities into your print stylesheet +// and +print-utilities("screen") into your screen stylesheet. +// Note: these aren't semantic. +=print-utilities(!media = "print") + @if !media == "print" + .noprint, + .no-print + display: none + #{elements_of_type("block")} + &.print-only + display: block + #{elements_of_type("inline")} + &.print-only + display: inline + @else + .print-only + display: none diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/_sprites.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_sprites.sass new file mode 100644 index 00000000..b03e49c8 --- /dev/null +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_sprites.sass @@ -0,0 +1 @@ +@import sprites/sprite_img.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/_tables.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_tables.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/_tables.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/_tables.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/_text.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_text.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/_text.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/_text.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass similarity index 84% rename from frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass index e64afef3..3399e591 100644 --- a/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass @@ -6,7 +6,7 @@ Recommendations include using this in conjunction with a width: http://www.quirksmode.org/blog/archives/2005/03/clearing_floats.html =clearfix - :overflow hidden + overflow: hidden +has-layout //** @@ -15,10 +15,10 @@ http://www.positioniseverything.net/easyclearing.html =pie-clearfix &:after - :content " " - :display block - :height 0 - :clear both - :overflow hidden - :visibility hidden + content: " " + display: block + height: 0 + clear: both + overflow: hidden + visibility: hidden +has-layout diff --git a/frameworks/compass/stylesheets/compass/utilities/general/_float.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_float.sass similarity index 89% rename from frameworks/compass/stylesheets/compass/utilities/general/_float.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_float.sass index a0d58713..616765f6 100644 --- a/frameworks/compass/stylesheets/compass/utilities/general/_float.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_float.sass @@ -13,5 +13,5 @@ // Available as alternate syntax with just +float =float(!side = "left") - :display inline - :float= !side + display: inline + float= !side diff --git a/frameworks/compass/stylesheets/compass/utilities/general/_hacks.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_hacks.sass similarity index 65% rename from frameworks/compass/stylesheets/compass/utilities/general/_hacks.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_hacks.sass index 19417ee1..e3c21fb5 100644 --- a/frameworks/compass/stylesheets/compass/utilities/general/_hacks.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_hacks.sass @@ -1,6 +1,6 @@ =has-layout // This makes ie6 get layout - :display inline-block + display: inline-block // and this puts it back to block & - :display block + display: block diff --git a/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass similarity index 84% rename from frameworks/compass/stylesheets/compass/utilities/general/_reset.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass index 8d968e53..4ade16ee 100644 --- a/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass @@ -33,7 +33,7 @@ q, blockquote +reset-quotation - img a + a img +reset-image-anchor-border @@ -57,52 +57,52 @@ q, blockquote +reset-quotation - img a + a img +reset-image-anchor-border //Mixins partials =reset-box-model - :margin 0 - :padding 0 - :border 0 - :outline 0 + margin: 0 + padding: 0 + border: 0 + outline: 0 =reset-font - :font - :weight inherit - :style inherit - :size 100% - :family inherit - :vertical-align baseline + font: + weight: inherit + style: inherit + size: 100% + family: inherit + vertical-align: baseline =reset-focus - :outline 0 + outline: 0 =reset-body - :line-height 1em - :color = #000 - :background #fff + line-height: 1em + color: #000 + background: #fff =reset-list-style - :list-style none + list-style: none =reset-table - :border-collapse separate - :border-spacing 0 - :vertical-align middle + border-collapse: separate + border-spacing: 0 + vertical-align: middle =reset-table-cell - :text-align left - :font-weight normal - :vertical-align middle + text-align: left + font-weight: normal + vertical-align: middle =reset-quotation - :quotes "" "" + quotes: "" "" &:before, &:after - :content "" + content: "" =reset-image-anchor-border - :border none + border: none =reset-html5 section, article, aside, header, footer, nav, dialog, figure @@ -115,7 +115,7 @@ Usage Example: // Turn off the display for both of these classes .unregistered-only, .registered-only - :display none + display: none // Now turn only one of them back on depending on some other context. body.registered +reset-display(".registered-only") @@ -131,4 +131,4 @@ @if !important display: block !important @else - display: block \ No newline at end of file + display: block diff --git a/frameworks/compass/stylesheets/compass/utilities/general/_tabs.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_tabs.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/general/_tabs.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_tabs.sass diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass new file mode 100644 index 00000000..132cb4d1 --- /dev/null +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass @@ -0,0 +1,19 @@ +// Emits styles for a tag cloud +=tag-cloud(!base_size = 1em) + font-size= !base_size + line-height= 1.2 * !base_size + .xxs, .xs, .s, .l, .xl, .xxl + line-height= 1.2 * !base_size + .xxs + font-size= !base_size / 2.0 + .xs + font-size= 2.0 * !base_size / 3.0 + .s + font-size= 3.0 * !base_size / 4.0 + .l + font-size= 4.0 * !base_size / 3.0 + .xl + font-size= 3.0 * !base_size / 2.0 + .xxl + font-size= 2.0 * !base_size + diff --git a/frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass similarity index 59% rename from frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass index a8b51545..44b99a63 100644 --- a/frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass @@ -1,5 +1,5 @@ // a link that only has an underline when you hover over it =hover-link - :text-decoration none + text-decoration: none &:hover - :text-decoration underline + text-decoration: underline diff --git a/frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass similarity index 79% rename from frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass index dcdae06d..9d40d320 100644 --- a/frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass @@ -7,18 +7,18 @@ // +link-colors(#00c, #0cc, #c0c, #ccc, #cc0) =link-colors(!normal, !hover = false, !active = false, !visited = false, !focus = false) - :color= !normal + color= !normal @if !visited &:visited - :color= !visited + color= !visited @if !focus &:focus - :color= !focus + color= !focus @if !hover &:hover - :color= !hover + color= !hover @if !active &:active - :color= !active + color= !active - \ No newline at end of file + diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass new file mode 100644 index 00000000..f274eb9e --- /dev/null +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass @@ -0,0 +1,7 @@ +// A link that looks and acts like the text it is contained within +=unstyled-link + color: inherit + text-decoration: inherit + cursor: inherit + &:active, &:focus + outline: none diff --git a/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass similarity index 63% rename from frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass index 86657098..fce89824 100644 --- a/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass @@ -1,7 +1,7 @@ // Turn off the bullet for an element of a list =no-bullet - :list-style-type none - :margin-left 0px + list-style-type: none + margin-left: 0px // turns off the bullets for an entire list =no-bullets @@ -13,9 +13,9 @@ // ul.pretty // +pretty-bullets("my-icon.png", 5px, 7px) =pretty-bullets(!bullet_icon, !width, !height, !line_height = 18px, !padding = 14px) - :margin-left 0 + margin-left: 0 li - :padding-left= !padding - :background= image_url(!bullet_icon) "no-repeat" ((!padding - !width) / 2) ((!line_height - !height) / 2) - :list-style-type none + padding-left= !padding + background= image_url(!bullet_icon) "no-repeat" ((!padding - !width) / 2) ((!line_height - !height) / 2) + list-style-type: none diff --git a/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass similarity index 91% rename from frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass index 49d21c7d..8c601d6c 100644 --- a/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass @@ -32,15 +32,15 @@ Used to implement +horizontal-list. =horizontal-list-item(!padding = 4px) +no-bullet - :white-space nowrap + white-space: nowrap +float-left - :padding - :left= !padding - :right= !padding + padding: + left= !padding + right= !padding &.first - :padding-left 0px + padding-left: 0px &.last - :padding-right 0px + padding-right: 0px //** A list(ol,ul) that is layed out such that the elements are floated left and won't wrap. diff --git a/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass similarity index 76% rename from frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass index e6d0a185..88ea604f 100644 --- a/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass @@ -1,14 +1,14 @@ // makes a list inline. =inline-list - :list-style-type none - :margin 0px - :padding 0px - :display inline + list-style-type: none + margin: 0px + padding: 0px + display: inline li - :margin 0px - :padding 0px - :display inline + margin: 0px + padding: 0px + display: inline // makes an inlin list that is comma delimited. // use of this recipe is not recommended at this time due to browser support issues. @@ -23,7 +23,7 @@ +inline-list li &:after - :content ", " + content: ", " &:last-child, &.last &:after - :content "" + content: "" diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass new file mode 100644 index 00000000..b6b3caec --- /dev/null +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass @@ -0,0 +1,52 @@ +//** + Example 1: + a.twitter + +sprite-img("icons-32.png", 1) + a.facebook + +sprite-img("icons-32png", 2) + ... + Example 2: + a + +sprite-background("icons-32.png") + a.twitter + +sprite-column(1) + a.facebook + +sprite-row(2) + ... + +!sprite_default_size ||= 32px +!sprite_default_margin ||= 0px +!sprite_image_default_width ||= !sprite_default_size +!sprite_image_default_height ||= !sprite_default_size + + +// Sets all the rules for a sprite from a given sprite image to show just one of the sprites. +// To reduce duplication use a sprite-bg mixin for common properties and a sprite-select mixin for positioning. +=sprite-img(!img, !col, !row = 1, !width = !sprite_image_default_width, !height = !sprite_image_default_height, !margin = !sprite_default_margin) + +sprite-background(!img, !width, !height) + +sprite-position(!col, !row, !width, !height, !margin) + +// Sets rules common for all sprites, assumes you want a square, but allows a rectangular region. +=sprite-background(!img, !width = !sprite_default_size, !height = !width) + +sprite-background-rectangle(!img, !width, !height) + +// Sets rules common for all sprites, assumes a rectangular region. +=sprite-background-rectangle(!img, !width = !sprite_image_default_width, !height = !sprite_image_default_height) + background= image_url(!img) "no-repeat" + width= !width + height= !height + overflow: hidden + +// Allows horizontal sprite positioning optimized for a single row of sprites. +=sprite-column(!col, !width = !sprite_image_default_width, !margin = !sprite_default_margin) + +sprite-position(!col, 1, !width, 0px, !margin) + +// Allows vertical sprite positioning optimized for a single column of sprites. +=sprite-row(!row, !height = !sprite_image_default_height, !margin = !sprite_default_margin) + +sprite-position(1, !row, 0px, !height, !margin) + +// Allows vertical and horizontal sprite positioning from a grid of equal dimensioned sprites. +=sprite-position(!col, !row = 1, !width = !sprite_image_default_width, !height = !sprite_image_default_height, !margin = !sprite_default_margin) + !x = ((!col - 1) * -!width) - ((!col - 1) * !margin) + !y = ((!row - 1) * -!height) - ((!row - 1) * !margin) + background-position= !x !y diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass new file mode 100644 index 00000000..cb086792 --- /dev/null +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass @@ -0,0 +1,20 @@ +=alternating-rows-and-columns(!even_row_color, !odd_row_color, !dark_intersection, !header_color = #FFF, !footer_color = #FFF) + th + background-color= !header_color + &.even + background-color= !header_color - !dark_intersection + tr.odd + td + background-color= !odd_row_color + &.even + background-color= !odd_row_color - !dark_intersection + tr.even + td + background-color= !even_row_color + &.even + background-color= !even_row_color - !dark_intersection + tfoot + th, td + background-color= !footer_color + &.even + background-color= !footer_color - !dark_intersection diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass new file mode 100644 index 00000000..7f21fecf --- /dev/null +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass @@ -0,0 +1,27 @@ +=outer-table-borders(!width = 2px, !color = black) + border= !width "solid" !color + thead + th + border-bottom= !width "solid" !color + tfoot + th, td + border-top= !width "solid" !color + th + &:first-child + border-right= !width "solid" !color + +=inner-table-borders(!width = 2px, !color = black) + th, td + border: + right= !width "solid" !color + bottom= !width "solid" !color + left-width: 0px + top-width: 0px + &:last-child, + &.last + border-right-width: 0px + tbody, tfoot + tr:last-child, + tr.last + th, td + border-bottom-width: 0px diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass new file mode 100644 index 00000000..f55e6b0d --- /dev/null +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass @@ -0,0 +1,9 @@ +=table-scaffolding + th + text-align: center + font-weight: bold + td, + th + padding: 2px + &.numeric + text-align: right diff --git a/frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass similarity index 79% rename from frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass index 1d5ada52..62294eac 100644 --- a/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass @@ -1,3 +1,3 @@ // When remembering whether or not there's a hyphen in white-space is too hard =nowrap - :white-space nowrap + white-space: nowrap diff --git a/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass similarity index 79% rename from frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass index 52f28103..e7c6a1b5 100644 --- a/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass @@ -9,9 +9,9 @@ @param y the y position of the background image. =replace-text( !img, !x = 50%, !y = 50% ) - :text-indent -9999em - :overflow hidden - :background - :image= image_url(!img) - :repeat no-repeat - :position= !x !y + text-indent: -9999em + overflow: hidden + background: + image= image_url(!img) + repeat: no-repeat + position= !x !y diff --git a/frameworks/compass/templates/ellipsis/ellipsis.sass b/lib/compass/frameworks/compass/templates/ellipsis/ellipsis.sass similarity index 100% rename from frameworks/compass/templates/ellipsis/ellipsis.sass rename to lib/compass/frameworks/compass/templates/ellipsis/ellipsis.sass diff --git a/lib/compass/frameworks/compass/templates/ellipsis/manifest.rb b/lib/compass/frameworks/compass/templates/ellipsis/manifest.rb new file mode 100644 index 00000000..5de7d673 --- /dev/null +++ b/lib/compass/frameworks/compass/templates/ellipsis/manifest.rb @@ -0,0 +1,27 @@ +description "Plugin for cross-browser ellipsis truncated text." + +file 'xml/ellipsis.xml', :like => :css +stylesheet 'ellipsis.sass' + +help %Q{ +First, install the plugin to get the xml file that makes this work in firfox: + + compass init --using blueprint/link_icons + +Then mix +ellipsis into your selectors to enable ellipsis +there when text gets too long. + +The ellipsis.sass file is just an example for how to use this plugin, +feel free to delete it. + +For more information see: + http://mattsnider.com/css/css-string-truncation-with-ellipsis/ +} + +welcome_message %Q{ +The ellipsis.sass file is just an example for how to use this plugin, +feel free to delete it. + +For more information see: + http://mattsnider.com/css/css-string-truncation-with-ellipsis/ +} \ No newline at end of file diff --git a/frameworks/compass/templates/ellipsis/xml/ellipsis.xml b/lib/compass/frameworks/compass/templates/ellipsis/xml/ellipsis.xml similarity index 100% rename from frameworks/compass/templates/ellipsis/xml/ellipsis.xml rename to lib/compass/frameworks/compass/templates/ellipsis/xml/ellipsis.xml diff --git a/lib/compass/frameworks/compass/templates/extension/manifest.rb b/lib/compass/frameworks/compass/templates/extension/manifest.rb new file mode 100644 index 00000000..0f92706a --- /dev/null +++ b/lib/compass/frameworks/compass/templates/extension/manifest.rb @@ -0,0 +1,20 @@ +description "Generate a compass extension." + +file 'stylesheets/main.sass', :to => "stylesheets/_#{File.basename(options[:pattern_name]||options[:project_name]||'main')}.sass" +file 'templates/project/manifest.rb' +file 'templates/project/screen.sass' + +help %Q{ + To generate a compass extension: + compass create my_extension --using compass/extension +} + +welcome_message %Q{ +For a full tutorial on how to build your own extension see: + +http://github.com/chriseppstein/compass/blob/edge/docs/EXTENSIONS.markdown + +}, :replace => true + +no_configuration_file! +skip_compilation! diff --git a/lib/compass/frameworks/compass/templates/extension/stylesheets/main.sass b/lib/compass/frameworks/compass/templates/extension/stylesheets/main.sass new file mode 100644 index 00000000..bcccf41f --- /dev/null +++ b/lib/compass/frameworks/compass/templates/extension/stylesheets/main.sass @@ -0,0 +1 @@ +// This is your framework's main stylesheet. Use it to import all default modules. diff --git a/lib/compass/frameworks/compass/templates/extension/templates/project/manifest.rb b/lib/compass/frameworks/compass/templates/extension/templates/project/manifest.rb new file mode 100644 index 00000000..61591194 --- /dev/null +++ b/lib/compass/frameworks/compass/templates/extension/templates/project/manifest.rb @@ -0,0 +1,2 @@ +# Make sure you list all the project template files here in the manifest. +stylesheet 'screen.sass', :media => 'screen, projection' diff --git a/lib/compass/frameworks/compass/templates/extension/templates/project/screen.sass b/lib/compass/frameworks/compass/templates/extension/templates/project/screen.sass new file mode 100644 index 00000000..4558d133 --- /dev/null +++ b/lib/compass/frameworks/compass/templates/extension/templates/project/screen.sass @@ -0,0 +1,2 @@ +// This is where you put the contents of the main stylesheet for the user's project. +// It should import your sass stylesheets and demonstrate how to use them. \ No newline at end of file diff --git a/lib/compass/frameworks/compass/templates/project/USAGE.markdown b/lib/compass/frameworks/compass/templates/project/USAGE.markdown new file mode 100644 index 00000000..21b5fb61 --- /dev/null +++ b/lib/compass/frameworks/compass/templates/project/USAGE.markdown @@ -0,0 +1,32 @@ +When no framework is specified, a new compass project is set up with three stylesheets: + +* screen.sass +* print.sass +* ie.sass + +It is expected that you will link your html to these like so: + + + + + + + +You don't have to use these three stylesheets, they are just a recommendation. +You can rename them, make new stylesheets, and delete them. Compass will +happily compile whatever sass files you place into your project. + +Any folders you create in your source directory with sass files in them will be folders +that get created with css files in them when compiled. + +Sass files beginning with an underscore are called partials, they are not directly +compiled to their own css file. You can use these partials by importing them +into other stylesheets. This is useful for keeping your stylesheets small and manageable +and single-focused. It is common to create a file called _base.sass at the top level +of your stylesheets and to import this to set up project-wide constants and mixins. + diff --git a/frameworks/compass/templates/project/ie.sass b/lib/compass/frameworks/compass/templates/project/ie.sass similarity index 100% rename from frameworks/compass/templates/project/ie.sass rename to lib/compass/frameworks/compass/templates/project/ie.sass diff --git a/frameworks/compass/templates/project/manifest.rb b/lib/compass/frameworks/compass/templates/project/manifest.rb similarity index 80% rename from frameworks/compass/templates/project/manifest.rb rename to lib/compass/frameworks/compass/templates/project/manifest.rb index 03604fe2..fade058b 100644 --- a/frameworks/compass/templates/project/manifest.rb +++ b/lib/compass/frameworks/compass/templates/project/manifest.rb @@ -1,3 +1,4 @@ +description "The default project layout." stylesheet 'screen.sass', :media => 'screen, projection' stylesheet 'print.sass', :media => 'print' stylesheet 'ie.sass', :media => 'screen, projection', :condition => "IE" \ No newline at end of file diff --git a/frameworks/compass/templates/project/print.sass b/lib/compass/frameworks/compass/templates/project/print.sass similarity index 100% rename from frameworks/compass/templates/project/print.sass rename to lib/compass/frameworks/compass/templates/project/print.sass diff --git a/frameworks/compass/templates/project/screen.sass b/lib/compass/frameworks/compass/templates/project/screen.sass similarity index 100% rename from frameworks/compass/templates/project/screen.sass rename to lib/compass/frameworks/compass/templates/project/screen.sass diff --git a/lib/compass/grid_builder.rb b/lib/compass/grid_builder.rb index 0c91f60f..2b5c5d34 100644 --- a/lib/compass/grid_builder.rb +++ b/lib/compass/grid_builder.rb @@ -16,19 +16,21 @@ module Compass rescue Exception => e end - attr_reader :column_width, :gutter_width, :output_path, :able_to_generate, :options + attr_reader :column_width, :gutter_width, :filename, :able_to_generate, :options # ==== Options # * options # * :column_width -- Width (in pixels) of current grid column # * :gutter_width -- Width (in pixels) of current grid gutter - # * :output_path -- Output path of grid.png file + # * :height -- Height (in pixels) of a row + # * :filename -- Output path of grid.png file def initialize(options={}) @able_to_generate = Magick::Long_version rescue false return unless @able_to_generate @column_width = options[:column_width] @gutter_width = options[:gutter_width] - @output_path = options[:output_path] + @height = options[:height] || 20 + @filename = options[:filename] @options = options end @@ -40,22 +42,20 @@ module Compass def generate! return false unless self.able_to_generate total_width = self.column_width + self.gutter_width - height = 20 RVG::dpi = 100 - rvg = RVG.new((total_width.to_f/RVG::dpi).in, (height.to_f/RVG::dpi).in).viewbox(0, 0, total_width, height) do |canvas| + rvg = RVG.new((total_width.to_f/RVG::dpi).in, (@height.to_f/RVG::dpi).in).viewbox(0, 0, total_width, @height) do |canvas| canvas.background_fill = 'white' canvas.g do |column| - column.rect(self.column_width, height).styles(:fill => "#e8effb") + column.rect(self.column_width, @height).styles(:fill => "#e8effb") end canvas.g do |baseline| - baseline.line(0, (height - 1), total_width, (height- 1)).styles(:fill => "#e9e9e9") + baseline.line(0, (@height - 1), total_width, (@height- 1)).styles(:fill => "#e9e9e9") end end - filename = File.join(self.output_path, "grid.png") if File.exists?(filename) if options[:force] overwrite = true @@ -64,9 +64,13 @@ module Compass raise Compass::FilesystemConflict.new(msg) end end - directory self.output_path + directory File.dirname(filename) logger.record((overwrite ? :overwrite : :create), basename(filename)) - rvg.draw.write(filename) + unless options[:dry_run] + rvg.draw.write(filename) + else + true + end end end -end \ No newline at end of file +end diff --git a/lib/compass/installers.rb b/lib/compass/installers.rb index a92f1a3f..70b87cc8 100644 --- a/lib/compass/installers.rb +++ b/lib/compass/installers.rb @@ -1,5 +1,3 @@ -require File.join(File.dirname(__FILE__), 'installers', 'manifest') -require File.join(File.dirname(__FILE__), 'installers', 'base') -require File.join(File.dirname(__FILE__), 'installers', 'stand_alone') -require File.join(File.dirname(__FILE__), 'installers', 'rails') - +%w(manifest template_context base manifest_installer bare_installer).each do |f| + require "compass/installers/#{f}" +end diff --git a/lib/compass/installers/bare_installer.rb b/lib/compass/installers/bare_installer.rb new file mode 100644 index 00000000..96b017d3 --- /dev/null +++ b/lib/compass/installers/bare_installer.rb @@ -0,0 +1,58 @@ +module Compass + module Installers + + class BareInstaller < Base + def completed_configuration + nil + end + + def init + directory targetize("") + directory targetize(Compass.configuration.sass_dir) + end + + def prepare + end + + def install + config_file ||= targetize('config.rb') + write_file config_file, config_contents + end + + def config_contents + project_path, Compass.configuration.project_path = Compass.configuration.project_path, nil + Compass.configuration.serialize + ensure + Compass.configuration.project_path = project_path + end + + def finalize(options = {}) + puts <<-NEXTSTEPS + +********************************************************************* +Congratulations! Your compass project has been created. + +You may now add sass stylesheets to the #{Compass.configuration.sass_dir} subdirectory of your project. + +Sass files beginning with an underscore are called partials and won't be +compiled to CSS, but they can be imported into other sass stylesheets. + +You can configure your project by editing the config.rb configuration file. + +You must compile your sass stylesheets into CSS when they change. +This can be done in one of the following ways: + 1. To compile on demand: + compass compile [path/to/project] + 2. To monitor your project for changes and automatically recompile: + compass watch [path/to/project] + +More Resources: + * Wiki: http://wiki.github.com/chriseppstein/compass + * Sass: http://sass-lang.com + * Community: http://groups.google.com/group/compass-users/ +NEXTSTEPS + end + + end + end +end diff --git a/lib/compass/installers/base.rb b/lib/compass/installers/base.rb index fb1e26c3..e27dc2d0 100644 --- a/lib/compass/installers/base.rb +++ b/lib/compass/installers/base.rb @@ -7,40 +7,21 @@ module Compass attr_accessor :template_path, :target_path, :working_path attr_accessor :options - attr_accessor :manifest def initialize(template_path, target_path, options = {}) @template_path = template_path @target_path = target_path @working_path = Dir.getwd @options = options - @manifest = Manifest.new(manifest_file) if template_path self.logger = options[:logger] end - def manifest_file - @manifest_file ||= File.join(template_path, "manifest.rb") - end - - [:css_dir, :sass_dir, :images_dir, :javascripts_dir].each do |dir| + [:css_dir, :sass_dir, :images_dir, :javascripts_dir, :http_stylesheets_path].each do |dir| define_method dir do Compass.configuration.send(dir) end - end - - # Initializes the project to work with compass - def init - dirs = manifest.map do |entry| - File.dirname(send("install_location_for_#{entry.type}", entry.to, entry.options)) - end - - if manifest.has_stylesheet? - dirs << sass_dir - dirs << css_dir - end - - dirs.uniq.sort.each do |dir| - directory targetize(dir) + define_method "#{dir}_without_default" do + Compass.configuration.send("#{dir}_without_default") end end @@ -50,7 +31,7 @@ module Compass def run(options = {}) prepare install - finalize unless options[:skip_finalization] + finalize(options) unless options[:skip_finalization] end # The default prepare method -- it is a no-op. @@ -58,25 +39,14 @@ module Compass def prepare end - def configure_option_with_default(opt) - value = options[opt] - value ||= begin - default_method = "default_#{opt}".to_sym - send(default_method) if respond_to?(default_method) - end - send("#{opt}=", value) - end - - # The default install method. Calls install_ methods in the order specified by the manifest. + # The install method override this to install def install - manifest.each do |entry| - send("install_#{entry.type}", entry.from, entry.to, entry.options) - end + raise "Not Yet Implemented" end # The default finalize method -- it is a no-op. # This could print out a message or something. - def finalize + def finalize(options = {}) end def compilation_required? @@ -125,6 +95,31 @@ module Compass "#{pattern_name_as_dir}#{to}" end + installer :html do |to| + "#{pattern_name_as_dir}#{to}" + end + + alias install_html_without_haml install_html + def install_html(from, to, options) + if to =~ /\.haml$/ + require 'haml' + to = to[0..-(".haml".length+1)] + if respond_to?(:install_location_for_html) + to = install_location_for_html(to, options) + end + contents = File.read(templatize(from)) + if options.delete(:erb) + ctx = TemplateContext.ctx(:to => to, :options => options) + contents = process_erb(contents, ctx) + end + Compass.configure_sass_plugin! + html = Haml::Engine.new(contents, :filename => templatize(from)).render + write_file(targetize(to), html, options) + else + install_html_without_haml(from, to, options) + end + end + # returns an absolute path given a path relative to the current installation target. # Paths can use unix style "/" and will be corrected for the current platform. def targetize(path) @@ -137,22 +132,12 @@ module Compass strip_trailing_separator File.join(template_path, separate(path)) end + # Emits an HTML fragment that can be used to link to the compiled css files def stylesheet_links - html = "\n" - manifest.each_stylesheet do |stylesheet| - # Skip partials. - next if File.basename(stylesheet.from)[0..0] == "_" - media = if stylesheet.options[:media] - %Q{ media="#{stylesheet.options[:media]}"} - end - ss_line = %Q{ } - if stylesheet.options[:condition] - ss_line = " " - end - html << ss_line + "\n" - end - html << "" + "" end end end end +require 'compass/installers/bare_installer' +require 'compass/installers/manifest_installer' diff --git a/lib/compass/installers/manifest.rb b/lib/compass/installers/manifest.rb index bd5d9a34..eb664a7d 100644 --- a/lib/compass/installers/manifest.rb +++ b/lib/compass/installers/manifest.rb @@ -11,8 +11,12 @@ module Compass end end - def initialize(manifest_file = nil) + attr_reader :options + def initialize(manifest_file = nil, options = {}) @entries = [] + @options = options + @generate_config = true + @compile_after_generation = true parse(manifest_file) if manifest_file end @@ -34,14 +38,62 @@ module Compass type :image type :javascript type :file + type :html + + def help(value = nil) + if value + @help = value + else + @help + end + end + + attr_reader :welcome_message_options + + def welcome_message(value = nil, options = {}) + if value + @welcome_message = value + @welcome_message_options = options + else + @welcome_message + end + end + + def welcome_message_options + @welcome_message_options || {} + end + + def description(value = nil) + if value + @description = value + else + @description + end + end # Enumerates over the manifest files def each @entries.each {|e| yield e} end + def generate_config? + @generate_config + end + + def compile? + @compile_after_generation + end protected + + def no_configuration_file! + @generate_config = false + end + + def skip_compilation! + @compile_after_generation = false + end + # parses a manifest file which is a ruby script # evaluated in a Manifest instance context def parse(manifest_file) @@ -55,4 +107,4 @@ module Compass end end -end \ No newline at end of file +end diff --git a/lib/compass/installers/manifest_installer.rb b/lib/compass/installers/manifest_installer.rb new file mode 100644 index 00000000..d48ff5ad --- /dev/null +++ b/lib/compass/installers/manifest_installer.rb @@ -0,0 +1,59 @@ +module Compass + module Installers + + class ManifestInstaller < Base + + attr_accessor :manifest + + def initialize(template_path, target_path, options = {}) + super + @manifest = Manifest.new(manifest_file, options) if template_path + end + + def manifest_file + @manifest_file ||= File.join(template_path, "manifest.rb") + end + + # Initializes the project to work with compass + def init + dirs = manifest.map do |entry| + loc = send("install_location_for_#{entry.type}", entry.to, entry.options) + File.dirname(loc) + end + + if manifest.has_stylesheet? + dirs << sass_dir + dirs << css_dir + end + + dirs.uniq.sort.each do |dir| + directory targetize(dir) + end + end + + # The default install method. Calls install_ methods in the order specified by the manifest. + def install + manifest.each do |entry| + send("install_#{entry.type}", entry.from, entry.to, entry.options) + end + end + + def stylesheet_links + html = "\n" + manifest.each_stylesheet do |stylesheet| + # Skip partials. + next if File.basename(stylesheet.from)[0..0] == "_" + media = if stylesheet.options[:media] + %Q{ media="#{stylesheet.options[:media]}"} + end + ss_line = %Q{ } + if stylesheet.options[:condition] + ss_line = " " + end + html << ss_line + "\n" + end + html << "" + end + end + end +end diff --git a/lib/compass/installers/rails.rb b/lib/compass/installers/rails.rb deleted file mode 100644 index 9f2a3e36..00000000 --- a/lib/compass/installers/rails.rb +++ /dev/null @@ -1,135 +0,0 @@ -module Compass - module Installers - - class RailsInstaller < Base - - def configuration_defaults - { - :sass_dir => (sass_dir || prompt_sass_dir), - :css_dir => (css_dir || prompt_css_dir), - :images_dir => default_images_dir, - :javascripts_dir => default_javascripts_dir, - :http_stylesheets_path => default_http_stylesheets_path, - :http_javascripts_path => default_http_javascripts_path, - :http_images_path => default_http_images_path - } - end - - def write_configuration_files(config_file = nil) - config_file ||= targetize('config/compass.config') - write_file config_file, config_contents - write_file targetize('config/initializers/compass.rb'), initializer_contents - end - - def config_files_exist? - File.exists?(targetize('config/compass.config')) && - File.exists?(targetize('config/initializers/compass.rb')) - end - - def prepare - write_configuration_files unless config_files_exist? - end - - def finalize(options = {}) - if options[:create] - puts <<-NEXTSTEPS - -Congratulations! Your rails project has been configured to use Compass. -Sass will automatically compile your stylesheets during the next -page request and keep them up to date when they change. -Make sure you restart your server! -NEXTSTEPS - end - puts "\nNext add these lines to the head of your layouts:\n\n" - puts stylesheet_links - puts "\n(You are using haml, aren't you?)" - end - - def default_images_dir - separate("public/images") - end - - def default_javascripts_dir - separate("public/javascripts") - end - - def default_http_images_path - "/images" - end - - def default_http_javascripts_path - "/javascripts" - end - - def default_http_stylesheets_path - "/stylesheets" - end - - def prompt_sass_dir - recommended_location = separate('app/stylesheets') - default_location = separate('public/stylesheets/sass') - print %Q{Compass recommends that you keep your stylesheets in #{recommended_location} -instead of the Sass default location of #{default_location}. -Is this OK? (Y/n) } - answer = gets.downcase[0] - answer == ?n ? default_location : recommended_location - end - - def prompt_css_dir - recommended_location = separate("public/stylesheets/compiled") - default_location = separate("public/stylesheets") - puts - print %Q{Compass recommends that you keep your compiled css in #{recommended_location}/ -instead the Sass default of #{default_location}/. -However, if you're exclusively using Sass, then #{default_location}/ is recommended. -Emit compiled stylesheets to #{recommended_location}/? (Y/n) } - answer = gets.downcase[0] - answer == ?n ? default_location : recommended_location - end - - def config_contents - Compass.configuration.serialize do |prop, value| - if prop == :project_path - "project_path = RAILS_ROOT if defined?(RAILS_ROOT)\n" - elsif prop == :output_style - "" - end - end - end - - def initializer_contents - %Q{require 'compass' -# If you have any compass plugins, require them here. -Compass.configuration.parse(File.join(RAILS_ROOT, "config", "compass.config")) -Compass.configuration.environment = RAILS_ENV.to_sym -Compass.configure_sass_plugin! -} - end - - def stylesheet_prefix - if css_dir.length >= 19 - "#{css_dir[19..-1]}/" - else - nil - end - end - - def stylesheet_links - html = "%head\n" - manifest.each_stylesheet do |stylesheet| - # Skip partials. - next if File.basename(stylesheet.from)[0..0] == "_" - ss_line = " = stylesheet_link_tag '#{stylesheet_prefix}#{stylesheet.to.sub(/\.sass$/,'.css')}'" - if stylesheet.options[:media] - ss_line += ", :media => '#{stylesheet.options[:media]}'" - end - if stylesheet.options[:condition] - ss_line = " /[if #{stylesheet.options[:condition]}]\n " + ss_line - end - html << ss_line + "\n" - end - html - end - end - end -end diff --git a/lib/compass/installers/stand_alone.rb b/lib/compass/installers/stand_alone.rb deleted file mode 100644 index 5ae61d5d..00000000 --- a/lib/compass/installers/stand_alone.rb +++ /dev/null @@ -1,60 +0,0 @@ -module Compass - module Installers - - class StandAloneInstaller < Base - - def init - directory targetize("") - super - end - - def write_configuration_files(config_file = nil) - config_file ||= targetize('config.rb') - write_file config_file, config_contents - end - - def config_files_exist? - File.exists? targetize('config.rb') - end - - def config_contents - project_path, Compass.configuration.project_path = Compass.configuration.project_path, nil - Compass.configuration.serialize - ensure - Compass.configuration.project_path = project_path - end - - def prepare - write_configuration_files unless config_files_exist? - end - - # We want to rely on the defaults provided by Configuration - def configuration_defaults - {} - end - - def finalize(options = {}) - if options[:create] - puts <<-NEXTSTEPS - -Congratulations! Your compass project has been created. -You must recompile your sass stylesheets when they change. -This can be done in one of the following ways: - 1. From within your project directory run: - compass - 2. From any directory run: - compass -u path/to/project - 3. To monitor your project for changes and automatically recompile: - compass --watch [path/to/project] -NEXTSTEPS - end - puts "\nTo import your new stylesheets add the following lines of HTML (or equivalent) to your webpage:" - puts stylesheet_links - end - - def compilation_required? - true - end - end - end -end diff --git a/lib/compass/installers/template_context.rb b/lib/compass/installers/template_context.rb new file mode 100644 index 00000000..4df933fa --- /dev/null +++ b/lib/compass/installers/template_context.rb @@ -0,0 +1,44 @@ +module Compass + module Installers + class TemplateContext + + def self.ctx(*arguments) + new(*arguments).send(:get_binding) + end + + def initialize(template, locals = {}) + @template = template + @locals = locals + end + + def http_stylesheets_path + config.http_stylesheets_path || + config.default_for(:http_stylesheets_path) || + config.http_root_relative(config.css_dir) + end + + Compass::Configuration::ATTRIBUTES.each do |attribute| + unless instance_methods.include?(attribute.to_s) + define_method attribute do + config.send(attribute) || config.default_for(attribute) + end + end + end + + def config + Compass.configuration + end + + alias configuration config + + protected + + def get_binding + @locals.each do |k, v| + eval("#{k} = v") + end + binding + end + end + end +end \ No newline at end of file diff --git a/lib/compass/sass_extensions.rb b/lib/compass/sass_extensions.rb index 986be47f..182717b1 100644 --- a/lib/compass/sass_extensions.rb +++ b/lib/compass/sass_extensions.rb @@ -1,5 +1,5 @@ module Compass::SassExtensions end -require File.join(File.dirname(__FILE__), 'sass_extensions', 'functions') -require File.join(File.dirname(__FILE__), 'sass_extensions', 'monkey_patches') +require 'compass/sass_extensions/functions' +require 'compass/sass_extensions/monkey_patches' diff --git a/lib/compass/sass_extensions/functions.rb b/lib/compass/sass_extensions/functions.rb index 75c8eb2f..a945b59d 100644 --- a/lib/compass/sass_extensions/functions.rb +++ b/lib/compass/sass_extensions/functions.rb @@ -1,8 +1,8 @@ module Compass::SassExtensions::Functions end -['selectors', 'enumerate', 'urls', 'display', 'inline_image'].each do |func| - require File.join(File.dirname(__FILE__), 'functions', func) +%w(selectors enumerate urls display inline_image).each do |func| + require "compass/sass_extensions/functions/#{func}" end module Sass::Script::Functions diff --git a/lib/compass/sass_extensions/functions/selectors.rb b/lib/compass/sass_extensions/functions/selectors.rb index fecaab73..34de7508 100644 --- a/lib/compass/sass_extensions/functions/selectors.rb +++ b/lib/compass/sass_extensions/functions/selectors.rb @@ -33,7 +33,10 @@ module Compass::SassExtensions::Functions::Selectors # #{append_selector(!selector, !to_append)} # width: 2px def append_selector(selector, to_append) - Sass::Script::String.new(selector.value.split(COMMA_SEPARATOR).map{|s| "#{s}#{to_append}"}.join(", ")) + ancestors = selector.value.split(COMMA_SEPARATOR) + descendants = to_append.value.split(COMMA_SEPARATOR) + nested = ancestors.map{|a| descendants.map{|d| "#{a}#{d}"}.join(", ")}.join(", ") + Sass::Script::String.new(nested) end end \ No newline at end of file diff --git a/lib/compass/sass_extensions/functions/urls.rb b/lib/compass/sass_extensions/functions/urls.rb index 06103623..d37e8044 100644 --- a/lib/compass/sass_extensions/functions/urls.rb +++ b/lib/compass/sass_extensions/functions/urls.rb @@ -8,7 +8,7 @@ module Compass::SassExtensions::Functions::Urls elsif Compass.configuration.http_stylesheets_path Compass.configuration.http_stylesheets_path else - Compass.configuration.root_relative(Compass.configuration.css_dir) + Compass.configuration.http_root_relative(Compass.configuration.css_dir) end url("#{http_stylesheets_path}/#{path}") @@ -28,7 +28,7 @@ module Compass::SassExtensions::Functions::Urls elsif Compass.configuration.http_images_path Compass.configuration.http_images_path else - Compass.configuration.root_relative(Compass.configuration.images_dir) + Compass.configuration.http_root_relative(Compass.configuration.images_dir) end # Compute the real path to the image on the file stystem if the images_dir is set. diff --git a/lib/compass/sass_extensions/monkey_patches.rb b/lib/compass/sass_extensions/monkey_patches.rb index de54a75c..c612ea21 100644 --- a/lib/compass/sass_extensions/monkey_patches.rb +++ b/lib/compass/sass_extensions/monkey_patches.rb @@ -1,3 +1,3 @@ -['stylesheet_updating'].each do |patch| - require File.join(File.dirname(__FILE__), 'monkey_patches', patch) -end \ No newline at end of file +%w(stylesheet_updating traversal).each do |patch| + require "compass/sass_extensions/monkey_patches/#{patch}" +end diff --git a/lib/compass/sass_extensions/monkey_patches/traversal.rb b/lib/compass/sass_extensions/monkey_patches/traversal.rb new file mode 100644 index 00000000..4b40e2ec --- /dev/null +++ b/lib/compass/sass_extensions/monkey_patches/traversal.rb @@ -0,0 +1,23 @@ +module Sass + module Tree + class Node + unless method_defined?(:visit_depth_first) + def visit_depth_first(visitor) + visitor.visit(self) + visitor.down(self) if children.any? and visitor.respond_to?(:down) + if is_a?(ImportNode) && visitor.import?(self) + root = Sass::Files.tree_for(import, @options) + imported_children = root.children + end + + (imported_children || children).each do |child| + break if visitor.respond_to?(:stop?) && visitor.stop? + child.visit_depth_first(visitor) + end + visitor.up(self) if children.any? + end + end + end + end +end + diff --git a/lib/compass/stats.rb b/lib/compass/stats.rb new file mode 100644 index 00000000..30f59093 --- /dev/null +++ b/lib/compass/stats.rb @@ -0,0 +1,92 @@ +module Compass + module Stats + class StatsVisitor + attr_accessor :rule_count, :prop_count, :mixin_def_count, :mixin_count + def initialize + self.rule_count = 0 + self.prop_count = 0 + self.mixin_def_count = 0 + self.mixin_count = 0 + end + def visit(node) + self.prop_count += 1 if node.is_a?(Sass::Tree::PropNode) && !node.children.any? + if node.is_a?(Sass::Tree::RuleNode) + self.rule_count += node.rules.map{|r| r.split(/,/)}.flatten.compact.size + end + self.mixin_def_count += 1 if node.is_a?(Sass::Tree::MixinDefNode) + self.mixin_count += 1 if node.is_a?(Sass::Tree::MixinNode) + end + def up(node) + end + def down(node) + end + def import?(node) + return false + full_filename = node.send(:import) + full_filename != Compass.deprojectize(full_filename) + end + end + class CssFile + attr_accessor :path, :css + attr_accessor :selector_count, :prop_count + def initialize(path) + require 'css_parser' + self.path = path + self.css = CssParser::Parser.new + self.css.add_block!(contents) + self.selector_count = 0 + self.prop_count = 0 + end + def contents + @contents ||= File.read(path) + end + def lines + contents.inject(0){|m,c| m + 1 } + end + def analyze! + css.each_selector do |selector, declarations, specificity| + sels = selector.split(/,/).size + props = declarations.split(/;/).size + self.selector_count += sels + self.prop_count += props + end + end + end + class SassFile + attr_accessor :path + attr_reader :visitor + def initialize(path) + self.path = path + end + def contents + @contents ||= File.read(path) + end + def tree + @tree = Sass::Engine.new(contents, Compass.configuration.to_sass_engine_options).to_tree + end + def visit_tree! + @visitor = StatsVisitor.new + tree.visit_depth_first(@visitor) + @visitor + end + def analyze! + visit_tree! + end + def lines + contents.inject(0){|m,c| m + 1 } + end + def rule_count + visitor.rule_count + end + def prop_count + visitor.prop_count + end + def mixin_def_count + visitor.mixin_def_count + end + def mixin_count + visitor.mixin_count + end + end + end +end diff --git a/lib/compass/validator.rb b/lib/compass/validator.rb index 8ddefafa..606f3420 100644 --- a/lib/compass/validator.rb +++ b/lib/compass/validator.rb @@ -2,9 +2,8 @@ begin require 'rubygems' require 'compass-validator' rescue LoadError - puts %Q{The Compass CSS Validator could not be loaded. Please install it: + raise Compass::MissingDependency, %Q{The Compass CSS Validator could not be loaded. Please install it: sudo gem install chriseppstein-compass-validator --source http://gems.github.com/ } - exit(1) -end \ No newline at end of file +end diff --git a/lib/vendor/fssm.rb b/lib/vendor/fssm.rb index faf3fd1b..4044e014 100644 --- a/lib/vendor/fssm.rb +++ b/lib/vendor/fssm.rb @@ -39,3 +39,7 @@ require 'fssm/monitor' require "fssm/backends/#{FSSM::Support.backend.downcase}" FSSM::Backends::Default = FSSM::Backends.const_get(FSSM::Support.backend) +<<<<<<< HEAD:lib/vendor/fssm.rb +======= + +>>>>>>> edge:lib/vendor/fssm.rb diff --git a/lib/vendor/fssm/state.rb b/lib/vendor/fssm/state.rb index 50fd1f71..910c74af 100644 --- a/lib/vendor/fssm/state.rb +++ b/lib/vendor/fssm/state.rb @@ -46,7 +46,7 @@ class FSSM::State end def add_glob(base, glob) - Pathname.glob(base.join(glob)).each do |fn| + Pathname.glob(base.join(glob).to_s).each do |fn| @cache.set(fn) end end diff --git a/test/command_line_helper.rb b/test/command_line_helper.rb index 029994c3..3fc48bd6 100644 --- a/test/command_line_helper.rb +++ b/test/command_line_helper.rb @@ -1,3 +1,5 @@ +require 'timeout' + module Compass::CommandLineHelper def compass(*arguments) options = arguments.last.is_a?(Hash) ? arguments.pop : {} @@ -17,9 +19,11 @@ module Compass::CommandLineHelper else eof_at = nil timeout(1) do - output << io.readpartial(1024) + partial_output = io.readpartial(1024) + # puts "))))#{partial_output}(((((" + output << partial_output end - prompt = output.split("\n").last + prompt = output.split("\n").last.strip if response = responder.response_for(prompt) io.puts response end @@ -33,8 +37,10 @@ module Compass::CommandLineHelper end end else - @last_result = capture_output do - execute *arguments + @last_error = capture_warning do + @last_result = capture_output do + @last_exit_code = execute *arguments + end end end rescue Timeout::Error @@ -88,15 +94,8 @@ module Compass::CommandLineHelper FileUtils.rm_rf(d) end - def capture_output - real_stdout, $stdout = $stdout, StringIO.new - yield - $stdout.string - ensure - $stdout = real_stdout - end - def execute(*arguments) - Compass::Exec::Compass.new(arguments).run! + command_line_class = Compass::Exec::Helpers.select_appropriate_command_line_ui(arguments) + command_line_class.new(arguments).run! end -end \ No newline at end of file +end diff --git a/test/command_line_test.rb b/test/command_line_test.rb index 8e621deb..d99f7378 100644 --- a/test/command_line_test.rb +++ b/test/command_line_test.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__)+'/test_helper' +require 'test_helper' require 'fileutils' require 'compass' require 'compass/exec' @@ -7,9 +7,10 @@ require 'timeout' class CommandLineTest < Test::Unit::TestCase include Compass::TestCaseHelper include Compass::CommandLineHelper + include Compass::IoHelper def teardown - Compass.configuration.reset! + Compass.reset_configuration! end def test_print_version @@ -19,7 +20,7 @@ class CommandLineTest < Test::Unit::TestCase def test_list_frameworks compass "--list-frameworks" - assert_equal(%w(blueprint compass yui), @last_result.split.sort) + assert_equal(%w(blueprint compass), @last_result.split.sort) end def test_basic_install @@ -63,4 +64,4 @@ class CommandLineTest < Test::Unit::TestCase end end -end \ No newline at end of file +end diff --git a/test/compass_test.rb b/test/compass_test.rb index 89e3f988..eb155b15 100644 --- a/test/compass_test.rb +++ b/test/compass_test.rb @@ -1,15 +1,15 @@ -require File.dirname(__FILE__)+'/test_helper' +require 'test_helper' require 'fileutils' require 'compass' class CompassTest < Test::Unit::TestCase include Compass::TestCaseHelper def setup - Compass.configuration.reset! + Compass.reset_configuration! end def teardown - teardown_fixtures :blueprint, :yui, :empty, :compass, :image_urls + teardown_fixtures :blueprint, :empty, :compass, :image_urls end def teardown_fixtures(*project_names) @@ -37,15 +37,6 @@ class CompassTest < Test::Unit::TestCase end end - def test_yui - within_project('yui') do |proj| - each_css_file(proj.css_path) do |css_file| - assert_no_errors css_file, 'yui' - end - assert_renders_correctly :mixins - end - end - def test_compass within_project('compass') do |proj| each_css_file(proj.css_path) do |css_file| @@ -90,7 +81,7 @@ private def within_project(project_name) @current_project = project_name - Compass.configuration.parse(configuration_file(project_name)) if File.exists?(configuration_file(project_name)) + Compass.add_configuration(configuration_file(project_name)) if File.exists?(configuration_file(project_name)) Compass.configuration.project_path = project_path(project_name) args = Compass.configuration.to_compiler_arguments(:logger => Compass::NullLogger.new) if Compass.configuration.sass_path && File.exists?(Compass.configuration.sass_path) @@ -138,4 +129,4 @@ private File.join(project_path(project_name), "saved") end -end \ No newline at end of file +end diff --git a/test/configuration_test.rb b/test/configuration_test.rb index 0191d9a6..08c872fa 100644 --- a/test/configuration_test.rb +++ b/test/configuration_test.rb @@ -1,71 +1,75 @@ -require File.dirname(__FILE__)+'/test_helper' +require 'test_helper' require 'compass' +require 'stringio' class ConfigurationTest < Test::Unit::TestCase + include Compass::IoHelper def setup - Compass.configuration.reset! + Compass.reset_configuration! end def test_parse_and_serialize - contents = <<-CONFIG + contents = StringIO.new(<<-CONFIG) require 'compass' # Require any additional compass plugins here. project_type = :stand_alone - # Set this to the root of your project when deployed: - http_path = "/" css_dir = "css" sass_dir = "sass" images_dir = "img" javascripts_dir = "js" + # Set this to the root of your project when deployed: + http_path = "/" output_style = :nested # To enable relative paths to assets via compass helper functions. Uncomment: # relative_assets = true CONFIG - Compass.configuration.parse_string(contents, "test_parse") + Compass.add_configuration(contents, "test_parse") assert_equal 'sass', Compass.configuration.sass_dir assert_equal 'css', Compass.configuration.css_dir assert_equal 'img', Compass.configuration.images_dir assert_equal 'js', Compass.configuration.javascripts_dir - expected_lines = contents.split("\n").map{|l|l.strip} + expected_lines = contents.string.split("\n").map{|l|l.strip} actual_lines = Compass.configuration.serialize.split("\n").map{|l|l.strip} assert_equal expected_lines, actual_lines end - def test_serialization_fails_with_asset_host_set - contents = <<-CONFIG + def test_serialization_warns_with_asset_host_set + contents = StringIO.new(<<-CONFIG) asset_host do |path| "http://example.com" end CONFIG - Compass.configuration.parse_string(contents, "test_serialization_fails_with_asset_host_set") + Compass.add_configuration(contents, "test_serialization_warns_with_asset_host_set") - assert_raise Compass::Error do + warning = capture_warning do Compass.configuration.serialize end + assert_equal "WARNING: asset_host is code and cannot be written to a file. You'll need to copy it yourself.\n", warning end - def test_serialization_fails_with_asset_cache_buster_set - contents = <<-CONFIG + def test_serialization_warns_with_asset_cache_buster_set + contents = StringIO.new(<<-CONFIG) asset_cache_buster do |path| "http://example.com" end CONFIG - Compass.configuration.parse_string(contents, "test_serialization_fails_with_asset_cache_buster_set") + Compass.add_configuration(contents, "test_serialization_warns_with_asset_cache_buster_set") - assert_raise Compass::Error do + warning = capture_warning do Compass.configuration.serialize end + assert_equal "WARNING: asset_cache_buster is code and cannot be written to a file. You'll need to copy it yourself.\n", warning end def test_additional_import_paths - contents = <<-CONFIG + contents = StringIO.new(<<-CONFIG) http_path = "/" project_path = "/home/chris/my_compass_project" css_dir = "css" @@ -73,7 +77,7 @@ class ConfigurationTest < Test::Unit::TestCase add_import_path "/path/to/my/framework" CONFIG - Compass.configuration.parse_string(contents, "test_additional_import_paths") + Compass.add_configuration(contents, "test_additional_import_paths") assert Compass.configuration.to_sass_engine_options[:load_paths].include?("/home/chris/my_compass_project/../foo") assert Compass.configuration.to_sass_engine_options[:load_paths].include?("/path/to/my/framework"), Compass.configuration.to_sass_engine_options[:load_paths].inspect @@ -83,23 +87,23 @@ class ConfigurationTest < Test::Unit::TestCase expected_serialization = < 'bar'} CONFIG - Compass.configuration.parse_string(contents, "test_sass_options") + Compass.add_configuration(contents, "test_sass_options") assert_equal 'bar', Compass.configuration.to_sass_engine_options[:foo] assert_equal 'bar', Compass.configuration.to_sass_plugin_options[:foo] @@ -107,6 +111,7 @@ EXPECTED expected_serialization = <"bar"} @@ -115,4 +120,4 @@ EXPECTED assert_equal expected_serialization, Compass.configuration.serialize end -end \ No newline at end of file +end diff --git a/test/fixtures/stylesheets/compass/css/layout.css b/test/fixtures/stylesheets/compass/css/layout.css index 95a69635..f461c7a0 100644 --- a/test/fixtures/stylesheets/compass/css/layout.css +++ b/test/fixtures/stylesheets/compass/css/layout.css @@ -3,6 +3,8 @@ html, body { #layout { min-height: 100%; + height: auto !important; + height: 100%; margin-bottom: -72px; } #layout #layout_footer { height: 72px; } diff --git a/test/fixtures/stylesheets/compass/css/reset.css b/test/fixtures/stylesheets/compass/css/reset.css index e778b379..2df6b411 100644 --- a/test/fixtures/stylesheets/compass/css/reset.css +++ b/test/fixtures/stylesheets/compass/css/reset.css @@ -21,7 +21,7 @@ table, caption, tbody, tfoot, thead, tr, th, td { body { line-height: 1em; - color: black; + color: #000; background: #fff; } ol, ul { @@ -43,7 +43,7 @@ q, blockquote { q:before, q:after, blockquote:before, blockquote:after { content: ""; } -img a { +a img { border: none; } .unregistered-only, .registered-only { @@ -57,4 +57,4 @@ body.registered address.registered-only, body.registered blockquote.registered-o body.unregistered a.unregistered-only, body.unregistered abbr.unregistered-only, body.unregistered acronym.unregistered-only, body.unregistered b.unregistered-only, body.unregistered basefont.unregistered-only, body.unregistered bdo.unregistered-only, body.unregistered big.unregistered-only, body.unregistered br.unregistered-only, body.unregistered cite.unregistered-only, body.unregistered code.unregistered-only, body.unregistered dfn.unregistered-only, body.unregistered em.unregistered-only, body.unregistered font.unregistered-only, body.unregistered i.unregistered-only, body.unregistered img.unregistered-only, body.unregistered input.unregistered-only, body.unregistered kbd.unregistered-only, body.unregistered label.unregistered-only, body.unregistered q.unregistered-only, body.unregistered s.unregistered-only, body.unregistered samp.unregistered-only, body.unregistered select.unregistered-only, body.unregistered small.unregistered-only, body.unregistered span.unregistered-only, body.unregistered strike.unregistered-only, body.unregistered strong.unregistered-only, body.unregistered sub.unregistered-only, body.unregistered sup.unregistered-only, body.unregistered textarea.unregistered-only, body.unregistered tt.unregistered-only, body.unregistered u.unregistered-only, body.unregistered var.unregistered-only { display: inline; } body.unregistered address.unregistered-only, body.unregistered blockquote.unregistered-only, body.unregistered center.unregistered-only, body.unregistered dir.unregistered-only, body.unregistered div.unregistered-only, body.unregistered dd.unregistered-only, body.unregistered dl.unregistered-only, body.unregistered dt.unregistered-only, body.unregistered fieldset.unregistered-only, body.unregistered form.unregistered-only, body.unregistered frameset.unregistered-only, body.unregistered h1.unregistered-only, body.unregistered h2.unregistered-only, body.unregistered h3.unregistered-only, body.unregistered h4.unregistered-only, body.unregistered h5.unregistered-only, body.unregistered h6.unregistered-only, body.unregistered hr.unregistered-only, body.unregistered isindex.unregistered-only, body.unregistered menu.unregistered-only, body.unregistered noframes.unregistered-only, body.unregistered noscript.unregistered-only, body.unregistered ol.unregistered-only, body.unregistered p.unregistered-only, body.unregistered pre.unregistered-only, body.unregistered ul.unregistered-only { - display: block; } \ No newline at end of file + display: block; } diff --git a/test/fixtures/stylesheets/yui/config.rb b/test/fixtures/stylesheets/yui/config.rb deleted file mode 100644 index 1b3ad842..00000000 --- a/test/fixtures/stylesheets/yui/config.rb +++ /dev/null @@ -1,9 +0,0 @@ -# Require any additional compass plugins here. -project_type = :stand_alone -css_dir = "tmp" -sass_dir = "sass" -images_dir = "images" -output_style = :nested -# To enable relative image paths using the images_url() function: -# http_images_path = :relative -http_images_path = "/images" diff --git a/test/fixtures/stylesheets/yui/css/mixins.css b/test/fixtures/stylesheets/yui/css/mixins.css deleted file mode 100644 index 7037c3ef..00000000 --- a/test/fixtures/stylesheets/yui/css/mixins.css +++ /dev/null @@ -1,13 +0,0 @@ -.font-size-26px { - font-size: 200%; } - -.font-size-baseline { - font-size: 300%; } - -.em-sizing { - width: 1em; - margin: 9em; } - -.em-sizing-hack { - width: 1em; - *width: 0.975em; } \ No newline at end of file diff --git a/test/fixtures/stylesheets/yui/sass/base.sass b/test/fixtures/stylesheets/yui/sass/base.sass deleted file mode 100644 index 8c0bc40b..00000000 --- a/test/fixtures/stylesheets/yui/sass/base.sass +++ /dev/null @@ -1,3 +0,0 @@ -@import yui/modules/base.sass - -+yui-base \ No newline at end of file diff --git a/test/fixtures/stylesheets/yui/sass/fonts.sass b/test/fixtures/stylesheets/yui/sass/fonts.sass deleted file mode 100644 index a73ec8e9..00000000 --- a/test/fixtures/stylesheets/yui/sass/fonts.sass +++ /dev/null @@ -1,3 +0,0 @@ -@import yui/modules/fonts.sass - -+yui-base-fonts \ No newline at end of file diff --git a/test/fixtures/stylesheets/yui/sass/grids.sass b/test/fixtures/stylesheets/yui/sass/grids.sass deleted file mode 100644 index e751fae8..00000000 --- a/test/fixtures/stylesheets/yui/sass/grids.sass +++ /dev/null @@ -1,3 +0,0 @@ -@import yui/modules/grids.sass - -+yui-grids \ No newline at end of file diff --git a/test/fixtures/stylesheets/yui/sass/mixins.sass b/test/fixtures/stylesheets/yui/sass/mixins.sass deleted file mode 100644 index d0dbea12..00000000 --- a/test/fixtures/stylesheets/yui/sass/mixins.sass +++ /dev/null @@ -1,16 +0,0 @@ -@import yui/modules/fonts.sass -@import yui/modules/grids.sass - -.font-size-26px - +font-size(26px) - -.font-size-baseline - +font-size(30px, 10px) - -.em-sizing - +em-size("width", 13px) - +em-size("margin", 99px, 11px) - -.em-sizing-hack - +em-size-hacked("width", 13px) - diff --git a/test/io_helper.rb b/test/io_helper.rb new file mode 100644 index 00000000..ee88380d --- /dev/null +++ b/test/io_helper.rb @@ -0,0 +1,36 @@ +module Compass + module IoHelper + def capture_output + real_stdout, $stdout = $stdout, StringIO.new + yield + $stdout.string + ensure + $stdout = real_stdout + end + + def capture_warning + real_stderr, $stderr = $stderr, StringIO.new + yield + $stderr.string + ensure + $stderr = real_stderr + end + + def capture_pipe(io, options = {}) + options[:wait] = 0.25 + options[:timeout] = 1.0 + output = "" + eof_at = nil + while !eof_at || (Time.now - eof_at < options[:wait]) + if io.eof? + eof_at ||= Time.now + sleep 0.1 + else + eof_at = nil + timeout(options[:timeout]) { output << io.readpartial(1024) } + end + end + output + end + end +end diff --git a/test/rails_helper.rb b/test/rails_helper.rb new file mode 100644 index 00000000..d8b47a17 --- /dev/null +++ b/test/rails_helper.rb @@ -0,0 +1,40 @@ +module Compass + module RailsHelper + def generate_rails_app_directories(name) + Dir.mkdir name + Dir.mkdir File.join(name, "config") + Dir.mkdir File.join(name, "config", "initializers") + end + + # Generate a rails application without polluting our current set of requires + # with the rails libraries. This will allow testing against multiple versions of rails + # by manipulating the load path. + def generate_rails_app(name) + if pid = fork + Process.wait(pid) + if $?.exitstatus == 2 + raise LoadError, "Couldn't load rails" + elsif $?.exitstatus != 0 + raise "Failed to generate rails application." + end + else + begin + require 'rails/version' + require 'rails_generator' + require 'rails_generator/scripts/generate' + Rails::Generator::Base.use_application_sources! + capture_output do + Rails::Generator::Base.logger = Rails::Generator::SimpleLogger.new $stdout + Rails::Generator::Scripts::Generate.new.run([name], :generator => 'app') + end + rescue LoadError + Kernel.exit!(2) + rescue => e + $stderr.puts e + Kernel.exit!(1) + end + Kernel.exit!(0) + end + end + end +end diff --git a/test/rails_integration_test.rb b/test/rails_integration_test.rb index df144c7a..a46fd2f1 100644 --- a/test/rails_integration_test.rb +++ b/test/rails_integration_test.rb @@ -1,4 +1,4 @@ -require File.join(File.dirname(__FILE__),'test_helper') +require 'test_helper' require 'fileutils' require 'compass' require 'compass/exec' @@ -7,9 +7,11 @@ require 'timeout' class RailsIntegrationTest < Test::Unit::TestCase include Compass::TestCaseHelper include Compass::CommandLineHelper + include Compass::IoHelper + include Compass::RailsHelper def setup - Compass.configuration.reset! + Compass.reset_configuration! end def test_rails_install @@ -17,8 +19,8 @@ class RailsIntegrationTest < Test::Unit::TestCase generate_rails_app_directories("compass_rails") Dir.chdir "compass_rails" do compass("--rails", '--trace', ".") do |responder| - responder.respond_to "Is this OK? (Y/n) ", :with => "Y", :required => true - responder.respond_to "Emit compiled stylesheets to public/stylesheets/compiled/? (Y/n) ", :with => "Y", :required => true + responder.respond_to "Is this OK? (Y/n)", :with => "Y", :required => true + responder.respond_to "Emit compiled stylesheets to public/stylesheets/compiled/? (Y/n)", :with => "Y", :required => true end # puts ">>>#{@last_result}<<<" assert_action_performed :create, "./app/stylesheets/screen.sass" @@ -41,43 +43,4 @@ class RailsIntegrationTest < Test::Unit::TestCase rescue LoadError puts "Skipping rails test. Couldn't Load rails" end - - - def generate_rails_app_directories(name) - Dir.mkdir name - Dir.mkdir File.join(name, "config") - Dir.mkdir File.join(name, "config", "initializers") - end - - # Generate a rails application without polluting our current set of requires - # with the rails libraries. This will allow testing against multiple versions of rails - # by manipulating the load path. - def generate_rails_app(name) - if pid = fork - Process.wait(pid) - if $?.exitstatus == 2 - raise LoadError, "Couldn't load rails" - elsif $?.exitstatus != 0 - raise "Failed to generate rails application." - end - else - begin - require 'rails/version' - require 'rails_generator' - require 'rails_generator/scripts/generate' - Rails::Generator::Base.use_application_sources! - capture_output do - Rails::Generator::Base.logger = Rails::Generator::SimpleLogger.new $stdout - Rails::Generator::Scripts::Generate.new.run([name], :generator => 'app') - end - rescue LoadError - Kernel.exit(2) - rescue => e - $stderr.puts e - Kernel.exit!(1) - end - Kernel.exit!(0) - end - end - -end \ No newline at end of file +end diff --git a/test/sass_extensions_test.rb b/test/sass_extensions_test.rb index 98136c9a..797e235c 100644 --- a/test/sass_extensions_test.rb +++ b/test/sass_extensions_test.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__)+'/test_helper' +require 'test_helper' class SassExtensionsTest < Test::Unit::TestCase def test_simple @@ -28,4 +28,4 @@ protected options = arguments.last.is_a?(Hash) ? arguments.pop : Hash.new evaluation_content(options).nest(*arguments.map{|a| Sass::Script::String.new(a)}).to_s end -end \ No newline at end of file +end diff --git a/test/test_helper.rb b/test/test_helper.rb index 30ee1245..e9e6ea28 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,5 +1,10 @@ need_gems = false +lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')) +$:.unshift(lib_dir) unless $:.include?(lib_dir) +test_dir = File.dirname(__FILE__) +$:.unshift(test_dir) unless $:.include?(test_dir) + # allows testing with edge Haml by creating a test/haml symlink linked_haml = File.dirname(__FILE__) + '/haml' @@ -17,5 +22,7 @@ require 'compass' require 'test/unit' -require File.join(File.dirname(__FILE__), 'test_case_helper') -require File.join(File.dirname(__FILE__), 'command_line_helper') +require 'test_case_helper' +require 'io_helper' +require 'rails_helper' +require 'command_line_helper'