brakeman 4.4.0 → 4.5.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of brakeman might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGES.md +17 -0
- data/bundle/load.rb +7 -8
- data/bundle/ruby/2.5.0/gems/{ruby2ruby-2.4.1 → ruby2ruby-2.4.2}/History.rdoc +8 -0
- data/bundle/ruby/2.5.0/gems/{ruby2ruby-2.4.1 → ruby2ruby-2.4.2}/Manifest.txt +0 -0
- data/bundle/ruby/2.5.0/gems/{ruby2ruby-2.4.1 → ruby2ruby-2.4.2}/README.rdoc +0 -0
- data/bundle/ruby/2.5.0/gems/{ruby2ruby-2.4.1 → ruby2ruby-2.4.2}/lib/ruby2ruby.rb +34 -36
- data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/History.rdoc +47 -0
- data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/Manifest.txt +5 -4
- data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/README.rdoc +0 -0
- data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/compare/normalize.rb +29 -2
- data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/debugging.md +18 -0
- data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/rp_extensions.rb +0 -7
- data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/rp_stringscanner.rb +0 -0
- data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby20_parser.rb +6874 -0
- data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby20_parser.y +284 -201
- data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby21_parser.rb +6952 -0
- data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby21_parser.y +281 -197
- data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby22_parser.rb +6983 -0
- data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0/lib/ruby_parser.yy → ruby_parser-3.13.0/lib/ruby22_parser.y} +280 -306
- data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby23_parser.rb +6982 -0
- data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby23_parser.y +282 -203
- data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby24_parser.rb +6982 -0
- data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby24_parser.y +282 -203
- data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby25_parser.rb +6981 -0
- data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby25_parser.y +282 -203
- data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby26_parser.rb +6999 -0
- data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby26_parser.y +2469 -0
- data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby_lexer.rb +116 -118
- data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby_lexer.rex +10 -8
- data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby_lexer.rex.rb +8 -8
- data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby_parser.rb +5 -7
- data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby_parser.yy +2571 -0
- data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby_parser_extras.rb +1360 -0
- data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/tools/munge.rb +216 -0
- data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/tools/ripper.rb +23 -0
- data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/History.rdoc +6 -0
- data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/Manifest.txt +19 -0
- data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/README.rdoc +54 -0
- data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy.rb +5 -0
- data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0/lib → ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy}/ruby18_parser.rb +7 -6
- data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0/lib → ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy}/ruby18_parser.y +5 -4
- data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0/lib → ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy}/ruby19_parser.rb +7 -6
- data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0/lib → ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy}/ruby19_parser.y +5 -4
- data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby_lexer.rb +1412 -0
- data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby_lexer.rex +179 -0
- data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby_lexer.rex.rb +323 -0
- data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby_parser.rb +30 -0
- data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0/lib → ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy}/ruby_parser_extras.rb +43 -33
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/CHANGES.md +5 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/Gemfile +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/LICENSE.txt +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/README.md +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/bundle_install_all_ruby_versions.sh +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/deep.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/libyaml_checker.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/load.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/parse/date.rb +2 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/parse/hexadecimal.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/parse/sexagesimal.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/psych_handler.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/psych_resolver.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/resolver.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/safe_to_ruby_visitor.rb +0 -0
- data/bundle/ruby/2.5.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb +39 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/syck_hack.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/syck_node_monkeypatch.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/syck_resolver.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform/to_boolean.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform/to_date.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform/to_float.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform/to_integer.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform/to_nil.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform/to_symbol.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform/transformation_map.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/version.rb +1 -1
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/run_specs_all_ruby_versions.sh +0 -0
- data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/safe_yaml.gemspec +0 -0
- data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/History.rdoc +8 -0
- data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/Manifest.txt +0 -0
- data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/README.rdoc +0 -0
- data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/lib/composite_sexp_processor.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/lib/pt_testcase.rb +2 -2
- data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/lib/sexp.rb +4 -4
- data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/lib/sexp_processor.rb +1 -1
- data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/lib/strict_sexp.rb +3 -3
- data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/lib/unique.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/CHANGES +6 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/EXPRESSIONS.md +1 -1
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/Gemfile +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/LICENSE +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/README.md +1 -1
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/engine.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/erb/engine.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/erb/parser.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/erb/template.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/erb/trimming.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/exceptions.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filter.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/code_merger.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/control_flow.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/dynamic_inliner.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/encoding.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/eraser.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/escapable.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/multi_flattener.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/remove_bom.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/static_analyzer.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/static_merger.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/string_splitter.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/validator.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/generator.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/generators/array.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/generators/array_buffer.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/generators/erb.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/generators/rails_output_buffer.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/generators/string_buffer.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/grammar.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/attribute_merger.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/attribute_remover.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/attribute_sorter.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/dispatcher.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/fast.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/filter.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/pretty.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/safe.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/map.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/mixins/dispatcher.rb +2 -1
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/mixins/engine_dsl.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/mixins/grammar_dsl.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/mixins/options.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/mixins/template.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/parser.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/static_analyzer.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/templates.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/templates/rails.rb +2 -2
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/templates/tilt.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/utils.rb +0 -0
- data/bundle/ruby/2.5.0/gems/temple-0.8.1/lib/temple/version.rb +3 -0
- data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/temple.gemspec +0 -0
- data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/CHANGELOG.md +4 -0
- data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/MIT-LICENSE.txt +1 -1
- data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/README.md +10 -10
- data/bundle/ruby/2.5.0/gems/unicode-display_width-1.5.0/data/display_width.marshal.gz +0 -0
- data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/lib/unicode/display_width.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/lib/unicode/display_width/constants.rb +2 -2
- data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/lib/unicode/display_width/index.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/lib/unicode/display_width/no_string_ext.rb +0 -0
- data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/lib/unicode/display_width/string_ext.rb +0 -0
- data/lib/brakeman/checks/base_check.rb +16 -0
- data/lib/brakeman/checks/check_content_tag.rb +12 -0
- data/lib/brakeman/checks/check_cross_site_scripting.rb +6 -6
- data/lib/brakeman/checks/check_evaluation.rb +0 -1
- data/lib/brakeman/checks/check_execute.rb +18 -0
- data/lib/brakeman/checks/check_send.rb +0 -1
- data/lib/brakeman/checks/check_session_manipulation.rb +0 -1
- data/lib/brakeman/checks/check_sql.rb +12 -3
- data/lib/brakeman/file_parser.rb +8 -4
- data/lib/brakeman/parsers/haml_embedded.rb +44 -0
- data/lib/brakeman/parsers/slim_embedded.rb +44 -0
- data/lib/brakeman/parsers/template_parser.rb +2 -4
- data/lib/brakeman/processors/alias_processor.rb +23 -1
- data/lib/brakeman/processors/lib/call_conversion_helper.rb +4 -0
- data/lib/brakeman/processors/slim_template_processor.rb +16 -0
- data/lib/brakeman/processors/template_alias_processor.rb +2 -2
- data/lib/brakeman/scanner.rb +11 -10
- data/lib/brakeman/tracker.rb +5 -1
- data/lib/brakeman/tracker/config.rb +32 -7
- data/lib/brakeman/util.rb +17 -0
- data/lib/brakeman/version.rb +1 -1
- metadata +157 -320
- data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby20_parser.rb +0 -6687
- data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby21_parser.rb +0 -6767
- data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby22_parser.rb +0 -6803
- data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby22_parser.y +0 -2376
- data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby23_parser.rb +0 -6818
- data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby24_parser.rb +0 -6818
- data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby25_parser.rb +0 -6818
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/CODE_OF_CONDUCT.md +0 -10
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/CONTRIBUTING.md +0 -148
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/MIT-LICENSE +0 -20
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/README.md +0 -227
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/REVISION +0 -1
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/VERSION +0 -1
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/VERSION_DATE +0 -1
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/VERSION_NAME +0 -1
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/extra/sass-spec-ref.sh +0 -32
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/extra/update_watch.rb +0 -13
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/init.rb +0 -18
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass.rb +0 -109
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores.rb +0 -15
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores/base.rb +0 -88
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores/chain.rb +0 -34
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores/filesystem.rb +0 -60
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores/memory.rb +0 -46
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores/null.rb +0 -25
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/callbacks.rb +0 -67
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/css.rb +0 -408
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/deprecation.rb +0 -55
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/engine.rb +0 -1226
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/environment.rb +0 -215
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/error.rb +0 -198
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/exec.rb +0 -9
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/exec/base.rb +0 -199
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/exec/sass_convert.rb +0 -283
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/exec/sass_scss.rb +0 -440
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/features.rb +0 -47
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/importers.rb +0 -23
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/importers/base.rb +0 -182
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/importers/deprecated_path.rb +0 -51
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/importers/filesystem.rb +0 -219
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/logger.rb +0 -17
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/logger/base.rb +0 -36
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/logger/delayed.rb +0 -50
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/logger/log_level.rb +0 -45
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/media.rb +0 -210
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin.rb +0 -134
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/compiler.rb +0 -582
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/configuration.rb +0 -134
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/generic.rb +0 -15
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/merb.rb +0 -48
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/rack.rb +0 -60
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/rails.rb +0 -47
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/staleness_checker.rb +0 -199
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/railtie.rb +0 -10
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/repl.rb +0 -57
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/root.rb +0 -7
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script.rb +0 -66
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/css_lexer.rb +0 -33
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/css_parser.rb +0 -33
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/css_variable_warning.rb +0 -52
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/functions.rb +0 -2693
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/lexer.rb +0 -464
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/parser.rb +0 -832
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree.rb +0 -16
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/funcall.rb +0 -313
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/interpolation.rb +0 -223
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/list_literal.rb +0 -104
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/literal.rb +0 -49
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/map_literal.rb +0 -64
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/node.rb +0 -127
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/operation.rb +0 -156
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/selector.rb +0 -26
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/string_interpolation.rb +0 -125
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/unary_operation.rb +0 -69
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/variable.rb +0 -57
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value.rb +0 -11
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/arg_list.rb +0 -36
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/base.rb +0 -241
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/bool.rb +0 -35
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/color.rb +0 -698
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/helpers.rb +0 -272
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/list.rb +0 -113
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/map.rb +0 -70
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/null.rb +0 -44
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/number.rb +0 -563
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/string.rb +0 -138
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/scss.rb +0 -14
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/scss/css_parser.rb +0 -56
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/scss/parser.rb +0 -1254
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/scss/rx.rb +0 -140
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/scss/static_parser.rb +0 -373
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector.rb +0 -323
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/abstract_sequence.rb +0 -111
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/comma_sequence.rb +0 -191
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/pseudo.rb +0 -266
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/sequence.rb +0 -636
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/simple.rb +0 -117
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/simple_sequence.rb +0 -344
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/shared.rb +0 -76
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/source/map.rb +0 -213
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/source/position.rb +0 -39
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/source/range.rb +0 -41
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/stack.rb +0 -120
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/supports.rb +0 -225
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/at_root_node.rb +0 -83
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/charset_node.rb +0 -22
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/comment_node.rb +0 -82
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/content_node.rb +0 -9
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/css_import_node.rb +0 -68
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/debug_node.rb +0 -18
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/directive_node.rb +0 -59
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/each_node.rb +0 -24
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/error_node.rb +0 -18
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/extend_node.rb +0 -43
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/for_node.rb +0 -36
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/function_node.rb +0 -44
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/if_node.rb +0 -52
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/import_node.rb +0 -75
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/keyframe_rule_node.rb +0 -15
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/media_node.rb +0 -48
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/mixin_def_node.rb +0 -38
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/mixin_node.rb +0 -52
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/node.rb +0 -240
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/prop_node.rb +0 -170
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/return_node.rb +0 -19
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/root_node.rb +0 -44
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/rule_node.rb +0 -155
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/supports_node.rb +0 -38
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/trace_node.rb +0 -33
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/variable_node.rb +0 -36
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/base.rb +0 -72
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/check_nesting.rb +0 -173
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/convert.rb +0 -351
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/cssize.rb +0 -373
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/deep_copy.rb +0 -107
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/extend.rb +0 -70
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/perform.rb +0 -564
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/set_options.rb +0 -139
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/to_css.rb +0 -409
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/warn_node.rb +0 -18
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/while_node.rb +0 -18
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util.rb +0 -1375
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/cross_platform_random.rb +0 -19
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/multibyte_string_scanner.rb +0 -155
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/normalized_map.rb +0 -129
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/ordered_hash.rb +0 -192
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/subset_map.rb +0 -109
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/test.rb +0 -9
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/version.rb +0 -124
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/rails/init.rb +0 -1
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/CHANGELOG.md +0 -1
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/CONTRIBUTING.md +0 -38
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/Gemfile +0 -20
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/Guardfile +0 -8
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/LICENSE +0 -20
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/README.md +0 -349
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/Rakefile +0 -5
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/Vagrantfile +0 -96
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen.rb +0 -54
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapter.rb +0 -327
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/bsd.rb +0 -75
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/darwin.rb +0 -48
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/linux.rb +0 -81
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/polling.rb +0 -58
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/windows.rb +0 -91
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/directory_record.rb +0 -406
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/listener.rb +0 -323
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/turnstile.rb +0 -32
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/version.rb +0 -3
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/listen.gemspec +0 -28
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapter_spec.rb +0 -149
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapters/bsd_spec.rb +0 -36
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapters/darwin_spec.rb +0 -37
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapters/linux_spec.rb +0 -47
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapters/polling_spec.rb +0 -68
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapters/windows_spec.rb +0 -30
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/directory_record_spec.rb +0 -1250
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/listener_spec.rb +0 -258
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/turnstile_spec.rb +0 -56
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen_spec.rb +0 -67
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/spec_helper.rb +0 -25
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/support/adapter_helper.rb +0 -666
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/support/directory_record_helper.rb +0 -57
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/support/fixtures_helper.rb +0 -29
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/support/listeners_helper.rb +0 -179
- data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/support/platform_helper.rb +0 -15
- data/bundle/ruby/2.5.0/gems/temple-0.8.0/lib/temple/version.rb +0 -3
- data/bundle/ruby/2.5.0/gems/unicode-display_width-1.4.1/data/display_width.marshal.gz +0 -0
@@ -1,283 +0,0 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
require 'fileutils'
|
3
|
-
|
4
|
-
module Sass::Exec
|
5
|
-
# The `sass-convert` executable.
|
6
|
-
class SassConvert < Base
|
7
|
-
# @param args [Array<String>] The command-line arguments
|
8
|
-
def initialize(args)
|
9
|
-
super
|
10
|
-
require 'sass'
|
11
|
-
@options[:for_tree] = {}
|
12
|
-
@options[:for_engine] = {:cache => false, :read_cache => true}
|
13
|
-
end
|
14
|
-
|
15
|
-
# Tells optparse how to parse the arguments.
|
16
|
-
#
|
17
|
-
# @param opts [OptionParser]
|
18
|
-
def set_opts(opts)
|
19
|
-
opts.banner = <<END
|
20
|
-
Usage: sass-convert [options] [INPUT] [OUTPUT]
|
21
|
-
|
22
|
-
Description:
|
23
|
-
Converts between CSS, indented syntax, and SCSS files. For example,
|
24
|
-
this can convert from the indented syntax to SCSS, or from CSS to
|
25
|
-
SCSS (adding appropriate nesting).
|
26
|
-
END
|
27
|
-
|
28
|
-
common_options(opts)
|
29
|
-
style(opts)
|
30
|
-
input_and_output(opts)
|
31
|
-
miscellaneous(opts)
|
32
|
-
end
|
33
|
-
|
34
|
-
# Processes the options set by the command-line arguments,
|
35
|
-
# and runs the CSS compiler appropriately.
|
36
|
-
def process_result
|
37
|
-
require 'sass'
|
38
|
-
|
39
|
-
if @options[:recursive]
|
40
|
-
process_directory
|
41
|
-
return
|
42
|
-
end
|
43
|
-
|
44
|
-
super
|
45
|
-
input = @options[:input]
|
46
|
-
if File.directory?(input)
|
47
|
-
raise "Error: '#{input.path}' is a directory (did you mean to use --recursive?)"
|
48
|
-
end
|
49
|
-
output = @options[:output]
|
50
|
-
output = input if @options[:in_place]
|
51
|
-
process_file(input, output)
|
52
|
-
end
|
53
|
-
|
54
|
-
private
|
55
|
-
|
56
|
-
def common_options(opts)
|
57
|
-
opts.separator ''
|
58
|
-
opts.separator 'Common Options:'
|
59
|
-
|
60
|
-
opts.on('-F', '--from FORMAT',
|
61
|
-
'The format to convert from. Can be css, scss, sass.',
|
62
|
-
'By default, this is inferred from the input filename.',
|
63
|
-
'If there is none, defaults to css.') do |name|
|
64
|
-
@options[:from] = name.downcase.to_sym
|
65
|
-
raise "sass-convert no longer supports LessCSS." if @options[:from] == :less
|
66
|
-
unless [:css, :scss, :sass].include?(@options[:from])
|
67
|
-
raise "Unknown format for sass-convert --from: #{name}"
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
opts.on('-T', '--to FORMAT',
|
72
|
-
'The format to convert to. Can be scss or sass.',
|
73
|
-
'By default, this is inferred from the output filename.',
|
74
|
-
'If there is none, defaults to sass.') do |name|
|
75
|
-
@options[:to] = name.downcase.to_sym
|
76
|
-
unless [:scss, :sass].include?(@options[:to])
|
77
|
-
raise "Unknown format for sass-convert --to: #{name}"
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
opts.on('-i', '--in-place',
|
82
|
-
'Convert a file to its own syntax.',
|
83
|
-
'This can be used to update some deprecated syntax.') do
|
84
|
-
@options[:in_place] = true
|
85
|
-
end
|
86
|
-
|
87
|
-
opts.on('-R', '--recursive',
|
88
|
-
'Convert all the files in a directory. Requires --from and --to.') do
|
89
|
-
@options[:recursive] = true
|
90
|
-
end
|
91
|
-
|
92
|
-
opts.on("-?", "-h", "--help", "Show this help message.") do
|
93
|
-
puts opts
|
94
|
-
exit
|
95
|
-
end
|
96
|
-
|
97
|
-
opts.on("-v", "--version", "Print the Sass version.") do
|
98
|
-
puts("Sass #{Sass.version[:string]}")
|
99
|
-
exit
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
def style(opts)
|
104
|
-
opts.separator ''
|
105
|
-
opts.separator 'Style:'
|
106
|
-
|
107
|
-
opts.on('--dasherize', 'Convert underscores to dashes.') do
|
108
|
-
@options[:for_tree][:dasherize] = true
|
109
|
-
end
|
110
|
-
|
111
|
-
opts.on(
|
112
|
-
'--indent NUM',
|
113
|
-
'How many spaces to use for each level of indentation. Defaults to 2.',
|
114
|
-
'"t" means use hard tabs.'
|
115
|
-
) do |indent|
|
116
|
-
if indent == 't'
|
117
|
-
@options[:for_tree][:indent] = "\t"
|
118
|
-
else
|
119
|
-
@options[:for_tree][:indent] = " " * indent.to_i
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
opts.on('--old', 'Output the old-style ":prop val" property syntax.',
|
124
|
-
'Only meaningful when generating Sass.') do
|
125
|
-
@options[:for_tree][:old] = true
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
def input_and_output(opts)
|
130
|
-
opts.separator ''
|
131
|
-
opts.separator 'Input and Output:'
|
132
|
-
|
133
|
-
opts.on('-s', '--stdin', :NONE,
|
134
|
-
'Read input from standard input instead of an input file.',
|
135
|
-
'This is the default if no input file is specified. Requires --from.') do
|
136
|
-
@options[:input] = $stdin
|
137
|
-
end
|
138
|
-
|
139
|
-
encoding_option(opts)
|
140
|
-
|
141
|
-
opts.on('--unix-newlines', 'Use Unix-style newlines in written files.',
|
142
|
-
('Always true on Unix.' unless Sass::Util.windows?)) do
|
143
|
-
@options[:unix_newlines] = true if Sass::Util.windows?
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
def miscellaneous(opts)
|
148
|
-
opts.separator ''
|
149
|
-
opts.separator 'Miscellaneous:'
|
150
|
-
|
151
|
-
opts.on('--cache-location PATH',
|
152
|
-
'The path to save parsed Sass files. Defaults to .sass-cache.') do |loc|
|
153
|
-
@options[:for_engine][:cache_location] = loc
|
154
|
-
end
|
155
|
-
|
156
|
-
opts.on('-C', '--no-cache', "Don't cache to sassc files.") do
|
157
|
-
@options[:for_engine][:read_cache] = false
|
158
|
-
end
|
159
|
-
|
160
|
-
opts.on('-q', '--quiet', 'Silence warnings and status messages during conversion.') do |bool|
|
161
|
-
@options[:for_engine][:quiet] = bool
|
162
|
-
end
|
163
|
-
|
164
|
-
opts.on('--trace', :NONE, 'Show a full Ruby stack trace on error') do
|
165
|
-
@options[:trace] = true
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
def process_directory
|
170
|
-
@options[:input] = @args.shift
|
171
|
-
unless @options[:input]
|
172
|
-
raise "Error: directory required when using --recursive."
|
173
|
-
end
|
174
|
-
|
175
|
-
output = @options[:output] = @args.shift
|
176
|
-
raise "Error: --from required when using --recursive." unless @options[:from]
|
177
|
-
raise "Error: --to required when using --recursive." unless @options[:to]
|
178
|
-
unless File.directory?(@options[:input])
|
179
|
-
raise "Error: '#{@options[:input]}' is not a directory"
|
180
|
-
end
|
181
|
-
if @options[:output] && File.exist?(@options[:output]) &&
|
182
|
-
!File.directory?(@options[:output])
|
183
|
-
raise "Error: '#{@options[:output]}' is not a directory"
|
184
|
-
end
|
185
|
-
@options[:output] ||= @options[:input]
|
186
|
-
|
187
|
-
if @options[:to] == @options[:from] && !@options[:in_place]
|
188
|
-
fmt = @options[:from]
|
189
|
-
raise "Error: converting from #{fmt} to #{fmt} without --in-place"
|
190
|
-
end
|
191
|
-
|
192
|
-
ext = @options[:from]
|
193
|
-
Sass::Util.glob("#{@options[:input]}/**/*.#{ext}") do |f|
|
194
|
-
output =
|
195
|
-
if @options[:in_place]
|
196
|
-
f
|
197
|
-
elsif @options[:output]
|
198
|
-
output_name = f.gsub(/\.(c|sa|sc|le)ss$/, ".#{@options[:to]}")
|
199
|
-
output_name[0...@options[:input].size] = @options[:output]
|
200
|
-
output_name
|
201
|
-
else
|
202
|
-
f.gsub(/\.(c|sa|sc|le)ss$/, ".#{@options[:to]}")
|
203
|
-
end
|
204
|
-
|
205
|
-
unless File.directory?(File.dirname(output))
|
206
|
-
puts_action :directory, :green, File.dirname(output)
|
207
|
-
FileUtils.mkdir_p(File.dirname(output))
|
208
|
-
end
|
209
|
-
puts_action :convert, :green, f
|
210
|
-
if File.exist?(output)
|
211
|
-
puts_action :overwrite, :yellow, output
|
212
|
-
else
|
213
|
-
puts_action :create, :green, output
|
214
|
-
end
|
215
|
-
|
216
|
-
process_file(f, output)
|
217
|
-
end
|
218
|
-
end
|
219
|
-
|
220
|
-
def process_file(input, output)
|
221
|
-
input_path, output_path = path_for(input), path_for(output)
|
222
|
-
if input_path
|
223
|
-
@options[:from] ||=
|
224
|
-
case input_path
|
225
|
-
when /\.scss$/; :scss
|
226
|
-
when /\.sass$/; :sass
|
227
|
-
when /\.less$/; raise "sass-convert no longer supports LessCSS."
|
228
|
-
when /\.css$/; :css
|
229
|
-
end
|
230
|
-
elsif @options[:in_place]
|
231
|
-
raise "Error: the --in-place option requires a filename."
|
232
|
-
end
|
233
|
-
|
234
|
-
if output_path
|
235
|
-
@options[:to] ||=
|
236
|
-
case output_path
|
237
|
-
when /\.scss$/; :scss
|
238
|
-
when /\.sass$/; :sass
|
239
|
-
end
|
240
|
-
end
|
241
|
-
|
242
|
-
@options[:from] ||= :css
|
243
|
-
@options[:to] ||= :sass
|
244
|
-
@options[:for_engine][:syntax] = @options[:from]
|
245
|
-
|
246
|
-
out =
|
247
|
-
Sass::Util.silence_sass_warnings do
|
248
|
-
if @options[:from] == :css
|
249
|
-
require 'sass/css'
|
250
|
-
Sass::CSS.new(read(input), @options[:for_tree]).render(@options[:to])
|
251
|
-
else
|
252
|
-
if input_path
|
253
|
-
Sass::Engine.for_file(input_path, @options[:for_engine])
|
254
|
-
else
|
255
|
-
Sass::Engine.new(read(input), @options[:for_engine])
|
256
|
-
end.to_tree.send("to_#{@options[:to]}", @options[:for_tree])
|
257
|
-
end
|
258
|
-
end
|
259
|
-
|
260
|
-
output = input_path if @options[:in_place]
|
261
|
-
write_output(out, output)
|
262
|
-
rescue Sass::SyntaxError => e
|
263
|
-
raise e if @options[:trace]
|
264
|
-
file = " of #{e.sass_filename}" if e.sass_filename
|
265
|
-
raise "Error on line #{e.sass_line}#{file}: #{e.message}\n Use --trace for backtrace"
|
266
|
-
rescue LoadError => err
|
267
|
-
handle_load_error(err)
|
268
|
-
end
|
269
|
-
|
270
|
-
def path_for(file)
|
271
|
-
return file.path if file.is_a?(File)
|
272
|
-
return file if file.is_a?(String)
|
273
|
-
end
|
274
|
-
|
275
|
-
def read(file)
|
276
|
-
if file.respond_to?(:read)
|
277
|
-
file.read
|
278
|
-
else
|
279
|
-
open(file, 'rb') {|f| f.read}
|
280
|
-
end
|
281
|
-
end
|
282
|
-
end
|
283
|
-
end
|
@@ -1,440 +0,0 @@
|
|
1
|
-
module Sass::Exec
|
2
|
-
# The `sass` and `scss` executables.
|
3
|
-
class SassScss < Base
|
4
|
-
attr_reader :default_syntax
|
5
|
-
|
6
|
-
# @param args [Array<String>] The command-line arguments
|
7
|
-
def initialize(args, default_syntax)
|
8
|
-
super(args)
|
9
|
-
@options[:sourcemap] = :auto
|
10
|
-
@options[:for_engine] = {
|
11
|
-
:load_paths => default_sass_path
|
12
|
-
}
|
13
|
-
@default_syntax = default_syntax
|
14
|
-
end
|
15
|
-
|
16
|
-
protected
|
17
|
-
|
18
|
-
# Tells optparse how to parse the arguments.
|
19
|
-
#
|
20
|
-
# @param opts [OptionParser]
|
21
|
-
def set_opts(opts)
|
22
|
-
opts.banner = <<END
|
23
|
-
Usage: #{default_syntax} [options] [INPUT] [OUTPUT]
|
24
|
-
|
25
|
-
Description:
|
26
|
-
Converts SCSS or Sass files to CSS.
|
27
|
-
END
|
28
|
-
|
29
|
-
common_options(opts)
|
30
|
-
watching_and_updating(opts)
|
31
|
-
input_and_output(opts)
|
32
|
-
miscellaneous(opts)
|
33
|
-
end
|
34
|
-
|
35
|
-
# Processes the options set by the command-line arguments,
|
36
|
-
# and runs the Sass compiler appropriately.
|
37
|
-
def process_result
|
38
|
-
require 'sass'
|
39
|
-
|
40
|
-
if !@options[:update] && !@options[:watch] &&
|
41
|
-
@args.first && colon_path?(@args.first)
|
42
|
-
if @args.size == 1
|
43
|
-
@args = split_colon_path(@args.first)
|
44
|
-
else
|
45
|
-
@fake_update = true
|
46
|
-
@options[:update] = true
|
47
|
-
end
|
48
|
-
end
|
49
|
-
load_compass if @options[:compass]
|
50
|
-
return interactive if @options[:interactive]
|
51
|
-
return watch_or_update if @options[:watch] || @options[:update]
|
52
|
-
super
|
53
|
-
|
54
|
-
if @options[:sourcemap] != :none && @options[:output_filename]
|
55
|
-
@options[:sourcemap_filename] = Sass::Util.sourcemap_name(@options[:output_filename])
|
56
|
-
end
|
57
|
-
|
58
|
-
@options[:for_engine][:filename] = @options[:filename]
|
59
|
-
@options[:for_engine][:css_filename] = @options[:output] if @options[:output].is_a?(String)
|
60
|
-
@options[:for_engine][:sourcemap_filename] = @options[:sourcemap_filename]
|
61
|
-
@options[:for_engine][:sourcemap] = @options[:sourcemap]
|
62
|
-
|
63
|
-
run
|
64
|
-
end
|
65
|
-
|
66
|
-
private
|
67
|
-
|
68
|
-
def common_options(opts)
|
69
|
-
opts.separator ''
|
70
|
-
opts.separator 'Common Options:'
|
71
|
-
|
72
|
-
opts.on('-I', '--load-path PATH', 'Specify a Sass import path.') do |path|
|
73
|
-
(@options[:for_engine][:load_paths] ||= []) << path
|
74
|
-
end
|
75
|
-
|
76
|
-
opts.on('-r', '--require LIB', 'Require a Ruby library before running Sass.') do |lib|
|
77
|
-
require lib
|
78
|
-
end
|
79
|
-
|
80
|
-
opts.on('--compass', 'Make Compass imports available and load project configuration.') do
|
81
|
-
@options[:compass] = true
|
82
|
-
end
|
83
|
-
|
84
|
-
opts.on('-t', '--style NAME', 'Output style. Can be nested (default), compact, ' \
|
85
|
-
'compressed, or expanded.') do |name|
|
86
|
-
@options[:for_engine][:style] = name.to_sym
|
87
|
-
end
|
88
|
-
|
89
|
-
opts.on("-?", "-h", "--help", "Show this help message.") do
|
90
|
-
puts opts
|
91
|
-
exit
|
92
|
-
end
|
93
|
-
|
94
|
-
opts.on("-v", "--version", "Print the Sass version.") do
|
95
|
-
puts("Sass #{Sass.version[:string]}")
|
96
|
-
exit
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
def watching_and_updating(opts)
|
101
|
-
opts.separator ''
|
102
|
-
opts.separator 'Watching and Updating:'
|
103
|
-
|
104
|
-
opts.on('--watch', 'Watch files or directories for changes.',
|
105
|
-
'The location of the generated CSS can be set using a colon:',
|
106
|
-
" #{@default_syntax} --watch input.#{@default_syntax}:output.css",
|
107
|
-
" #{@default_syntax} --watch input-dir:output-dir") do
|
108
|
-
@options[:watch] = true
|
109
|
-
end
|
110
|
-
|
111
|
-
# Polling is used by default on Windows.
|
112
|
-
unless Sass::Util.windows?
|
113
|
-
opts.on('--poll', 'Check for file changes manually, rather than relying on the OS.',
|
114
|
-
'Only meaningful for --watch.') do
|
115
|
-
@options[:poll] = true
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
opts.on('--update', 'Compile files or directories to CSS.',
|
120
|
-
'Locations are set like --watch.') do
|
121
|
-
@options[:update] = true
|
122
|
-
end
|
123
|
-
|
124
|
-
opts.on('-f', '--force', 'Recompile every Sass file, even if the CSS file is newer.',
|
125
|
-
'Only meaningful for --update.') do
|
126
|
-
@options[:force] = true
|
127
|
-
end
|
128
|
-
|
129
|
-
opts.on('--stop-on-error', 'If a file fails to compile, exit immediately.',
|
130
|
-
'Only meaningful for --watch and --update.') do
|
131
|
-
@options[:stop_on_error] = true
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
def input_and_output(opts)
|
136
|
-
opts.separator ''
|
137
|
-
opts.separator 'Input and Output:'
|
138
|
-
|
139
|
-
if @default_syntax == :sass
|
140
|
-
opts.on('--scss',
|
141
|
-
'Use the CSS-superset SCSS syntax.') do
|
142
|
-
@options[:for_engine][:syntax] = :scss
|
143
|
-
end
|
144
|
-
else
|
145
|
-
opts.on('--sass',
|
146
|
-
'Use the indented Sass syntax.') do
|
147
|
-
@options[:for_engine][:syntax] = :sass
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
# This is optional for backwards-compatibility with Sass 3.3, which didn't
|
152
|
-
# enable sourcemaps by default and instead used "--sourcemap" to do so.
|
153
|
-
opts.on(:OPTIONAL, '--sourcemap=TYPE',
|
154
|
-
'How to link generated output to the source files.',
|
155
|
-
' auto (default): relative paths where possible, file URIs elsewhere',
|
156
|
-
' file: always absolute file URIs',
|
157
|
-
' inline: include the source text in the sourcemap',
|
158
|
-
' none: no sourcemaps') do |type|
|
159
|
-
if type && !%w(auto file inline none).include?(type)
|
160
|
-
$stderr.puts "Unknown sourcemap type #{type}.\n\n"
|
161
|
-
$stderr.puts opts
|
162
|
-
exit
|
163
|
-
elsif type.nil?
|
164
|
-
Sass::Util.sass_warn <<MESSAGE.rstrip
|
165
|
-
DEPRECATION WARNING: Passing --sourcemap without a value is deprecated.
|
166
|
-
Sourcemaps are now generated by default, so this flag has no effect.
|
167
|
-
MESSAGE
|
168
|
-
end
|
169
|
-
|
170
|
-
@options[:sourcemap] = (type || :auto).to_sym
|
171
|
-
end
|
172
|
-
|
173
|
-
opts.on('-s', '--stdin', :NONE,
|
174
|
-
'Read input from standard input instead of an input file.',
|
175
|
-
'This is the default if no input file is specified.') do
|
176
|
-
@options[:input] = $stdin
|
177
|
-
end
|
178
|
-
|
179
|
-
encoding_option(opts)
|
180
|
-
|
181
|
-
opts.on('--unix-newlines', 'Use Unix-style newlines in written files.',
|
182
|
-
('Always true on Unix.' unless Sass::Util.windows?)) do
|
183
|
-
@options[:unix_newlines] = true if Sass::Util.windows?
|
184
|
-
end
|
185
|
-
|
186
|
-
opts.on('-g', '--debug-info',
|
187
|
-
'Emit output that can be used by the FireSass Firebug plugin.') do
|
188
|
-
@options[:for_engine][:debug_info] = true
|
189
|
-
end
|
190
|
-
|
191
|
-
opts.on('-l', '--line-numbers', '--line-comments',
|
192
|
-
'Emit comments in the generated CSS indicating the corresponding source line.') do
|
193
|
-
@options[:for_engine][:line_numbers] = true
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
def miscellaneous(opts)
|
198
|
-
opts.separator ''
|
199
|
-
opts.separator 'Miscellaneous:'
|
200
|
-
|
201
|
-
opts.on('-i', '--interactive',
|
202
|
-
'Run an interactive SassScript shell.') do
|
203
|
-
@options[:interactive] = true
|
204
|
-
end
|
205
|
-
|
206
|
-
opts.on('-c', '--check', "Just check syntax, don't evaluate.") do
|
207
|
-
require 'stringio'
|
208
|
-
@options[:check_syntax] = true
|
209
|
-
@options[:output] = StringIO.new
|
210
|
-
end
|
211
|
-
|
212
|
-
opts.on('--precision NUMBER_OF_DIGITS', Integer,
|
213
|
-
"How many digits of precision to use when outputting decimal numbers.",
|
214
|
-
"Defaults to #{Sass::Script::Value::Number.precision}.") do |precision|
|
215
|
-
Sass::Script::Value::Number.precision = precision
|
216
|
-
end
|
217
|
-
|
218
|
-
opts.on('--cache-location PATH',
|
219
|
-
'The path to save parsed Sass files. Defaults to .sass-cache.') do |loc|
|
220
|
-
@options[:for_engine][:cache_location] = loc
|
221
|
-
end
|
222
|
-
|
223
|
-
opts.on('-C', '--no-cache', "Don't cache parsed Sass files.") do
|
224
|
-
@options[:for_engine][:cache] = false
|
225
|
-
end
|
226
|
-
|
227
|
-
opts.on('--trace', :NONE, 'Show a full Ruby stack trace on error.') do
|
228
|
-
@options[:trace] = true
|
229
|
-
end
|
230
|
-
|
231
|
-
opts.on('-q', '--quiet', 'Silence warnings and status messages during compilation.') do
|
232
|
-
@options[:for_engine][:quiet] = true
|
233
|
-
end
|
234
|
-
end
|
235
|
-
|
236
|
-
def load_compass
|
237
|
-
begin
|
238
|
-
require 'compass'
|
239
|
-
rescue LoadError
|
240
|
-
require 'rubygems'
|
241
|
-
begin
|
242
|
-
require 'compass'
|
243
|
-
rescue LoadError
|
244
|
-
puts "ERROR: Cannot load compass."
|
245
|
-
exit 1
|
246
|
-
end
|
247
|
-
end
|
248
|
-
Compass.add_project_configuration
|
249
|
-
Compass.configuration.project_path ||= Dir.pwd
|
250
|
-
@options[:for_engine][:load_paths] ||= []
|
251
|
-
@options[:for_engine][:load_paths] += Compass.configuration.sass_load_paths
|
252
|
-
end
|
253
|
-
|
254
|
-
def interactive
|
255
|
-
require 'sass/repl'
|
256
|
-
Sass::Repl.new(@options).run
|
257
|
-
end
|
258
|
-
|
259
|
-
# @comment
|
260
|
-
# rubocop:disable MethodLength
|
261
|
-
def watch_or_update
|
262
|
-
require 'sass/plugin'
|
263
|
-
Sass::Plugin.options.merge! @options[:for_engine]
|
264
|
-
Sass::Plugin.options[:unix_newlines] = @options[:unix_newlines]
|
265
|
-
Sass::Plugin.options[:poll] = @options[:poll]
|
266
|
-
Sass::Plugin.options[:sourcemap] = @options[:sourcemap]
|
267
|
-
|
268
|
-
if @options[:force]
|
269
|
-
raise "The --force flag may only be used with --update." unless @options[:update]
|
270
|
-
Sass::Plugin.options[:always_update] = true
|
271
|
-
end
|
272
|
-
|
273
|
-
raise <<MSG if @args.empty?
|
274
|
-
What files should I watch? Did you mean something like:
|
275
|
-
#{@default_syntax} --watch input.#{@default_syntax}:output.css
|
276
|
-
#{@default_syntax} --watch input-dir:output-dir
|
277
|
-
MSG
|
278
|
-
|
279
|
-
if !colon_path?(@args[0]) && probably_dest_dir?(@args[1])
|
280
|
-
flag = @options[:update] ? "--update" : "--watch"
|
281
|
-
err =
|
282
|
-
if !File.exist?(@args[1])
|
283
|
-
"doesn't exist"
|
284
|
-
elsif @args[1] =~ /\.css$/
|
285
|
-
"is a CSS file"
|
286
|
-
end
|
287
|
-
raise <<MSG if err
|
288
|
-
File #{@args[1]} #{err}.
|
289
|
-
Did you mean: #{@default_syntax} #{flag} #{@args[0]}:#{@args[1]}
|
290
|
-
MSG
|
291
|
-
end
|
292
|
-
|
293
|
-
dirs, files = @args.map {|name| split_colon_path(name)}.
|
294
|
-
partition {|i, _| File.directory? i}
|
295
|
-
|
296
|
-
if @fake_update && !dirs.empty?
|
297
|
-
# Issue 1602.
|
298
|
-
Sass::Util.sass_warn <<WARNING.strip
|
299
|
-
DEPRECATION WARNING: Compiling directories without --update or --watch is
|
300
|
-
deprecated and won't work in future versions of Sass. Instead use:
|
301
|
-
#{@default_syntax} --update #{@args}
|
302
|
-
WARNING
|
303
|
-
end
|
304
|
-
|
305
|
-
files.map! do |from, to|
|
306
|
-
to ||= from.gsub(/\.[^.]*?$/, '.css')
|
307
|
-
sourcemap = Sass::Util.sourcemap_name(to) if @options[:sourcemap]
|
308
|
-
[from, to, sourcemap]
|
309
|
-
end
|
310
|
-
dirs.map! {|from, to| [from, to || from]}
|
311
|
-
Sass::Plugin.options[:template_location] = dirs
|
312
|
-
|
313
|
-
Sass::Plugin.on_updated_stylesheet do |_, css, sourcemap|
|
314
|
-
[css, sourcemap].each do |file|
|
315
|
-
next unless file
|
316
|
-
puts_action :write, :green, file
|
317
|
-
end
|
318
|
-
end
|
319
|
-
|
320
|
-
had_error = false
|
321
|
-
Sass::Plugin.on_creating_directory {|dirname| puts_action :directory, :green, dirname}
|
322
|
-
Sass::Plugin.on_deleting_css {|filename| puts_action :delete, :yellow, filename}
|
323
|
-
Sass::Plugin.on_deleting_sourcemap {|filename| puts_action :delete, :yellow, filename}
|
324
|
-
Sass::Plugin.on_compilation_error do |error, _, _|
|
325
|
-
if error.is_a?(SystemCallError) && !@options[:stop_on_error]
|
326
|
-
had_error = true
|
327
|
-
puts_action :error, :red, error.message
|
328
|
-
STDOUT.flush
|
329
|
-
next
|
330
|
-
end
|
331
|
-
|
332
|
-
raise error unless error.is_a?(Sass::SyntaxError) && !@options[:stop_on_error]
|
333
|
-
had_error = true
|
334
|
-
puts_action :error, :red,
|
335
|
-
"#{error.sass_filename} (Line #{error.sass_line}: #{error.message})"
|
336
|
-
STDOUT.flush
|
337
|
-
end
|
338
|
-
|
339
|
-
if @options[:update]
|
340
|
-
Sass::Plugin.update_stylesheets(files)
|
341
|
-
exit 1 if had_error
|
342
|
-
return
|
343
|
-
end
|
344
|
-
|
345
|
-
puts ">>> Sass is watching for changes. Press Ctrl-C to stop."
|
346
|
-
|
347
|
-
Sass::Plugin.on_template_modified do |template|
|
348
|
-
puts ">>> Change detected to: #{template}"
|
349
|
-
STDOUT.flush
|
350
|
-
end
|
351
|
-
Sass::Plugin.on_template_created do |template|
|
352
|
-
puts ">>> New template detected: #{template}"
|
353
|
-
STDOUT.flush
|
354
|
-
end
|
355
|
-
Sass::Plugin.on_template_deleted do |template|
|
356
|
-
puts ">>> Deleted template detected: #{template}"
|
357
|
-
STDOUT.flush
|
358
|
-
end
|
359
|
-
|
360
|
-
Sass::Plugin.watch(files)
|
361
|
-
end
|
362
|
-
# @comment
|
363
|
-
# rubocop:enable MethodLength
|
364
|
-
|
365
|
-
def run
|
366
|
-
input = @options[:input]
|
367
|
-
output = @options[:output]
|
368
|
-
|
369
|
-
if input == $stdin
|
370
|
-
# See issue 1745
|
371
|
-
(@options[:for_engine][:load_paths] ||= []) << ::Sass::Importers::DeprecatedPath.new(".")
|
372
|
-
end
|
373
|
-
|
374
|
-
@options[:for_engine][:syntax] ||= :scss if input.is_a?(File) && input.path =~ /\.scss$/
|
375
|
-
@options[:for_engine][:syntax] ||= @default_syntax
|
376
|
-
engine =
|
377
|
-
if input.is_a?(File) && !@options[:check_syntax]
|
378
|
-
Sass::Engine.for_file(input.path, @options[:for_engine])
|
379
|
-
else
|
380
|
-
# We don't need to do any special handling of @options[:check_syntax] here,
|
381
|
-
# because the Sass syntax checking happens alongside evaluation
|
382
|
-
# and evaluation doesn't actually evaluate any code anyway.
|
383
|
-
Sass::Engine.new(input.read, @options[:for_engine])
|
384
|
-
end
|
385
|
-
|
386
|
-
input.close if input.is_a?(File)
|
387
|
-
|
388
|
-
if @options[:sourcemap] != :none && @options[:sourcemap_filename]
|
389
|
-
relative_sourcemap_path = Sass::Util.relative_path_from(
|
390
|
-
@options[:sourcemap_filename], Sass::Util.pathname(@options[:output_filename]).dirname)
|
391
|
-
rendered, mapping = engine.render_with_sourcemap(relative_sourcemap_path.to_s)
|
392
|
-
write_output(rendered, output)
|
393
|
-
write_output(
|
394
|
-
mapping.to_json(
|
395
|
-
:type => @options[:sourcemap],
|
396
|
-
:css_path => @options[:output_filename],
|
397
|
-
:sourcemap_path => @options[:sourcemap_filename]) + "\n",
|
398
|
-
@options[:sourcemap_filename])
|
399
|
-
else
|
400
|
-
write_output(engine.render, output)
|
401
|
-
end
|
402
|
-
rescue Sass::SyntaxError => e
|
403
|
-
write_output(Sass::SyntaxError.exception_to_css(e), output) if output.is_a?(String)
|
404
|
-
raise e
|
405
|
-
ensure
|
406
|
-
output.close if output.is_a? File
|
407
|
-
end
|
408
|
-
|
409
|
-
def colon_path?(path)
|
410
|
-
!split_colon_path(path)[1].nil?
|
411
|
-
end
|
412
|
-
|
413
|
-
def split_colon_path(path)
|
414
|
-
one, two = path.split(':', 2)
|
415
|
-
if one && two && Sass::Util.windows? &&
|
416
|
-
one =~ /\A[A-Za-z]\Z/ && two =~ %r{\A[/\\]}
|
417
|
-
# If we're on Windows and we were passed a drive letter path,
|
418
|
-
# don't split on that colon.
|
419
|
-
one2, two = two.split(':', 2)
|
420
|
-
one = one + ':' + one2
|
421
|
-
end
|
422
|
-
return one, two
|
423
|
-
end
|
424
|
-
|
425
|
-
# Whether path is likely to be meant as the destination
|
426
|
-
# in a source:dest pair.
|
427
|
-
def probably_dest_dir?(path)
|
428
|
-
return false unless path
|
429
|
-
return false if colon_path?(path)
|
430
|
-
Sass::Util.glob(File.join(path, "*.s[ca]ss")).empty?
|
431
|
-
end
|
432
|
-
|
433
|
-
def default_sass_path
|
434
|
-
return unless ENV['SASS_PATH']
|
435
|
-
# The select here prevents errors when the environment's
|
436
|
-
# load paths specified do not exist.
|
437
|
-
ENV['SASS_PATH'].split(File::PATH_SEPARATOR).select {|d| File.directory?(d)}
|
438
|
-
end
|
439
|
-
end
|
440
|
-
end
|