compass-edge 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.markdown +528 -0
- data/LICENSE.markdown +29 -0
- data/README.markdown +46 -0
- data/REVISION +1 -0
- data/Rakefile +131 -0
- data/VERSION.yml +4 -0
- data/bin/compass +26 -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 +4 -0
- data/examples/blueprint_scoped/src/print.sass +4 -0
- data/examples/blueprint_scoped/src/screen.sass +5 -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 +69 -0
- data/examples/blueprint_semantic/src/print.sass +3 -0
- data/examples/blueprint_semantic/src/screen.sass +70 -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/downloader.rb +57 -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/ninesixty/bootstrap.rb +4 -0
- data/examples/ninesixty/config.rb +9 -0
- data/examples/ninesixty/extensions/ninesixty/README.mkdn +56 -0
- data/examples/ninesixty/extensions/ninesixty/compass-960-plugin.gemspec +36 -0
- data/examples/ninesixty/extensions/ninesixty/lib/ninesixty.rb +1 -0
- data/examples/ninesixty/extensions/ninesixty/lib/ninesixty/compass_plugin.rb +5 -0
- data/examples/ninesixty/extensions/ninesixty/sass/960/_grid.sass +64 -0
- data/examples/ninesixty/extensions/ninesixty/sass/960/_text.sass +59 -0
- data/examples/ninesixty/extensions/ninesixty/templates/project/grid.sass +34 -0
- data/examples/ninesixty/extensions/ninesixty/templates/project/manifest.rb +2 -0
- data/examples/ninesixty/extensions/ninesixty/templates/project/text.sass +10 -0
- data/examples/ninesixty/src/grid.sass +16 -0
- data/examples/ninesixty/src/text.sass +10 -0
- data/examples/yui/bootstrap.rb +3 -0
- data/examples/yui/divisions.html.haml +179 -0
- data/examples/yui/extensions/yui/stylesheets/_yui.sass +7 -0
- data/examples/yui/extensions/yui/stylesheets/yui/modules/_base.sass +70 -0
- data/examples/yui/extensions/yui/stylesheets/yui/modules/_fonts.sass +45 -0
- data/examples/yui/extensions/yui/stylesheets/yui/modules/_grids.sass +385 -0
- data/examples/yui/extensions/yui/stylesheets/yui/modules/_reset.sass +61 -0
- data/examples/yui/extensions/yui/templates/project/manifest.rb +1 -0
- data/examples/yui/extensions/yui/templates/project/screen.sass +4 -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/lib/compass.rb +22 -0
- data/lib/compass/actions.rb +116 -0
- data/lib/compass/app_integration.rb +3 -0
- data/lib/compass/app_integration/merb.rb +1 -0
- data/lib/compass/app_integration/merb/runtime.rb +63 -0
- data/lib/compass/app_integration/rails.rb +8 -0
- data/lib/compass/app_integration/rails/action_controller.rb +15 -0
- data/lib/compass/app_integration/rails/configuration_defaults.rb +29 -0
- data/lib/compass/app_integration/rails/installer.rb +127 -0
- data/lib/compass/app_integration/rails/runtime.rb +14 -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/app_integration/stand_alone.rb +3 -0
- data/lib/compass/app_integration/stand_alone/configuration_defaults.rb +24 -0
- data/lib/compass/app_integration/stand_alone/installer.rb +71 -0
- data/lib/compass/commands.rb +11 -0
- data/lib/compass/commands/base.rb +36 -0
- data/lib/compass/commands/create_project.rb +113 -0
- data/lib/compass/commands/generate_grid_background.rb +91 -0
- data/lib/compass/commands/help.rb +62 -0
- data/lib/compass/commands/installer_command.rb +34 -0
- data/lib/compass/commands/list_frameworks.rb +16 -0
- data/lib/compass/commands/print_version.rb +91 -0
- data/lib/compass/commands/project_base.rb +92 -0
- data/lib/compass/commands/registry.rb +22 -0
- data/lib/compass/commands/stamp_pattern.rb +86 -0
- data/lib/compass/commands/update_project.rb +38 -0
- data/lib/compass/commands/validate_project.rb +21 -0
- data/lib/compass/commands/watch_project.rb +69 -0
- data/lib/compass/commands/write_configuration.rb +32 -0
- data/lib/compass/compiler.rb +54 -0
- data/lib/compass/configuration.rb +38 -0
- data/lib/compass/configuration/adapters.rb +59 -0
- data/lib/compass/configuration/comments.rb +22 -0
- data/lib/compass/configuration/data.rb +103 -0
- data/lib/compass/configuration/defaults.rb +107 -0
- data/lib/compass/configuration/helpers.rb +83 -0
- data/lib/compass/configuration/inheritance.rb +170 -0
- data/lib/compass/configuration/serialization.rb +86 -0
- data/lib/compass/core_ext.rb +14 -0
- data/lib/compass/dependencies.rb +6 -0
- data/lib/compass/errors.rb +7 -0
- data/lib/compass/exec.rb +15 -0
- data/lib/compass/exec/command_option_parser.rb +23 -0
- data/lib/compass/exec/global_options_parser.rb +37 -0
- data/lib/compass/exec/helpers.rb +28 -0
- data/lib/compass/exec/project_options_parser.rb +42 -0
- data/lib/compass/exec/sub_command_ui.rb +45 -0
- data/lib/compass/exec/switch_ui.rb +166 -0
- data/lib/compass/frameworks.rb +53 -0
- data/lib/compass/frameworks/blueprint/stylesheets/_blueprint.sass +3 -0
- data/lib/compass/frameworks/blueprint/stylesheets/blueprint/_ie.sass +99 -0
- data/lib/compass/frameworks/blueprint/stylesheets/blueprint/_print.sass +90 -0
- data/lib/compass/frameworks/blueprint/stylesheets/blueprint/_reset.sass +3 -0
- data/lib/compass/frameworks/blueprint/stylesheets/blueprint/_screen.sass +29 -0
- data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass +84 -0
- data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass +33 -0
- data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass +9 -0
- data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass +82 -0
- data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass +55 -0
- data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass +178 -0
- data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass +58 -0
- data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass +44 -0
- data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass +141 -0
- data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass +56 -0
- data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass +122 -0
- data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass +47 -0
- data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass +160 -0
- data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass +37 -0
- data/lib/compass/frameworks/blueprint/templates/buttons/buttons.sass +49 -0
- data/lib/compass/frameworks/blueprint/templates/buttons/buttons/cross.png +0 -0
- data/lib/compass/frameworks/blueprint/templates/buttons/buttons/key.png +0 -0
- data/lib/compass/frameworks/blueprint/templates/buttons/buttons/tick.png +0 -0
- data/lib/compass/frameworks/blueprint/templates/buttons/manifest.rb +5 -0
- data/lib/compass/frameworks/blueprint/templates/link_icons/link_icons.sass +13 -0
- data/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/doc.png +0 -0
- data/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/email.png +0 -0
- data/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/external.png +0 -0
- data/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/feed.png +0 -0
- data/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/im.png +0 -0
- data/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/pdf.png +0 -0
- data/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/visited.png +0 -0
- data/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/xls.png +0 -0
- data/lib/compass/frameworks/blueprint/templates/link_icons/manifest.rb +10 -0
- data/lib/compass/frameworks/blueprint/templates/project/grid.png +0 -0
- data/lib/compass/frameworks/blueprint/templates/project/ie.sass +16 -0
- data/lib/compass/frameworks/blueprint/templates/project/manifest.rb +8 -0
- data/lib/compass/frameworks/blueprint/templates/project/partials/_base.sass +11 -0
- data/lib/compass/frameworks/blueprint/templates/project/print.sass +8 -0
- data/lib/compass/frameworks/blueprint/templates/project/screen.sass +47 -0
- data/lib/compass/frameworks/blueprint/templates/project/welcome.html.haml +13 -0
- data/lib/compass/frameworks/compass/stylesheets/_compass.sass +1 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/_layout.sass +1 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/_misc.sass +24 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/_reset.sass +3 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/_utilities.sass +7 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass +19 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/_css3.sass +6 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/_general.sass +5 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/_links.sass +3 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/_lists.sass +3 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/_print.sass +18 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/_sprites.sass +1 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/_tables.sass +3 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/_text.sass +2 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_border_radius.sass +47 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_box_shadow.sass +12 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_box_sizing.sass +13 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_columns.sass +37 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_inline_block.sass +7 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_opacity.sass +18 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass +24 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_float.sass +17 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_hacks.sass +6 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass +134 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_tabs.sass +0 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass +19 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass +5 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass +24 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass +7 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass +21 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass +52 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass +29 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass +52 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass +20 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass +27 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass +9 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.sass +13 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass +3 -0
- data/lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass +17 -0
- data/lib/compass/frameworks/compass/templates/ellipsis/ellipsis.sass +6 -0
- data/lib/compass/frameworks/compass/templates/ellipsis/manifest.rb +2 -0
- data/lib/compass/frameworks/compass/templates/ellipsis/xml/ellipsis.xml +14 -0
- data/lib/compass/frameworks/compass/templates/extension/manifest.rb +6 -0
- data/lib/compass/frameworks/compass/templates/extension/stylesheets/main.sass +1 -0
- data/lib/compass/frameworks/compass/templates/extension/templates/project/manifest.rb +2 -0
- data/lib/compass/frameworks/compass/templates/extension/templates/project/screen.sass +2 -0
- data/lib/compass/frameworks/compass/templates/project/ie.sass +6 -0
- data/lib/compass/frameworks/compass/templates/project/manifest.rb +3 -0
- data/lib/compass/frameworks/compass/templates/project/print.sass +6 -0
- data/lib/compass/frameworks/compass/templates/project/screen.sass +13 -0
- data/lib/compass/grid_builder.rb +76 -0
- data/lib/compass/installers.rb +3 -0
- data/lib/compass/installers/base.rb +186 -0
- data/lib/compass/installers/manifest.rb +79 -0
- data/lib/compass/installers/template_context.rb +44 -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 +42 -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 +28 -0
- data/lib/vendor/fssm/backends/fsevents.rb +78 -0
- data/lib/vendor/fssm/backends/polling.rb +24 -0
- data/lib/vendor/fssm/ext.rb +7 -0
- data/lib/vendor/fssm/monitor.rb +21 -0
- data/lib/vendor/fssm/path.rb +88 -0
- data/lib/vendor/fssm/state.rb +46 -0
- data/lib/vendor/fssm/support.rb +26 -0
- data/test/command_line_helper.rb +97 -0
- data/test/command_line_test.rb +67 -0
- data/test/compass_test.rb +132 -0
- data/test/configuration_test.rb +123 -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 +15 -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/io_helper.rb +19 -0
- data/test/rails_integration_test.rb +84 -0
- data/test/sass_extensions_test.rb +31 -0
- data/test/test_case_helper.rb +13 -0
- data/test/test_helper.rb +27 -0
- data/test/test_rails_helper.rb +20 -0
- metadata +404 -0
@@ -0,0 +1,79 @@
|
|
1
|
+
module Compass
|
2
|
+
module Installers
|
3
|
+
|
4
|
+
class Manifest
|
5
|
+
include Enumerable
|
6
|
+
|
7
|
+
# A Manifest entry
|
8
|
+
class Entry < Struct.new(:type, :from, :options)
|
9
|
+
def to
|
10
|
+
options[:to] || from
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
attr_reader :options
|
15
|
+
def initialize(manifest_file = nil, options = {})
|
16
|
+
@entries = []
|
17
|
+
@options = options
|
18
|
+
@generate_config = true
|
19
|
+
@compile_after_generation = true
|
20
|
+
parse(manifest_file) if manifest_file
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.type(t)
|
24
|
+
eval <<-END
|
25
|
+
def #{t}(from, options = {})
|
26
|
+
@entries << Entry.new(:#{t}, from, options)
|
27
|
+
end
|
28
|
+
def has_#{t}?
|
29
|
+
@entries.detect {|e| e.type == :#{t}}
|
30
|
+
end
|
31
|
+
def each_#{t}
|
32
|
+
@entries.select {|e| e.type == :#{t}}.each {|e| yield e}
|
33
|
+
end
|
34
|
+
END
|
35
|
+
end
|
36
|
+
|
37
|
+
type :stylesheet
|
38
|
+
type :image
|
39
|
+
type :javascript
|
40
|
+
type :file
|
41
|
+
type :html
|
42
|
+
|
43
|
+
# Enumerates over the manifest files
|
44
|
+
def each
|
45
|
+
@entries.each {|e| yield e}
|
46
|
+
end
|
47
|
+
|
48
|
+
def generate_config?
|
49
|
+
@generate_config
|
50
|
+
end
|
51
|
+
|
52
|
+
def compile?
|
53
|
+
@compile_after_generation
|
54
|
+
end
|
55
|
+
|
56
|
+
protected
|
57
|
+
|
58
|
+
def no_configuration_file!
|
59
|
+
@generate_config = false
|
60
|
+
end
|
61
|
+
|
62
|
+
def skip_compilation!
|
63
|
+
@compile_after_generation = false
|
64
|
+
end
|
65
|
+
|
66
|
+
# parses a manifest file which is a ruby script
|
67
|
+
# evaluated in a Manifest instance context
|
68
|
+
def parse(manifest_file)
|
69
|
+
open(manifest_file) do |f|
|
70
|
+
eval(f.read, instance_binding, manifest_file)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
def instance_binding
|
74
|
+
binding
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Compass
|
2
|
+
module Installers
|
3
|
+
class TemplateContext
|
4
|
+
|
5
|
+
def self.ctx(*arguments)
|
6
|
+
new(*arguments).send(:get_binding)
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(template, locals = {})
|
10
|
+
@template = template
|
11
|
+
@locals = locals
|
12
|
+
end
|
13
|
+
|
14
|
+
def http_stylesheets_path
|
15
|
+
config.http_stylesheets_path ||
|
16
|
+
config.default_for(:http_stylesheets_path) ||
|
17
|
+
config.http_root_relative(config.css_dir)
|
18
|
+
end
|
19
|
+
|
20
|
+
Compass::Configuration::ATTRIBUTES.each do |attribute|
|
21
|
+
unless instance_methods.include?(attribute.to_s)
|
22
|
+
define_method attribute do
|
23
|
+
config.send(attribute) || config.default_for(attribute)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def config
|
29
|
+
Compass.configuration
|
30
|
+
end
|
31
|
+
|
32
|
+
alias configuration config
|
33
|
+
|
34
|
+
protected
|
35
|
+
|
36
|
+
def get_binding
|
37
|
+
@locals.each do |k, v|
|
38
|
+
eval("#{k} = v")
|
39
|
+
end
|
40
|
+
binding
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Compass
|
2
|
+
class Logger
|
3
|
+
|
4
|
+
DEFAULT_ACTIONS = [:directory, :exists, :remove, :create, :overwrite, :compile]
|
5
|
+
|
6
|
+
attr_accessor :actions, :options
|
7
|
+
|
8
|
+
def initialize(*actions)
|
9
|
+
self.options = actions.last.is_a?(Hash) ? actions.pop : {}
|
10
|
+
@actions = DEFAULT_ACTIONS.dup
|
11
|
+
@actions += actions
|
12
|
+
end
|
13
|
+
|
14
|
+
# Record an action that has occurred
|
15
|
+
def record(action, *arguments)
|
16
|
+
log "#{action_padding(action)}#{action} #{arguments.join(' ')}"
|
17
|
+
end
|
18
|
+
|
19
|
+
# Emit a log message
|
20
|
+
def log(msg)
|
21
|
+
puts msg
|
22
|
+
end
|
23
|
+
|
24
|
+
# add padding to the left of an action that was performed.
|
25
|
+
def action_padding(action)
|
26
|
+
' ' * [(max_action_length - action.to_s.length), 0].max
|
27
|
+
end
|
28
|
+
|
29
|
+
# the maximum length of all the actions known to the logger.
|
30
|
+
def max_action_length
|
31
|
+
@max_action_length ||= actions.inject(0){|memo, a| [memo, a.to_s.length].max}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class NullLogger
|
36
|
+
def record(*args)
|
37
|
+
end
|
38
|
+
|
39
|
+
def log(msg)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Compass::SassExtensions::Functions
|
2
|
+
end
|
3
|
+
|
4
|
+
%w(selectors enumerate urls display inline_image).each do |func|
|
5
|
+
require "compass/sass_extensions/functions/#{func}"
|
6
|
+
end
|
7
|
+
|
8
|
+
module Sass::Script::Functions
|
9
|
+
include Compass::SassExtensions::Functions::Selectors
|
10
|
+
include Compass::SassExtensions::Functions::Enumerate
|
11
|
+
include Compass::SassExtensions::Functions::Urls
|
12
|
+
include Compass::SassExtensions::Functions::Display
|
13
|
+
include Compass::SassExtensions::Functions::InlineImage
|
14
|
+
end
|
15
|
+
|
16
|
+
# Wierd that this has to be re-included to pick up sub-modules. Ruby bug?
|
17
|
+
class Sass::Script::Functions::EvaluationContext
|
18
|
+
include Sass::Script::Functions
|
19
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Compass::SassExtensions::Functions::Display
|
2
|
+
DEFAULT_DISPLAY = {
|
3
|
+
:block => %w{address blockquote center dir div dd dl dt fieldset form
|
4
|
+
frameset h1 h2 h3 h4 h5 h6 hr isindex menu noframes
|
5
|
+
noscript ol p pre ul},
|
6
|
+
:inline => %w{a abbr acronym b basefont bdo big br cite code dfn em
|
7
|
+
font i img input kbd label q s samp select small span
|
8
|
+
strike strong sub sup textarea tt u var},
|
9
|
+
:table => %w{table},
|
10
|
+
:"list-item" => %w{li},
|
11
|
+
:"table-row-group" => %w{tbody},
|
12
|
+
:"table-header-group" => %w{thead},
|
13
|
+
:"table-footer-group" => %w{tfoot},
|
14
|
+
:"table-row" => %w{tr},
|
15
|
+
:"table-cell" => %w{th td}
|
16
|
+
}
|
17
|
+
|
18
|
+
# returns a comma delimited string for all the elements according to their default css3 display value.
|
19
|
+
def elements_of_type(display)
|
20
|
+
Sass::Script::String.new(DEFAULT_DISPLAY.fetch(display.value.to_sym).join(", "))
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'base64'
|
2
|
+
module Compass::SassExtensions::Functions::InlineImage
|
3
|
+
|
4
|
+
def inline_image(path, mime_type = nil)
|
5
|
+
path = path.value
|
6
|
+
real_path = File.join(Compass.configuration.project_path, Compass.configuration.images_dir, path)
|
7
|
+
url = "url('data:#{compute_mime_type(path,mime_type)};base64,#{data(real_path)}')"
|
8
|
+
Sass::Script::String.new(url)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
def compute_mime_type(path, mime_type)
|
13
|
+
return mime_type if mime_type
|
14
|
+
case path
|
15
|
+
when /\.png$/i
|
16
|
+
'image/png'
|
17
|
+
when /\.jpe?g$/i
|
18
|
+
'image/jpeg'
|
19
|
+
when /\.gif$/i
|
20
|
+
'image/gif'
|
21
|
+
when /\.([a-zA-Z]+)$/
|
22
|
+
"image/#{Regexp.last_match(1).downcase}"
|
23
|
+
else
|
24
|
+
raise Compass::Error, "A mime type could not be determined for #{path}, please specify one explicitly."
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def data(real_path)
|
29
|
+
if File.readable?(real_path)
|
30
|
+
Base64.encode64(File.read(real_path)).gsub("\n","")
|
31
|
+
else
|
32
|
+
raise Compass::Error, "File not found or cannot be read: #{real_path}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Compass::SassExtensions::Functions::Selectors
|
2
|
+
COMMA_SEPARATOR = /\s*,\s*/
|
3
|
+
|
4
|
+
# Permute multiple selectors each of which may be comma delimited, the end result is
|
5
|
+
# a new selector that is the equivalent of nesting each under the previous selector.
|
6
|
+
# To illustrate, the following mixins are equivalent:
|
7
|
+
# =mixin-a(!selector1, !selector2, !selector3)
|
8
|
+
# #{!selector1}
|
9
|
+
# #{selector2}
|
10
|
+
# #{selector3}
|
11
|
+
# width: 2px
|
12
|
+
# =mixin-b(!selector1, !selector2)
|
13
|
+
# #{nest(!selector, !selector2, !selector3)}
|
14
|
+
# width: 2px
|
15
|
+
def nest(*arguments)
|
16
|
+
nested = arguments.map{|a| a.value}.inject do |memo,arg|
|
17
|
+
ancestors = memo.split(COMMA_SEPARATOR)
|
18
|
+
descendants = arg.split(COMMA_SEPARATOR)
|
19
|
+
ancestors.map{|a| descendants.map{|d| "#{a} #{d}"}.join(", ")}.join(", ")
|
20
|
+
end
|
21
|
+
Sass::Script::String.new(nested)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Permute two selectors, the first may be comma delimited.
|
25
|
+
# The end result is a new selector that is the equivalent of nesting the second
|
26
|
+
# selector under the first one in a sass file and preceding it with an &.
|
27
|
+
# To illustrate, the following mixins are equivalent:
|
28
|
+
# =mixin-a(!selector, !to_append)
|
29
|
+
# #{!selector}
|
30
|
+
# &#{!to_append}
|
31
|
+
# width: 2px
|
32
|
+
# =mixin-b(!selector, !to_append)
|
33
|
+
# #{append_selector(!selector, !to_append)}
|
34
|
+
# width: 2px
|
35
|
+
def append_selector(selector, to_append)
|
36
|
+
ancestors = selector.value.split(COMMA_SEPARATOR)
|
37
|
+
descendants = to_append.value.split(COMMA_SEPARATOR)
|
38
|
+
nested = ancestors.map{|a| descendants.map{|d| "#{a}#{d}"}.join(", ")}.join(", ")
|
39
|
+
Sass::Script::String.new(nested)
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
module Compass::SassExtensions::Functions::Urls
|
2
|
+
|
3
|
+
def stylesheet_url(path)
|
4
|
+
# Compute the path to the stylesheet, either root relative or stylesheet relative
|
5
|
+
# or nil if the http_images_path is not set in the configuration.
|
6
|
+
http_stylesheets_path = if relative?
|
7
|
+
compute_relative_path(Compass.configuration.css_dir)
|
8
|
+
elsif Compass.configuration.http_stylesheets_path
|
9
|
+
Compass.configuration.http_stylesheets_path
|
10
|
+
else
|
11
|
+
Compass.configuration.http_root_relative(Compass.configuration.css_dir)
|
12
|
+
end
|
13
|
+
|
14
|
+
url("#{http_stylesheets_path}/#{path}")
|
15
|
+
end
|
16
|
+
|
17
|
+
def image_url(path)
|
18
|
+
path = path.value # get to the string value of the literal.
|
19
|
+
# Short curcuit if they have provided an absolute url.
|
20
|
+
if absolute_path?(path)
|
21
|
+
return Sass::Script::String.new("url(#{path})")
|
22
|
+
end
|
23
|
+
|
24
|
+
# Compute the path to the image, either root relative or stylesheet relative
|
25
|
+
# or nil if the http_images_path is not set in the configuration.
|
26
|
+
http_images_path = if relative?
|
27
|
+
compute_relative_path(Compass.configuration.images_dir)
|
28
|
+
elsif Compass.configuration.http_images_path
|
29
|
+
Compass.configuration.http_images_path
|
30
|
+
else
|
31
|
+
Compass.configuration.http_root_relative(Compass.configuration.images_dir)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Compute the real path to the image on the file stystem if the images_dir is set.
|
35
|
+
real_path = if Compass.configuration.images_dir
|
36
|
+
File.join(Compass.configuration.project_path, Compass.configuration.images_dir, path)
|
37
|
+
end
|
38
|
+
|
39
|
+
# prepend the path to the image if there's one
|
40
|
+
if http_images_path
|
41
|
+
http_images_path = "#{http_images_path}/" unless http_images_path[-1..-1] == "/"
|
42
|
+
path = "#{http_images_path}#{path}"
|
43
|
+
end
|
44
|
+
|
45
|
+
# Compute the asset host unless in relative mode.
|
46
|
+
asset_host = if !relative? && Compass.configuration.asset_host
|
47
|
+
Compass.configuration.asset_host.call(path)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Compute and append the cache buster if there is one.
|
51
|
+
if buster = compute_cache_buster(path, real_path)
|
52
|
+
path += "?#{buster}"
|
53
|
+
end
|
54
|
+
|
55
|
+
# prepend the asset host if there is one.
|
56
|
+
path = "#{asset_host}#{'/' unless path[0..0] == "/"}#{path}" if asset_host
|
57
|
+
|
58
|
+
url(path)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Emits a url, taking off any leading "./"
|
62
|
+
def url(url)
|
63
|
+
url = url.to_s
|
64
|
+
url = url[0..1] == "./" ? url[2..-1] : url
|
65
|
+
Sass::Script::String.new("url('#{url}')")
|
66
|
+
end
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
def relative?
|
71
|
+
Compass.configuration.relative_assets?
|
72
|
+
end
|
73
|
+
|
74
|
+
def absolute_path?(path)
|
75
|
+
path[0..0] == "/" || path[0..3] == "http"
|
76
|
+
end
|
77
|
+
|
78
|
+
def compute_relative_path(dir)
|
79
|
+
if (target_css_file = options[:css_filename])
|
80
|
+
path = File.join(Compass.configuration.project_path, dir)
|
81
|
+
Pathname.new(path).relative_path_from(Pathname.new(File.dirname(target_css_file))).to_s
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def compute_cache_buster(path, real_path)
|
86
|
+
if Compass.configuration.asset_cache_buster
|
87
|
+
args = [path]
|
88
|
+
if Compass.configuration.asset_cache_buster.arity > 1
|
89
|
+
args << (File.new(real_path) if real_path)
|
90
|
+
end
|
91
|
+
Compass.configuration.asset_cache_buster.call(*args)
|
92
|
+
elsif real_path
|
93
|
+
default_cache_buster(path, real_path)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def default_cache_buster(path, real_path)
|
98
|
+
if File.readable?(real_path)
|
99
|
+
File.mtime(real_path).strftime("%s")
|
100
|
+
else
|
101
|
+
$stderr.puts "WARNING: '#{File.basename(path)}' was not found (or cannot be read) in #{File.dirname(real_path)}"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'sass/plugin'
|
2
|
+
|
3
|
+
# XXX: We can remove this monkeypatch once Sass 2.2 is released.
|
4
|
+
module Sass::Plugin
|
5
|
+
class << self
|
6
|
+
unless method_defined?(:exact_stylesheet_needs_update?)
|
7
|
+
def stylesheet_needs_update?(name, template_path, css_path)
|
8
|
+
css_file = css_filename(name, css_path)
|
9
|
+
template_file = template_filename(name, template_path)
|
10
|
+
exact_stylesheet_needs_update?(css_file, template_file)
|
11
|
+
end
|
12
|
+
def exact_stylesheet_needs_update?(css_file, template_file)
|
13
|
+
if !File.exists?(css_file)
|
14
|
+
return true
|
15
|
+
else
|
16
|
+
css_mtime = File.mtime(css_file)
|
17
|
+
File.mtime(template_file) > css_mtime ||
|
18
|
+
dependencies(template_file).any?(&dependency_updated?(css_mtime))
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Compass
|
2
|
+
# Write your unit test like this if you want to make sure all your stylesheets compile.
|
3
|
+
#
|
4
|
+
# require 'compass/test_case'
|
5
|
+
# class StylesheetsTest < Compass::TestCase
|
6
|
+
# def test_stylesheets
|
7
|
+
# my_sass_files.each do |sass_file|
|
8
|
+
# assert_compiles(sass_file) do |result|
|
9
|
+
# assert_not_blank result
|
10
|
+
# end
|
11
|
+
# end
|
12
|
+
# end
|
13
|
+
# protected
|
14
|
+
# def my_sass_files
|
15
|
+
# Dir.glob(File.expand_path(File.join(File.dirname(__FILE__), "../..", "app/stylesheets/**/[^_]*.sass")))
|
16
|
+
# end
|
17
|
+
# end
|
18
|
+
class TestCase < (defined?(ActiveSupport::TestCase) ? ActiveSupport::TestCase : Test::Unit::TestCase)
|
19
|
+
|
20
|
+
def setup
|
21
|
+
super
|
22
|
+
@last_compile = nil
|
23
|
+
end
|
24
|
+
|
25
|
+
def compile(stylesheet)
|
26
|
+
input = open(stylesheet)
|
27
|
+
template = input.read()
|
28
|
+
input.close()
|
29
|
+
@last_compile = ::Sass::Engine.new(template, ::Sass::Plugin.engine_options(:filename => stylesheet)).render
|
30
|
+
yield @last_compile if block_given?
|
31
|
+
end
|
32
|
+
|
33
|
+
def assert_compiles(stylesheet, &block)
|
34
|
+
compile(stylesheet, &block)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|