testerobly 1.0.0 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18fcbc0c6020f6948a601108fe53f03c2109c38dfaa6586fc529fcfca6dd6a84
4
- data.tar.gz: 3c9e5af2cf0e5a41b8705672c494a086f950866f82beee2d712b028561c6e060
3
+ metadata.gz: 13b3d9061556f46643cdd0590d2b2b688d83bbefd793fbfc2cca78ab8328528b
4
+ data.tar.gz: 998c8364fe24da6d7f00482ac81b9b25084783766ca869969eea1469fa6bd1af
5
5
  SHA512:
6
- metadata.gz: 7ab5a8842e6ded4194f697dad6e4cf6b2bebb224f8fb7e12c940d046b88b1ae91c388f012316709c698a9b95c76648ce353b781b3533e01a8eac7ce847404ff4
7
- data.tar.gz: 9f427e05ad8e8b68e8fd214db1378638deda7ef67481479ebf1ebe0fe923fafec3ca2a344ea067e25afbe6c20480d9fbd9eb938256f17e3cd2acad88eaba569c
6
+ metadata.gz: 1d8e5867399ef90093d3d45335d54be9123443d3a1347556a24a490881120ca358038d69468a6afd0e9ffd96aa946d43e7be70e7f18971741f707f0f2e23b43b
7
+ data.tar.gz: efa85417c7522588ccbecb04dfa802aab2bd2890e215596544139708c8289ec4d33685841cb93348d195d451db56b42c0439e3f00f49cd20545960443fc04d14
@@ -2,11 +2,20 @@
2
2
 
3
3
  module Testerobly
4
4
  class Configuration
5
- attr_accessor :test_command, :test_all_command, :on_change
5
+ attr_accessor :test_command, :on_change
6
+ attr_reader :keys
6
7
 
7
8
  def initialize
8
9
  @test_command = "bin/test %s"
9
- @test_all_command = "bin/test"
10
+ @keys = {}
11
+ end
12
+
13
+ def bind(label, command)
14
+ @keys[label] = command
15
+ end
16
+
17
+ def test_all_command=(command)
18
+ bind "", command
10
19
  end
11
20
  end
12
21
  end
data/lib/testerobly.rb CHANGED
@@ -1,9 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "listen"
4
+ require "io/console"
4
5
  require "testerobly/configuration"
5
6
 
6
7
  module Testerobly
8
+ ENTER_SYMBOL = "⏎"
9
+
7
10
  class << self
8
11
  attr_accessor :configuration
9
12
  end
@@ -41,7 +44,7 @@ module Testerobly
41
44
 
42
45
  if item = @queue.shift
43
46
  capture_input_thread.kill
44
- log item[:message]
47
+ log item[:message] unless item[:message].nil?
45
48
  system item[:command]
46
49
  capture_input_thread = capture_input
47
50
  end
@@ -96,12 +99,19 @@ module Testerobly
96
99
  end
97
100
 
98
101
  def capture_input
99
- log "[Enter] #{configuration.test_all_command}"
102
+ configuration.keys.each do |label, command|
103
+ log "[#{label}#{ENTER_SYMBOL}] #{command}"
104
+ end
100
105
 
101
106
  Thread.new do
102
107
  loop do
103
- if [ "\r", "\n" ].include?($stdin.getc)
104
- @queue << { command: configuration.test_all_command, message: configuration.test_all_command }
108
+ input = $stdin.gets.strip
109
+
110
+ configuration.keys.each do |label, command|
111
+ if label == input
112
+ @queue << { command:, message: command }
113
+ break
114
+ end
105
115
  end
106
116
  end
107
117
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testerobly
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Starsi
@@ -23,8 +23,7 @@ dependencies:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
25
  version: 3.9.0
26
- description: Small test runner to launch alongside your developer session for immediate
27
- feedback.
26
+ description: ''
28
27
  email: klevo@klevo.sk
29
28
  executables:
30
29
  - testerobly
@@ -53,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
52
  - !ruby/object:Gem::Version
54
53
  version: '0'
55
54
  requirements: []
56
- rubygems_version: 3.7.1
55
+ rubygems_version: 3.7.2
57
56
  specification_version: 4
58
- summary: run MiniTest when files change
57
+ summary: Test runner to launch alongside your developer session for immediate feedback
59
58
  test_files: []