tldr 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/tldr/reporters/default.rb +2 -2
- 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: cd834ada0b427dab9478141f188df34e88af9eb650f1869110d16067783ed667
|
4
|
+
data.tar.gz: 0f474dd49db30970150fa8202335baa8ad753cfe8ce5c6e5867bc2d892b9124b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95ad516ad60583d95d64c24b4c0706d34eaa468d304eef91f9224c1b3bdf6a81f39524f6323e19e28267cc05f37c603e5cc98eb705edbeb80076837ec3dc37a4
|
7
|
+
data.tar.gz: 6d275b09c8d73533df1d9836f6c19bb0e424519da4474bb17ac1f2b104d2e2a8e49d63fb7c7e359f01ebc216a9c5ffbf8237e72629ff4d376d97fa4c1a0fb1d9
|
data/CHANGELOG.md
CHANGED
@@ -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
|