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,75 +0,0 @@
|
|
1
|
-
module Listen
|
2
|
-
module Adapters
|
3
|
-
|
4
|
-
# Listener implementation for BSD's `kqueue`.
|
5
|
-
#
|
6
|
-
class BSD < Adapter
|
7
|
-
# Watched kqueue events
|
8
|
-
#
|
9
|
-
# @see http://www.freebsd.org/cgi/man.cgi?query=kqueue
|
10
|
-
# @see https://github.com/nex3/rb-kqueue/blob/master/lib/rb-kqueue/queue.rb
|
11
|
-
#
|
12
|
-
EVENTS = [:delete, :write, :extend, :attrib, :link, :rename, :revoke]
|
13
|
-
|
14
|
-
def self.target_os_regex; /freebsd/i; end
|
15
|
-
def self.adapter_gem; 'rb-kqueue'; end
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
# Initializes a kqueue Queue and adds a watcher for each files in
|
20
|
-
# the directories passed to the adapter.
|
21
|
-
#
|
22
|
-
# @return [INotify::Notifier] initialized kqueue
|
23
|
-
#
|
24
|
-
# @see Listen::Adapter#initialize_worker
|
25
|
-
#
|
26
|
-
def initialize_worker
|
27
|
-
require 'find'
|
28
|
-
|
29
|
-
callback = lambda do |event|
|
30
|
-
path = event.watcher.path
|
31
|
-
mutex.synchronize do
|
32
|
-
# kqueue watches everything, but Listen only needs the
|
33
|
-
# directory where stuffs happens.
|
34
|
-
@changed_directories << (File.directory?(path) ? path : File.dirname(path))
|
35
|
-
|
36
|
-
# If it is a directory, and it has a write flag, it means a
|
37
|
-
# file has been added so find out which and deal with it.
|
38
|
-
# No need to check for removed files, kqueue will forget them
|
39
|
-
# when the vfs does.
|
40
|
-
if File.directory?(path) && event.flags.include?(:write)
|
41
|
-
queue = event.watcher.queue
|
42
|
-
Find.find(path) do |file|
|
43
|
-
unless queue.watchers.detect { |k,v| v.path == file.to_s }
|
44
|
-
queue.watch_file(file, *EVENTS, &callback)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
KQueue::Queue.new.tap do |queue|
|
52
|
-
directories.each do |directory|
|
53
|
-
Find.find(directory) do |path|
|
54
|
-
queue.watch_file(path, *EVENTS, &callback)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
# Starts the worker in a new thread.
|
61
|
-
#
|
62
|
-
# @see Listen::Adapter#start_worker
|
63
|
-
#
|
64
|
-
def start_worker
|
65
|
-
@worker_thread = Thread.new do
|
66
|
-
until stopped
|
67
|
-
worker.poll
|
68
|
-
sleep(latency)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
end
|
75
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
module Listen
|
2
|
-
module Adapters
|
3
|
-
|
4
|
-
# Adapter implementation for Mac OS X `FSEvents`.
|
5
|
-
#
|
6
|
-
class Darwin < Adapter
|
7
|
-
LAST_SEPARATOR_REGEX = /\/$/
|
8
|
-
|
9
|
-
|
10
|
-
def self.target_os_regex; /darwin(1.+)?$/i; end
|
11
|
-
def self.adapter_gem; 'rb-fsevent'; end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
# Initializes a FSEvent worker and adds a watcher for
|
16
|
-
# each directory passed to the adapter.
|
17
|
-
#
|
18
|
-
# @return [FSEvent] initialized worker
|
19
|
-
#
|
20
|
-
# @see Listen::Adapter#initialize_worker
|
21
|
-
#
|
22
|
-
def initialize_worker
|
23
|
-
FSEvent.new.tap do |worker|
|
24
|
-
worker.watch(directories.dup, :latency => latency) do |changes|
|
25
|
-
next if paused
|
26
|
-
|
27
|
-
mutex.synchronize do
|
28
|
-
changes.each { |path| @changed_directories << path.sub(LAST_SEPARATOR_REGEX, '') }
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
# Starts the worker in a new thread and sleep 0.1 second.
|
35
|
-
#
|
36
|
-
# @see Listen::Adapter#start_worker
|
37
|
-
#
|
38
|
-
def start_worker
|
39
|
-
@worker_thread = Thread.new { worker.run }
|
40
|
-
# The FSEvent worker needs some time to start up. Turnstiles can't
|
41
|
-
# be used to wait for it as it runs in a loop.
|
42
|
-
# TODO: Find a better way to block until the worker starts.
|
43
|
-
sleep 0.1
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
end
|
@@ -1,81 +0,0 @@
|
|
1
|
-
module Listen
|
2
|
-
module Adapters
|
3
|
-
|
4
|
-
# Listener implementation for Linux `inotify`.
|
5
|
-
#
|
6
|
-
class Linux < Adapter
|
7
|
-
# Watched inotify events
|
8
|
-
#
|
9
|
-
# @see http://www.tin.org/bin/man.cgi?section=7&topic=inotify
|
10
|
-
# @see https://github.com/nex3/rb-inotify/blob/master/lib/rb-inotify/notifier.rb#L99-L177
|
11
|
-
#
|
12
|
-
EVENTS = [:recursive, :attrib, :create, :delete, :move, :close_write]
|
13
|
-
|
14
|
-
# The message to show when the limit of inotify watchers is not enough
|
15
|
-
#
|
16
|
-
INOTIFY_LIMIT_MESSAGE = <<-EOS.gsub(/^\s*/, '')
|
17
|
-
Listen error: unable to monitor directories for changes.
|
18
|
-
|
19
|
-
Please head to https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers
|
20
|
-
for information on how to solve this issue.
|
21
|
-
EOS
|
22
|
-
|
23
|
-
def self.target_os_regex; /linux/i; end
|
24
|
-
def self.adapter_gem; 'rb-inotify'; end
|
25
|
-
|
26
|
-
# Initializes the Adapter.
|
27
|
-
#
|
28
|
-
# @see Listen::Adapter#initialize
|
29
|
-
#
|
30
|
-
def initialize(directories, options = {}, &callback)
|
31
|
-
super
|
32
|
-
rescue Errno::ENOSPC
|
33
|
-
abort(INOTIFY_LIMIT_MESSAGE)
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
# Initializes a INotify worker and adds a watcher for
|
39
|
-
# each directory passed to the adapter.
|
40
|
-
#
|
41
|
-
# @return [INotify::Notifier] initialized worker
|
42
|
-
#
|
43
|
-
# @see Listen::Adapter#initialize_worker
|
44
|
-
#
|
45
|
-
def initialize_worker
|
46
|
-
callback = lambda do |event|
|
47
|
-
if paused || (
|
48
|
-
# Event on root directory
|
49
|
-
event.name == ""
|
50
|
-
) || (
|
51
|
-
# INotify reports changes to files inside directories as events
|
52
|
-
# on the directories themselves too.
|
53
|
-
#
|
54
|
-
# @see http://linux.die.net/man/7/inotify
|
55
|
-
event.flags.include?(:isdir) and (event.flags & [:close, :modify]).any?
|
56
|
-
)
|
57
|
-
# Skip all of these!
|
58
|
-
next
|
59
|
-
end
|
60
|
-
|
61
|
-
mutex.synchronize do
|
62
|
-
@changed_directories << File.dirname(event.absolute_name)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
INotify::Notifier.new.tap do |worker|
|
67
|
-
directories.each { |dir| worker.watch(dir, *EVENTS, &callback) }
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
# Starts the worker in a new thread.
|
72
|
-
#
|
73
|
-
# @see Listen::Adapter#start_worker
|
74
|
-
#
|
75
|
-
def start_worker
|
76
|
-
@worker_thread = Thread.new { worker.run }
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
81
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
module Listen
|
2
|
-
module Adapters
|
3
|
-
|
4
|
-
DEFAULT_POLLING_LATENCY = 1.0
|
5
|
-
|
6
|
-
# Polling Adapter that works cross-platform and
|
7
|
-
# has no dependencies. This is the adapter that
|
8
|
-
# uses the most CPU processing power and has higher
|
9
|
-
# file IO than the other implementations.
|
10
|
-
#
|
11
|
-
class Polling < Adapter
|
12
|
-
private
|
13
|
-
|
14
|
-
# The default delay between checking for changes.
|
15
|
-
#
|
16
|
-
# @see Listen::Adapter#default_latency
|
17
|
-
#
|
18
|
-
def default_latency
|
19
|
-
1.0
|
20
|
-
end
|
21
|
-
|
22
|
-
# The thread on which the main thread should wait
|
23
|
-
# when the adapter has been started in blocking mode.
|
24
|
-
#
|
25
|
-
# @see Listen::Adapter#blocking_thread
|
26
|
-
#
|
27
|
-
def blocking_thread
|
28
|
-
poller_thread
|
29
|
-
end
|
30
|
-
|
31
|
-
# @see Listen::Adapter#start_worker
|
32
|
-
#
|
33
|
-
# @see Listen::Adapter#start_worker
|
34
|
-
#
|
35
|
-
def start_worker
|
36
|
-
# The polling adapter has no worker! Sad panda! :'(
|
37
|
-
end
|
38
|
-
|
39
|
-
# Poll listener directory for file system changes.
|
40
|
-
#
|
41
|
-
# @see Listen::Adapter#poll_changed_directories
|
42
|
-
#
|
43
|
-
def poll_changed_directories
|
44
|
-
until stopped
|
45
|
-
next if paused
|
46
|
-
|
47
|
-
start = Time.now.to_f
|
48
|
-
callback.call(directories.dup, :recursive => true)
|
49
|
-
turnstile.signal
|
50
|
-
nap_time = latency - (Time.now.to_f - start)
|
51
|
-
sleep(nap_time) if nap_time > 0
|
52
|
-
end
|
53
|
-
rescue Interrupt
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
58
|
-
end
|
@@ -1,91 +0,0 @@
|
|
1
|
-
require 'set'
|
2
|
-
require 'rubygems'
|
3
|
-
|
4
|
-
module Listen
|
5
|
-
module Adapters
|
6
|
-
|
7
|
-
# Adapter implementation for Windows `wdm`.
|
8
|
-
#
|
9
|
-
class Windows < Adapter
|
10
|
-
|
11
|
-
BUNDLER_DECLARE_GEM = <<-EOS.gsub(/^ {6}/, '')
|
12
|
-
Please add the following to your Gemfile to avoid polling for changes:
|
13
|
-
require 'rbconfig'
|
14
|
-
gem 'wdm', '>= 0.1.0' if RbConfig::CONFIG['target_os'] =~ /mswin|mingw/i
|
15
|
-
EOS
|
16
|
-
|
17
|
-
def self.target_os_regex; /mswin|mingw/i; end
|
18
|
-
def self.adapter_gem; 'wdm'; end
|
19
|
-
|
20
|
-
# Checks if the adapter is usable on target OS.
|
21
|
-
#
|
22
|
-
# @return [Boolean] whether usable or not
|
23
|
-
#
|
24
|
-
def self.usable?
|
25
|
-
super if mri? && at_least_ruby_1_9?
|
26
|
-
end
|
27
|
-
|
28
|
-
# Load the adapter gem
|
29
|
-
#
|
30
|
-
# @return [Boolean] whether required or not
|
31
|
-
#
|
32
|
-
def self.load_dependent_adapter
|
33
|
-
super
|
34
|
-
rescue Gem::LoadError
|
35
|
-
Kernel.warn BUNDLER_DECLARE_GEM
|
36
|
-
end
|
37
|
-
|
38
|
-
private
|
39
|
-
|
40
|
-
# Checks if Ruby engine is MRI.
|
41
|
-
#
|
42
|
-
# @return [Boolean]
|
43
|
-
#
|
44
|
-
def self.mri?
|
45
|
-
defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby'
|
46
|
-
end
|
47
|
-
|
48
|
-
# Checks if Ruby engine is MRI.
|
49
|
-
#
|
50
|
-
# @return [Boolean]
|
51
|
-
#
|
52
|
-
def self.at_least_ruby_1_9?
|
53
|
-
Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('1.9.2')
|
54
|
-
end
|
55
|
-
|
56
|
-
# Initializes a WDM monitor and adds a watcher for
|
57
|
-
# each directory passed to the adapter.
|
58
|
-
#
|
59
|
-
# @return [WDM::Monitor] initialized worker
|
60
|
-
#
|
61
|
-
# @see Listen::Adapter#initialize_worker
|
62
|
-
#
|
63
|
-
def initialize_worker
|
64
|
-
callback = Proc.new do |change|
|
65
|
-
next if paused
|
66
|
-
|
67
|
-
mutex.synchronize do
|
68
|
-
@changed_directories << File.dirname(change.path)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
WDM::Monitor.new.tap do |worker|
|
73
|
-
directories.each { |dir| worker.watch_recursively(dir, &callback) }
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
# Start the worker in a new thread and sleep 0.1 second.
|
78
|
-
#
|
79
|
-
# @see Listen::Adapter#start_worker
|
80
|
-
#
|
81
|
-
def start_worker
|
82
|
-
@worker_thread = Thread.new { worker.run! }
|
83
|
-
# Wait for the worker to start. This is needed to avoid a deadlock
|
84
|
-
# when stopping immediately after starting.
|
85
|
-
sleep 0.1
|
86
|
-
end
|
87
|
-
|
88
|
-
end
|
89
|
-
|
90
|
-
end
|
91
|
-
end
|
@@ -1,406 +0,0 @@
|
|
1
|
-
require 'set'
|
2
|
-
require 'find'
|
3
|
-
require 'digest/sha1'
|
4
|
-
|
5
|
-
module Listen
|
6
|
-
|
7
|
-
# The directory record stores information about
|
8
|
-
# a directory and keeps track of changes to
|
9
|
-
# the structure of its childs.
|
10
|
-
#
|
11
|
-
class DirectoryRecord
|
12
|
-
attr_reader :directory, :paths, :sha1_checksums
|
13
|
-
|
14
|
-
# The default list of directories that get ignored by the listener.
|
15
|
-
DEFAULT_IGNORED_DIRECTORIES = %w[.rbx .bundle .git .svn bundle log tmp vendor]
|
16
|
-
|
17
|
-
# The default list of files that get ignored by the listener.
|
18
|
-
DEFAULT_IGNORED_EXTENSIONS = %w[.DS_Store]
|
19
|
-
|
20
|
-
# Defines the used precision based on the type of mtime returned by the
|
21
|
-
# system (whether its in milliseconds or just seconds)
|
22
|
-
#
|
23
|
-
begin
|
24
|
-
HIGH_PRECISION_SUPPORTED = File.mtime(__FILE__).to_f.to_s[-2..-1] != '.0'
|
25
|
-
rescue
|
26
|
-
HIGH_PRECISION_SUPPORTED = false
|
27
|
-
end
|
28
|
-
|
29
|
-
# Data structure used to save meta data about a path
|
30
|
-
#
|
31
|
-
MetaData = Struct.new(:type, :mtime)
|
32
|
-
|
33
|
-
# Class methods
|
34
|
-
#
|
35
|
-
class << self
|
36
|
-
|
37
|
-
# Creates the ignoring patterns from the default ignored
|
38
|
-
# directories and extensions. It memoizes the generated patterns
|
39
|
-
# to avoid unnecessary computation.
|
40
|
-
#
|
41
|
-
def generate_default_ignoring_patterns
|
42
|
-
@@default_ignoring_patterns ||= Array.new.tap do |default_patterns|
|
43
|
-
# Add directories
|
44
|
-
ignored_directories = DEFAULT_IGNORED_DIRECTORIES.map { |d| Regexp.escape(d) }
|
45
|
-
default_patterns << %r{^(?:#{ignored_directories.join('|')})/}
|
46
|
-
|
47
|
-
# Add extensions
|
48
|
-
ignored_extensions = DEFAULT_IGNORED_EXTENSIONS.map { |e| Regexp.escape(e) }
|
49
|
-
default_patterns << %r{(?:#{ignored_extensions.join('|')})$}
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
# Initializes a directory record.
|
55
|
-
#
|
56
|
-
# @option [String] directory the directory to keep track of
|
57
|
-
#
|
58
|
-
def initialize(directory)
|
59
|
-
raise ArgumentError, "The path '#{directory}' is not a directory!" unless File.directory?(directory)
|
60
|
-
|
61
|
-
@directory, @sha1_checksums = File.expand_path(directory), Hash.new
|
62
|
-
@ignoring_patterns, @filtering_patterns = Set.new, Set.new
|
63
|
-
|
64
|
-
@ignoring_patterns.merge(DirectoryRecord.generate_default_ignoring_patterns)
|
65
|
-
end
|
66
|
-
|
67
|
-
# Returns the ignoring patterns in the record to know
|
68
|
-
# which paths should be ignored.
|
69
|
-
#
|
70
|
-
# @return [Array<Regexp>] the ignoring patterns
|
71
|
-
#
|
72
|
-
def ignoring_patterns
|
73
|
-
@ignoring_patterns.to_a
|
74
|
-
end
|
75
|
-
|
76
|
-
# Returns the filtering patterns in the record to know
|
77
|
-
# which paths should be stored.
|
78
|
-
#
|
79
|
-
# @return [Array<Regexp>] the filtering patterns
|
80
|
-
#
|
81
|
-
def filtering_patterns
|
82
|
-
@filtering_patterns.to_a
|
83
|
-
end
|
84
|
-
|
85
|
-
# Adds ignoring patterns to the record.
|
86
|
-
#
|
87
|
-
# @example Ignore some paths
|
88
|
-
# ignore %r{^ignored/path/}, /man/
|
89
|
-
#
|
90
|
-
# @param [Regexp] regexps a list of patterns for ignoring paths
|
91
|
-
#
|
92
|
-
def ignore(*regexps)
|
93
|
-
@ignoring_patterns.merge(regexps).reject! { |r| r.nil? }
|
94
|
-
end
|
95
|
-
|
96
|
-
# Replaces ignoring patterns in the record.
|
97
|
-
#
|
98
|
-
# @example Ignore only these paths
|
99
|
-
# ignore! %r{^ignored/path/}, /man/
|
100
|
-
#
|
101
|
-
# @param [Regexp] regexps a list of patterns for ignoring paths
|
102
|
-
#
|
103
|
-
def ignore!(*regexps)
|
104
|
-
@ignoring_patterns.replace(regexps).reject! { |r| r.nil? }
|
105
|
-
end
|
106
|
-
|
107
|
-
# Adds filtering patterns to the record.
|
108
|
-
#
|
109
|
-
# @example Filter some files
|
110
|
-
# filter /\.txt$/, /.*\.zip/
|
111
|
-
#
|
112
|
-
# @param [Regexp] regexps a list of patterns for filtering files
|
113
|
-
#
|
114
|
-
def filter(*regexps)
|
115
|
-
@filtering_patterns.merge(regexps).reject! { |r| r.nil? }
|
116
|
-
end
|
117
|
-
|
118
|
-
# Replaces filtering patterns in the record.
|
119
|
-
#
|
120
|
-
# @example Filter only these files
|
121
|
-
# filter! /\.txt$/, /.*\.zip/
|
122
|
-
#
|
123
|
-
# @param [Regexp] regexps a list of patterns for filtering files
|
124
|
-
#
|
125
|
-
def filter!(*regexps)
|
126
|
-
@filtering_patterns.replace(regexps).reject! { |r| r.nil? }
|
127
|
-
end
|
128
|
-
|
129
|
-
# Returns whether a path should be ignored or not.
|
130
|
-
#
|
131
|
-
# @param [String] path the path to test
|
132
|
-
#
|
133
|
-
# @return [Boolean]
|
134
|
-
#
|
135
|
-
def ignored?(path)
|
136
|
-
path = relative_to_base(path)
|
137
|
-
@ignoring_patterns.any? { |pattern| pattern =~ path }
|
138
|
-
end
|
139
|
-
|
140
|
-
# Returns whether a path should be filtered or not.
|
141
|
-
#
|
142
|
-
# @param [String] path the path to test
|
143
|
-
#
|
144
|
-
# @return [Boolean]
|
145
|
-
#
|
146
|
-
def filtered?(path)
|
147
|
-
# When no filtering patterns are set, ALL files are stored.
|
148
|
-
return true if @filtering_patterns.empty?
|
149
|
-
|
150
|
-
path = relative_to_base(path)
|
151
|
-
@filtering_patterns.any? { |pattern| pattern =~ path }
|
152
|
-
end
|
153
|
-
|
154
|
-
# Finds the paths that should be stored and adds them
|
155
|
-
# to the paths' hash.
|
156
|
-
#
|
157
|
-
def build
|
158
|
-
@paths = Hash.new { |h, k| h[k] = Hash.new }
|
159
|
-
important_paths { |path| insert_path(path) }
|
160
|
-
end
|
161
|
-
|
162
|
-
# Detects changes in the passed directories, updates
|
163
|
-
# the record with the new changes and returns the changes.
|
164
|
-
#
|
165
|
-
# @param [Array] directories the list of directories to scan for changes
|
166
|
-
# @param [Hash] options
|
167
|
-
# @option options [Boolean] recursive scan all sub-directories recursively
|
168
|
-
# @option options [Boolean] relative_paths whether or not to use relative paths for changes
|
169
|
-
#
|
170
|
-
# @return [Hash<Array>] the changes
|
171
|
-
#
|
172
|
-
def fetch_changes(directories, options = {})
|
173
|
-
@changes = { :modified => [], :added => [], :removed => [] }
|
174
|
-
directories = directories.sort_by { |el| el.length }.reverse # diff sub-dir first
|
175
|
-
|
176
|
-
directories.each do |directory|
|
177
|
-
next unless directory[@directory] # Path is or inside directory
|
178
|
-
|
179
|
-
detect_modifications_and_removals(directory, options)
|
180
|
-
detect_additions(directory, options)
|
181
|
-
end
|
182
|
-
|
183
|
-
@changes
|
184
|
-
end
|
185
|
-
|
186
|
-
# Converts an absolute path to a path that's relative to the base directory.
|
187
|
-
#
|
188
|
-
# @param [String] path the path to convert
|
189
|
-
#
|
190
|
-
# @return [String] the relative path
|
191
|
-
#
|
192
|
-
def relative_to_base(path)
|
193
|
-
path = path.dup
|
194
|
-
regexp = "\\A#{Regexp.quote directory}(#{File::SEPARATOR}|\\z)"
|
195
|
-
if path.respond_to?(:force_encoding)
|
196
|
-
path.force_encoding("BINARY")
|
197
|
-
regexp.force_encoding("BINARY")
|
198
|
-
end
|
199
|
-
if path.sub!(Regexp.new(regexp), '')
|
200
|
-
path
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
private
|
205
|
-
|
206
|
-
# Detects modifications and removals recursively in a directory.
|
207
|
-
#
|
208
|
-
# @note Modifications detection begins by checking the modification time (mtime)
|
209
|
-
# of files and then by checking content changes (using SHA1-checksum)
|
210
|
-
# when the mtime of files is not changed.
|
211
|
-
#
|
212
|
-
# @param [String] directory the path to analyze
|
213
|
-
# @param [Hash] options
|
214
|
-
# @option options [Boolean] recursive scan all sub-directories recursively
|
215
|
-
# @option options [Boolean] relative_paths whether or not to use relative paths for changes
|
216
|
-
#
|
217
|
-
def detect_modifications_and_removals(directory, options = {})
|
218
|
-
paths[directory].each do |basename, meta_data|
|
219
|
-
path = File.join(directory, basename)
|
220
|
-
case meta_data.type
|
221
|
-
when 'Dir'
|
222
|
-
detect_modification_or_removal_for_dir(path, options)
|
223
|
-
when 'File'
|
224
|
-
detect_modification_or_removal_for_file(path, meta_data, options)
|
225
|
-
end
|
226
|
-
end
|
227
|
-
end
|
228
|
-
|
229
|
-
def detect_modification_or_removal_for_dir(path, options)
|
230
|
-
|
231
|
-
# Directory still exists
|
232
|
-
if File.directory?(path)
|
233
|
-
detect_modifications_and_removals(path, options) if options[:recursive]
|
234
|
-
|
235
|
-
# Directory has been removed
|
236
|
-
else
|
237
|
-
detect_modifications_and_removals(path, options)
|
238
|
-
@paths[File.dirname(path)].delete(File.basename(path))
|
239
|
-
@paths.delete("#{File.dirname(path)}/#{File.basename(path)}")
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
|
-
def detect_modification_or_removal_for_file(path, meta_data, options)
|
244
|
-
# File still exists
|
245
|
-
if File.exist?(path)
|
246
|
-
detect_modification(path, meta_data, options)
|
247
|
-
|
248
|
-
# File has been removed
|
249
|
-
else
|
250
|
-
removal_detected(path, meta_data, options)
|
251
|
-
end
|
252
|
-
end
|
253
|
-
|
254
|
-
def detect_modification(path, meta_data, options)
|
255
|
-
new_mtime = mtime_of(path)
|
256
|
-
|
257
|
-
# First check if we are in the same second (to update checksums)
|
258
|
-
# before checking the time difference
|
259
|
-
if (meta_data.mtime.to_i == new_mtime.to_i && content_modified?(path)) || meta_data.mtime < new_mtime
|
260
|
-
modification_detected(path, meta_data, new_mtime, options)
|
261
|
-
end
|
262
|
-
end
|
263
|
-
|
264
|
-
def modification_detected(path, meta_data, new_mtime, options)
|
265
|
-
# Update the sha1 checksum of the file
|
266
|
-
update_sha1_checksum(path)
|
267
|
-
|
268
|
-
# Update the meta data of the file
|
269
|
-
meta_data.mtime = new_mtime
|
270
|
-
@paths[File.dirname(path)][File.basename(path)] = meta_data
|
271
|
-
|
272
|
-
@changes[:modified] << (options[:relative_paths] ? relative_to_base(path) : path)
|
273
|
-
end
|
274
|
-
|
275
|
-
def removal_detected(path, meta_data, options)
|
276
|
-
@paths[File.dirname(path)].delete(File.basename(path))
|
277
|
-
@sha1_checksums.delete(path)
|
278
|
-
@changes[:removed] << (options[:relative_paths] ? relative_to_base(path) : path)
|
279
|
-
end
|
280
|
-
|
281
|
-
# Detects additions in a directory.
|
282
|
-
#
|
283
|
-
# @param [String] directory the path to analyze
|
284
|
-
# @param [Hash] options
|
285
|
-
# @option options [Boolean] recursive scan all sub-directories recursively
|
286
|
-
# @option options [Boolean] relative_paths whether or not to use relative paths for changes
|
287
|
-
#
|
288
|
-
def detect_additions(directory, options = {})
|
289
|
-
# Don't process removed directories
|
290
|
-
return unless File.exist?(directory)
|
291
|
-
|
292
|
-
Find.find(directory) do |path|
|
293
|
-
next if path == @directory
|
294
|
-
|
295
|
-
if File.directory?(path)
|
296
|
-
# Add a trailing slash to directories when checking if a directory is
|
297
|
-
# ignored to optimize finding them as Find.find doesn't.
|
298
|
-
if ignored?(path + File::SEPARATOR) || (directory != path && (!options[:recursive] && existing_path?(path)))
|
299
|
-
Find.prune # Don't look any further into this directory.
|
300
|
-
else
|
301
|
-
insert_path(path)
|
302
|
-
end
|
303
|
-
elsif !ignored?(path) && filtered?(path) && !existing_path?(path)
|
304
|
-
if File.file?(path)
|
305
|
-
@changes[:added] << (options[:relative_paths] ? relative_to_base(path) : path)
|
306
|
-
insert_path(path)
|
307
|
-
end
|
308
|
-
end
|
309
|
-
end
|
310
|
-
end
|
311
|
-
|
312
|
-
# Returns whether or not a file's content has been modified by
|
313
|
-
# comparing the SHA1-checksum to a stored one.
|
314
|
-
# Ensure that the SHA1-checksum is inserted to the sha1_checksums
|
315
|
-
# array for later comparaison if false.
|
316
|
-
#
|
317
|
-
# @param [String] path the file path
|
318
|
-
#
|
319
|
-
def content_modified?(path)
|
320
|
-
return false unless File.ftype(path) == 'file'
|
321
|
-
@sha1_checksum = sha1_checksum(path)
|
322
|
-
if sha1_checksums[path] == @sha1_checksum || !sha1_checksums.key?(path)
|
323
|
-
update_sha1_checksum(path)
|
324
|
-
false
|
325
|
-
else
|
326
|
-
true
|
327
|
-
end
|
328
|
-
end
|
329
|
-
|
330
|
-
# Inserts a SHA1-checksum path in @SHA1-checksums hash.
|
331
|
-
#
|
332
|
-
# @param [String] path the SHA1-checksum path to insert in @sha1_checksums.
|
333
|
-
#
|
334
|
-
def update_sha1_checksum(path)
|
335
|
-
if @sha1_checksum ||= sha1_checksum(path)
|
336
|
-
@sha1_checksums[path] = @sha1_checksum
|
337
|
-
@sha1_checksum = nil
|
338
|
-
end
|
339
|
-
end
|
340
|
-
|
341
|
-
# Returns the SHA1-checksum for the file path.
|
342
|
-
#
|
343
|
-
# @param [String] path the file path
|
344
|
-
#
|
345
|
-
def sha1_checksum(path)
|
346
|
-
Digest::SHA1.file(path).to_s
|
347
|
-
rescue
|
348
|
-
nil
|
349
|
-
end
|
350
|
-
|
351
|
-
# Traverses the base directory looking for paths that should
|
352
|
-
# be stored; thus paths that are filtered or not ignored.
|
353
|
-
#
|
354
|
-
# @yield [path] an important path
|
355
|
-
#
|
356
|
-
def important_paths
|
357
|
-
Find.find(directory) do |path|
|
358
|
-
next if path == directory
|
359
|
-
|
360
|
-
if File.directory?(path)
|
361
|
-
# Add a trailing slash to directories when checking if a directory is
|
362
|
-
# ignored to optimize finding them as Find.find doesn't.
|
363
|
-
if ignored?(path + File::SEPARATOR)
|
364
|
-
Find.prune # Don't look any further into this directory.
|
365
|
-
else
|
366
|
-
yield(path)
|
367
|
-
end
|
368
|
-
elsif !ignored?(path) && filtered?(path)
|
369
|
-
yield(path)
|
370
|
-
end
|
371
|
-
end
|
372
|
-
end
|
373
|
-
|
374
|
-
# Inserts a path with its type (Dir or File) in paths hash.
|
375
|
-
#
|
376
|
-
# @param [String] path the path to insert in @paths.
|
377
|
-
#
|
378
|
-
def insert_path(path)
|
379
|
-
meta_data = MetaData.new
|
380
|
-
meta_data.type = File.directory?(path) ? 'Dir' : 'File'
|
381
|
-
meta_data.mtime = mtime_of(path) unless meta_data.type == 'Dir' # mtimes of dirs are not used yet
|
382
|
-
@paths[File.dirname(path)][File.basename(path)] = meta_data
|
383
|
-
rescue Errno::ENOENT
|
384
|
-
end
|
385
|
-
|
386
|
-
# Returns whether or not a path exists in the paths hash.
|
387
|
-
#
|
388
|
-
# @param [String] path the path to check
|
389
|
-
#
|
390
|
-
# @return [Boolean]
|
391
|
-
#
|
392
|
-
def existing_path?(path)
|
393
|
-
paths[File.dirname(path)][File.basename(path)] != nil
|
394
|
-
end
|
395
|
-
|
396
|
-
# Returns the modification time of a file based on the precision defined by the system
|
397
|
-
#
|
398
|
-
# @param [String] file the file for which the mtime must be returned
|
399
|
-
#
|
400
|
-
# @return [Fixnum, Float] the mtime of the file
|
401
|
-
#
|
402
|
-
def mtime_of(file)
|
403
|
-
File.lstat(file).mtime.send(HIGH_PRECISION_SUPPORTED ? :to_f : :to_i)
|
404
|
-
end
|
405
|
-
end
|
406
|
-
end
|