compass 0.8.16
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.markdown +551 -0
- data/LICENSE.markdown +29 -0
- data/README.markdown +44 -0
- data/REVISION +1 -0
- data/Rakefile +127 -0
- data/VERSION.yml +4 -0
- data/bin/compass +8 -0
- data/deps.rip +1 -0
- data/examples/README.markdown +4 -0
- data/examples/blueprint_default/config.rb +7 -0
- data/examples/blueprint_default/images/grid.png +0 -0
- data/examples/blueprint_default/index.html.haml +85 -0
- data/examples/blueprint_default/parts/elements.html.haml +282 -0
- data/examples/blueprint_default/parts/forms.html.haml +190 -0
- data/examples/blueprint_default/parts/grid.html.haml +274 -0
- data/examples/blueprint_default/parts/test-small.jpg +0 -0
- data/examples/blueprint_default/parts/test.jpg +0 -0
- data/examples/blueprint_default/parts/valid.png +0 -0
- data/examples/blueprint_default/src/ie.sass +3 -0
- data/examples/blueprint_default/src/images/grid.png +0 -0
- data/examples/blueprint_default/src/print.sass +3 -0
- data/examples/blueprint_default/src/screen.sass +8 -0
- data/examples/blueprint_plugins/config.rb +8 -0
- data/examples/blueprint_plugins/images/buttons/cross.png +0 -0
- data/examples/blueprint_plugins/images/buttons/key.png +0 -0
- data/examples/blueprint_plugins/images/buttons/tick.png +0 -0
- data/examples/blueprint_plugins/images/grid.png +0 -0
- data/examples/blueprint_plugins/images/link_icons/doc.png +0 -0
- data/examples/blueprint_plugins/images/link_icons/email.png +0 -0
- data/examples/blueprint_plugins/images/link_icons/external.png +0 -0
- data/examples/blueprint_plugins/images/link_icons/feed.png +0 -0
- data/examples/blueprint_plugins/images/link_icons/im.png +0 -0
- data/examples/blueprint_plugins/images/link_icons/pdf.png +0 -0
- data/examples/blueprint_plugins/images/link_icons/visited.png +0 -0
- data/examples/blueprint_plugins/images/link_icons/xls.png +0 -0
- data/examples/blueprint_plugins/images/test-small.jpg +0 -0
- data/examples/blueprint_plugins/images/test.jpg +0 -0
- data/examples/blueprint_plugins/images/valid.png +0 -0
- data/examples/blueprint_plugins/index.html.haml +96 -0
- data/examples/blueprint_plugins/plugins/buttons.html.haml +67 -0
- data/examples/blueprint_plugins/plugins/fancy_type.html.haml +100 -0
- data/examples/blueprint_plugins/plugins/link_icons.html.haml +61 -0
- data/examples/blueprint_plugins/plugins/rtl.html.haml +100 -0
- data/examples/blueprint_plugins/src/buttons.sass +49 -0
- data/examples/blueprint_plugins/src/ie.sass +3 -0
- data/examples/blueprint_plugins/src/images/grid.png +0 -0
- data/examples/blueprint_plugins/src/link_icons.sass +13 -0
- data/examples/blueprint_plugins/src/print.sass +3 -0
- data/examples/blueprint_plugins/src/rtl_screen.sass +13 -0
- data/examples/blueprint_plugins/src/screen.sass +11 -0
- data/examples/blueprint_scoped/images/grid.png +0 -0
- data/examples/blueprint_scoped/src/ie.sass +3 -0
- data/examples/blueprint_scoped/src/print.sass +3 -0
- data/examples/blueprint_scoped/src/screen.sass +4 -0
- data/examples/blueprint_scoped_form/images/grid.png +0 -0
- data/examples/blueprint_scoped_form/src/ie.sass +3 -0
- data/examples/blueprint_scoped_form/src/print.sass +3 -0
- data/examples/blueprint_scoped_form/src/screen.sass +10 -0
- data/examples/blueprint_semantic/config.rb +7 -0
- data/examples/blueprint_semantic/images/grid.png +0 -0
- data/examples/blueprint_semantic/index.html.haml +86 -0
- data/examples/blueprint_semantic/parts/fancy_type.html.haml +100 -0
- data/examples/blueprint_semantic/parts/liquid.html.haml +100 -0
- data/examples/blueprint_semantic/parts/test-small.jpg +0 -0
- data/examples/blueprint_semantic/parts/test.jpg +0 -0
- data/examples/blueprint_semantic/parts/valid.png +0 -0
- data/examples/blueprint_semantic/src/ie.sass +3 -0
- data/examples/blueprint_semantic/src/images/grid.png +0 -0
- data/examples/blueprint_semantic/src/liquid.sass +70 -0
- data/examples/blueprint_semantic/src/print.sass +3 -0
- data/examples/blueprint_semantic/src/screen.sass +71 -0
- data/examples/compass/compass.html.haml +39 -0
- data/examples/compass/config.rb +7 -0
- data/examples/compass/images/blue_arrow.gif +0 -0
- data/examples/compass/src/compass.sass +47 -0
- data/examples/compass/src/images/blue_arrow.gif +0 -0
- data/examples/compass/src/sticky_footer.sass +11 -0
- data/examples/compass/src/utilities.sass +108 -0
- data/examples/compass/sticky_footer.html.haml +14 -0
- data/examples/compass/utilities.html.haml +189 -0
- data/examples/logo/logo.html.haml +40 -0
- data/examples/logo/src/ie.sass +6 -0
- data/examples/logo/src/print.sass +6 -0
- data/examples/logo/src/screen.sass +29 -0
- data/examples/yui/divisions.html.haml +179 -0
- data/examples/yui/index.html.haml +19 -0
- data/examples/yui/src/screen.sass +13 -0
- data/examples/yui/sub_divisions.html.haml +169 -0
- data/examples/yui/templates.html.haml +54 -0
- data/examples/yui/test.jpg +0 -0
- data/examples/yui/typography.html.haml +132 -0
- data/frameworks/blueprint.rb +2 -0
- data/frameworks/blueprint/stylesheets/_blueprint.sass +3 -0
- data/frameworks/blueprint/stylesheets/blueprint/_ie.sass +93 -0
- data/frameworks/blueprint/stylesheets/blueprint/_print.sass +83 -0
- data/frameworks/blueprint/stylesheets/blueprint/_reset.sass +3 -0
- data/frameworks/blueprint/stylesheets/blueprint/_screen.sass +15 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass +84 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass +33 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass +9 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass +82 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass +55 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass +178 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass +58 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass +44 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass +141 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass +56 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass +104 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass +47 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass +155 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass +37 -0
- data/frameworks/blueprint/templates/buttons/buttons.sass +49 -0
- data/frameworks/blueprint/templates/buttons/buttons/cross.png +0 -0
- data/frameworks/blueprint/templates/buttons/buttons/key.png +0 -0
- data/frameworks/blueprint/templates/buttons/buttons/tick.png +0 -0
- data/frameworks/blueprint/templates/buttons/manifest.rb +5 -0
- data/frameworks/blueprint/templates/link_icons/link_icons.sass +13 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/doc.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/email.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/external.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/feed.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/im.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/pdf.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/visited.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/xls.png +0 -0
- data/frameworks/blueprint/templates/link_icons/manifest.rb +10 -0
- data/frameworks/blueprint/templates/project/grid.png +0 -0
- data/frameworks/blueprint/templates/project/ie.sass +15 -0
- data/frameworks/blueprint/templates/project/manifest.rb +6 -0
- data/frameworks/blueprint/templates/project/partials/_base.sass +11 -0
- data/frameworks/blueprint/templates/project/print.sass +3 -0
- data/frameworks/blueprint/templates/project/screen.sass +40 -0
- data/frameworks/compass.rb +2 -0
- data/frameworks/compass/stylesheets/_compass.sass +1 -0
- data/frameworks/compass/stylesheets/compass/_layout.sass +1 -0
- data/frameworks/compass/stylesheets/compass/_misc.sass +24 -0
- data/frameworks/compass/stylesheets/compass/_reset.sass +3 -0
- data/frameworks/compass/stylesheets/compass/_utilities.sass +6 -0
- data/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass +17 -0
- data/frameworks/compass/stylesheets/compass/utilities/_general.sass +6 -0
- data/frameworks/compass/stylesheets/compass/utilities/_links.sass +3 -0
- data/frameworks/compass/stylesheets/compass/utilities/_lists.sass +3 -0
- data/frameworks/compass/stylesheets/compass/utilities/_print.sass +24 -0
- data/frameworks/compass/stylesheets/compass/utilities/_sprites.sass +1 -0
- data/frameworks/compass/stylesheets/compass/utilities/_tables.sass +3 -0
- data/frameworks/compass/stylesheets/compass/utilities/_text.sass +2 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass +24 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_float.sass +17 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_hacks.sass +6 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_inline_block.sass +6 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass +134 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_tabs.sass +0 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass +19 -0
- data/frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass +5 -0
- data/frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass +24 -0
- data/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass +5 -0
- data/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass +21 -0
- data/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass +52 -0
- data/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass +29 -0
- data/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass +12 -0
- data/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass +20 -0
- data/frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass +27 -0
- data/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass +9 -0
- data/frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.sass +13 -0
- data/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass +3 -0
- data/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass +17 -0
- data/frameworks/compass/templates/ellipsis/ellipsis.sass +6 -0
- data/frameworks/compass/templates/ellipsis/manifest.rb +2 -0
- data/frameworks/compass/templates/ellipsis/xml/ellipsis.xml +14 -0
- data/frameworks/compass/templates/project/ie.sass +6 -0
- data/frameworks/compass/templates/project/manifest.rb +3 -0
- data/frameworks/compass/templates/project/print.sass +6 -0
- data/frameworks/compass/templates/project/screen.sass +13 -0
- data/frameworks/yui.rb +2 -0
- data/frameworks/yui/stylesheets/_yui.sass +7 -0
- data/frameworks/yui/stylesheets/yui/modules/_base.sass +60 -0
- data/frameworks/yui/stylesheets/yui/modules/_fonts.sass +38 -0
- data/frameworks/yui/stylesheets/yui/modules/_grids.sass +341 -0
- data/frameworks/yui/stylesheets/yui/modules/_reset.sass +61 -0
- data/frameworks/yui/templates/project/manifest.rb +1 -0
- data/frameworks/yui/templates/project/screen.sass +4 -0
- data/lib/compass.rb +23 -0
- data/lib/compass/actions.rb +110 -0
- data/lib/compass/app_integration.rb +5 -0
- data/lib/compass/app_integration/merb.rb +43 -0
- data/lib/compass/app_integration/rails.rb +12 -0
- data/lib/compass/app_integration/rails/action_controller.rb +15 -0
- data/lib/compass/app_integration/rails/sass_plugin.rb +5 -0
- data/lib/compass/app_integration/rails/templates/compass-install-rails.rb +80 -0
- data/lib/compass/app_integration/rails/urls.rb +14 -0
- data/lib/compass/commands/base.rb +33 -0
- data/lib/compass/commands/create_project.rb +19 -0
- data/lib/compass/commands/generate_grid_background.rb +24 -0
- data/lib/compass/commands/installer_command.rb +31 -0
- data/lib/compass/commands/list_frameworks.rb +16 -0
- data/lib/compass/commands/print_version.rb +23 -0
- data/lib/compass/commands/project_base.rb +112 -0
- data/lib/compass/commands/stamp_pattern.rb +33 -0
- data/lib/compass/commands/update_project.rb +34 -0
- data/lib/compass/commands/validate_project.rb +21 -0
- data/lib/compass/commands/watch_project.rb +64 -0
- data/lib/compass/commands/write_configuration.rb +28 -0
- data/lib/compass/compiler.rb +54 -0
- data/lib/compass/configuration.rb +324 -0
- data/lib/compass/core_ext.rb +14 -0
- data/lib/compass/dependencies.rb +10 -0
- data/lib/compass/errors.rb +7 -0
- data/lib/compass/exec.rb +251 -0
- data/lib/compass/frameworks.rb +29 -0
- data/lib/compass/grid_builder.rb +72 -0
- data/lib/compass/installers.rb +5 -0
- data/lib/compass/installers/base.rb +158 -0
- data/lib/compass/installers/manifest.rb +58 -0
- data/lib/compass/installers/rails.rb +135 -0
- data/lib/compass/installers/stand_alone.rb +60 -0
- data/lib/compass/logger.rb +42 -0
- data/lib/compass/sass_extensions.rb +5 -0
- data/lib/compass/sass_extensions/functions.rb +19 -0
- data/lib/compass/sass_extensions/functions/display.rb +22 -0
- data/lib/compass/sass_extensions/functions/enumerate.rb +6 -0
- data/lib/compass/sass_extensions/functions/inline_image.rb +35 -0
- data/lib/compass/sass_extensions/functions/selectors.rb +39 -0
- data/lib/compass/sass_extensions/functions/urls.rb +105 -0
- data/lib/compass/sass_extensions/monkey_patches.rb +3 -0
- data/lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb +23 -0
- data/lib/compass/test_case.rb +38 -0
- data/lib/compass/validator.rb +10 -0
- data/lib/compass/version.rb +57 -0
- data/lib/vendor/fssm.rb +41 -0
- data/lib/vendor/fssm/backends/fsevents.rb +37 -0
- data/lib/vendor/fssm/backends/polling.rb +26 -0
- data/lib/vendor/fssm/cache.rb +193 -0
- data/lib/vendor/fssm/ext.rb +37 -0
- data/lib/vendor/fssm/fsevents.rb +129 -0
- data/lib/vendor/fssm/monitor.rb +25 -0
- data/lib/vendor/fssm/path.rb +91 -0
- data/lib/vendor/fssm/state.rb +54 -0
- data/lib/vendor/fssm/support.rb +22 -0
- data/lib/vendor/fssm/tree.rb +176 -0
- data/test/command_line_helper.rb +102 -0
- data/test/command_line_test.rb +66 -0
- data/test/compass_test.rb +141 -0
- data/test/configuration_test.rb +118 -0
- data/test/fixtures/stylesheets/blueprint/config.rb +9 -0
- data/test/fixtures/stylesheets/blueprint/css/typography.css +158 -0
- data/test/fixtures/stylesheets/blueprint/images/grid.png +0 -0
- data/test/fixtures/stylesheets/blueprint/sass/ie.sass +3 -0
- data/test/fixtures/stylesheets/blueprint/sass/print.sass +3 -0
- data/test/fixtures/stylesheets/blueprint/sass/screen.sass +17 -0
- data/test/fixtures/stylesheets/blueprint/sass/typography.sass +3 -0
- data/test/fixtures/stylesheets/compass/config.rb +9 -0
- data/test/fixtures/stylesheets/compass/css/layout.css +13 -0
- data/test/fixtures/stylesheets/compass/css/print.css +18 -0
- data/test/fixtures/stylesheets/compass/css/reset.css +60 -0
- data/test/fixtures/stylesheets/compass/css/utilities.css +17 -0
- data/test/fixtures/stylesheets/compass/sass/layout.sass +3 -0
- data/test/fixtures/stylesheets/compass/sass/print.sass +5 -0
- data/test/fixtures/stylesheets/compass/sass/reset.sass +10 -0
- data/test/fixtures/stylesheets/compass/sass/utilities.sass +6 -0
- data/test/fixtures/stylesheets/image_urls/config.rb +17 -0
- data/test/fixtures/stylesheets/image_urls/css/screen.css +3 -0
- data/test/fixtures/stylesheets/image_urls/images/grid.png +0 -0
- data/test/fixtures/stylesheets/image_urls/sass/screen.sass +6 -0
- data/test/fixtures/stylesheets/yui/config.rb +9 -0
- data/test/fixtures/stylesheets/yui/css/mixins.css +13 -0
- data/test/fixtures/stylesheets/yui/sass/base.sass +3 -0
- data/test/fixtures/stylesheets/yui/sass/fonts.sass +3 -0
- data/test/fixtures/stylesheets/yui/sass/grids.sass +3 -0
- data/test/fixtures/stylesheets/yui/sass/mixins.sass +16 -0
- data/test/rails_integration_test.rb +83 -0
- data/test/sass_extensions_test.rb +31 -0
- data/test/test_case_helper.rb +13 -0
- data/test/test_helper.rb +21 -0
- data/test/test_rails_helper.rb +20 -0
- metadata +372 -0
@@ -0,0 +1,5 @@
|
|
1
|
+
# If we're running inside Rails
|
2
|
+
require File.join(File.dirname(__FILE__), 'app_integration', 'rails') if defined?(ActionController::Base)
|
3
|
+
|
4
|
+
# If we're running inside Merb
|
5
|
+
require File.join(File.dirname(__FILE__), 'app_integration', 'merb') if defined?(Merb::Plugins)
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# To configure Merb to use compass do the following:
|
2
|
+
# Merb::BootLoader.after_app_loads do
|
3
|
+
# require 'merb-haml'
|
4
|
+
# require 'compass'
|
5
|
+
# end
|
6
|
+
#
|
7
|
+
# To use a different sass stylesheets locations as is recommended by compass
|
8
|
+
# add this configuration to your configuration block:
|
9
|
+
#
|
10
|
+
# Merb::Config.use do |c|
|
11
|
+
# c[:compass] = {
|
12
|
+
# :stylesheets => 'app/stylesheets',
|
13
|
+
# :compiled_stylesheets => 'public/stylesheets/compiled'
|
14
|
+
# }
|
15
|
+
# end
|
16
|
+
|
17
|
+
Merb::BootLoader.after_app_loads do
|
18
|
+
#set up sass if haml load didn't do it -- this happens when using a non-default stylesheet location.
|
19
|
+
unless defined?(Sass::Plugin)
|
20
|
+
require "sass/plugin"
|
21
|
+
Sass::Plugin.options = Merb::Config[:sass] if Merb::Config[:sass]
|
22
|
+
end
|
23
|
+
|
24
|
+
# default the compass configuration if they didn't set it up yet.
|
25
|
+
Merb::Config[:compass] ||= {}
|
26
|
+
|
27
|
+
# default sass stylesheet location unless configured to something else
|
28
|
+
Merb::Config[:compass][:stylesheets] ||= Merb.dir_for(:stylesheet) / "sass"
|
29
|
+
|
30
|
+
# default sass css location unless configured to something else
|
31
|
+
Merb::Config[:compass][:compiled_stylesheets] ||= Merb.dir_for(:stylesheet)
|
32
|
+
|
33
|
+
#define the template hash for the project stylesheets as well as the framework stylesheets.
|
34
|
+
template_location = {
|
35
|
+
Merb::Config[:compass][:stylesheets] => Merb::Config[:compass][:compiled_stylesheets]
|
36
|
+
}
|
37
|
+
Compass::Frameworks::ALL.each do |framework|
|
38
|
+
template_location[framework.stylesheets_directory] = Merb::Config[:compass][:compiled_stylesheets]
|
39
|
+
end
|
40
|
+
|
41
|
+
#configure Sass to know about all these sass locations.
|
42
|
+
Sass::Plugin.options[:template_location] = template_location
|
43
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
unless defined?(Compass::RAILS_LOADED)
|
2
|
+
Compass::RAILS_LOADED = true
|
3
|
+
require File.join(File.dirname(__FILE__), 'rails', 'action_controller')
|
4
|
+
require File.join(File.dirname(__FILE__), 'rails', 'sass_plugin')
|
5
|
+
require File.join(File.dirname(__FILE__), 'rails', 'urls')
|
6
|
+
# Wierd that this has to be re-included to pick up sub-modules. Ruby bug?
|
7
|
+
class Sass::Script::Functions::EvaluationContext
|
8
|
+
include Sass::Script::Functions
|
9
|
+
private
|
10
|
+
include ActionView::Helpers::AssetTagHelper
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# :stopdoc:
|
2
|
+
module ActionController
|
3
|
+
class Base
|
4
|
+
def process_with_compass(*args)
|
5
|
+
Sass::Plugin.rails_controller = self
|
6
|
+
begin
|
7
|
+
process_without_compass(*args)
|
8
|
+
ensure
|
9
|
+
Sass::Plugin.rails_controller = nil
|
10
|
+
end
|
11
|
+
end
|
12
|
+
alias_method_chain :process, :compass
|
13
|
+
end
|
14
|
+
end
|
15
|
+
# :startdoc:
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# =================================================================
|
2
|
+
# Compass Ruby on Rails Installer (template) v.1.0
|
3
|
+
# written by Derek Perez (derek@derekperez.com)
|
4
|
+
# -----------------------------------------------------------------
|
5
|
+
# NOTE: This installer is designed to work as a Rails template,
|
6
|
+
# and can only be used with Rails 2.3+.
|
7
|
+
# -----------------------------------------------------------------
|
8
|
+
# Copyright (c) 2009 Derek Perez
|
9
|
+
#
|
10
|
+
# Permission is hereby granted, free of charge, to any person
|
11
|
+
# obtaining a copy of this software and associated documentation
|
12
|
+
# files (the "Software"), to deal in the Software without
|
13
|
+
# restriction, including without limitation the rights to use,
|
14
|
+
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
15
|
+
# copies of the Software, and to permit persons to whom the
|
16
|
+
# Software is furnished to do so, subject to the following
|
17
|
+
# conditions:
|
18
|
+
#
|
19
|
+
# The above copyright notice and this permission notice shall be
|
20
|
+
# included in all copies or substantial portions of the Software.
|
21
|
+
#
|
22
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
23
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
24
|
+
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
25
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
26
|
+
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
27
|
+
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
28
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
29
|
+
# OTHER DEALINGS IN THE SOFTWARE.
|
30
|
+
# =================================================================
|
31
|
+
puts "==================================================="
|
32
|
+
puts "Welcome to the Compass Installer for Ruby on Rails!"
|
33
|
+
puts "==================================================="
|
34
|
+
puts
|
35
|
+
|
36
|
+
# css framework prompt
|
37
|
+
css_framework = ask("What CSS Framework do you want to use with Compass? (default: 'blueprint')")
|
38
|
+
css_framework = "blueprint" if css_framework.blank?
|
39
|
+
|
40
|
+
# sass storage prompt
|
41
|
+
sass_dir = ask("Where would you like to keep your sass files within your project? (default: 'app/stylesheets')")
|
42
|
+
sass_dir = "app/stylesheets" if sass_dir.blank?
|
43
|
+
|
44
|
+
# compiled css storage prompt
|
45
|
+
css_dir = ask("Where would you like Compass to store your compiled css files? (default: 'public/stylesheets/compiled')")
|
46
|
+
css_dir = "public/stylesheets/compiled" if css_dir.blank?
|
47
|
+
|
48
|
+
# define dependencies
|
49
|
+
gem "haml", :lib => "haml", :version => ">=2.2.0"
|
50
|
+
gem "chriseppstein-compass", :source => "http://gems.github.com/", :lib => "compass"
|
51
|
+
|
52
|
+
# install and unpack
|
53
|
+
rake "gems:install GEM=haml", :sudo => true
|
54
|
+
rake "gems:install GEM=chriseppstein-compass", :sudo => true
|
55
|
+
rake "gems:unpack GEM=chriseppstein-compass"
|
56
|
+
|
57
|
+
# load any compass framework plugins
|
58
|
+
if css_framework =~ /960/
|
59
|
+
gem "chriseppstein-compass-960-plugin", :source => "http://gems.github.com", :lib => "ninesixty"
|
60
|
+
rake "gems:install GEM=chriseppstein-compass-960-plugin", :sudo => true
|
61
|
+
rake "gems:unpack GEM=chriseppstein-compass-960-plugin"
|
62
|
+
css_framework = "960" # rename for command
|
63
|
+
plugin_require = "-r ninesixty"
|
64
|
+
end
|
65
|
+
|
66
|
+
# build out compass command
|
67
|
+
compass_command = "compass --rails -f #{css_framework} . --css-dir=#{css_dir} --sass-dir=#{sass_dir} "
|
68
|
+
compass_command << plugin_require if plugin_require
|
69
|
+
|
70
|
+
# Require compass during plugin loading
|
71
|
+
file 'vendor/plugins/compass/init.rb', <<-CODE
|
72
|
+
# This is here to make sure that the right version of sass gets loaded (haml 2.2) by the compass requires.
|
73
|
+
require 'compass'
|
74
|
+
CODE
|
75
|
+
|
76
|
+
# integrate it!
|
77
|
+
run "haml --rails ."
|
78
|
+
run compass_command
|
79
|
+
|
80
|
+
puts "Compass (with #{css_framework}) is all setup, have fun!"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Compass::SassExtensions::Functions::Urls
|
2
|
+
def image_url_with_rails_integration(path)
|
3
|
+
if (@controller = Sass::Plugin.rails_controller) && @controller.respond_to?(:request) && @controller.request
|
4
|
+
begin
|
5
|
+
Sass::Script::String.new "url(#{image_path(path.value)})"
|
6
|
+
ensure
|
7
|
+
@controller = nil
|
8
|
+
end
|
9
|
+
else
|
10
|
+
image_url_without_rails_integration(path)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
alias_method_chain :image_url, :rails_integration
|
14
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Compass
|
2
|
+
module Commands
|
3
|
+
class Base
|
4
|
+
|
5
|
+
include Actions
|
6
|
+
|
7
|
+
attr_accessor :working_path, :options
|
8
|
+
|
9
|
+
def initialize(working_path, options)
|
10
|
+
self.working_path = working_path
|
11
|
+
self.options = options
|
12
|
+
end
|
13
|
+
|
14
|
+
def execute
|
15
|
+
perform
|
16
|
+
end
|
17
|
+
|
18
|
+
def perform
|
19
|
+
raise StandardError.new("Not Implemented")
|
20
|
+
end
|
21
|
+
|
22
|
+
protected
|
23
|
+
|
24
|
+
def framework
|
25
|
+
unless Compass::Frameworks[options[:framework]]
|
26
|
+
raise Compass::Error.new("No such framework: #{options[:framework].inspect}")
|
27
|
+
end
|
28
|
+
Compass::Frameworks[options[:framework]]
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require File.join(File.dirname(__FILE__), 'stamp_pattern')
|
3
|
+
require File.join(File.dirname(__FILE__), 'update_project')
|
4
|
+
|
5
|
+
module Compass
|
6
|
+
module Commands
|
7
|
+
class CreateProject < StampPattern
|
8
|
+
|
9
|
+
def initialize(working_path, options)
|
10
|
+
super(working_path, options.merge(:pattern => "project", :pattern_name => nil))
|
11
|
+
end
|
12
|
+
|
13
|
+
def is_project_creation?
|
14
|
+
true
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'project_base')
|
2
|
+
require File.join(File.dirname(__FILE__), 'update_project')
|
3
|
+
require File.join(File.dirname(__FILE__), '..', 'grid_builder')
|
4
|
+
|
5
|
+
module Compass
|
6
|
+
module Commands
|
7
|
+
class GenerateGridBackground < ProjectBase
|
8
|
+
include Actions
|
9
|
+
def initialize(working_path, options)
|
10
|
+
super
|
11
|
+
assert_project_directory_exists!
|
12
|
+
end
|
13
|
+
|
14
|
+
def perform
|
15
|
+
column_width, gutter_width = options[:grid_dimensions].split(/\+/).map{|d| d.to_i}
|
16
|
+
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!
|
17
|
+
puts "ERROR: Some library dependencies appear to be missing."
|
18
|
+
puts "Have you installed rmagick? If not, please run:"
|
19
|
+
puts "sudo gem install rmagick"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.join(Compass.lib_directory, 'compass', 'installers')
|
2
|
+
|
3
|
+
module Compass
|
4
|
+
module Commands
|
5
|
+
module InstallerCommand
|
6
|
+
include Compass::Installers
|
7
|
+
|
8
|
+
def configure!
|
9
|
+
read_project_configuration
|
10
|
+
Compass.configuration.set_maybe(options)
|
11
|
+
Compass.configuration.default_all(installer.configuration_defaults)
|
12
|
+
Compass.configuration.set_defaults!
|
13
|
+
end
|
14
|
+
|
15
|
+
def installer
|
16
|
+
@installer ||= case options[:project_type]
|
17
|
+
when :stand_alone
|
18
|
+
StandAloneInstaller.new *installer_args
|
19
|
+
when :rails
|
20
|
+
RailsInstaller.new *installer_args
|
21
|
+
else
|
22
|
+
raise "Unknown project type: #{options[:project_type].inspect}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def installer_args
|
27
|
+
[template_directory(options[:pattern]), project_directory, options]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Compass
|
2
|
+
module Commands
|
3
|
+
class ListFrameworks
|
4
|
+
attr_accessor :options
|
5
|
+
def initialize(working_path, options)
|
6
|
+
self.options = options
|
7
|
+
end
|
8
|
+
|
9
|
+
def execute
|
10
|
+
Compass::Frameworks::ALL.each do |framework|
|
11
|
+
puts framework.name
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Compass
|
2
|
+
module Commands
|
3
|
+
class PrintVersion
|
4
|
+
attr_accessor :options
|
5
|
+
def initialize(working_path, options)
|
6
|
+
self.options = options
|
7
|
+
end
|
8
|
+
|
9
|
+
def execute
|
10
|
+
if options[:quiet]
|
11
|
+
# The quiet option may make scripting easier
|
12
|
+
puts ::Compass.version[:string]
|
13
|
+
else
|
14
|
+
lines = []
|
15
|
+
lines << "Compass #{::Compass.version[:string]}"
|
16
|
+
lines << "Copyright (c) 2008-2009 Chris Eppstein"
|
17
|
+
lines << "Released under the MIT License."
|
18
|
+
puts lines.join("\n")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'pathname'
|
3
|
+
require File.join(File.dirname(__FILE__), 'base')
|
4
|
+
require File.join(File.dirname(__FILE__), 'installer_command')
|
5
|
+
|
6
|
+
module Compass
|
7
|
+
module Commands
|
8
|
+
class ProjectBase < Base
|
9
|
+
attr_accessor :project_directory, :project_name, :options
|
10
|
+
|
11
|
+
def initialize(working_path, options = {})
|
12
|
+
super(working_path, options)
|
13
|
+
self.project_name = determine_project_name(working_path, options)
|
14
|
+
Compass.configuration.project_path = determine_project_directory(working_path, options)
|
15
|
+
end
|
16
|
+
|
17
|
+
def execute
|
18
|
+
configure!
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
protected
|
23
|
+
|
24
|
+
def configure!
|
25
|
+
read_project_configuration
|
26
|
+
Compass.configuration.set_maybe(options)
|
27
|
+
Compass.configuration.set_defaults!
|
28
|
+
end
|
29
|
+
|
30
|
+
def projectize(path)
|
31
|
+
File.join(project_directory, separate(path))
|
32
|
+
end
|
33
|
+
|
34
|
+
def project_directory
|
35
|
+
Compass.configuration.project_path
|
36
|
+
end
|
37
|
+
|
38
|
+
def project_css_subdirectory
|
39
|
+
Compass.configuration.css_dir
|
40
|
+
end
|
41
|
+
|
42
|
+
def project_src_subdirectory
|
43
|
+
Compass.configuration.sass_dir
|
44
|
+
end
|
45
|
+
|
46
|
+
def project_images_subdirectory
|
47
|
+
Compass.configuration.images_dir
|
48
|
+
end
|
49
|
+
|
50
|
+
# Read the configuration file for this project
|
51
|
+
def read_project_configuration
|
52
|
+
if file = detect_configuration_file
|
53
|
+
Compass.configuration.parse(file) if File.readable?(file)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def explicit_config_file_must_be_readable?
|
58
|
+
true
|
59
|
+
end
|
60
|
+
|
61
|
+
# TODO: Deprecate the src/config.rb location.
|
62
|
+
KNOWN_CONFIG_LOCATIONS = [".compass/config.rb", "config/compass.config", "config.rb", "src/config.rb"]
|
63
|
+
|
64
|
+
# Finds the configuration file, if it exists in a known location.
|
65
|
+
def detect_configuration_file
|
66
|
+
if options[:configuration_file]
|
67
|
+
if explicit_config_file_must_be_readable? && !File.readable?(options[:configuration_file])
|
68
|
+
raise Compass::Error, "Configuration file, #{file}, not found or not readable."
|
69
|
+
end
|
70
|
+
return options[:configuration_file]
|
71
|
+
end
|
72
|
+
KNOWN_CONFIG_LOCATIONS.map{|f| projectize(f)}.detect{|f| File.exists?(f)}
|
73
|
+
end
|
74
|
+
|
75
|
+
def assert_project_directory_exists!
|
76
|
+
if File.exists?(project_directory) && !File.directory?(project_directory)
|
77
|
+
raise Compass::FilesystemConflict.new("#{project_directory} is not a directory.")
|
78
|
+
elsif !File.directory?(project_directory)
|
79
|
+
raise Compass::Error.new("#{project_directory} does not exist.")
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
private
|
84
|
+
|
85
|
+
def determine_project_name(working_path, options)
|
86
|
+
if options[:project_name]
|
87
|
+
File.basename(strip_trailing_separator(options[:project_name]))
|
88
|
+
else
|
89
|
+
File.basename(working_path)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def determine_project_directory(working_path, options)
|
94
|
+
if options[:project_name]
|
95
|
+
if absolute_path?(options[:project_name])
|
96
|
+
options[:project_name]
|
97
|
+
else
|
98
|
+
File.join(working_path, options[:project_name])
|
99
|
+
end
|
100
|
+
else
|
101
|
+
working_path
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def absolute_path?(path)
|
106
|
+
# This is only going to work on unix, gonna need a better implementation.
|
107
|
+
path.index(File::SEPARATOR) == 0
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|