compass-sass37 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.markdown +1 -0
- data/Rakefile +237 -0
- data/VERSION +1 -0
- data/VERSION_NAME +1 -0
- data/bin/compass +45 -0
- data/features/command_line.feature +195 -0
- data/features/extensions.feature +27 -0
- data/features/step_definitions/command_line_steps.rb +268 -0
- data/features/step_definitions/extension_steps.rb +24 -0
- data/lib/compass/actions.rb +116 -0
- data/lib/compass/app_integration/stand_alone/configuration_defaults.rb +32 -0
- data/lib/compass/app_integration/stand_alone/installer.rb +83 -0
- data/lib/compass/app_integration/stand_alone.rb +22 -0
- data/lib/compass/app_integration.rb +39 -0
- data/lib/compass/commands/base.rb +44 -0
- data/lib/compass/commands/clean_project.rb +79 -0
- data/lib/compass/commands/create_project.rb +131 -0
- data/lib/compass/commands/default.rb +50 -0
- data/lib/compass/commands/extension_command.rb +60 -0
- data/lib/compass/commands/help.rb +85 -0
- data/lib/compass/commands/imports.rb +35 -0
- data/lib/compass/commands/installer_command.rb +32 -0
- data/lib/compass/commands/interactive.rb +61 -0
- data/lib/compass/commands/list_frameworks.rb +39 -0
- data/lib/compass/commands/print_version.rb +88 -0
- data/lib/compass/commands/project_base.rb +103 -0
- data/lib/compass/commands/project_stats.rb +178 -0
- data/lib/compass/commands/project_structure.rb +93 -0
- data/lib/compass/commands/registry.rb +40 -0
- data/lib/compass/commands/sprite.rb +89 -0
- data/lib/compass/commands/stamp_pattern.rb +90 -0
- data/lib/compass/commands/unpack_extension.rb +120 -0
- data/lib/compass/commands/update_project.rb +148 -0
- data/lib/compass/commands/validate_project.rb +77 -0
- data/lib/compass/commands/watch_project.rb +117 -0
- data/lib/compass/commands/write_configuration.rb +125 -0
- data/lib/compass/commands.rb +14 -0
- data/lib/compass/compiler.rb +249 -0
- data/lib/compass/configuration/comments.rb +62 -0
- data/lib/compass/configuration/file_data.rb +21 -0
- data/lib/compass/configuration/helpers.rb +113 -0
- data/lib/compass/configuration/serialization.rb +95 -0
- data/lib/compass/dependencies.rb +12 -0
- data/lib/compass/deprecation.rb +19 -0
- data/lib/compass/errors.rb +9 -0
- data/lib/compass/exec/command_option_parser.rb +23 -0
- data/lib/compass/exec/global_options_parser.rb +59 -0
- data/lib/compass/exec/helpers.rb +21 -0
- data/lib/compass/exec/project_options_parser.rb +74 -0
- data/lib/compass/exec/sub_command_ui.rb +51 -0
- data/lib/compass/exec.rb +23 -0
- data/lib/compass/generated_version.rb +4 -0
- data/lib/compass/installers/bare_installer.rb +58 -0
- data/lib/compass/installers/base.rb +187 -0
- data/lib/compass/installers/manifest.rb +161 -0
- data/lib/compass/installers/manifest_installer.rb +61 -0
- data/lib/compass/installers/template_context.rb +44 -0
- data/lib/compass/installers.rb +3 -0
- data/lib/compass/logger.rb +140 -0
- data/lib/compass/quick_cache.rb +15 -0
- data/lib/compass/rails.rb +2 -0
- data/lib/compass/sass_compiler.rb +152 -0
- data/lib/compass/sass_extensions/functions/sprites.rb +305 -0
- data/lib/compass/sass_extensions/functions.rb +15 -0
- data/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rb +35 -0
- data/lib/compass/sass_extensions/sprites/engines.rb +25 -0
- data/lib/compass/sass_extensions/sprites/image.rb +162 -0
- data/lib/compass/sass_extensions/sprites/image_methods.rb +52 -0
- data/lib/compass/sass_extensions/sprites/image_row.rb +47 -0
- data/lib/compass/sass_extensions/sprites/images.rb +29 -0
- data/lib/compass/sass_extensions/sprites/layout/diagonal.rb +42 -0
- data/lib/compass/sass_extensions/sprites/layout/horizontal.rb +66 -0
- data/lib/compass/sass_extensions/sprites/layout/smart.rb +33 -0
- data/lib/compass/sass_extensions/sprites/layout/vertical.rb +68 -0
- data/lib/compass/sass_extensions/sprites/layout.rb +39 -0
- data/lib/compass/sass_extensions/sprites/layout_methods.rb +53 -0
- data/lib/compass/sass_extensions/sprites/row_fitter.rb +92 -0
- data/lib/compass/sass_extensions/sprites/sprite_map.rb +93 -0
- data/lib/compass/sass_extensions/sprites/sprite_methods.rb +136 -0
- data/lib/compass/sass_extensions/sprites.rb +21 -0
- data/lib/compass/sass_extensions.rb +9 -0
- data/lib/compass/sprite_importer/binding.rb +11 -0
- data/lib/compass/sprite_importer/content.erb +87 -0
- data/lib/compass/sprite_importer.rb +117 -0
- data/lib/compass/stats.rb +99 -0
- data/lib/compass/test_case.rb +38 -0
- data/lib/compass/validator.rb +16 -0
- data/lib/compass/version.rb +42 -0
- data/lib/compass.rb +39 -0
- data/test/fixtures/extensions/only_stylesheets/compass_init.rb +1 -0
- data/test/fixtures/extensions/only_stylesheets/scss/only_stylesheets/foo.scss +3 -0
- data/test/fixtures/fonts/bgrove.base64.txt +1 -0
- data/test/fixtures/fonts/bgrove.ttf +0 -0
- data/test/fixtures/sprites/public/images/bad_extensions/ten-by-ten.gif +0 -0
- data/test/fixtures/sprites/public/images/bad_extensions/twenty-by-twenty.jpg +0 -0
- data/test/fixtures/sprites/public/images/bool/false.png +0 -0
- data/test/fixtures/sprites/public/images/bool/true.png +0 -0
- data/test/fixtures/sprites/public/images/colors/blue.png +0 -0
- data/test/fixtures/sprites/public/images/colors/yellow.png +0 -0
- data/test/fixtures/sprites/public/images/focus/ten-by-ten.png +0 -0
- data/test/fixtures/sprites/public/images/focus/ten-by-ten_active.png +0 -0
- data/test/fixtures/sprites/public/images/focus/ten-by-ten_focus.png +0 -0
- data/test/fixtures/sprites/public/images/focus/ten-by-ten_hover.png +0 -0
- data/test/fixtures/sprites/public/images/focus/ten-by-ten_target.png +0 -0
- data/test/fixtures/sprites/public/images/image_row/large.png +0 -0
- data/test/fixtures/sprites/public/images/image_row/large_square.png +0 -0
- data/test/fixtures/sprites/public/images/image_row/medium.png +0 -0
- data/test/fixtures/sprites/public/images/image_row/small.png +0 -0
- data/test/fixtures/sprites/public/images/image_row/tall.png +0 -0
- data/test/fixtures/sprites/public/images/ko/default_background.png +0 -0
- data/test/fixtures/sprites/public/images/ko/starbg26x27.png +0 -0
- data/test/fixtures/sprites/public/images/nested/squares/ten-by-ten.png +0 -0
- data/test/fixtures/sprites/public/images/numeric/200.png +0 -0
- data/test/fixtures/sprites/public/images/prefix/20-by-20.png +0 -0
- data/test/fixtures/sprites/public/images/prefix/ten-by-ten.png +0 -0
- data/test/fixtures/sprites/public/images/repeat_x/five.png +0 -0
- data/test/fixtures/sprites/public/images/repeat_x/four.png +0 -0
- data/test/fixtures/sprites/public/images/repeat_x/one.png +0 -0
- data/test/fixtures/sprites/public/images/repeat_x/three.png +0 -0
- data/test/fixtures/sprites/public/images/repeat_x/two.png +0 -0
- data/test/fixtures/sprites/public/images/selectors/ten-by-ten.png +0 -0
- data/test/fixtures/sprites/public/images/selectors/ten-by-ten_active.png +0 -0
- data/test/fixtures/sprites/public/images/selectors/ten-by-ten_hover.png +0 -0
- data/test/fixtures/sprites/public/images/selectors/ten-by-ten_target.png +0 -0
- data/test/fixtures/sprites/public/images/squares/ten-by-ten.png +0 -0
- data/test/fixtures/sprites/public/images/squares/twenty-by-twenty.png +0 -0
- data/test/fixtures/stylesheets/busted_font_urls/config.rb +32 -0
- data/test/fixtures/stylesheets/busted_font_urls/css/screen.css +9 -0
- data/test/fixtures/stylesheets/busted_font_urls/fonts/feed.ttf +0 -0
- data/test/fixtures/stylesheets/busted_font_urls/fonts/grid.ttf +0 -0
- data/test/fixtures/stylesheets/busted_font_urls/fonts/sub/dk.ttf +0 -0
- data/test/fixtures/stylesheets/busted_font_urls/sass/screen.sass +14 -0
- data/test/fixtures/stylesheets/busted_image_urls/config.rb +29 -0
- data/test/fixtures/stylesheets/busted_image_urls/css/screen.css +9 -0
- data/test/fixtures/stylesheets/busted_image_urls/images/feed.png +0 -0
- data/test/fixtures/stylesheets/busted_image_urls/images/flags/dk.png +0 -0
- data/test/fixtures/stylesheets/busted_image_urls/images/grid.png +0 -0
- data/test/fixtures/stylesheets/busted_image_urls/sass/screen.sass +14 -0
- data/test/fixtures/stylesheets/compass/100x150.jpg +0 -0
- data/test/fixtures/stylesheets/compass/config.rb +18 -0
- data/test/fixtures/stylesheets/compass/css/animation-with-legacy-ie.css +22 -0
- data/test/fixtures/stylesheets/compass/css/animation.css +22 -0
- data/test/fixtures/stylesheets/compass/css/appearance.css +3 -0
- data/test/fixtures/stylesheets/compass/css/background-clip.css +11 -0
- data/test/fixtures/stylesheets/compass/css/background-origin.css +11 -0
- data/test/fixtures/stylesheets/compass/css/background-size.css +17 -0
- data/test/fixtures/stylesheets/compass/css/border_radius.css +14 -0
- data/test/fixtures/stylesheets/compass/css/box-sizing.css +14 -0
- data/test/fixtures/stylesheets/compass/css/box.css +103 -0
- data/test/fixtures/stylesheets/compass/css/box_shadow.css +24 -0
- data/test/fixtures/stylesheets/compass/css/brightness.css +14 -0
- data/test/fixtures/stylesheets/compass/css/browser-support.css +335 -0
- data/test/fixtures/stylesheets/compass/css/color.css +18 -0
- data/test/fixtures/stylesheets/compass/css/columns.css +134 -0
- data/test/fixtures/stylesheets/compass/css/filters.css +53 -0
- data/test/fixtures/stylesheets/compass/css/flexbox.css +94 -0
- data/test/fixtures/stylesheets/compass/css/fonts.css +8 -0
- data/test/fixtures/stylesheets/compass/css/force-wrap.css +9 -0
- data/test/fixtures/stylesheets/compass/css/gradients.css +222 -0
- data/test/fixtures/stylesheets/compass/css/grid_background.css +79 -0
- data/test/fixtures/stylesheets/compass/css/hyphenation.css +16 -0
- data/test/fixtures/stylesheets/compass/css/image_size.css +15 -0
- data/test/fixtures/stylesheets/compass/css/images.css +8 -0
- data/test/fixtures/stylesheets/compass/css/layout.css +16 -0
- data/test/fixtures/stylesheets/compass/css/legacy_clearfix.css +26 -0
- data/test/fixtures/stylesheets/compass/css/lists.css +145 -0
- data/test/fixtures/stylesheets/compass/css/opacity.css +7 -0
- data/test/fixtures/stylesheets/compass/css/print.css +11 -0
- data/test/fixtures/stylesheets/compass/css/regions.css +9 -0
- data/test/fixtures/stylesheets/compass/css/replacement.css +66 -0
- data/test/fixtures/stylesheets/compass/css/reset.css +59 -0
- data/test/fixtures/stylesheets/compass/css/selection.css +50 -0
- data/test/fixtures/stylesheets/compass/css/sprites_with_explicit_separator.css +19 -0
- data/test/fixtures/stylesheets/compass/css/stretching.css +66 -0
- data/test/fixtures/stylesheets/compass/css/support.css +116 -0
- data/test/fixtures/stylesheets/compass/css/text_shadow.css +29 -0
- data/test/fixtures/stylesheets/compass/css/transform.css +341 -0
- data/test/fixtures/stylesheets/compass/css/transition.css +116 -0
- data/test/fixtures/stylesheets/compass/css/typography/links/hover-link.css +4 -0
- data/test/fixtures/stylesheets/compass/css/units.css +34 -0
- data/test/fixtures/stylesheets/compass/css/user-interface.css +52 -0
- data/test/fixtures/stylesheets/compass/css/utilities.css +71 -0
- data/test/fixtures/stylesheets/compass/css/vertical_rhythm.css +42 -0
- data/test/fixtures/stylesheets/compass/css/vertical_rhythm_with_ems.css +53 -0
- data/test/fixtures/stylesheets/compass/css/vertical_rhythm_with_px.css +52 -0
- data/test/fixtures/stylesheets/compass/css/vertical_rhythm_with_rems.css +67 -0
- data/test/fixtures/stylesheets/compass/images/100x150.gif +0 -0
- data/test/fixtures/stylesheets/compass/images/100x150.jpeg +0 -0
- data/test/fixtures/stylesheets/compass/images/100x150.jpg +0 -0
- data/test/fixtures/stylesheets/compass/images/100x150.png +0 -0
- data/test/fixtures/stylesheets/compass/images/4x6.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ad.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ae.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/af.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ag.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ai.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/al.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/am.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/an.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ao.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ar.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/as.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/at.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/au.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/aw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ax.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/az.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ba.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bb.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bd.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/be.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bf.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bh.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bi.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bj.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bo.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/br.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bs.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bt.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bv.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/by.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ca.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/catalonia.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cc.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cd.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cf.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ch.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ci.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ck.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cl.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/co.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cs.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cu.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cv.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cx.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cy.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/de.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/dj.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/dk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/dm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/do.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/dz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ec.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ee.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/eg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/eh.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/england.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/er.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/es.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/et.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/europeanunion.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/fam.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/fi.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/fj.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/fk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/fm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/fo.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/fr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ga.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gb.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gd.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ge.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gf.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gh.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gi.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gl.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gp.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gq.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gs.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gt.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gu.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gy.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/hk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/hm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/hn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/hr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ht.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/hu.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/id-2.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ie.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/il.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/in.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/io.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/iq.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ir.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/is.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/it.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/jm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/jo.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/jp.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ke.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/kg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/kh.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ki.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/km.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/kn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/kp.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/kr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/kw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ky.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/kz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/la.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/lb.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/lc.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/li.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/lk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/lr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ls.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/lt.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/lu.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/lv.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ly.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ma.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mc.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/md.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/me.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mh.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ml.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mo.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mp.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mq.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ms.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mt.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mu.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mv.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mx.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/my.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/na.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/nc.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ne.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/nf.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ng.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ni.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/nl.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/no.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/np.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/nr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/nu.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/nz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/om.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pa.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pe.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pf.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ph.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pl.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ps.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pt.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/py.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/qa.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/re.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ro.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/rs.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ru.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/rw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sa.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sb.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sc.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/scotland.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sd.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/se.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sh.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/si.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sj.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sl.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/so.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/st.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sv.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sy.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tc.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/td.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tf.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/th.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tj.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tl.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/to.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tt.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tv.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ua.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ug.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/um.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/us.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/uy.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/uz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/va.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/vc.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ve.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/vg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/vi.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/vn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/vu.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/wales.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/wf.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ws.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ye.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/yt.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/za.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/zm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/zw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag-s5b4f509715.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag_states/foo.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag_states/foo_active.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag_states/foo_focus.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag_states/foo_hover.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag_states/foo_target.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag_states-sc42d7bf926.png +0 -0
- data/test/fixtures/stylesheets/compass/sass/animation-with-legacy-ie.scss +17 -0
- data/test/fixtures/stylesheets/compass/sass/animation.scss +13 -0
- data/test/fixtures/stylesheets/compass/sass/appearance.scss +5 -0
- data/test/fixtures/stylesheets/compass/sass/background-clip.scss +5 -0
- data/test/fixtures/stylesheets/compass/sass/background-origin.scss +5 -0
- data/test/fixtures/stylesheets/compass/sass/background-size.scss +7 -0
- data/test/fixtures/stylesheets/compass/sass/border_radius.scss +5 -0
- data/test/fixtures/stylesheets/compass/sass/box-sizing.scss +11 -0
- data/test/fixtures/stylesheets/compass/sass/box.sass +50 -0
- data/test/fixtures/stylesheets/compass/sass/box_shadow.scss +7 -0
- data/test/fixtures/stylesheets/compass/sass/brightness.scss +12 -0
- data/test/fixtures/stylesheets/compass/sass/browser-support.scss +30 -0
- data/test/fixtures/stylesheets/compass/sass/color.scss +25 -0
- data/test/fixtures/stylesheets/compass/sass/columns.scss +29 -0
- data/test/fixtures/stylesheets/compass/sass/filters.scss +25 -0
- data/test/fixtures/stylesheets/compass/sass/flexbox.scss +88 -0
- data/test/fixtures/stylesheets/compass/sass/fonts.sass +8 -0
- data/test/fixtures/stylesheets/compass/sass/force-wrap.scss +3 -0
- data/test/fixtures/stylesheets/compass/sass/gradients.sass +128 -0
- data/test/fixtures/stylesheets/compass/sass/grid_background.scss +34 -0
- data/test/fixtures/stylesheets/compass/sass/hyphenation.scss +11 -0
- data/test/fixtures/stylesheets/compass/sass/image_size.sass +15 -0
- data/test/fixtures/stylesheets/compass/sass/images.scss +9 -0
- data/test/fixtures/stylesheets/compass/sass/layout.sass +3 -0
- data/test/fixtures/stylesheets/compass/sass/legacy_clearfix.scss +14 -0
- data/test/fixtures/stylesheets/compass/sass/lists.scss +12 -0
- data/test/fixtures/stylesheets/compass/sass/opacity.scss +9 -0
- data/test/fixtures/stylesheets/compass/sass/print.sass +5 -0
- data/test/fixtures/stylesheets/compass/sass/regions.scss +4 -0
- data/test/fixtures/stylesheets/compass/sass/replacement.scss +22 -0
- data/test/fixtures/stylesheets/compass/sass/reset.sass +12 -0
- data/test/fixtures/stylesheets/compass/sass/selection.scss +41 -0
- data/test/fixtures/stylesheets/compass/sass/sprites_with_explicit_separator.scss +11 -0
- data/test/fixtures/stylesheets/compass/sass/stretching.sass +34 -0
- data/test/fixtures/stylesheets/compass/sass/support.scss +174 -0
- data/test/fixtures/stylesheets/compass/sass/text_shadow.scss +12 -0
- data/test/fixtures/stylesheets/compass/sass/transform.scss +87 -0
- data/test/fixtures/stylesheets/compass/sass/transition.scss +21 -0
- data/test/fixtures/stylesheets/compass/sass/typography/links/hover-link.scss +3 -0
- data/test/fixtures/stylesheets/compass/sass/units.scss +50 -0
- data/test/fixtures/stylesheets/compass/sass/user-interface.scss +28 -0
- data/test/fixtures/stylesheets/compass/sass/utilities.scss +33 -0
- data/test/fixtures/stylesheets/compass/sass/vertical_rhythm.scss +60 -0
- data/test/fixtures/stylesheets/compass/sass/vertical_rhythm_with_ems.scss +52 -0
- data/test/fixtures/stylesheets/compass/sass/vertical_rhythm_with_px.scss +50 -0
- data/test/fixtures/stylesheets/compass/sass/vertical_rhythm_with_rems.scss +50 -0
- data/test/fixtures/stylesheets/envtest/config.rb +9 -0
- data/test/fixtures/stylesheets/envtest/css/env.css +10 -0
- data/test/fixtures/stylesheets/envtest/sass/env.scss +19 -0
- data/test/fixtures/stylesheets/error/config.rb +10 -0
- data/test/fixtures/stylesheets/error/sass/screen.sass +2 -0
- data/test/fixtures/stylesheets/image_urls/config.rb +19 -0
- data/test/fixtures/stylesheets/image_urls/css/screen.css +5 -0
- data/test/fixtures/stylesheets/image_urls/images/grid.png +0 -0
- data/test/fixtures/stylesheets/image_urls/sass/screen.sass +8 -0
- data/test/fixtures/stylesheets/relative/assets/images/testing.png +0 -0
- data/test/fixtures/stylesheets/relative/config.rb +10 -0
- data/test/fixtures/stylesheets/relative/css/ie.css +1 -0
- data/test/fixtures/stylesheets/relative/css/print.css +1 -0
- data/test/fixtures/stylesheets/relative/css/screen.css +1 -0
- data/test/fixtures/stylesheets/relative/sass/ie.sass +5 -0
- data/test/fixtures/stylesheets/relative/sass/print.sass +3 -0
- data/test/fixtures/stylesheets/relative/sass/screen.sass +2 -0
- data/test/fixtures/stylesheets/sourcemaps/config.rb +10 -0
- data/test/fixtures/stylesheets/sourcemaps/css/another_simple.css +2 -0
- data/test/fixtures/stylesheets/sourcemaps/css/another_simple.css.map +7 -0
- data/test/fixtures/stylesheets/sourcemaps/css/simple.css +2 -0
- data/test/fixtures/stylesheets/sourcemaps/css/simple.css.map +7 -0
- data/test/fixtures/stylesheets/sourcemaps/css/with_libraries.css +2 -0
- data/test/fixtures/stylesheets/sourcemaps/css/with_libraries.css.map +7 -0
- data/test/fixtures/stylesheets/sourcemaps/sass/another_simple.scss +3 -0
- data/test/fixtures/stylesheets/sourcemaps/sass/simple.sass +2 -0
- data/test/fixtures/stylesheets/sourcemaps/sass/with_libraries.scss +5 -0
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/config.rb +25 -0
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/ie.scss +5 -0
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/print.scss +3 -0
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/screen.scss +6 -0
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/ie.css +5 -0
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/print.css +3 -0
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/screen.css +68 -0
- data/test/fixtures/stylesheets/valid/config.rb +9 -0
- data/test/fixtures/stylesheets/valid/sass/another_simple.scss +3 -0
- data/test/fixtures/stylesheets/valid/sass/simple.sass +2 -0
- data/test/fixtures/stylesheets/with_sass_globbing/config.rb +26 -0
- data/test/fixtures/stylesheets/with_sass_globbing/css/screen.css +19 -0
- data/test/fixtures/stylesheets/with_sass_globbing/sass/partials/_1.scss +3 -0
- data/test/fixtures/stylesheets/with_sass_globbing/sass/partials/_2.scss +3 -0
- data/test/fixtures/stylesheets/with_sass_globbing/sass/partials/_3.scss +4 -0
- data/test/fixtures/stylesheets/with_sass_globbing/sass/screen.scss +3 -0
- data/test/helpers/command_line.rb +114 -0
- data/test/helpers/diff.rb +49 -0
- data/test/helpers/io.rb +36 -0
- data/test/helpers/rails.rb +55 -0
- data/test/helpers/test_case.rb +62 -0
- data/test/integrations/compass_test.rb +259 -0
- data/test/integrations/sprites_test.rb +1123 -0
- data/test/test_helper.rb +67 -0
- data/test/units/actions_test.rb +24 -0
- data/test/units/caniuse_test.rb +194 -0
- data/test/units/command_line_test.rb +60 -0
- data/test/units/compass_util_test.rb +11 -0
- data/test/units/compiler_test.rb +16 -0
- data/test/units/configuration_test.rb +618 -0
- data/test/units/regressions_test.rb +35 -0
- data/test/units/sass_extensions_test.rb +232 -0
- data/test/units/sass_extenstions/gradients_test.rb +30 -0
- data/test/units/sprites/engine_test.rb +48 -0
- data/test/units/sprites/image_row_test.rb +58 -0
- data/test/units/sprites/image_test.rb +116 -0
- data/test/units/sprites/images_test.rb +46 -0
- data/test/units/sprites/importer_test.rb +91 -0
- data/test/units/sprites/layout_test.rb +180 -0
- data/test/units/sprites/row_fitter_test.rb +66 -0
- data/test/units/sprites/sprite_command_test.rb +55 -0
- data/test/units/sprites/sprite_map_test.rb +169 -0
- metadata +1175 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
require 'pathname'
|
|
2
|
+
|
|
3
|
+
module Compass
|
|
4
|
+
class Compiler
|
|
5
|
+
|
|
6
|
+
include Actions
|
|
7
|
+
|
|
8
|
+
attr_accessor :working_path, :from, :to, :options, :sass_options, :staleness_checker, :importer
|
|
9
|
+
|
|
10
|
+
def initialize(working_path, from, to, options)
|
|
11
|
+
Compass::Deprecation.deprecated!(:compass_compiler_constructor,
|
|
12
|
+
"Compass::Compiler is deprecated. Use Compass::SassCompiler instead.")
|
|
13
|
+
self.working_path = working_path.to_s
|
|
14
|
+
self.from, self.to = File.expand_path(from), to
|
|
15
|
+
self.logger = options.delete(:logger)
|
|
16
|
+
sass_opts = options.delete(:sass) || {}
|
|
17
|
+
self.options = options
|
|
18
|
+
self.sass_options = options.dup
|
|
19
|
+
self.sass_options.delete(:quiet)
|
|
20
|
+
self.sass_options.update(sass_opts)
|
|
21
|
+
self.sass_options[:cache_location] ||= determine_cache_location
|
|
22
|
+
self.sass_options[:filesystem_importer] ||= Sass::Importers::Filesystem
|
|
23
|
+
self.sass_options[:importer] = self.importer = self.sass_options[:filesystem_importer].new(from)
|
|
24
|
+
self.sass_options[:compass] ||= {}
|
|
25
|
+
self.sass_options[:compass][:logger] = self.logger
|
|
26
|
+
self.sass_options[:compass][:environment] = Compass.configuration.environment
|
|
27
|
+
self.sass_options[:compass][:compiler_in_use] = true
|
|
28
|
+
reset_staleness_checker!
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def reset_staleness_checker!
|
|
32
|
+
self.staleness_checker = nil
|
|
33
|
+
#Sass::Plugin::StalenessChecker.dependencies_cache = {}
|
|
34
|
+
self.staleness_checker = Sass::Plugin::StalenessChecker.new(sass_options)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def determine_cache_location
|
|
38
|
+
Compass.configuration.cache_path || Sass::Plugin.options[:cache_location] || File.join(working_path, ".sass-cache")
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def sass_files(options = {})
|
|
42
|
+
exclude_partials = options.fetch(:exclude_partials, true)
|
|
43
|
+
@sass_files = self.options[:sass_files] || Dir.glob(separate("#{from}/**/#{'[^_]' if exclude_partials}*.s[ac]ss"))
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def relative_stylesheet_name(sass_file)
|
|
47
|
+
sass_file[(from.length + 1)..-1]
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def stylesheet_name(sass_file)
|
|
51
|
+
if sass_file.index(from) == 0
|
|
52
|
+
sass_file[(from.length + 1)..-6].sub(/\.css$/,'')
|
|
53
|
+
else
|
|
54
|
+
raise Compass::Error, "You must compile individual stylesheets from the project directory."
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def css_files
|
|
59
|
+
@css_files ||= sass_files.map{|sass_file| corresponding_css_file(sass_file)}
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def sourcemap_files
|
|
63
|
+
@sourcemap_files ||= sass_files.map{|sass_file| corresponding_sourcemap_file(sass_file)}
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def corresponding_css_file(sass_file)
|
|
67
|
+
"#{to}/#{stylesheet_name(sass_file)}.css"
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def corresponding_sourcemap_file(sass_file)
|
|
71
|
+
"#{to}/#{stylesheet_name(sass_file)}.css.map"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def target_directories
|
|
75
|
+
css_files.map{|css_file| File.dirname(css_file)}.uniq.sort.sort_by{|d| d.length }
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Returns the sass file that needs to be compiled, if any.
|
|
79
|
+
def out_of_date?
|
|
80
|
+
sass_files.zip(css_files).each do |sass_filename, css_filename|
|
|
81
|
+
return sass_filename if needs_update?(css_filename, sass_filename)
|
|
82
|
+
end
|
|
83
|
+
false
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def needs_update?(css_filename, sass_filename)
|
|
87
|
+
staleness_checker.stylesheet_needs_update?(css_filename, File.expand_path(sass_filename), importer)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Determines if the configuration file is newer than any css file
|
|
91
|
+
def new_config?
|
|
92
|
+
config_file = Compass.detect_configuration_file
|
|
93
|
+
return false unless config_file
|
|
94
|
+
config_mtime = File.mtime(config_file)
|
|
95
|
+
css_files.each do |css_filename|
|
|
96
|
+
return config_file if File.exist?(css_filename) && config_mtime > File.mtime(css_filename)
|
|
97
|
+
end
|
|
98
|
+
nil
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def reset!
|
|
102
|
+
reset_staleness_checker!
|
|
103
|
+
@sass_files = nil
|
|
104
|
+
@css_files = nil
|
|
105
|
+
@sourcemap_files = nil
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def clean!
|
|
109
|
+
remove options[:cache_location]
|
|
110
|
+
css_files.zip(sourcemap_files).each do |css_file, sourcemap_file|
|
|
111
|
+
remove css_file
|
|
112
|
+
remove sourcemap_file
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def run
|
|
117
|
+
failure_count = 0
|
|
118
|
+
if new_config?
|
|
119
|
+
# Wipe out the cache and force compilation if the configuration has changed.
|
|
120
|
+
remove options[:cache_location] if options[:cache_location]
|
|
121
|
+
options[:force] = true
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# Make sure the target directories exist
|
|
125
|
+
target_directories.each {|dir| directory dir}
|
|
126
|
+
|
|
127
|
+
# Compile each sass file.
|
|
128
|
+
result = timed do
|
|
129
|
+
sass_files.zip(css_files, sourcemap_files).each do |sass_filename, css_filename, sourcemap_filename|
|
|
130
|
+
begin
|
|
131
|
+
compile_if_required sass_filename, css_filename, sourcemap_filename
|
|
132
|
+
rescue Sass::SyntaxError => e
|
|
133
|
+
failure_count += 1
|
|
134
|
+
handle_exception(sass_filename, css_filename, e)
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
if options[:time]
|
|
139
|
+
puts "Compilation took #{(result.__duration * 1000).round / 1000.0}s"
|
|
140
|
+
end
|
|
141
|
+
return failure_count
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def compile_if_required(sass_filename, css_filename, sourcemap_filename = nil)
|
|
145
|
+
if should_compile?(sass_filename, css_filename, sourcemap_filename)
|
|
146
|
+
compile sass_filename, css_filename, sourcemap_filename
|
|
147
|
+
else
|
|
148
|
+
logger.record :unchanged, basename(sass_filename) unless options[:quiet]
|
|
149
|
+
remove(sourcemap_filename) if sourcemap_filename && !options[:sourcemap]
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
def timed(timed_thing = lambda {|res| res})
|
|
154
|
+
start_time = Time.now
|
|
155
|
+
res = yield
|
|
156
|
+
end_time = Time.now
|
|
157
|
+
has_duration = timed_thing.call(res)
|
|
158
|
+
has_duration.instance_variable_set("@__duration", end_time - start_time)
|
|
159
|
+
def has_duration.__duration
|
|
160
|
+
@__duration
|
|
161
|
+
end
|
|
162
|
+
res
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Compile one Sass file
|
|
166
|
+
def compile(sass_filename, css_filename, sourcemap_filename = nil)
|
|
167
|
+
css_content, sourcemap = logger.red do
|
|
168
|
+
timed(lambda {|r| r[0]}) do
|
|
169
|
+
engine = engine(sass_filename, css_filename, sourcemap_filename)
|
|
170
|
+
if sourcemap_filename && options[:sourcemap]
|
|
171
|
+
engine.render_with_sourcemap(relative_path(css_filename, sourcemap_filename))
|
|
172
|
+
else
|
|
173
|
+
[engine.render, nil]
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
duration = options[:time] ? "(#{(css_content.__duration * 1000).round / 1000.0}s)" : ""
|
|
178
|
+
write_file(css_filename, css_content, options.merge(:force => true, :extra => duration), sass_options[:unix_newlines])
|
|
179
|
+
Compass.configuration.run_stylesheet_saved(css_filename)
|
|
180
|
+
if sourcemap && sourcemap_filename
|
|
181
|
+
sourcemap_content = sourcemap.to_json(:css_path => css_filename,
|
|
182
|
+
:sourcemap_path => sourcemap_filename)
|
|
183
|
+
write_file(sourcemap_filename, sourcemap_content, options.merge(:force => true), sass_options[:unix_newlines])
|
|
184
|
+
Compass.configuration.run_sourcemap_saved(sourcemap_filename)
|
|
185
|
+
elsif sourcemap_filename && File.exist?(sourcemap_filename)
|
|
186
|
+
remove sourcemap_filename
|
|
187
|
+
Compass.configuration.run_sourcemap_removed(sourcemap_filename)
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
def relative_path(from_path, to_path)
|
|
192
|
+
Pathname.new(to_path).relative_path_from(Pathname.new(from_path).dirname).to_s
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
def should_compile?(sass_filename, css_filename, sourcemap_filename = nil)
|
|
196
|
+
return true if css_filename && !File.exist?(css_filename)
|
|
197
|
+
return true if sourcemap_filename && options[:sourcemap] && !File.exist?(sourcemap_filename)
|
|
198
|
+
options[:force] ||
|
|
199
|
+
needs_update?(css_filename, sass_filename) ||
|
|
200
|
+
(options[:sourcemap] && needs_update?(sourcemap_filename, sass_filename))
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# A sass engine for compiling a single file.
|
|
204
|
+
def engine(sass_filename, css_filename, sourcemap_filename = nil)
|
|
205
|
+
syntax = (sass_filename =~ /\.(s[ac]ss)$/) && $1.to_sym || :sass
|
|
206
|
+
opts = sass_options.merge(:filename => sass_filename,
|
|
207
|
+
:css_filename => css_filename,
|
|
208
|
+
:syntax => syntax,
|
|
209
|
+
:sourcemap_filename => sourcemap_filename)
|
|
210
|
+
Sass::Engine.new(open(sass_filename).read, opts)
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# Place the syntax error into the target css file,
|
|
214
|
+
# formatted to display in the browser (in development mode)
|
|
215
|
+
# if there's an error.
|
|
216
|
+
def handle_exception(sass_filename, css_filename, e)
|
|
217
|
+
exception_file = basename(e.sass_filename || sass_filename)
|
|
218
|
+
file = basename(sass_filename)
|
|
219
|
+
exception_file = nil if exception_file == file
|
|
220
|
+
formatted_error = "(Line #{e.sass_line}#{ " of #{exception_file}" if exception_file}: #{e.message})"
|
|
221
|
+
logger.record :error, file, formatted_error
|
|
222
|
+
Compass.configuration.run_stylesheet_error(sass_filename, formatted_error)
|
|
223
|
+
write_file css_filename, error_contents(e, sass_filename), options.merge(:force => true), sass_options[:unix_newlines]
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# Haml refactored this logic in 2.3, this is backwards compatibility for either one
|
|
227
|
+
def error_contents(e, sass_filename)
|
|
228
|
+
if show_full_exception?
|
|
229
|
+
e.sass_template = sass_filename
|
|
230
|
+
Sass::SyntaxError.exception_to_css(e)
|
|
231
|
+
else
|
|
232
|
+
header = Sass::SyntaxError.send(:header_string, e, 1)
|
|
233
|
+
<<END
|
|
234
|
+
/*
|
|
235
|
+
#{header.gsub("*/", "*\\/")}
|
|
236
|
+
|
|
237
|
+
Backtrace:\n#{e.backtrace.join("\n").gsub("*/", "*\\/")}
|
|
238
|
+
*/
|
|
239
|
+
END
|
|
240
|
+
end
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
# We don't want to show the full exception in production environments.
|
|
244
|
+
def show_full_exception?
|
|
245
|
+
Compass.configuration.environment == :development
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
end
|
|
249
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
module Compass
|
|
2
|
+
module Configuration
|
|
3
|
+
# Comments are emitted into the configuration file when serialized and make it easier to understand for new users.
|
|
4
|
+
module Comments
|
|
5
|
+
|
|
6
|
+
def comment_for_http_path
|
|
7
|
+
unless top_level.http_path_without_default
|
|
8
|
+
"# Set this to the root of your project when deployed:\nhttp_path = #{top_level.http_path.to_s.inspect}\n"
|
|
9
|
+
else
|
|
10
|
+
""
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def comment_for_relative_assets
|
|
15
|
+
unless top_level.relative_assets
|
|
16
|
+
%q{# To enable relative paths to assets via compass helper functions. Uncomment:
|
|
17
|
+
# relative_assets = true
|
|
18
|
+
}
|
|
19
|
+
else
|
|
20
|
+
""
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def comment_for_line_comments
|
|
25
|
+
if top_level.line_comments
|
|
26
|
+
%q{# To disable debugging comments that display the original location of your selectors. Uncomment:
|
|
27
|
+
# line_comments = false
|
|
28
|
+
}
|
|
29
|
+
else
|
|
30
|
+
""
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def comment_for_output_style
|
|
35
|
+
unless top_level.output_style_without_default
|
|
36
|
+
%Q{# You can select your preferred output style here (can be overridden via the command line):
|
|
37
|
+
# output_style = :expanded or :nested or :compact or :compressed
|
|
38
|
+
}
|
|
39
|
+
else
|
|
40
|
+
""
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def comment_for_preferred_syntax
|
|
45
|
+
if top_level.preferred_syntax_without_default.nil? && top_level.sass_dir
|
|
46
|
+
%Q{
|
|
47
|
+
# If you prefer the indented syntax, you might want to regenerate this
|
|
48
|
+
# project again passing --syntax sass, or you can uncomment this:
|
|
49
|
+
# preferred_syntax = :sass
|
|
50
|
+
# and then run:
|
|
51
|
+
# sass-convert -R --from scss --to sass #{top_level.sass_dir} scss && rm -rf sass && mv scss sass
|
|
52
|
+
}
|
|
53
|
+
else
|
|
54
|
+
""
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
class Data
|
|
59
|
+
include Comments
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module Compass
|
|
2
|
+
module Configuration
|
|
3
|
+
class FileData < Data
|
|
4
|
+
def self.new_from_file(config_file, defaults = nil)
|
|
5
|
+
data = new(config_file)
|
|
6
|
+
data.with_defaults(defaults) do
|
|
7
|
+
data._parse(config_file)
|
|
8
|
+
end
|
|
9
|
+
data
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.new_from_string(contents, filename, defaults = nil)
|
|
13
|
+
data = new(filename)
|
|
14
|
+
data.with_defaults(defaults) do
|
|
15
|
+
data.parse_string(contents, filename)
|
|
16
|
+
end
|
|
17
|
+
data
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
module Compass
|
|
2
|
+
module Configuration
|
|
3
|
+
@callbacks_loaded = false
|
|
4
|
+
# The helpers are available as methods on the Compass module. E.g. Compass.configuration
|
|
5
|
+
module Helpers
|
|
6
|
+
def configuration_for(config, filename = nil, defaults = nil)
|
|
7
|
+
if config.nil?
|
|
8
|
+
nil
|
|
9
|
+
elsif config.is_a?(Compass::Configuration::Data)
|
|
10
|
+
config
|
|
11
|
+
elsif config.instance_of?(Hash)
|
|
12
|
+
Compass::Configuration::Data.new(filename, config)
|
|
13
|
+
elsif config.respond_to?(:read)
|
|
14
|
+
filename ||= config.to_s if config.is_a?(Pathname)
|
|
15
|
+
Compass::Configuration::FileData.new_from_string(config.read, filename, defaults)
|
|
16
|
+
elsif config.is_a?(Hash)
|
|
17
|
+
Compass::Configuration::Data.new(filename, config)
|
|
18
|
+
elsif config.is_a?(String)
|
|
19
|
+
Compass::Configuration::FileData.new_from_file(config, defaults)
|
|
20
|
+
elsif config.is_a?(Symbol)
|
|
21
|
+
Compass::AppIntegration.lookup(config).configuration
|
|
22
|
+
else
|
|
23
|
+
raise "I don't know what to do with: #{config.inspect}"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def sass_plugin_configuration
|
|
28
|
+
configuration.to_sass_plugin_options
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def configure_sass_plugin!
|
|
32
|
+
require 'sass/plugin'
|
|
33
|
+
config = sass_plugin_configuration
|
|
34
|
+
locations = config.delete(:template_location)
|
|
35
|
+
Sass::Plugin.options.merge!(config)
|
|
36
|
+
locations.each do |sass_dir, css_dir|
|
|
37
|
+
unless Sass::Plugin.engine_options[:load_paths].include?(sass_dir)
|
|
38
|
+
Sass::Plugin.add_template_location sass_dir, css_dir
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
unless @callbacks_loaded
|
|
42
|
+
on_saved = Proc.new do |sass_file, css_file|
|
|
43
|
+
Compass.configuration.run_stylesheet_saved(css_file)
|
|
44
|
+
end
|
|
45
|
+
if Sass::Plugin.respond_to?(:on_updated_stylesheet)
|
|
46
|
+
Sass::Plugin.on_updated_stylesheet(&on_saved)
|
|
47
|
+
else
|
|
48
|
+
Sass::Plugin.on_updating_stylesheet(&on_saved)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
Sass::Plugin.on_compilation_error do |e, filename, css|
|
|
52
|
+
Compass.configuration.run_stylesheet_error(filename, e.message)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
@callbacks_loaded = true
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def sass_engine_options
|
|
60
|
+
configuration.to_sass_engine_options
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Read the configuration file for this project
|
|
64
|
+
def add_project_configuration(*args)
|
|
65
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
|
66
|
+
configuration_file_path = args.shift || detect_configuration_file
|
|
67
|
+
|
|
68
|
+
raise ArgumentError, "Too many arguments" if args.any?
|
|
69
|
+
if AppIntegration.default? && data = configuration_for(configuration_file_path, nil, configuration_for(options[:defaults]))
|
|
70
|
+
if data.raw_project_type
|
|
71
|
+
add_configuration(data.raw_project_type.to_sym)
|
|
72
|
+
elsif options[:project_type]
|
|
73
|
+
add_configuration(options[:project_type])
|
|
74
|
+
else
|
|
75
|
+
add_configuration(:stand_alone)
|
|
76
|
+
end
|
|
77
|
+
add_configuration(data)
|
|
78
|
+
else
|
|
79
|
+
add_configuration(options[:project_type] || configuration.project_type_without_default || (yield if block_given?) || :stand_alone)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# TODO: Deprecate the src/config.rb location.
|
|
84
|
+
KNOWN_CONFIG_LOCATIONS = ['config/compass.rb', ".compass/config.rb", "config/compass.config", "config.rb", "src/config.rb"]
|
|
85
|
+
|
|
86
|
+
# Finds the configuration file, if it exists in a known location.
|
|
87
|
+
def detect_configuration_file(project_path = nil)
|
|
88
|
+
possible_files = KNOWN_CONFIG_LOCATIONS.map{|f| projectize(f, project_path) }
|
|
89
|
+
possible_files.detect{|f| File.exist?(f)}
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def handle_configuration_change!
|
|
93
|
+
if (compiler = Compass.compiler).new_config?
|
|
94
|
+
compiler.clean!
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# @deprecated
|
|
99
|
+
def compiler
|
|
100
|
+
Compass::Deprecation.deprecated!(:compiler_accessor,
|
|
101
|
+
"Compass.compiler is deprecated. Use Compass.sass_compiler instead.")
|
|
102
|
+
Compass::Deprecation.mark_as_issued(:compass_compiler_constructor)
|
|
103
|
+
Compass::Compiler.new(*Compass.configuration.to_compiler_arguments)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def sass_compiler(*args)
|
|
107
|
+
Compass::SassCompiler.new(*args)
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
extend Configuration::Helpers
|
|
113
|
+
end
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
module Compass
|
|
2
|
+
module Configuration
|
|
3
|
+
# The serialization module manages reading and writing the configuration file(s).
|
|
4
|
+
module Serialization
|
|
5
|
+
def parse(config_file)
|
|
6
|
+
raise Compass::Error, "Compass.configuration.parse(filename) has been removed. Please call Compass.add_project_configuration(filename) instead."
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# parses a configuration file which is a ruby script
|
|
10
|
+
def _parse(config_file)
|
|
11
|
+
unless File.readable?(config_file)
|
|
12
|
+
raise Compass::Error, "Configuration file, #{config_file}, not found or not readable."
|
|
13
|
+
end
|
|
14
|
+
open(config_file) do |f|
|
|
15
|
+
parse_string(f.read, config_file)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def get_binding
|
|
20
|
+
binding
|
|
21
|
+
end
|
|
22
|
+
def parse_string(contents, filename)
|
|
23
|
+
bind = get_binding
|
|
24
|
+
eval(contents, bind, filename)
|
|
25
|
+
local_vars_set = eval("local_variables", bind)
|
|
26
|
+
local_vars_set.each do |local_var|
|
|
27
|
+
if (ATTRIBUTES+ARRAY_ATTRIBUTES).include?(local_var.to_sym)
|
|
28
|
+
value = eval(local_var.to_s, bind)
|
|
29
|
+
value = value.to_s if value.is_a?(Pathname)
|
|
30
|
+
self.send("#{local_var}=", value)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
if @added_import_paths
|
|
34
|
+
@added_import_paths.each do |p|
|
|
35
|
+
self.additional_import_paths << p unless self.additional_import_paths.include?(p)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
issue_deprecation_warnings
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def serialize
|
|
42
|
+
contents = ""
|
|
43
|
+
(required_libraries || []).each do |lib|
|
|
44
|
+
contents << %Q{require '#{lib}'\n}
|
|
45
|
+
end
|
|
46
|
+
unless (required_libraries || []).include?("compass/import-once/activate") ||
|
|
47
|
+
(required_libraries || []).include?("compass/import-once")
|
|
48
|
+
contents << "require 'compass/import-once/activate'\n"
|
|
49
|
+
end
|
|
50
|
+
(loaded_frameworks || []).each do |lib|
|
|
51
|
+
contents << %Q{load '#{lib}'\n}
|
|
52
|
+
end
|
|
53
|
+
(framework_path || []).each do |lib|
|
|
54
|
+
contents << %Q{discover '#{lib}'\n}
|
|
55
|
+
end
|
|
56
|
+
contents << "# Require any additional compass plugins here.\n"
|
|
57
|
+
contents << "\n" if (required_libraries || []).any?
|
|
58
|
+
(ATTRIBUTES + ARRAY_ATTRIBUTES).each do |prop|
|
|
59
|
+
value = send("#{prop}_without_default")
|
|
60
|
+
if value.is_a?(Proc)
|
|
61
|
+
$stderr.puts "WARNING: #{prop} is code and cannot be written to a file. You'll need to copy it yourself."
|
|
62
|
+
end
|
|
63
|
+
if respond_to?("comment_for_#{prop}")
|
|
64
|
+
contents << "\n"
|
|
65
|
+
contents << send("comment_for_#{prop}")
|
|
66
|
+
end
|
|
67
|
+
if block_given? && (to_emit = yield(prop, value))
|
|
68
|
+
contents << to_emit
|
|
69
|
+
else
|
|
70
|
+
contents << serialize_property(prop, value) unless value.nil?
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
contents
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def serialize_property(prop, value)
|
|
77
|
+
if value.respond_to?(:serialize_to_config)
|
|
78
|
+
value.serialize_to_config(prop) + "\n"
|
|
79
|
+
else
|
|
80
|
+
%Q(#{prop} = #{value.inspect}\n)
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def issue_deprecation_warnings
|
|
85
|
+
if http_images_path == :relative
|
|
86
|
+
$stderr.puts "DEPRECATION WARNING: Please set relative_assets = true to enable relative paths."
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
end
|
|
91
|
+
class Data
|
|
92
|
+
include Serialization
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Compass
|
|
2
|
+
module Deprecation
|
|
3
|
+
class << self
|
|
4
|
+
attr_accessor :issued_deprecations
|
|
5
|
+
end
|
|
6
|
+
self.issued_deprecations = {}
|
|
7
|
+
|
|
8
|
+
def self.deprecated!(identifier, message)
|
|
9
|
+
return if Deprecation.issued_deprecations[identifier]
|
|
10
|
+
Deprecation.issued_deprecations[identifier] = true
|
|
11
|
+
warn message
|
|
12
|
+
warn "Called from #{caller[1]}"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.mark_as_issued(identifier)
|
|
16
|
+
Deprecation.issued_deprecations[identifier] = true
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Compass::Exec
|
|
2
|
+
class CommandOptionParser
|
|
3
|
+
attr_accessor :options, :arguments, :opts
|
|
4
|
+
def initialize(arguments)
|
|
5
|
+
self.arguments = arguments
|
|
6
|
+
self.options = {}
|
|
7
|
+
end
|
|
8
|
+
def parse!
|
|
9
|
+
opts.parse!(arguments)
|
|
10
|
+
end
|
|
11
|
+
def opts
|
|
12
|
+
OptionParser.new do |opts|
|
|
13
|
+
self.set_options(opts)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
def set_options(opts)
|
|
17
|
+
|
|
18
|
+
end
|
|
19
|
+
def to_s
|
|
20
|
+
opts.to_s
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
module Compass::Exec::GlobalOptionsParser
|
|
2
|
+
def set_options(opts)
|
|
3
|
+
super
|
|
4
|
+
set_global_options(opts)
|
|
5
|
+
end
|
|
6
|
+
def set_global_options(opts)
|
|
7
|
+
opts.on('-r LIBRARY', '--require LIBRARY',
|
|
8
|
+
"Require the given ruby LIBRARY before running commands.",
|
|
9
|
+
" This is used to access compass plugins without having a",
|
|
10
|
+
" project configuration file."
|
|
11
|
+
) do |library|
|
|
12
|
+
::Compass.configuration.require library
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
opts.on('-l FRAMEWORK_DIR', '--load FRAMEWORK_DIR',
|
|
16
|
+
"Load the framework or extensions found in the FRAMEWORK directory."
|
|
17
|
+
) do |framework_dir|
|
|
18
|
+
require 'pathname'
|
|
19
|
+
::Compass.configuration.load Pathname.new(framework_dir).realpath
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
opts.on('-L FRAMEWORKS_DIR', '--load-all FRAMEWORKS_DIR',
|
|
23
|
+
"Load all the frameworks or extensions found in the FRAMEWORKS_DIR directory."
|
|
24
|
+
) do |frameworks_dir|
|
|
25
|
+
require 'pathname'
|
|
26
|
+
::Compass.configuration.discover Pathname.new(frameworks_dir).realpath
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
opts.on('-I IMPORT_PATH', '--import-path IMPORT_PATH',
|
|
30
|
+
"Makes files under the IMPORT_PATH folder findable by Sass's @import directive."
|
|
31
|
+
) do |import_path|
|
|
32
|
+
require 'pathname'
|
|
33
|
+
::Compass.configuration.add_import_path Pathname.new(import_path).realpath
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
opts.on('-q', '--quiet', :NONE, 'Quiet mode.') do
|
|
37
|
+
self.options[:quiet] = true
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
opts.on('--trace', :NONE, 'Show a full stacktrace on error') do
|
|
41
|
+
self.options[:trace] = true
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
opts.on('--force', :NONE, 'Allows compass to overwrite existing files.') do
|
|
45
|
+
self.options[:force] = true
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
opts.on('--boring', :NONE, 'Turn off colorized output.') do
|
|
49
|
+
self.options[:color_output] = false
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
opts.on_tail("-?", "-h", "--help", "Show this message") do
|
|
53
|
+
puts opts
|
|
54
|
+
exit
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module Compass::Exec
|
|
2
|
+
module Helpers
|
|
3
|
+
extend self
|
|
4
|
+
def report_error(e, options)
|
|
5
|
+
$stderr.puts "#{e.class} on line #{get_line e} of #{get_file e}: #{e.message}"
|
|
6
|
+
if options[:trace]
|
|
7
|
+
e.backtrace[1..-1].each { |t| $stderr.puts " #{t}" }
|
|
8
|
+
else
|
|
9
|
+
$stderr.puts "Run with --trace to see the full backtrace"
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def get_file(exception)
|
|
14
|
+
exception.backtrace[0].split(/:/, 2)[0]
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def get_line(exception)
|
|
18
|
+
exception.backtrace[0].scan(/:(\d+)/)[0]
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|