tldr 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/tldr/reporters/default.rb +3 -3
- data/lib/tldr/value/config.rb +28 -22
- data/lib/tldr/version.rb +1 -1
- data/lib/tldr/watcher.rb +3 -3
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 0c87b13131b7bdbd2307b55c7cc4f60dd9033f086063786aed52f3dbe9be0516
         | 
| 4 | 
            +
              data.tar.gz: b4d5f7589dee0f5f94b585d930c8d225beb10ba42c3dad22c5321e57b80e96ec
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 1a5196a70159c64afc23eff6278b310fa44c1ed5c86a50a9aecc55229309c10d46f20aedd7fb04e0f743053b53859b80a09509cd2c56ca8f359532e98bcfd40d
         | 
| 7 | 
            +
              data.tar.gz: 9d31131b6b72e80c4ff1c81e2e13bbb7e942d25adaf0d3e7524032ff293d3a94458886320f2b3f3ab6c924f8fdd2ae83acab87e0f45cf4e487a39ecf04faed52
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
| @@ -39,7 +39,7 @@ class TLDR | |
| 39 39 | 
             
                    @err.print "\n\n"
         | 
| 40 40 |  | 
| 41 41 | 
             
                    if @config.yes_i_know
         | 
| 42 | 
            -
                      @err.print "🚨 TLDR!  | 
| 42 | 
            +
                      @err.print "🚨 TLDR after completing #{test_results.size} of #{planned_tests.size} tests! Print full summary by omitting --yes-i-know"
         | 
| 43 43 | 
             
                    else
         | 
| 44 44 | 
             
                      wrap_in_horizontal_rule do
         | 
| 45 45 | 
             
                        @err.print [
         | 
| @@ -121,7 +121,7 @@ class TLDR | |
| 121 121 | 
             
                      "#{index + 1}) #{describe(result.test, result.relevant_location)} #{result.failure? ? "failed" : "errored"}:",
         | 
| 122 122 | 
             
                      result.error.message.chomp,
         | 
| 123 123 | 
             
                      "\n  Re-run this test:",
         | 
| 124 | 
            -
                      "    #{tldr_command} #{@config.to_single_path_args(result.test.location.locator)}",
         | 
| 124 | 
            +
                      "    #{tldr_command} #{@config.to_single_path_args(result.test.location.locator, exclude_dotfile_matches: true)}\n",
         | 
| 125 125 | 
             
                      (TLDR.filter_backtrace(result.error.backtrace).join("\n") if @config.verbose)
         | 
| 126 126 | 
             
                    ].compact.reject(&:empty?).join("\n").strip
         | 
| 127 127 | 
             
                  end
         | 
| @@ -160,7 +160,7 @@ class TLDR | |
| 160 160 | 
             
                    ].compact + failed_locators
         | 
| 161 161 | 
             
                    <<~MSG
         | 
| 162 162 | 
             
                      #{@icons.rock_on} Run the #{plural(unrun.size, "test")} that didn't finish:
         | 
| 163 | 
            -
                        #{tldr_command} #{@config.to_full_args(exclude: [:paths])} #{suggested_locators.join(" \\\n    ")}
         | 
| 163 | 
            +
                        #{tldr_command} #{@config.to_full_args(exclude: [:paths], exclude_dotfile_matches: true)} #{suggested_locators.join(" \\\n    ")}
         | 
| 164 164 | 
             
                    MSG
         | 
| 165 165 | 
             
                  end
         | 
| 166 166 |  | 
    
        data/lib/tldr/value/config.rb
    CHANGED
    
    | @@ -142,14 +142,14 @@ class TLDR | |
| 142 142 | 
             
                  }.compact
         | 
| 143 143 | 
             
                end
         | 
| 144 144 |  | 
| 145 | 
            -
                def to_full_args exclude: [], ensure_args: []
         | 
| 145 | 
            +
                def to_full_args exclude: [], ensure_args: [], exclude_dotfile_matches: false
         | 
| 146 146 | 
             
                  argv = to_cli_argv(
         | 
| 147 | 
            -
                    CONFLAGS.keys -
         | 
| 148 | 
            -
                    exclude - [
         | 
| 147 | 
            +
                    CONFLAGS.keys - exclude - [
         | 
| 149 148 | 
             
                      (:seed unless seed_set_intentionally),
         | 
| 150 149 | 
             
                      :watch,
         | 
| 151 150 | 
             
                      :i_am_being_watched
         | 
| 152 | 
            -
                    ]
         | 
| 151 | 
            +
                    ],
         | 
| 152 | 
            +
                    exclude_dotfile_matches:
         | 
| 153 153 | 
             
                  )
         | 
| 154 154 |  | 
| 155 155 | 
             
                  ensure_args.each do |arg|
         | 
| @@ -159,19 +159,20 @@ class TLDR | |
| 159 159 | 
             
                  argv.join(" ")
         | 
| 160 160 | 
             
                end
         | 
| 161 161 |  | 
| 162 | 
            -
                def to_single_path_args path
         | 
| 162 | 
            +
                def to_single_path_args path, exclude_dotfile_matches: false
         | 
| 163 163 | 
             
                  argv = to_cli_argv(CONFLAGS.keys - [
         | 
| 164 164 | 
             
                    :seed, :parallel, :names, :fail_fast, :paths, :prepend_paths,
         | 
| 165 165 | 
             
                    :no_prepend, :exclude_paths, :watch, :i_am_being_watched
         | 
| 166 | 
            -
                  ])
         | 
| 166 | 
            +
                  ], exclude_dotfile_matches:)
         | 
| 167 167 |  | 
| 168 168 | 
             
                  (argv + [stringify(:paths, path)]).join(" ")
         | 
| 169 169 | 
             
                end
         | 
| 170 170 |  | 
| 171 171 | 
             
                private
         | 
| 172 172 |  | 
| 173 | 
            -
                def to_cli_argv options = CONFLAGS.keys
         | 
| 173 | 
            +
                def to_cli_argv options = CONFLAGS.keys, exclude_dotfile_matches:
         | 
| 174 174 | 
             
                  defaults = Config.build_defaults(cli_defaults: true)
         | 
| 175 | 
            +
                  defaults = defaults.merge(dotfile_args) if exclude_dotfile_matches
         | 
| 175 176 | 
             
                  options.map { |key|
         | 
| 176 177 | 
             
                    flag = CONFLAGS[key]
         | 
| 177 178 |  | 
| @@ -239,23 +240,28 @@ class TLDR | |
| 239 240 | 
             
                end
         | 
| 240 241 |  | 
| 241 242 | 
             
                def merge_dotfile_args args
         | 
| 242 | 
            -
                  return args if args[:no_dotfile] | 
| 243 | 
            -
                  require "yaml"
         | 
| 244 | 
            -
             | 
| 245 | 
            -
                  dotfile_args = YAML.load_file(".tldr.yml").transform_keys { |k| k.to_sym }
         | 
| 246 | 
            -
                  # Since we don't have shell expansion, we have to glob any paths ourselves
         | 
| 247 | 
            -
                  if dotfile_args.key?(:paths)
         | 
| 248 | 
            -
                    dotfile_args[:paths] = dotfile_args[:paths].flat_map { |path| Dir[path] }
         | 
| 249 | 
            -
                  end
         | 
| 250 | 
            -
                  # The argv parser normally does this:
         | 
| 251 | 
            -
                  if dotfile_args.key?(:reporter)
         | 
| 252 | 
            -
                    dotfile_args[:reporter] = Kernel.const_get(dotfile_args[:reporter])
         | 
| 253 | 
            -
                  end
         | 
| 254 | 
            -
                  if (invalid_args = dotfile_args.except(*CONFIG_ATTRIBUTES)).any?
         | 
| 255 | 
            -
                    raise Error, "Invalid keys in .tldr.yml file: #{invalid_args.keys.join(", ")}"
         | 
| 256 | 
            -
                  end
         | 
| 243 | 
            +
                  return args if args[:no_dotfile]
         | 
| 257 244 |  | 
| 258 245 | 
             
                  dotfile_args.merge(args)
         | 
| 259 246 | 
             
                end
         | 
| 247 | 
            +
             | 
| 248 | 
            +
                def dotfile_args
         | 
| 249 | 
            +
                  return {} unless File.exist?(".tldr.yml")
         | 
| 250 | 
            +
             | 
| 251 | 
            +
                  require "yaml"
         | 
| 252 | 
            +
                  @dotfile_args ||= YAML.load_file(".tldr.yml").transform_keys { |k| k.to_sym }.tap do |dotfile_args|
         | 
| 253 | 
            +
                    # Since we don't have shell expansion, we have to glob any paths ourselves
         | 
| 254 | 
            +
                    if dotfile_args.key?(:paths)
         | 
| 255 | 
            +
                      dotfile_args[:paths] = dotfile_args[:paths].flat_map { |path| Dir[path] }
         | 
| 256 | 
            +
                    end
         | 
| 257 | 
            +
                    # The argv parser normally does this:
         | 
| 258 | 
            +
                    if dotfile_args.key?(:reporter)
         | 
| 259 | 
            +
                      dotfile_args[:reporter] = Kernel.const_get(dotfile_args[:reporter])
         | 
| 260 | 
            +
                    end
         | 
| 261 | 
            +
                    if (invalid_args = dotfile_args.except(*CONFIG_ATTRIBUTES)).any?
         | 
| 262 | 
            +
                      raise Error, "Invalid keys in .tldr.yml file: #{invalid_args.keys.join(", ")}"
         | 
| 263 | 
            +
                    end
         | 
| 264 | 
            +
                  end
         | 
| 265 | 
            +
                end
         | 
| 260 266 | 
             
              end
         | 
| 261 267 | 
             
            end
         | 
    
        data/lib/tldr/version.rb
    CHANGED
    
    
    
        data/lib/tldr/watcher.rb
    CHANGED
    
    | @@ -5,14 +5,14 @@ class TLDR | |
| 5 5 | 
             
                  tldr_command = "#{"bundle exec " if defined?(Bundler)}tldr #{config.to_full_args(ensure_args: ["--i-am-being-watched"])}"
         | 
| 6 6 | 
             
                  command = "fswatch -o #{config.load_paths.reverse.join(" ")} | xargs -n1 -I{} #{tldr_command}"
         | 
| 7 7 |  | 
| 8 | 
            -
                   | 
| 9 | 
            -
             | 
| 10 | 
            -
                    Watching for changes in #{config.load_paths.map(&:inspect).join(", ")}...
         | 
| 8 | 
            +
                  print <<~MSG.chomp
         | 
| 9 | 
            +
                    Waiting for changes in --load-path directories: #{config.load_paths.map(&:inspect).join(", ")}
         | 
| 11 10 |  | 
| 12 11 | 
             
                    When a file changes, TLDR will run this command:
         | 
| 13 12 |  | 
| 14 13 | 
             
                    $ #{tldr_command}
         | 
| 15 14 |  | 
| 15 | 
            +
                    Watching...
         | 
| 16 16 | 
             
                  MSG
         | 
| 17 17 |  | 
| 18 18 | 
             
                  exec command
         |