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,57 @@
|
|
1
|
+
module Compass
|
2
|
+
module Version
|
3
|
+
# Returns a hash representing the version.
|
4
|
+
# The :major, :minor, and :teeny keys have their respective numbers.
|
5
|
+
# The :string key contains a human-readable string representation of the version.
|
6
|
+
# The :rev key will have the current revision hash.
|
7
|
+
#
|
8
|
+
# This method swiped from Haml and then modified, some credit goes to Nathan Weizenbaum
|
9
|
+
attr_writer :version
|
10
|
+
def version
|
11
|
+
return @version if defined?(@version)
|
12
|
+
|
13
|
+
read_version_file
|
14
|
+
|
15
|
+
if r = revision
|
16
|
+
@version[:rev] = r
|
17
|
+
@version[:string] << " [#{r[0...7]}]"
|
18
|
+
end
|
19
|
+
|
20
|
+
@version
|
21
|
+
end
|
22
|
+
|
23
|
+
protected
|
24
|
+
|
25
|
+
def scope(file) # :nodoc:
|
26
|
+
File.join(File.dirname(__FILE__), '..', '..', file)
|
27
|
+
end
|
28
|
+
|
29
|
+
def read_version_file
|
30
|
+
require 'yaml'
|
31
|
+
@version = YAML::load(File.read(scope('VERSION.yml')))
|
32
|
+
@version[:string] = "#{@version[:major]}.#{@version[:minor]}.#{@version[:patch]}"
|
33
|
+
@version[:teeny] = @version[:patch]
|
34
|
+
end
|
35
|
+
|
36
|
+
def revision
|
37
|
+
revision_from_git || revision_from_file
|
38
|
+
end
|
39
|
+
|
40
|
+
def revision_from_file
|
41
|
+
if File.exists?(scope('REVISION'))
|
42
|
+
rev = File.read(scope('REVISION')).strip
|
43
|
+
rev if rev =~ /[a-f0-9]+/
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def revision_from_git
|
48
|
+
if File.exists?(scope('.git/HEAD'))
|
49
|
+
rev = File.read(scope('.git/HEAD')).strip
|
50
|
+
if rev =~ /^ref: (.*)$/
|
51
|
+
rev = File.read(scope(".git/#{$1}")).strip
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
data/lib/vendor/fssm.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
module FSSM
|
2
|
+
FileNotFoundError = Class.new(StandardError)
|
3
|
+
CallbackError = Class.new(StandardError)
|
4
|
+
|
5
|
+
class << self
|
6
|
+
def monitor(*args, &block)
|
7
|
+
monitor = FSSM::Monitor.new
|
8
|
+
context = args.empty? ? monitor : monitor.path(*args)
|
9
|
+
if block && block.arity == 0
|
10
|
+
context.instance_eval(&block)
|
11
|
+
elsif block && block.arity == 1
|
12
|
+
block.call(context)
|
13
|
+
end
|
14
|
+
monitor.run
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
require 'pathname'
|
20
|
+
require 'fssm/ext'
|
21
|
+
require 'fssm/support'
|
22
|
+
require 'fssm/path'
|
23
|
+
require 'fssm/state'
|
24
|
+
require 'fssm/monitor'
|
25
|
+
|
26
|
+
require "fssm/backends/#{FSSM::Support.backend.downcase}"
|
27
|
+
FSSM::Backends::Default = FSSM::Backends.const_get(FSSM::Support.backend)
|
28
|
+
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module FSSM::Backends
|
2
|
+
class FSEvents
|
3
|
+
def initialize(options={})
|
4
|
+
@streams = []
|
5
|
+
@handlers = {}
|
6
|
+
@allocator = options[:allocator] || OSX::KCFAllocatorDefault
|
7
|
+
@context = options[:context] || nil
|
8
|
+
@since = options[:since] || OSX::KFSEventStreamEventIdSinceNow
|
9
|
+
@latency = options[:latency] || 0.0
|
10
|
+
@flags = options[:flags] || 0
|
11
|
+
end
|
12
|
+
|
13
|
+
def add_path(path, preload=true)
|
14
|
+
@handlers["#{path}"] = FSSM::State.new(path, preload)
|
15
|
+
|
16
|
+
cb = lambda do |stream, context, number, paths, flags, ids|
|
17
|
+
paths.regard_as('*')
|
18
|
+
watched = OSX.FSEventStreamCopyPathsBeingWatched(stream).first
|
19
|
+
@handlers["#{watched}"].refresh
|
20
|
+
# TODO: support this level of granularity
|
21
|
+
# number.times do |n|
|
22
|
+
# @handlers["#{watched}"].refresh_path(paths[n])
|
23
|
+
# end
|
24
|
+
end
|
25
|
+
|
26
|
+
@streams << create_stream(cb, "#{path}")
|
27
|
+
end
|
28
|
+
|
29
|
+
def run
|
30
|
+
@streams.each do |stream|
|
31
|
+
schedule_stream(stream)
|
32
|
+
start_stream(stream)
|
33
|
+
end
|
34
|
+
|
35
|
+
begin
|
36
|
+
OSX.CFRunLoopRun
|
37
|
+
rescue Interrupt
|
38
|
+
@streams.each do |stream|
|
39
|
+
stop_stream(stream)
|
40
|
+
invalidate_stream(stream)
|
41
|
+
release_stream(stream)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def create_stream(callback, paths)
|
50
|
+
paths = [paths] unless paths.is_a?(Array)
|
51
|
+
OSX.FSEventStreamCreate(@allocator, callback, @context, paths, @since, @latency, @flags)
|
52
|
+
end
|
53
|
+
|
54
|
+
def schedule_stream(stream, options={})
|
55
|
+
run_loop = options[:run_loop] || OSX.CFRunLoopGetCurrent
|
56
|
+
loop_mode = options[:loop_mode] || OSX::KCFRunLoopDefaultMode
|
57
|
+
|
58
|
+
OSX.FSEventStreamScheduleWithRunLoop(stream, run_loop, loop_mode)
|
59
|
+
end
|
60
|
+
|
61
|
+
def start_stream(stream)
|
62
|
+
OSX.FSEventStreamStart(stream)
|
63
|
+
end
|
64
|
+
|
65
|
+
def stop_stream(stream)
|
66
|
+
OSX.FSEventStreamStop(stream)
|
67
|
+
end
|
68
|
+
|
69
|
+
def invalidate_stream(stream)
|
70
|
+
OSX.FSEventStreamInvalidate(stream)
|
71
|
+
end
|
72
|
+
|
73
|
+
def release_stream(stream)
|
74
|
+
OSX.FSEventStreamRelease(stream)
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module FSSM::Backends
|
2
|
+
class Polling
|
3
|
+
def initialize(options={})
|
4
|
+
@handlers = []
|
5
|
+
@latency = options[:latency] || 1
|
6
|
+
end
|
7
|
+
|
8
|
+
def add_path(path, preload=true)
|
9
|
+
@handlers << FSSM::State.new(path, preload)
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
begin
|
14
|
+
loop do
|
15
|
+
start = Time.now.to_f
|
16
|
+
@handlers.each {|handler| handler.refresh}
|
17
|
+
nap_time = @latency - (Time.now.to_f - start)
|
18
|
+
sleep nap_time if nap_time > 0
|
19
|
+
end
|
20
|
+
rescue Interrupt
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class FSSM::Monitor
|
2
|
+
def initialize(options={})
|
3
|
+
@options = options
|
4
|
+
@backend = FSSM::Backends::Default.new
|
5
|
+
end
|
6
|
+
|
7
|
+
def path(*args, &block)
|
8
|
+
path = FSSM::Path.new(*args)
|
9
|
+
if block && block.arity == 0
|
10
|
+
path.instance_eval(&block)
|
11
|
+
elsif block && block.arity == 1
|
12
|
+
block.call(path)
|
13
|
+
end
|
14
|
+
@backend.add_path(path)
|
15
|
+
path
|
16
|
+
end
|
17
|
+
|
18
|
+
def run
|
19
|
+
@backend.run
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
class FSSM::Path
|
2
|
+
def initialize(path=nil, glob=nil, &block)
|
3
|
+
set_path(path || '.')
|
4
|
+
set_glob(glob || '**/*')
|
5
|
+
init_callbacks
|
6
|
+
if block && block.arity == 0
|
7
|
+
self.instance_eval(&block)
|
8
|
+
elsif block && block.arity == 1
|
9
|
+
block.call(self)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_s
|
14
|
+
@path.to_s
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_pathname
|
18
|
+
@path
|
19
|
+
end
|
20
|
+
|
21
|
+
def glob(value=nil)
|
22
|
+
return @glob if value.nil?
|
23
|
+
set_glob(value)
|
24
|
+
end
|
25
|
+
|
26
|
+
def create(callback_or_path=nil, &block)
|
27
|
+
callback_action(:create, (block_given? ? block : callback_or_path))
|
28
|
+
end
|
29
|
+
|
30
|
+
def update(callback_or_path=nil, &block)
|
31
|
+
callback_action(:update, (block_given? ? block : callback_or_path))
|
32
|
+
end
|
33
|
+
|
34
|
+
def delete(callback_or_path=nil, &block)
|
35
|
+
callback_action(:delete, (block_given? ? block : callback_or_path))
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def init_callbacks
|
41
|
+
do_nothing = lambda {|base, relative|}
|
42
|
+
@callbacks = Hash.new(do_nothing)
|
43
|
+
end
|
44
|
+
|
45
|
+
def callback_action(type, arg=nil)
|
46
|
+
if arg.is_a?(Proc)
|
47
|
+
set_callback(type, arg)
|
48
|
+
elsif arg.nil?
|
49
|
+
get_callback(type)
|
50
|
+
else
|
51
|
+
run_callback(type, arg)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def set_callback(type, arg)
|
56
|
+
raise ArgumentError, "Proc expected" unless arg.is_a?(Proc)
|
57
|
+
@callbacks[type] = arg
|
58
|
+
end
|
59
|
+
|
60
|
+
def get_callback(type)
|
61
|
+
@callbacks[type]
|
62
|
+
end
|
63
|
+
|
64
|
+
def run_callback(type, arg)
|
65
|
+
base, relative = split_path(arg)
|
66
|
+
|
67
|
+
begin
|
68
|
+
@callbacks[type].call(base, relative)
|
69
|
+
rescue Exception => e
|
70
|
+
raise FSSM::CallbackError, "#{type} - #{base.join(relative)}: #{e.message}", e.backtrace
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def split_path(path)
|
75
|
+
path = Pathname.for(path)
|
76
|
+
[@path, (path.relative? ? path : path.relative_path_from(@path))]
|
77
|
+
end
|
78
|
+
|
79
|
+
def set_path(path)
|
80
|
+
path = Pathname.for(path)
|
81
|
+
raise FSSM::FileNotFoundError, "#{path}" unless path.exist?
|
82
|
+
@path = path.realpath
|
83
|
+
end
|
84
|
+
|
85
|
+
def set_glob(glob)
|
86
|
+
@glob = glob.is_a?(Array) ? glob : [glob]
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
class FSSM::State
|
2
|
+
def initialize(path, preload=true)
|
3
|
+
@path = path
|
4
|
+
@snapshot = {}
|
5
|
+
snapshot if preload
|
6
|
+
end
|
7
|
+
|
8
|
+
def refresh
|
9
|
+
previous = @snapshot
|
10
|
+
current = snapshot
|
11
|
+
|
12
|
+
deleted(previous, current)
|
13
|
+
created(previous, current)
|
14
|
+
modified(previous, current)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def created(previous, current)
|
20
|
+
(current.keys - previous.keys).each {|created| @path.create(created)}
|
21
|
+
end
|
22
|
+
|
23
|
+
def deleted(previous, current)
|
24
|
+
(previous.keys - current.keys).each {|deleted| @path.delete(deleted)}
|
25
|
+
end
|
26
|
+
|
27
|
+
def modified(previous, current)
|
28
|
+
(current.keys & previous.keys).each do |file|
|
29
|
+
@path.update(file) if (current[file] <=> previous[file]) != 0
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def snapshot
|
34
|
+
snap = {}
|
35
|
+
@path.glob.each {|glob| add_glob(snap, glob)}
|
36
|
+
@snapshot = snap
|
37
|
+
end
|
38
|
+
|
39
|
+
def add_glob(snap, glob)
|
40
|
+
Pathname.glob(@path.to_pathname.join(glob)).each do |fn|
|
41
|
+
next unless fn.file?
|
42
|
+
snap["#{fn}"] = fn.mtime
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module FSSM::Support
|
2
|
+
class << self
|
3
|
+
# def backend
|
4
|
+
# (mac? && carbon_core?) ? 'FSEvents' : 'Polling'
|
5
|
+
# end
|
6
|
+
|
7
|
+
def backend
|
8
|
+
'Polling'
|
9
|
+
end
|
10
|
+
|
11
|
+
def mac?
|
12
|
+
@@mac ||= RUBY_PLATFORM =~ /darwin/i
|
13
|
+
end
|
14
|
+
|
15
|
+
def carbon_core?
|
16
|
+
@@carbon_core ||= begin
|
17
|
+
require 'osx/foundation'
|
18
|
+
OSX.require_framework '/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework'
|
19
|
+
true
|
20
|
+
rescue LoadError
|
21
|
+
false
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
module Compass::CommandLineHelper
|
2
|
+
def compass(*arguments)
|
3
|
+
options = arguments.last.is_a?(Hash) ? arguments.pop : {}
|
4
|
+
options[:wait] = 0.25
|
5
|
+
if block_given?
|
6
|
+
responder = Responder.new
|
7
|
+
yield responder
|
8
|
+
IO.popen("-", "w+") do |io|
|
9
|
+
if io
|
10
|
+
#parent process
|
11
|
+
output = ""
|
12
|
+
eof_at = nil
|
13
|
+
while !eof_at || (Time.now - eof_at < options[:wait])
|
14
|
+
if io.eof?
|
15
|
+
eof_at ||= Time.now
|
16
|
+
sleep 0.1
|
17
|
+
else
|
18
|
+
eof_at = nil
|
19
|
+
timeout(1) do
|
20
|
+
partial_output = io.readpartial(1024)
|
21
|
+
# puts "))))#{partial_output}((((("
|
22
|
+
output << partial_output
|
23
|
+
end
|
24
|
+
prompt = output.split("\n").last.strip
|
25
|
+
if response = responder.response_for(prompt)
|
26
|
+
io.puts response
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
responder.assert_required_responses!
|
31
|
+
@last_result = output
|
32
|
+
else
|
33
|
+
#child process
|
34
|
+
execute *arguments
|
35
|
+
end
|
36
|
+
end
|
37
|
+
else
|
38
|
+
@last_result = capture_output do
|
39
|
+
execute *arguments
|
40
|
+
end
|
41
|
+
end
|
42
|
+
rescue Timeout::Error
|
43
|
+
fail "Read from child process timed out"
|
44
|
+
end
|
45
|
+
|
46
|
+
class Responder
|
47
|
+
Response = Struct.new(:prompt, :text, :required, :responded)
|
48
|
+
def initialize
|
49
|
+
@responses = []
|
50
|
+
end
|
51
|
+
def respond_to(prompt, options = {})
|
52
|
+
@responses << Response.new(prompt, options[:with], options[:required])
|
53
|
+
end
|
54
|
+
def response_for(prompt)
|
55
|
+
response = @responses.detect{|r| r.prompt == prompt}
|
56
|
+
if response
|
57
|
+
response.responded = true
|
58
|
+
response.text
|
59
|
+
end
|
60
|
+
end
|
61
|
+
def assert_required_responses!
|
62
|
+
@responses.each do |response|
|
63
|
+
if response.required && !response.responded
|
64
|
+
raise "Prompt not encountered: \"#{response.prompt}\""
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def assert_action_performed(action, path)
|
71
|
+
actions_found = []
|
72
|
+
@last_result.split("\n").each do |line|
|
73
|
+
line = line.split
|
74
|
+
return if line.first == action.to_s && line.last == path
|
75
|
+
actions_found << line.first if line.last == path
|
76
|
+
end
|
77
|
+
message = "Action #{action.inspect} was not performed on: #{path}."
|
78
|
+
message += "The following actions were performed: #{actions_found.join(", ")}" if actions_found.any?
|
79
|
+
puts @last_result
|
80
|
+
fail message
|
81
|
+
end
|
82
|
+
|
83
|
+
def within_tmp_directory(dir = "tmp")
|
84
|
+
d = absolutize(dir)
|
85
|
+
FileUtils.mkdir_p(d)
|
86
|
+
Dir.chdir(d) do
|
87
|
+
yield
|
88
|
+
end
|
89
|
+
ensure
|
90
|
+
FileUtils.rm_rf(d)
|
91
|
+
end
|
92
|
+
|
93
|
+
def execute(*arguments)
|
94
|
+
command_line_class = Compass::Exec::Helpers.select_appropriate_command_line_ui(arguments)
|
95
|
+
command_line_class.new(arguments).run!
|
96
|
+
end
|
97
|
+
end
|