tldr 0.9.3 → 0.9.5

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: 0c87b13131b7bdbd2307b55c7cc4f60dd9033f086063786aed52f3dbe9be0516
4
- data.tar.gz: b4d5f7589dee0f5f94b585d930c8d225beb10ba42c3dad22c5321e57b80e96ec
3
+ metadata.gz: 6929795fbe4a33bf03bc8bb107a4902b6f125bfc879edf0ec0441b5ec7e5d7a5
4
+ data.tar.gz: 52df3f72b9fcd4dd046d5513fd1c0c1ce69a04a6559f3edfc2c50c58fb7aa073
5
5
  SHA512:
6
- metadata.gz: 1a5196a70159c64afc23eff6278b310fa44c1ed5c86a50a9aecc55229309c10d46f20aedd7fb04e0f743053b53859b80a09509cd2c56ca8f359532e98bcfd40d
7
- data.tar.gz: 9d31131b6b72e80c4ff1c81e2e13bbb7e942d25adaf0d3e7524032ff293d3a94458886320f2b3f3ab6c924f8fdd2ae83acab87e0f45cf4e487a39ecf04faed52
6
+ metadata.gz: d065a84fd62ebc48fdac9223a615540c02b570172e4337c07e362dcdd8fec94037fbb64447b1099e127641c8909e0148f465252fc5f2e48c5d2af2128b5d4e28
7
+ data.tar.gz: cbfbaee9dbbbc6854d48c415f3818611f9b980527a0afb5ce7d032484edce9753bf902c0f737b44480e1717484e74fac96221cc2104844a96d2b1e9c2b5eaaf5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## [0.9.5]
2
+
3
+ * Fix warning when defining `setup`/`teardown` on TLDR class itself [#7](https://github.com/tendersearls/tldr/issues/7)
4
+
5
+ ## [0.9.4]
6
+
7
+ * Fix Sorbet compatibility [#5](https://github.com/tendersearls/tldr/issues/5)
8
+
9
+ ## [0.9.3]
10
+
1
11
  * Print how many tests ran vs. didn't even when suppressing TLDR summary
2
12
 
3
13
  ## [0.9.2]
data/README.md CHANGED
@@ -8,12 +8,12 @@ We initially meant this as a joke [while
8
8
  pairin'](https://www.youtube.com/live/bmi-SWeH4MA?si=p5g1j1FQZrbYEOCg&t=63), but
9
9
  in addition to being funny, it was also a pretty good idea. So we fleshed out
10
10
  `tldr` to be a full-featured, mostly
11
- [Minitest-compatible](#minitest-compatibility), and downright pleasant test
11
+ [Minitest-compatible](#minitest-compatibility), and dare-we-say pleasant test
12
12
  framework for Ruby.
13
13
 
14
14
  The "big idea" here is TLDR is designed for users to run the `tldr` command
15
15
  repeatedly as they work—as opposed to only running the tests for whatever is
16
- being worked on. Even if the suite run over the 1.8 second time limit. Because
16
+ being worked on. Even if the suite runs over the 1.8 second time limit. Because
17
17
  TLDR shuffles and runs in parallel and is guaranteed to take less than two
18
18
  seconds,
19
19
  **you'll actually wind up running _all_ of your tests quite often as you work**,
data/lib/tldr/hooks.rb ADDED
@@ -0,0 +1,9 @@
1
+ class TLDR
2
+ module Hooks
3
+ def setup
4
+ end
5
+
6
+ def teardown
7
+ end
8
+ end
9
+ end
@@ -39,5 +39,13 @@ class TLDR
39
39
  location.file == test.file && (location.line.nil? || test.covers_line?(location.line))
40
40
  }
41
41
  end
42
+
43
+ def self.chdir_maybe path
44
+ if path.nil?
45
+ yield
46
+ else
47
+ Dir.chdir(path) { yield }
48
+ end
49
+ end
42
50
  end
43
51
  end
@@ -3,7 +3,13 @@ class TLDR
3
3
  def self.unwrap_method method
4
4
  return method unless defined? ::T::Private::Methods
5
5
 
6
- T::Private::Methods.signature_for_method(method).method || method
6
+ sig_or_method = ::T::Private::Methods.signature_for_method(method) || method
7
+
8
+ if sig_or_method.is_a?(Method) || sig_or_method.is_a?(UnboundMethod)
9
+ sig_or_method
10
+ else # it's a T::Private::Methods::Signature
11
+ sig_or_method.method
12
+ end
7
13
  end
8
14
  end
9
15
  end
@@ -36,6 +36,7 @@ class TLDR
36
36
 
37
37
  Config = Struct.new(*CONFIG_ATTRIBUTES, keyword_init: true) do
38
38
  def initialize(**args)
39
+ original_base_path = Dir.pwd
39
40
  unless args[:config_intended_for_merge_only]
40
41
  change_working_directory_because_i_am_bad_and_i_should_feel_bad!(args[:base_path])
41
42
  args = merge_dotfile_args(args) unless args[:no_dotfile]
@@ -43,6 +44,7 @@ class TLDR
43
44
  args = undefault_parallel_if_seed_set(args)
44
45
  unless args[:config_intended_for_merge_only]
45
46
  args = merge_defaults(args)
47
+ revert_working_directory_change_because_itll_ruin_everything!(original_base_path)
46
48
  end
47
49
 
48
50
  super(**args)
@@ -239,6 +241,10 @@ class TLDR
239
241
  Dir.chdir(base_path) unless base_path.nil?
240
242
  end
241
243
 
244
+ def revert_working_directory_change_because_itll_ruin_everything! original_base_path
245
+ Dir.chdir(original_base_path) unless Dir.pwd == original_base_path
246
+ end
247
+
242
248
  def merge_dotfile_args args
243
249
  return args if args[:no_dotfile]
244
250
 
data/lib/tldr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class TLDR
2
- VERSION = "0.9.3"
2
+ VERSION = "0.9.5"
3
3
  end
data/lib/tldr.rb CHANGED
@@ -6,6 +6,7 @@ require_relative "tldr/backtrace_filter"
6
6
  require_relative "tldr/class_util"
7
7
  require_relative "tldr/error"
8
8
  require_relative "tldr/executor"
9
+ require_relative "tldr/hooks"
9
10
  require_relative "tldr/parallel_controls"
10
11
  require_relative "tldr/path_util"
11
12
  require_relative "tldr/planner"
@@ -21,12 +22,7 @@ require_relative "tldr/watcher"
21
22
  class TLDR
22
23
  include Assertions
23
24
  include Skippable
24
-
25
- def setup
26
- end
27
-
28
- def teardown
29
- end
25
+ include Hooks
30
26
 
31
27
  module Run
32
28
  def self.cli argv
@@ -38,7 +34,9 @@ class TLDR
38
34
  if config.watch
39
35
  Watcher.new.watch(config)
40
36
  else
41
- Runner.new.run(config, Planner.new.plan(config))
37
+ PathUtil.chdir_maybe(config.base_path) do
38
+ Runner.new.run(config, Planner.new.plan(config))
39
+ end
42
40
  end
43
41
  end
44
42
 
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.3
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2023-10-04 00:00:00.000000000 Z
12
+ date: 2023-10-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: super_diff
@@ -64,6 +64,7 @@ files:
64
64
  - lib/tldr/class_util.rb
65
65
  - lib/tldr/error.rb
66
66
  - lib/tldr/executor.rb
67
+ - lib/tldr/hooks.rb
67
68
  - lib/tldr/parallel_controls.rb
68
69
  - lib/tldr/path_util.rb
69
70
  - lib/tldr/planner.rb
@@ -110,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
111
  - !ruby/object:Gem::Version
111
112
  version: '0'
112
113
  requirements: []
113
- rubygems_version: 3.3.26
114
+ rubygems_version: 3.4.6
114
115
  signing_key:
115
116
  specification_version: 4
116
117
  summary: TLDR will run your tests, but only for 1.8 seconds.