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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6d49bfa66698f5e33451a20655ab442e6a6e50e76ec3b048b49d93baf7d8c66
4
- data.tar.gz: f64c38ecd633686bc7616d4cf377fd49d2d91387dadaad09d81bf960ae2c39b6
3
+ metadata.gz: cd834ada0b427dab9478141f188df34e88af9eb650f1869110d16067783ed667
4
+ data.tar.gz: 0f474dd49db30970150fa8202335baa8ad753cfe8ce5c6e5867bc2d892b9124b
5
5
  SHA512:
6
- metadata.gz: 524382d1fe9004b821bc7c7ea9b33779221ed60b35f51cf78924412c15a2c3cf07bb2ad46f8d5815f0890f3bd2ccfec868310521b00def3196ab93069e9153b0
7
- data.tar.gz: 11313f640b6f2443063dbd79083f6810dca5778411c8093a36ebd5284b306c3db6be9dbc9e7bf53c4f63500734075371051243e75a665fb7e0e952ce28fdbe23
6
+ metadata.gz: 95ad516ad60583d95d64c24b4c0706d34eaa468d304eef91f9224c1b3bdf6a81f39524f6323e19e28267cc05f37c603e5cc98eb705edbeb80076837ec3dc37a4
7
+ data.tar.gz: 6d275b09c8d73533df1d9836f6c19bb0e424519da4474bb17ac1f2b104d2e2a8e49d63fb7c7e359f01ebc216a9c5ffbf8237e72629ff4d376d97fa4c1a0fb1d9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.9.2]
2
+
3
+ * Don't redundantly print out dotfile config values for re-run instructions
4
+
1
5
  ## [0.9.1]
2
6
 
3
7
  * Correctly clear the screen between runs
@@ -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
 
@@ -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] || !File.exist?(".tldr.yml")
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
@@ -1,3 +1,3 @@
1
1
  class TLDR
2
- VERSION = "0.9.1"
2
+ VERSION = "0.9.2"
3
3
  end
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
- puts <<~MSG
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tldr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls