uh-wm 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/lib/uh/wm/actions_handler.rb +9 -0
  3. data/lib/uh/wm/cli.rb +1 -1
  4. data/lib/uh/wm/client.rb +14 -0
  5. data/lib/uh/wm/env.rb +3 -1
  6. data/lib/uh/wm/env_logging.rb +1 -1
  7. data/lib/uh/wm/launcher.rb +73 -0
  8. data/lib/uh/wm/run_control.rb +10 -0
  9. data/lib/uh/wm/runner.rb +26 -5
  10. data/lib/uh/wm/testing/acceptance_helpers.rb +36 -65
  11. data/lib/uh/wm/testing/x_client.rb +63 -0
  12. data/lib/uh/wm/version.rb +1 -1
  13. data/lib/uh/wm/workers/base.rb +1 -1
  14. data/lib/uh/wm/workers/mux.rb +3 -1
  15. data/lib/uh/wm.rb +5 -3
  16. metadata +9 -111
  17. data/.gitignore +0 -3
  18. data/.rspec +0 -1
  19. data/.travis.yml +0 -15
  20. data/Gemfile +0 -5
  21. data/Guardfile +0 -12
  22. data/LICENSE +0 -30
  23. data/Rakefile +0 -40
  24. data/config/cucumber.yaml +0 -1
  25. data/features/actions/execute.feature +0 -9
  26. data/features/actions/layout_delegation.feature +0 -31
  27. data/features/actions/quit.feature +0 -9
  28. data/features/cli/debug.feature +0 -5
  29. data/features/cli/layout.feature +0 -15
  30. data/features/cli/require.feature +0 -5
  31. data/features/cli/run_control.feature +0 -9
  32. data/features/cli/usage.feature +0 -11
  33. data/features/cli/verbose.feature +0 -5
  34. data/features/cli/version.feature +0 -6
  35. data/features/cli/worker.feature +0 -9
  36. data/features/layout/manage.feature +0 -12
  37. data/features/layout/protocol.feature +0 -56
  38. data/features/layout/unmanage.feature +0 -10
  39. data/features/manager/change.feature +0 -7
  40. data/features/manager/check_other_wm.feature +0 -8
  41. data/features/manager/expose.feature +0 -5
  42. data/features/manager/input_events.feature +0 -8
  43. data/features/manager/manage.feature +0 -14
  44. data/features/manager/unmanage.feature +0 -13
  45. data/features/manager/x_errors.feature +0 -17
  46. data/features/run_control/evaluation.feature +0 -18
  47. data/features/run_control/key.feature +0 -33
  48. data/features/run_control/layout.feature +0 -39
  49. data/features/run_control/modifier.feature +0 -10
  50. data/features/run_control/worker.feature +0 -9
  51. data/features/session/connection.feature +0 -5
  52. data/features/session/termination.feature +0 -12
  53. data/features/steps/filesystem_steps.rb +0 -3
  54. data/features/steps/output_steps.rb +0 -55
  55. data/features/steps/run_control_steps.rb +0 -3
  56. data/features/steps/run_steps.rb +0 -41
  57. data/features/steps/x_steps.rb +0 -58
  58. data/features/support/env.rb +0 -33
  59. data/features/workers/block.feature +0 -15
  60. data/features/workers/mux.feature +0 -15
  61. data/spec/spec_helper.rb +0 -30
  62. data/spec/support/exit_helpers.rb +0 -6
  63. data/spec/support/factories.rb +0 -27
  64. data/spec/support/filesystem_helpers.rb +0 -11
  65. data/spec/uh/wm/actions_handler_spec.rb +0 -35
  66. data/spec/uh/wm/cli_spec.rb +0 -214
  67. data/spec/uh/wm/client_spec.rb +0 -148
  68. data/spec/uh/wm/dispatcher_spec.rb +0 -76
  69. data/spec/uh/wm/env_spec.rb +0 -154
  70. data/spec/uh/wm/manager_spec.rb +0 -386
  71. data/spec/uh/wm/run_control_spec.rb +0 -126
  72. data/spec/uh/wm/runner_spec.rb +0 -196
  73. data/uh-wm.gemspec +0 -26
@@ -1,148 +0,0 @@
1
- module Uh
2
- module WM
3
- RSpec.describe Client do
4
- let(:window) { mock_window }
5
- let(:geo) { build_geo }
6
- subject(:client) { described_class.new window, geo }
7
-
8
- it 'is not visible' do
9
- expect(client).not_to be_visible
10
- end
11
-
12
- it 'is hidden' do
13
- expect(client).to be_hidden
14
- end
15
-
16
- it 'has an unmap count of 0' do
17
- expect(client.unmap_count).to eq 0
18
- end
19
-
20
- describe '#to_s' do
21
- it 'includes window name' do
22
- expect(client.to_s).to include 'wname'
23
- end
24
-
25
- it 'includes window class' do
26
- expect(client.to_s).to include 'wclass'
27
- end
28
-
29
- it 'includes geo' do
30
- expect(client.to_s).to include geo.to_s
31
- end
32
-
33
- it 'includes window string representation' do
34
- expect(client.to_s).to include 'wid'
35
- end
36
- end
37
-
38
- describe '#name' do
39
- it 'returns the window name' do
40
- expect(client.name).to eq window.name
41
- end
42
- end
43
-
44
- describe '#wclass' do
45
- it 'returns the window class' do
46
- expect(client.wclass).to eq window.wclass
47
- end
48
- end
49
-
50
- describe '#update_window_properties' do
51
- it 'updates the cached window name' do
52
- client.name
53
- allow(window).to receive(:name) { 'new name' }
54
- expect { client.update_window_properties }
55
- .to change { client.name }
56
- .from('wname').to 'new name'
57
- end
58
-
59
- it 'updates the cached window class' do
60
- client.wclass
61
- allow(window).to receive(:wclass) { 'new class' }
62
- expect { client.update_window_properties }
63
- .to change { client.wclass }
64
- .from('wclass').to 'new class'
65
- end
66
- end
67
-
68
- describe '#configure' do
69
- it 'configures the window with client geo' do
70
- expect(window).to receive(:configure).with geo
71
- client.configure
72
- end
73
-
74
- it 'returns self' do
75
- expect(client.configure).to be client
76
- end
77
- end
78
-
79
- describe '#moveresize' do
80
- it 'moveresizes the window with client geo' do
81
- expect(window).to receive(:moveresize).with geo
82
- client.moveresize
83
- end
84
-
85
- it 'returns self' do
86
- expect(client.moveresize).to be client
87
- end
88
- end
89
-
90
- describe '#show' do
91
- it 'maps the window' do
92
- expect(window).to receive :map
93
- client.show
94
- end
95
-
96
- it 'toggles the client as visible' do
97
- expect { client.show }
98
- .to change { client.visible? }
99
- .from(false).to true
100
- end
101
-
102
- it 'returns self' do
103
- expect(client.show).to be client
104
- end
105
- end
106
-
107
- describe '#hide' do
108
- it 'unmaps the window' do
109
- expect(window).to receive :unmap
110
- client.hide
111
- end
112
-
113
- it 'toggles the client as hidden' do
114
- client.show
115
- expect { client.hide }
116
- .to change { client.hidden? }
117
- .from(false).to true
118
- end
119
-
120
- it 'increments the unmap count' do
121
- expect { client.hide }
122
- .to change { client.unmap_count }
123
- .from(0).to 1
124
- end
125
-
126
- it 'returns self' do
127
- expect(client.hide).to be client
128
- end
129
- end
130
-
131
- describe '#focus' do
132
- it 'raises the window' do
133
- expect(window).to receive :raise
134
- client.focus
135
- end
136
-
137
- it 'focuses the window' do
138
- expect(window).to receive :focus
139
- client.focus
140
- end
141
-
142
- it 'returns self' do
143
- expect(client.focus).to be client
144
- end
145
- end
146
- end
147
- end
148
- end
@@ -1,76 +0,0 @@
1
- module Uh
2
- module WM
3
- RSpec.describe Dispatcher do
4
- subject(:dispatcher) { described_class.new }
5
-
6
- describe '#[]' do
7
- context 'when given key for existing hook' do
8
- before { dispatcher.hooks[:hook_key] = [:hook] }
9
-
10
- it 'returns registered hooks for this key' do
11
- expect(dispatcher[:hook_key]).to eq [:hook]
12
- end
13
- end
14
-
15
- context 'when given multiple keys for existing hook' do
16
- before { dispatcher.hooks[%i[hook key]] = [:hook] }
17
-
18
- it 'returns registered hooks for this key' do
19
- expect(dispatcher[:hook, :key]).to eq [:hook]
20
- end
21
- end
22
-
23
- context 'when given key for unknown hook' do
24
- it 'returns an empty array' do
25
- expect(dispatcher[:unknown_hook]).to eq []
26
- end
27
- end
28
- end
29
-
30
- describe '#on' do
31
- it 'registers given hook for given key' do
32
- dispatcher.on(:hook_key) { :hook }
33
- expect(dispatcher.hooks[:hook_key]).to be
34
- end
35
-
36
- it 'registers given hook for given multiple keys' do
37
- dispatcher.on(:hook, :key) { :hook }
38
- expect(dispatcher.hooks[%i[hook key]]).to be
39
- end
40
- end
41
-
42
- describe '#emit' do
43
- it 'calls hooks registered for given key' do
44
- dispatcher.on(:hook_key) { throw :hook_code }
45
- expect { dispatcher.emit :hook_key }.to throw_symbol :hook_code
46
- end
47
-
48
- it 'returns the value returned by a registered hook' do
49
- dispatcher.on(:hook_key) { :hook_code }
50
- expect(dispatcher.emit :hook_key).to eq :hook_code
51
- end
52
-
53
- context 'when no hooks are registered for given key' do
54
- it 'does not call another hook' do
55
- dispatcher.on(:hook_key) { throw :hook_code }
56
- expect { dispatcher.emit :other_hook_key }.not_to throw_symbol
57
- end
58
- end
59
-
60
- context 'when no hooks are registered at all' do
61
- it 'does not raise any error' do
62
- expect { dispatcher.emit :hook_key }.not_to raise_error
63
- end
64
- end
65
-
66
- context 'when args keyword argument is given' do
67
- it 'calls hooks with given args' do
68
- dispatcher.on(:hook_key) { |arg1, arg2| throw arg2 }
69
- expect { dispatcher.emit :hook_key, args: %i[arg1 arg2] }
70
- .to throw_symbol :arg2
71
- end
72
- end
73
- end
74
- end
75
- end
76
- end
@@ -1,154 +0,0 @@
1
- module Uh
2
- module WM
3
- RSpec.describe Env do
4
- let(:output) { StringIO.new }
5
- let(:logger) { Logger.new(StringIO.new) }
6
- subject(:env) { described_class.new output }
7
-
8
- it 'has verbose mode disabled' do
9
- expect(env).not_to be_verbose
10
- end
11
-
12
- it 'has debug mode disabled' do
13
- expect(env).not_to be_debug
14
- end
15
-
16
- it 'has the default rc path set' do
17
- expect(env.rc_path).to eq '~/.uhwmrc.rb'
18
- end
19
-
20
- it 'has no layout_class set' do
21
- expect(env.layout_class).not_to be
22
- end
23
-
24
- it 'has the default modifier set' do
25
- expect(env.modifier).to eq :mod1
26
- end
27
-
28
- it 'has default key binding for quit set' do
29
- expect(env.keybinds.keys).to include [:q, :shift]
30
- end
31
-
32
- it 'has the blocking worker by default' do
33
- expect(env.worker).to eq :block
34
- end
35
-
36
- describe '#verbose?' do
37
- context 'when verbose mode is disabled' do
38
- before { env.verbose = false }
39
-
40
- it 'returns false' do
41
- expect(env.verbose?).to be false
42
- end
43
- end
44
-
45
- context 'when verbose mode is enabled' do
46
- before { env.verbose = true }
47
-
48
- it 'returns true' do
49
- expect(env.verbose?).to be true
50
- end
51
- end
52
- end
53
-
54
- describe '#debug?' do
55
- context 'when debug mode is disabled' do
56
- before { env.debug = false }
57
-
58
- it 'returns false' do
59
- expect(env.debug?).to be false
60
- end
61
- end
62
-
63
- context 'when debug mode is enabled' do
64
- before { env.debug = true }
65
-
66
- it 'returns true' do
67
- expect(env.debug?).to be true
68
- end
69
- end
70
- end
71
-
72
- describe '#layout' do
73
- let(:some_layout_class) { Class.new }
74
-
75
- it 'returns the default layout' do
76
- expect(env.layout).to be_an_instance_of ::Uh::Layout
77
- end
78
-
79
- context 'when a layout is set' do
80
- let(:some_layout) { some_layout_class.new }
81
-
82
- before { env.layout = some_layout }
83
-
84
- it 'returns the assigned layout' do
85
- expect(env.layout).to be some_layout
86
- end
87
- end
88
-
89
- context 'when a layout class is set' do
90
- before { env.layout_class = some_layout_class }
91
-
92
- it 'returns a new instance of this layout class' do
93
- expect(env.layout).to be_an_instance_of some_layout_class
94
- end
95
- end
96
- end
97
-
98
- describe '#logger' do
99
- it 'returns a logger' do
100
- expect(env.logger).to be_a Logger
101
- end
102
-
103
- it 'has logger level warn set' do
104
- expect(env.logger.level).to be Logger::WARN
105
- end
106
-
107
- context 'when verbose mode is enabled' do
108
- before { env.verbose = true }
109
-
110
- it 'has logger level info set' do
111
- expect(env.logger.level).to be Logger::INFO
112
- end
113
- end
114
-
115
- context 'when debug mode is enabled' do
116
- before { env.debug = true }
117
-
118
- it 'has logger level debug set' do
119
- expect(env.logger.level).to be Logger::DEBUG
120
- end
121
- end
122
- end
123
-
124
- describe '#log' do
125
- it 'logs given message at info level' do
126
- expect(env.logger).to receive(:info).with 'some message'
127
- env.log 'some message'
128
- end
129
- end
130
-
131
- describe '#log_debug' do
132
- it 'logs given message at debug level' do
133
- expect(env.logger).to receive(:debug).with 'some message'
134
- env.log_debug 'some message'
135
- end
136
- end
137
-
138
- describe '#log_logger_level' do
139
- it 'logs the logger level' do
140
- expect(env.logger)
141
- .to receive(:info).with /log.+(warn|info|debug).+level/i
142
- env.log_logger_level
143
- end
144
- end
145
-
146
- describe '#print' do
147
- it 'prints the message to the output' do
148
- env.print 'some message'
149
- expect(output.string).to eq 'some message'
150
- end
151
- end
152
- end
153
- end
154
- end