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,215 +0,0 @@
|
|
1
|
-
require 'set'
|
2
|
-
|
3
|
-
module Sass
|
4
|
-
# The abstract base class for lexical environments for SassScript.
|
5
|
-
class BaseEnvironment
|
6
|
-
class << self
|
7
|
-
# Note: when updating this,
|
8
|
-
# update sass/yard/inherited_hash.rb as well.
|
9
|
-
def inherited_hash_accessor(name)
|
10
|
-
inherited_hash_reader(name)
|
11
|
-
inherited_hash_writer(name)
|
12
|
-
end
|
13
|
-
|
14
|
-
def inherited_hash_reader(name)
|
15
|
-
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
16
|
-
def #{name}(name)
|
17
|
-
_#{name}(name.tr('_', '-'))
|
18
|
-
end
|
19
|
-
|
20
|
-
def _#{name}(name)
|
21
|
-
(@#{name}s && @#{name}s[name]) || @parent && @parent._#{name}(name)
|
22
|
-
end
|
23
|
-
protected :_#{name}
|
24
|
-
|
25
|
-
def is_#{name}_global?(name)
|
26
|
-
return !@parent if @#{name}s && @#{name}s.has_key?(name)
|
27
|
-
@parent && @parent.is_#{name}_global?(name)
|
28
|
-
end
|
29
|
-
RUBY
|
30
|
-
end
|
31
|
-
|
32
|
-
def inherited_hash_writer(name)
|
33
|
-
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
34
|
-
def set_#{name}(name, value)
|
35
|
-
name = name.tr('_', '-')
|
36
|
-
@#{name}s[name] = value unless try_set_#{name}(name, value)
|
37
|
-
end
|
38
|
-
|
39
|
-
def try_set_#{name}(name, value)
|
40
|
-
@#{name}s ||= {}
|
41
|
-
if @#{name}s.include?(name)
|
42
|
-
@#{name}s[name] = value
|
43
|
-
true
|
44
|
-
elsif @parent && !@parent.global?
|
45
|
-
@parent.try_set_#{name}(name, value)
|
46
|
-
else
|
47
|
-
false
|
48
|
-
end
|
49
|
-
end
|
50
|
-
protected :try_set_#{name}
|
51
|
-
|
52
|
-
def set_local_#{name}(name, value)
|
53
|
-
@#{name}s ||= {}
|
54
|
-
@#{name}s[name.tr('_', '-')] = value
|
55
|
-
end
|
56
|
-
|
57
|
-
def set_global_#{name}(name, value)
|
58
|
-
global_env.set_#{name}(name, value)
|
59
|
-
end
|
60
|
-
RUBY
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
# The options passed to the Sass Engine.
|
65
|
-
attr_reader :options
|
66
|
-
|
67
|
-
attr_writer :caller
|
68
|
-
attr_writer :content
|
69
|
-
attr_writer :selector
|
70
|
-
|
71
|
-
# variable
|
72
|
-
# Script::Value
|
73
|
-
inherited_hash_reader :var
|
74
|
-
|
75
|
-
# mixin
|
76
|
-
# Sass::Callable
|
77
|
-
inherited_hash_reader :mixin
|
78
|
-
|
79
|
-
# function
|
80
|
-
# Sass::Callable
|
81
|
-
inherited_hash_reader :function
|
82
|
-
|
83
|
-
# @param options [{Symbol => Object}] The options hash. See
|
84
|
-
# {file:SASS_REFERENCE.md#Options the Sass options documentation}.
|
85
|
-
# @param parent [Environment] See \{#parent}
|
86
|
-
def initialize(parent = nil, options = nil)
|
87
|
-
@parent = parent
|
88
|
-
@options = options || (parent && parent.options) || {}
|
89
|
-
@stack = @parent.nil? ? Sass::Stack.new : nil
|
90
|
-
@caller = nil
|
91
|
-
@content = nil
|
92
|
-
@filename = nil
|
93
|
-
@functions = nil
|
94
|
-
@mixins = nil
|
95
|
-
@selector = nil
|
96
|
-
@vars = nil
|
97
|
-
end
|
98
|
-
|
99
|
-
# Returns whether this is the global environment.
|
100
|
-
#
|
101
|
-
# @return [Boolean]
|
102
|
-
def global?
|
103
|
-
@parent.nil?
|
104
|
-
end
|
105
|
-
|
106
|
-
# The environment of the caller of this environment's mixin or function.
|
107
|
-
# @return {Environment?}
|
108
|
-
def caller
|
109
|
-
@caller || (@parent && @parent.caller)
|
110
|
-
end
|
111
|
-
|
112
|
-
# The content passed to this environment. This is naturally only set
|
113
|
-
# for mixin body environments with content passed in.
|
114
|
-
#
|
115
|
-
# @return {[Array<Sass::Tree::Node>, Environment]?} The content nodes and
|
116
|
-
# the lexical environment of the content block.
|
117
|
-
def content
|
118
|
-
@content || (@parent && @parent.content)
|
119
|
-
end
|
120
|
-
|
121
|
-
# The selector for the current CSS rule, or nil if there is no
|
122
|
-
# current CSS rule.
|
123
|
-
#
|
124
|
-
# @return [Selector::CommaSequence?] The current selector, with any
|
125
|
-
# nesting fully resolved.
|
126
|
-
def selector
|
127
|
-
@selector || (@caller && @caller.selector) || (@parent && @parent.selector)
|
128
|
-
end
|
129
|
-
|
130
|
-
# The top-level Environment object.
|
131
|
-
#
|
132
|
-
# @return [Environment]
|
133
|
-
def global_env
|
134
|
-
@global_env ||= global? ? self : @parent.global_env
|
135
|
-
end
|
136
|
-
|
137
|
-
# The import/mixin stack.
|
138
|
-
#
|
139
|
-
# @return [Sass::Stack]
|
140
|
-
def stack
|
141
|
-
@stack || global_env.stack
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
# The lexical environment for SassScript.
|
146
|
-
# This keeps track of variable, mixin, and function definitions.
|
147
|
-
#
|
148
|
-
# A new environment is created for each level of Sass nesting.
|
149
|
-
# This allows variables to be lexically scoped.
|
150
|
-
# The new environment refers to the environment in the upper scope,
|
151
|
-
# so it has access to variables defined in enclosing scopes,
|
152
|
-
# but new variables are defined locally.
|
153
|
-
#
|
154
|
-
# Environment also keeps track of the {Engine} options
|
155
|
-
# so that they can be made available to {Sass::Script::Functions}.
|
156
|
-
class Environment < BaseEnvironment
|
157
|
-
# The enclosing environment,
|
158
|
-
# or nil if this is the global environment.
|
159
|
-
#
|
160
|
-
# @return [Environment]
|
161
|
-
attr_reader :parent
|
162
|
-
|
163
|
-
# variable
|
164
|
-
# Script::Value
|
165
|
-
inherited_hash_writer :var
|
166
|
-
|
167
|
-
# mixin
|
168
|
-
# Sass::Callable
|
169
|
-
inherited_hash_writer :mixin
|
170
|
-
|
171
|
-
# function
|
172
|
-
# Sass::Callable
|
173
|
-
inherited_hash_writer :function
|
174
|
-
end
|
175
|
-
|
176
|
-
# A read-only wrapper for a lexical environment for SassScript.
|
177
|
-
class ReadOnlyEnvironment < BaseEnvironment
|
178
|
-
# The read-only environment of the caller of this environment's mixin or function.
|
179
|
-
#
|
180
|
-
# @see BaseEnvironment#caller
|
181
|
-
# @return {ReadOnlyEnvironment}
|
182
|
-
def caller
|
183
|
-
return @caller if @caller
|
184
|
-
env = super
|
185
|
-
@caller ||= env.is_a?(ReadOnlyEnvironment) ? env : ReadOnlyEnvironment.new(env, env.options)
|
186
|
-
end
|
187
|
-
|
188
|
-
# The read-only content passed to this environment.
|
189
|
-
#
|
190
|
-
# @see BaseEnvironment#content
|
191
|
-
# @return {ReadOnlyEnvironment}
|
192
|
-
def content
|
193
|
-
return @content if @content
|
194
|
-
env = super
|
195
|
-
@content ||= env.is_a?(ReadOnlyEnvironment) ? env : ReadOnlyEnvironment.new(env, env.options)
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
# An environment that can write to in-scope global variables, but doesn't
|
200
|
-
# create new variables in the global scope. Useful for top-level control
|
201
|
-
# directives.
|
202
|
-
class SemiGlobalEnvironment < Environment
|
203
|
-
def try_set_var(name, value)
|
204
|
-
@vars ||= {}
|
205
|
-
if @vars.include?(name)
|
206
|
-
@vars[name] = value
|
207
|
-
true
|
208
|
-
elsif @parent
|
209
|
-
@parent.try_set_var(name, value)
|
210
|
-
else
|
211
|
-
false
|
212
|
-
end
|
213
|
-
end
|
214
|
-
end
|
215
|
-
end
|
@@ -1,198 +0,0 @@
|
|
1
|
-
module Sass
|
2
|
-
# An exception class that keeps track of
|
3
|
-
# the line of the Sass template it was raised on
|
4
|
-
# and the Sass file that was being parsed (if applicable).
|
5
|
-
#
|
6
|
-
# All Sass errors are raised as {Sass::SyntaxError}s.
|
7
|
-
#
|
8
|
-
# When dealing with SyntaxErrors,
|
9
|
-
# it's important to provide filename and line number information.
|
10
|
-
# This will be used in various error reports to users, including backtraces;
|
11
|
-
# see \{#sass\_backtrace} for details.
|
12
|
-
#
|
13
|
-
# Some of this information is usually provided as part of the constructor.
|
14
|
-
# New backtrace entries can be added with \{#add\_backtrace},
|
15
|
-
# which is called when an exception is raised between files (e.g. with `@import`).
|
16
|
-
#
|
17
|
-
# Often, a chunk of code will all have similar backtrace information -
|
18
|
-
# the same filename or even line.
|
19
|
-
# It may also be useful to have a default line number set.
|
20
|
-
# In those situations, the default values can be used
|
21
|
-
# by omitting the information on the original exception,
|
22
|
-
# and then calling \{#modify\_backtrace} in a wrapper `rescue`.
|
23
|
-
# When doing this, be sure that all exceptions ultimately end up
|
24
|
-
# with the information filled in.
|
25
|
-
class SyntaxError < StandardError
|
26
|
-
# The backtrace of the error within Sass files.
|
27
|
-
# This is an array of hashes containing information for a single entry.
|
28
|
-
# The hashes have the following keys:
|
29
|
-
#
|
30
|
-
# `:filename`
|
31
|
-
# : The name of the file in which the exception was raised,
|
32
|
-
# or `nil` if no filename is available.
|
33
|
-
#
|
34
|
-
# `:mixin`
|
35
|
-
# : The name of the mixin in which the exception was raised,
|
36
|
-
# or `nil` if it wasn't raised in a mixin.
|
37
|
-
#
|
38
|
-
# `:line`
|
39
|
-
# : The line of the file on which the error occurred. Never nil.
|
40
|
-
#
|
41
|
-
# This information is also included in standard backtrace format
|
42
|
-
# in the output of \{#backtrace}.
|
43
|
-
#
|
44
|
-
# @return [Aray<{Symbol => Object>}]
|
45
|
-
attr_accessor :sass_backtrace
|
46
|
-
|
47
|
-
# The text of the template where this error was raised.
|
48
|
-
#
|
49
|
-
# @return [String]
|
50
|
-
attr_accessor :sass_template
|
51
|
-
|
52
|
-
# @param msg [String] The error message
|
53
|
-
# @param attrs [{Symbol => Object}] The information in the backtrace entry.
|
54
|
-
# See \{#sass\_backtrace}
|
55
|
-
def initialize(msg, attrs = {})
|
56
|
-
@message = msg
|
57
|
-
@sass_backtrace = []
|
58
|
-
add_backtrace(attrs)
|
59
|
-
end
|
60
|
-
|
61
|
-
# The name of the file in which the exception was raised.
|
62
|
-
# This could be `nil` if no filename is available.
|
63
|
-
#
|
64
|
-
# @return [String, nil]
|
65
|
-
def sass_filename
|
66
|
-
sass_backtrace.first[:filename]
|
67
|
-
end
|
68
|
-
|
69
|
-
# The name of the mixin in which the error occurred.
|
70
|
-
# This could be `nil` if the error occurred outside a mixin.
|
71
|
-
#
|
72
|
-
# @return [String]
|
73
|
-
def sass_mixin
|
74
|
-
sass_backtrace.first[:mixin]
|
75
|
-
end
|
76
|
-
|
77
|
-
# The line of the Sass template on which the error occurred.
|
78
|
-
#
|
79
|
-
# @return [Integer]
|
80
|
-
def sass_line
|
81
|
-
sass_backtrace.first[:line]
|
82
|
-
end
|
83
|
-
|
84
|
-
# Adds an entry to the exception's Sass backtrace.
|
85
|
-
#
|
86
|
-
# @param attrs [{Symbol => Object}] The information in the backtrace entry.
|
87
|
-
# See \{#sass\_backtrace}
|
88
|
-
def add_backtrace(attrs)
|
89
|
-
sass_backtrace << attrs.reject {|_k, v| v.nil?}
|
90
|
-
end
|
91
|
-
|
92
|
-
# Modify the top Sass backtrace entries
|
93
|
-
# (that is, the most deeply nested ones)
|
94
|
-
# to have the given attributes.
|
95
|
-
#
|
96
|
-
# Specifically, this goes through the backtrace entries
|
97
|
-
# from most deeply nested to least,
|
98
|
-
# setting the given attributes for each entry.
|
99
|
-
# If an entry already has one of the given attributes set,
|
100
|
-
# the pre-existing attribute takes precedence
|
101
|
-
# and is not used for less deeply-nested entries
|
102
|
-
# (even if they don't have that attribute set).
|
103
|
-
#
|
104
|
-
# @param attrs [{Symbol => Object}] The information to add to the backtrace entry.
|
105
|
-
# See \{#sass\_backtrace}
|
106
|
-
def modify_backtrace(attrs)
|
107
|
-
attrs = attrs.reject {|_k, v| v.nil?}
|
108
|
-
# Move backwards through the backtrace
|
109
|
-
(0...sass_backtrace.size).to_a.reverse_each do |i|
|
110
|
-
entry = sass_backtrace[i]
|
111
|
-
sass_backtrace[i] = attrs.merge(entry)
|
112
|
-
attrs.reject! {|k, _v| entry.include?(k)}
|
113
|
-
break if attrs.empty?
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
# @return [String] The error message
|
118
|
-
def to_s
|
119
|
-
@message
|
120
|
-
end
|
121
|
-
|
122
|
-
# Returns the standard exception backtrace,
|
123
|
-
# including the Sass backtrace.
|
124
|
-
#
|
125
|
-
# @return [Array<String>]
|
126
|
-
def backtrace
|
127
|
-
return nil if super.nil?
|
128
|
-
return super if sass_backtrace.all? {|h| h.empty?}
|
129
|
-
sass_backtrace.map do |h|
|
130
|
-
"#{h[:filename] || '(sass)'}:#{h[:line]}" +
|
131
|
-
(h[:mixin] ? ":in `#{h[:mixin]}'" : "")
|
132
|
-
end + super
|
133
|
-
end
|
134
|
-
|
135
|
-
# Returns a string representation of the Sass backtrace.
|
136
|
-
#
|
137
|
-
# @param default_filename [String] The filename to use for unknown files
|
138
|
-
# @see #sass_backtrace
|
139
|
-
# @return [String]
|
140
|
-
def sass_backtrace_str(default_filename = "an unknown file")
|
141
|
-
lines = message.split("\n")
|
142
|
-
msg = lines[0] + lines[1..-1].
|
143
|
-
map {|l| "\n" + (" " * "Error: ".size) + l}.join
|
144
|
-
"Error: #{msg}" +
|
145
|
-
Sass::Util.enum_with_index(sass_backtrace).map do |entry, i|
|
146
|
-
"\n #{i == 0 ? 'on' : 'from'} line #{entry[:line]}" +
|
147
|
-
" of #{entry[:filename] || default_filename}" +
|
148
|
-
(entry[:mixin] ? ", in `#{entry[:mixin]}'" : "")
|
149
|
-
end.join
|
150
|
-
end
|
151
|
-
|
152
|
-
class << self
|
153
|
-
# Returns an error report for an exception in CSS format.
|
154
|
-
#
|
155
|
-
# @param e [Exception]
|
156
|
-
# @param line_offset [Integer] The number of the first line of the Sass template.
|
157
|
-
# @return [String] The error report
|
158
|
-
# @raise [Exception] `e`, if the
|
159
|
-
# {file:SASS_REFERENCE.md#full_exception-option `:full_exception`} option
|
160
|
-
# is set to false.
|
161
|
-
def exception_to_css(e, line_offset = 1)
|
162
|
-
header = header_string(e, line_offset)
|
163
|
-
|
164
|
-
<<END
|
165
|
-
/*
|
166
|
-
#{header.gsub('*/', '*\\/')}
|
167
|
-
|
168
|
-
Backtrace:\n#{e.backtrace.join("\n").gsub('*/', '*\\/')}
|
169
|
-
*/
|
170
|
-
body:before {
|
171
|
-
white-space: pre;
|
172
|
-
font-family: monospace;
|
173
|
-
content: "#{header.gsub('"', '\"').gsub("\n", '\\A ')}"; }
|
174
|
-
END
|
175
|
-
end
|
176
|
-
|
177
|
-
private
|
178
|
-
|
179
|
-
def header_string(e, line_offset)
|
180
|
-
unless e.is_a?(Sass::SyntaxError) && e.sass_line && e.sass_template
|
181
|
-
return "#{e.class}: #{e.message}"
|
182
|
-
end
|
183
|
-
|
184
|
-
line_num = e.sass_line + 1 - line_offset
|
185
|
-
min = [line_num - 6, 0].max
|
186
|
-
section = e.sass_template.rstrip.split("\n")[min...line_num + 5]
|
187
|
-
return e.sass_backtrace_str if section.nil? || section.empty?
|
188
|
-
|
189
|
-
e.sass_backtrace_str + "\n\n" + Sass::Util.enum_with_index(section).
|
190
|
-
map {|line, i| "#{line_offset + min + i}: #{line}"}.join("\n")
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
# The class for Sass errors that are raised due to invalid unit conversions
|
196
|
-
# in SassScript.
|
197
|
-
class UnitConversionError < SyntaxError; end
|
198
|
-
end
|
@@ -1,199 +0,0 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
|
3
|
-
module Sass::Exec
|
4
|
-
# The abstract base class for Sass executables.
|
5
|
-
class Base
|
6
|
-
# @param args [Array<String>] The command-line arguments
|
7
|
-
def initialize(args)
|
8
|
-
@args = args
|
9
|
-
@options = {}
|
10
|
-
end
|
11
|
-
|
12
|
-
# Parses the command-line arguments and runs the executable.
|
13
|
-
# Calls `Kernel#exit` at the end, so it never returns.
|
14
|
-
#
|
15
|
-
# @see #parse
|
16
|
-
def parse!
|
17
|
-
# rubocop:disable RescueException
|
18
|
-
begin
|
19
|
-
parse
|
20
|
-
rescue Exception => e
|
21
|
-
# Exit code 65 indicates invalid data per
|
22
|
-
# http://www.freebsd.org/cgi/man.cgi?query=sysexits. Setting it via
|
23
|
-
# at_exit is a bit of a hack, but it allows us to rethrow when --trace
|
24
|
-
# is active and get both the built-in exception formatting and the
|
25
|
-
# correct exit code.
|
26
|
-
at_exit {exit Sass::Util.windows? ? 13 : 65} if e.is_a?(Sass::SyntaxError)
|
27
|
-
|
28
|
-
raise e if @options[:trace] || e.is_a?(SystemExit)
|
29
|
-
|
30
|
-
if e.is_a?(Sass::SyntaxError)
|
31
|
-
$stderr.puts e.sass_backtrace_str("standard input")
|
32
|
-
else
|
33
|
-
$stderr.print "#{e.class}: " unless e.class == RuntimeError
|
34
|
-
$stderr.puts e.message.to_s
|
35
|
-
end
|
36
|
-
$stderr.puts " Use --trace for backtrace."
|
37
|
-
|
38
|
-
exit 1
|
39
|
-
end
|
40
|
-
exit 0
|
41
|
-
# rubocop:enable RescueException
|
42
|
-
end
|
43
|
-
|
44
|
-
# Parses the command-line arguments and runs the executable.
|
45
|
-
# This does not handle exceptions or exit the program.
|
46
|
-
#
|
47
|
-
# @see #parse!
|
48
|
-
def parse
|
49
|
-
@opts = OptionParser.new(&method(:set_opts))
|
50
|
-
@opts.parse!(@args)
|
51
|
-
|
52
|
-
process_result
|
53
|
-
|
54
|
-
@options
|
55
|
-
end
|
56
|
-
|
57
|
-
# @return [String] A description of the executable
|
58
|
-
def to_s
|
59
|
-
@opts.to_s
|
60
|
-
end
|
61
|
-
|
62
|
-
protected
|
63
|
-
|
64
|
-
# Finds the line of the source template
|
65
|
-
# on which an exception was raised.
|
66
|
-
#
|
67
|
-
# @param exception [Exception] The exception
|
68
|
-
# @return [String] The line number
|
69
|
-
def get_line(exception)
|
70
|
-
# SyntaxErrors have weird line reporting
|
71
|
-
# when there's trailing whitespace
|
72
|
-
if exception.is_a?(::SyntaxError)
|
73
|
-
return (exception.message.scan(/:(\d+)/).first || ["??"]).first
|
74
|
-
end
|
75
|
-
(exception.backtrace[0].scan(/:(\d+)/).first || ["??"]).first
|
76
|
-
end
|
77
|
-
|
78
|
-
# Tells optparse how to parse the arguments
|
79
|
-
# available for all executables.
|
80
|
-
#
|
81
|
-
# This is meant to be overridden by subclasses
|
82
|
-
# so they can add their own options.
|
83
|
-
#
|
84
|
-
# @param opts [OptionParser]
|
85
|
-
def set_opts(opts)
|
86
|
-
Sass::Util.abstract(this)
|
87
|
-
end
|
88
|
-
|
89
|
-
# Set an option for specifying `Encoding.default_external`.
|
90
|
-
#
|
91
|
-
# @param opts [OptionParser]
|
92
|
-
def encoding_option(opts)
|
93
|
-
encoding_desc = if Sass::Util.ruby1_8?
|
94
|
-
'Does not work in Ruby 1.8.'
|
95
|
-
else
|
96
|
-
'Specify the default encoding for input files.'
|
97
|
-
end
|
98
|
-
opts.on('-E', '--default-encoding ENCODING', encoding_desc) do |encoding|
|
99
|
-
if Sass::Util.ruby1_8?
|
100
|
-
$stderr.puts "Specifying the encoding is not supported in ruby 1.8."
|
101
|
-
exit 1
|
102
|
-
else
|
103
|
-
Encoding.default_external = encoding
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
# Processes the options set by the command-line arguments. In particular,
|
109
|
-
# sets `@options[:input]` and `@options[:output]` to appropriate IO streams.
|
110
|
-
#
|
111
|
-
# This is meant to be overridden by subclasses
|
112
|
-
# so they can run their respective programs.
|
113
|
-
def process_result
|
114
|
-
input, output = @options[:input], @options[:output]
|
115
|
-
args = @args.dup
|
116
|
-
input ||=
|
117
|
-
begin
|
118
|
-
filename = args.shift
|
119
|
-
@options[:filename] = filename
|
120
|
-
open_file(filename) || $stdin
|
121
|
-
end
|
122
|
-
@options[:output_filename] = args.shift
|
123
|
-
output ||= @options[:output_filename] || $stdout
|
124
|
-
@options[:input], @options[:output] = input, output
|
125
|
-
end
|
126
|
-
|
127
|
-
COLORS = {:red => 31, :green => 32, :yellow => 33}
|
128
|
-
|
129
|
-
# Prints a status message about performing the given action,
|
130
|
-
# colored using the given color (via terminal escapes) if possible.
|
131
|
-
#
|
132
|
-
# @param name [#to_s] A short name for the action being performed.
|
133
|
-
# Shouldn't be longer than 11 characters.
|
134
|
-
# @param color [Symbol] The name of the color to use for this action.
|
135
|
-
# Can be `:red`, `:green`, or `:yellow`.
|
136
|
-
def puts_action(name, color, arg)
|
137
|
-
return if @options[:for_engine][:quiet]
|
138
|
-
printf color(color, "%11s %s\n"), name, arg
|
139
|
-
STDOUT.flush
|
140
|
-
end
|
141
|
-
|
142
|
-
# Same as `Kernel.puts`, but doesn't print anything if the `--quiet` option is set.
|
143
|
-
#
|
144
|
-
# @param args [Array] Passed on to `Kernel.puts`
|
145
|
-
def puts(*args)
|
146
|
-
return if @options[:for_engine][:quiet]
|
147
|
-
Kernel.puts(*args)
|
148
|
-
end
|
149
|
-
|
150
|
-
# Wraps the given string in terminal escapes
|
151
|
-
# causing it to have the given color.
|
152
|
-
# If terminal escapes aren't supported on this platform,
|
153
|
-
# just returns the string instead.
|
154
|
-
#
|
155
|
-
# @param color [Symbol] The name of the color to use.
|
156
|
-
# Can be `:red`, `:green`, or `:yellow`.
|
157
|
-
# @param str [String] The string to wrap in the given color.
|
158
|
-
# @return [String] The wrapped string.
|
159
|
-
def color(color, str)
|
160
|
-
raise "[BUG] Unrecognized color #{color}" unless COLORS[color]
|
161
|
-
|
162
|
-
# Almost any real Unix terminal will support color,
|
163
|
-
# so we just filter for Windows terms (which don't set TERM)
|
164
|
-
# and not-real terminals, which aren't ttys.
|
165
|
-
return str if ENV["TERM"].nil? || ENV["TERM"].empty? || !STDOUT.tty?
|
166
|
-
"\e[#{COLORS[color]}m#{str}\e[0m"
|
167
|
-
end
|
168
|
-
|
169
|
-
def write_output(text, destination)
|
170
|
-
if destination.is_a?(String)
|
171
|
-
open_file(destination, 'w') {|file| file.write(text)}
|
172
|
-
else
|
173
|
-
destination.write(text)
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
private
|
178
|
-
|
179
|
-
def open_file(filename, flag = 'r')
|
180
|
-
return if filename.nil?
|
181
|
-
flag = 'wb' if @options[:unix_newlines] && flag == 'w'
|
182
|
-
file = File.open(filename, flag)
|
183
|
-
return file unless block_given?
|
184
|
-
yield file
|
185
|
-
file.close
|
186
|
-
end
|
187
|
-
|
188
|
-
def handle_load_error(err)
|
189
|
-
dep = err.message[/^no such file to load -- (.*)/, 1]
|
190
|
-
raise err if @options[:trace] || dep.nil? || dep.empty?
|
191
|
-
$stderr.puts <<MESSAGE
|
192
|
-
Required dependency #{dep} not found!
|
193
|
-
Run "gem install #{dep}" to get it.
|
194
|
-
Use --trace for backtrace.
|
195
|
-
MESSAGE
|
196
|
-
exit 1
|
197
|
-
end
|
198
|
-
end
|
199
|
-
end
|