yap-shell 0.7.1 → 0.7.2
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 +4 -4
- data/.gitignore +9 -24
- data/Gemfile +1 -5
- data/LICENSE.txt +17 -18
- data/README.md +28 -14
- data/Rakefile +4 -1
- data/bin/yap +1 -3
- data/lib/.gitkeep +0 -0
- data/yap-shell.gemspec +12 -11
- metadata +19 -184
- data/.rspec +0 -2
- data/.travis.yml +0 -11
- data/DESIGN.md +0 -87
- data/Gemfile.travis +0 -8
- data/Gemfile.travis.lock +0 -104
- data/WISHLIST.md +0 -54
- data/bin/yap-dev +0 -45
- data/lib/tasks/gem.rake +0 -62
- data/lib/yap.rb +0 -52
- data/lib/yap/addon.rb +0 -24
- data/lib/yap/addon/base.rb +0 -52
- data/lib/yap/addon/export_as.rb +0 -12
- data/lib/yap/addon/loader.rb +0 -84
- data/lib/yap/addon/path.rb +0 -56
- data/lib/yap/addon/rc_file.rb +0 -21
- data/lib/yap/addon/reference.rb +0 -22
- data/lib/yap/cli.rb +0 -4
- data/lib/yap/cli/commands.rb +0 -6
- data/lib/yap/cli/commands/addon.rb +0 -14
- data/lib/yap/cli/commands/addon/disable.rb +0 -35
- data/lib/yap/cli/commands/addon/enable.rb +0 -35
- data/lib/yap/cli/commands/addon/list.rb +0 -37
- data/lib/yap/cli/commands/addon/search.rb +0 -99
- data/lib/yap/cli/commands/generate.rb +0 -13
- data/lib/yap/cli/commands/generate/addon.rb +0 -258
- data/lib/yap/cli/commands/generate/addonrb.template +0 -22
- data/lib/yap/cli/commands/generate/gemspec.template +0 -25
- data/lib/yap/cli/commands/generate/license.template +0 -21
- data/lib/yap/cli/commands/generate/rakefile.template +0 -6
- data/lib/yap/cli/commands/generate/readme.template +0 -40
- data/lib/yap/cli/options.rb +0 -162
- data/lib/yap/cli/options/addon.rb +0 -64
- data/lib/yap/cli/options/addon/disable.rb +0 -62
- data/lib/yap/cli/options/addon/enable.rb +0 -63
- data/lib/yap/cli/options/addon/list.rb +0 -65
- data/lib/yap/cli/options/addon/search.rb +0 -76
- data/lib/yap/cli/options/generate.rb +0 -59
- data/lib/yap/cli/options/generate/addon.rb +0 -63
- data/lib/yap/configuration.rb +0 -74
- data/lib/yap/gem_helper.rb +0 -195
- data/lib/yap/gem_tasks.rb +0 -6
- data/lib/yap/shell.rb +0 -116
- data/lib/yap/shell/aliases.rb +0 -58
- data/lib/yap/shell/builtins.rb +0 -18
- data/lib/yap/shell/builtins/alias.rb +0 -42
- data/lib/yap/shell/builtins/cd.rb +0 -57
- data/lib/yap/shell/builtins/env.rb +0 -11
- data/lib/yap/shell/commands.rb +0 -163
- data/lib/yap/shell/evaluation.rb +0 -439
- data/lib/yap/shell/evaluation/shell_expansions.rb +0 -99
- data/lib/yap/shell/event_emitter.rb +0 -18
- data/lib/yap/shell/execution.rb +0 -16
- data/lib/yap/shell/execution/builtin_command_execution.rb +0 -20
- data/lib/yap/shell/execution/command_execution.rb +0 -30
- data/lib/yap/shell/execution/context.rb +0 -128
- data/lib/yap/shell/execution/file_system_command_execution.rb +0 -137
- data/lib/yap/shell/execution/result.rb +0 -18
- data/lib/yap/shell/execution/ruby_command_execution.rb +0 -80
- data/lib/yap/shell/execution/shell_command_execution.rb +0 -30
- data/lib/yap/shell/prompt.rb +0 -21
- data/lib/yap/shell/repl.rb +0 -237
- data/lib/yap/shell/version.rb +0 -5
- data/lib/yap/world.rb +0 -286
- data/rcfiles/yaprc +0 -390
- data/scripts/4 +0 -8
- data/scripts/bg-vim +0 -4
- data/scripts/fail +0 -3
- data/scripts/letters +0 -8
- data/scripts/lots-of-output +0 -6
- data/scripts/pass +0 -3
- data/scripts/simulate-long-running +0 -4
- data/scripts/write-to-stderr.rb +0 -3
- data/scripts/write-to-stdout.rb +0 -3
- data/spec/features/addons/generating_an_addon_spec.rb +0 -55
- data/spec/features/addons/using_an_addon_spec.rb +0 -182
- data/spec/features/aliases_spec.rb +0 -78
- data/spec/features/environment_variables_spec.rb +0 -69
- data/spec/features/filesystem_commands_spec.rb +0 -61
- data/spec/features/first_time_spec.rb +0 -45
- data/spec/features/grouping_spec.rb +0 -81
- data/spec/features/line_editing_spec.rb +0 -174
- data/spec/features/range_spec.rb +0 -35
- data/spec/features/redirection_spec.rb +0 -234
- data/spec/features/repetition_spec.rb +0 -118
- data/spec/features/shell_expansions_spec.rb +0 -127
- data/spec/spec_helper.rb +0 -172
- data/spec/support/matchers/have_not_printed.rb +0 -30
- data/spec/support/matchers/have_printed.rb +0 -68
- data/spec/support/very_soon.rb +0 -9
- data/spec/support/yap_spec_dsl.rb +0 -258
- data/test.rb +0 -206
- data/update-rawline.sh +0 -6
@@ -1,182 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Using an addon', type: :feature do
|
4
|
-
let(:addons_path) { tmp_dir.join('addons/') }
|
5
|
-
let(:yaprc_path) { tmp_dir.join('yaprc') }
|
6
|
-
let(:yaprc_contents) { '' }
|
7
|
-
|
8
|
-
let(:foo_addon_path) { addons_path.join('yap-shell-addon-foo-0.1.0') }
|
9
|
-
let(:foo_lib_addon_path) { foo_addon_path.join('lib') }
|
10
|
-
let(:foo_addon_rb_path) { foo_lib_addon_path.join('yap-shell-addon-foo.rb') }
|
11
|
-
let(:create_foo_addon) do
|
12
|
-
mkdir_p foo_lib_addon_path.to_s
|
13
|
-
write_file foo_addon_rb_path.to_s, <<-RUBY.strip_heredoc
|
14
|
-
|module YapShellAddonFoo
|
15
|
-
| class Addon < ::Yap::Addon::Base
|
16
|
-
| self.export_as :foo
|
17
|
-
|
|
18
|
-
| def initialize_world(world)
|
19
|
-
| world.func('foo-addon') do |args:, stdout:|
|
20
|
-
| stdout.puts \"You passed \#\{args.inspect\} to foo-addon\"
|
21
|
-
| end
|
22
|
-
| end
|
23
|
-
| end
|
24
|
-
|end
|
25
|
-
RUBY
|
26
|
-
end
|
27
|
-
|
28
|
-
let(:bar_addon_path) { addons_path.join('yap-shell-addon-bar-0.1.0') }
|
29
|
-
let(:bar_lib_addon_path) { bar_addon_path.join('lib') }
|
30
|
-
let(:bar_addon_rb_path) { bar_lib_addon_path.join('yap-shell-addon-bar.rb') }
|
31
|
-
let(:create_bar_addon) do
|
32
|
-
mkdir_p bar_lib_addon_path.to_s
|
33
|
-
write_file bar_addon_rb_path.to_s, <<-RUBY.strip_heredoc
|
34
|
-
|module YapShellAddonBar
|
35
|
-
| class Addon < ::Yap::Addon::Base
|
36
|
-
| self.export_as :bar
|
37
|
-
|
|
38
|
-
| def initialize_world(world)
|
39
|
-
| world.func('bar-addon') do |args:, stdout:|
|
40
|
-
| stdout.puts \"You passed \#\{args.inspect\} to bar-addon\"
|
41
|
-
| end
|
42
|
-
| end
|
43
|
-
| end
|
44
|
-
|end
|
45
|
-
RUBY
|
46
|
-
end
|
47
|
-
|
48
|
-
let(:create_yaprc_file) do
|
49
|
-
write_file yaprc_path.to_s, <<-RUBY.strip_heredoc
|
50
|
-
|#{yaprc_contents}
|
51
|
-
RUBY
|
52
|
-
end
|
53
|
-
|
54
|
-
let(:yap_cli_args) do
|
55
|
-
[
|
56
|
-
'--addon-paths', addons_path.to_s,
|
57
|
-
'--rcfiles', yaprc_path.to_s,
|
58
|
-
'--no-history',
|
59
|
-
'--no-rcfiles',
|
60
|
-
'--skip-first-time'
|
61
|
-
]
|
62
|
-
end
|
63
|
-
|
64
|
-
before do
|
65
|
-
set_yap_command_line_arguments yap_cli_args
|
66
|
-
|
67
|
-
create_foo_addon
|
68
|
-
create_bar_addon
|
69
|
-
create_yaprc_file
|
70
|
-
|
71
|
-
turn_on_debug_log(debug: 'editor')
|
72
|
-
reinitialize_shell
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'loads addons it finds in addon paths' do
|
76
|
-
# foo-addon is a shell function added by the foo-addon defined above
|
77
|
-
type 'foo-addon hello world'
|
78
|
-
enter
|
79
|
-
|
80
|
-
expect { output }.to have_printed("You passed [\"hello\", \"world\"] to foo-addon")
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'makes addons available thru its export_as name' do
|
84
|
-
type '!addons.keys.include?(:foo)'
|
85
|
-
enter
|
86
|
-
expect { output }.to have_printed('true')
|
87
|
-
clear_all_output
|
88
|
-
|
89
|
-
type '!addons.keys.include?(:non_existent_addon)'
|
90
|
-
enter
|
91
|
-
expect { output }.to have_printed('false')
|
92
|
-
end
|
93
|
-
|
94
|
-
describe 'disabling an addon', repl: false do
|
95
|
-
let(:yap_cli_args) do
|
96
|
-
[
|
97
|
-
'--addon-paths', addons_path.to_s,
|
98
|
-
'addon', 'disable', 'foo'
|
99
|
-
]
|
100
|
-
end
|
101
|
-
|
102
|
-
it 'writes to disk that the addon has been disabled' do
|
103
|
-
expect { output }.to have_printed("Addon foo has been disabled")
|
104
|
-
|
105
|
-
expect(File.exists?(tmp_dir.join('.yap/addons.yml'))).to be(true)
|
106
|
-
|
107
|
-
addons_config_hsh = YAML.load_file(tmp_dir.join('.yap/addons.yml'))
|
108
|
-
expect(addons_config_hsh[:foo]).to include(disabled: true)
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
describe 'enabling an addon', repl: false do
|
113
|
-
let(:yap_cli_args) do
|
114
|
-
[
|
115
|
-
'--addon-paths', addons_path.to_s,
|
116
|
-
'addon', 'enable', 'foo'
|
117
|
-
]
|
118
|
-
end
|
119
|
-
|
120
|
-
it 'writes to disk that the addon has been enabled' do
|
121
|
-
expect { output }.to have_printed("Addon foo has been enabled")
|
122
|
-
|
123
|
-
expect(File.exists?(tmp_dir.join('.yap/addons.yml'))).to be(true)
|
124
|
-
|
125
|
-
addons_config_hsh = YAML.load_file(tmp_dir.join('.yap/addons.yml'))
|
126
|
-
expect(addons_config_hsh[:foo]).to include(disabled: false)
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
describe 'listing addons', repl: false do
|
131
|
-
let(:yap_cli_args) do
|
132
|
-
[
|
133
|
-
'--addon-paths', addons_path.to_s,
|
134
|
-
'addon', 'list'
|
135
|
-
]
|
136
|
-
end
|
137
|
-
|
138
|
-
before do
|
139
|
-
mkdir tmp_dir.join('.yap')
|
140
|
-
write_file(
|
141
|
-
tmp_dir.join('.yap/addons.yml'),
|
142
|
-
{
|
143
|
-
bar: { disabled: true },
|
144
|
-
foo: { disabled: false }
|
145
|
-
}.to_yaml
|
146
|
-
)
|
147
|
-
reinitialize_shell
|
148
|
-
end
|
149
|
-
|
150
|
-
it 'lists all addons found in the addon-paths' do
|
151
|
-
expect { output }.to have_printed(/bar.*foo/m)
|
152
|
-
end
|
153
|
-
|
154
|
-
describe 'enabled' do
|
155
|
-
let(:yap_cli_args) do
|
156
|
-
[
|
157
|
-
'--addon-paths', addons_path.to_s,
|
158
|
-
'addon', 'list', '--enabled'
|
159
|
-
]
|
160
|
-
end
|
161
|
-
|
162
|
-
it 'lists enabled addons' do
|
163
|
-
expect { output }.to have_printed(/foo/m)
|
164
|
-
expect { output }.to have_not_printed(/bar/m)
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
describe 'disabled' do
|
169
|
-
let(:yap_cli_args) do
|
170
|
-
[
|
171
|
-
'--addon-paths', addons_path.to_s,
|
172
|
-
'addon', 'list', '--disabled'
|
173
|
-
]
|
174
|
-
end
|
175
|
-
|
176
|
-
it 'lists disabled addons' do
|
177
|
-
expect { output }.to have_printed(/bar/m)
|
178
|
-
expect { output }.to have_not_printed(/foo/m)
|
179
|
-
end
|
180
|
-
end
|
181
|
-
end
|
182
|
-
end
|
@@ -1,78 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Aliases', type: :feature do
|
4
|
-
before do
|
5
|
-
type "alias foo='echo bar'"
|
6
|
-
enter
|
7
|
-
expect { output }.to have_printed(/Setting alias foo done/)
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'sets them' do
|
11
|
-
type 'alias | grep foo'
|
12
|
-
enter
|
13
|
-
expect { output }.to have_printed(/alias foo='echo bar'/)
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'executes them' do
|
17
|
-
type 'foo'
|
18
|
-
enter
|
19
|
-
expect { output }.to have_printed(/^bar$/m)
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'unsets them' do
|
23
|
-
type 'unalias foo'
|
24
|
-
enter
|
25
|
-
expect { output }.to have_printed(/Removing alias foo done\n/)
|
26
|
-
|
27
|
-
type 'alias | grep foo'
|
28
|
-
enter
|
29
|
-
expect(output).to_not match(/alias foo='echo bar'/)
|
30
|
-
end
|
31
|
-
|
32
|
-
describe 'conditionals' do
|
33
|
-
before do
|
34
|
-
type "alias fail='non-existent-command'"
|
35
|
-
enter
|
36
|
-
type "alias pass='echo pass'"
|
37
|
-
enter
|
38
|
-
clear_all_output
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'supports logical AND: &&' do
|
42
|
-
type "pass && pass"
|
43
|
-
enter
|
44
|
-
expect { output }.to have_printed(/^pass$.*^pass$/m)
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'supports logical OR: &&' do
|
48
|
-
type "fail || pass"
|
49
|
-
enter
|
50
|
-
expect { error_output }.to have_printed(/yap: command not found: non-existent-command/m)
|
51
|
-
expect { output }.to have_printed(/^pass$/m)
|
52
|
-
clear_all_output
|
53
|
-
|
54
|
-
type "echo $?"
|
55
|
-
enter
|
56
|
-
expect { output }.to have_printed(/0/m)
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'can combine logical AND and OR' do
|
60
|
-
type "(pass && fail) || pass"
|
61
|
-
enter
|
62
|
-
expect { error_output }.to have_printed(/yap: command not found: non-existent-command/m)
|
63
|
-
expect { output }.to have_printed(/^pass$.*^pass$/m)
|
64
|
-
clear_all_output
|
65
|
-
|
66
|
-
type "(pass || fail) && pass"
|
67
|
-
enter
|
68
|
-
expect { error_output }.to have_not_printed(/yap: command not found: non-existent-command/m)
|
69
|
-
expect { output }.to have_printed(/^pass$.*^pass$/m)
|
70
|
-
clear_all_output
|
71
|
-
|
72
|
-
type "(fail && pass) && pass"
|
73
|
-
enter
|
74
|
-
expect { error_output }.to have_printed(/yap: command not found: non-existent-command/m)
|
75
|
-
expect { output }.to have_not_printed(/^pass$.*^pass$/m)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
@@ -1,69 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Environment variables', type: :feature do
|
4
|
-
it 'sets and gets them with: NAME=value' do
|
5
|
-
type 'FOO=foobarbaz'
|
6
|
-
enter
|
7
|
-
|
8
|
-
type 'echo $FOO'
|
9
|
-
enter
|
10
|
-
expect { output }.to have_printed('foobarbaz')
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'can set multiple on a single line: NAME1=value1 NAME2=value2 etc' do
|
14
|
-
type 'A=b B=c C=d'
|
15
|
-
enter
|
16
|
-
clear_all_output
|
17
|
-
|
18
|
-
type 'echo $A $B $C'
|
19
|
-
enter
|
20
|
-
expect { output }.to have_printed('b c d')
|
21
|
-
clear_all_output
|
22
|
-
|
23
|
-
type 'echo $A$B$C'
|
24
|
-
enter
|
25
|
-
expect { output }.to have_printed('bcd')
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'expands env vars inside of double quotes' do
|
29
|
-
type 'BAR=foobarbaz'
|
30
|
-
enter
|
31
|
-
|
32
|
-
type %|echo "BAR is $BAR"|
|
33
|
-
enter
|
34
|
-
expect { output }.to have_printed('BAR is foobarbaz')
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'does not expand env vars inside of single quotes' do
|
38
|
-
type 'BAR=foobarbaz'
|
39
|
-
enter
|
40
|
-
|
41
|
-
type %|echo 'BAR is $BAR'|
|
42
|
-
enter
|
43
|
-
expect { output }.to have_printed('BAR is $BAR')
|
44
|
-
end
|
45
|
-
|
46
|
-
describe 'setting env vars for a single statement' do
|
47
|
-
it 'makes the env var available to the statement' do
|
48
|
-
type 'BAZ=baz echo $BAZ'
|
49
|
-
enter
|
50
|
-
expect { output }.to have_printed('baz')
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'does not keep the env var around for the next statement' do
|
54
|
-
type 'BAZ=baz echo $BAZ'
|
55
|
-
enter
|
56
|
-
clear_all_output
|
57
|
-
|
58
|
-
type 'echo $BAZ'
|
59
|
-
enter
|
60
|
-
expect { output }.to have_printed('$BAZ')
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'can set multiple env vars for a statement' do
|
64
|
-
type %|FOO=foo BAR='is the' BAZ="fastest pineapple" echo $FOO $BAR $BAZ|
|
65
|
-
enter
|
66
|
-
expect { output }.to have_printed('foo is the fastest pineapple')
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Filesystem commands', type: :feature do
|
4
|
-
it 'runs filesystem commands' do
|
5
|
-
touch 'bar.txt'
|
6
|
-
type 'ls .'
|
7
|
-
enter
|
8
|
-
|
9
|
-
expect { output }.to have_printed("bar.txt")
|
10
|
-
|
11
|
-
type 'echo "hello there"'
|
12
|
-
enter
|
13
|
-
expect { output }.to have_printed("hello there\n")
|
14
|
-
clear_all_output
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'pipes filesystem commands' do
|
18
|
-
type "echo 'food' | sed -e 's/o/_/g'"
|
19
|
-
enter
|
20
|
-
expect { output }.to have_printed(/^f__d\n/m)
|
21
|
-
end
|
22
|
-
|
23
|
-
describe 'conditionals' do
|
24
|
-
it 'supports logical AND: &&' do
|
25
|
-
type "echo foo && echo bar"
|
26
|
-
enter
|
27
|
-
expect { output }.to have_printed(/foo.*\n.*bar/m)
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'supports logical OR: &&' do
|
31
|
-
type "non-existent-command || echo bar"
|
32
|
-
enter
|
33
|
-
expect { error_output }.to have_printed(/yap: command not found: non-existent-command/m)
|
34
|
-
expect { output }.to have_printed(/bar/m)
|
35
|
-
clear_all_output
|
36
|
-
|
37
|
-
type "echo $?"
|
38
|
-
enter
|
39
|
-
expect { output }.to have_printed(/0/m)
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'can combine logical AND and OR' do
|
43
|
-
type "(echo foo && non-existent-command) || echo bar"
|
44
|
-
enter
|
45
|
-
expect { error_output }.to have_printed(/yap: command not found: non-existent-command/m)
|
46
|
-
expect { output }.to have_printed(/foo.*\n.*bar/m)
|
47
|
-
clear_all_output
|
48
|
-
|
49
|
-
type "(echo foo || non-existent-command) && echo bar"
|
50
|
-
enter
|
51
|
-
expect { error_output }.to have_not_printed(/yap: command not found: non-existent-command/m)
|
52
|
-
expect { output }.to have_printed(/foo.*\n.*bar/m)
|
53
|
-
clear_all_output
|
54
|
-
|
55
|
-
type "(non-existent-command && echo foo) && echo bar"
|
56
|
-
enter
|
57
|
-
expect { error_output }.to have_printed(/yap: command not found: non-existent-command/m)
|
58
|
-
expect { output }.to have_not_printed(/foo.*\n.*bar/m)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Running Yap for the first time', type: :feature, forks: true do
|
4
|
-
before do
|
5
|
-
# do not pass in --skip-first-time
|
6
|
-
set_yap_command_line_arguments \
|
7
|
-
'--no-history', '--no-addons', '--no-rcfiles'
|
8
|
-
|
9
|
-
turn_on_debug_log(debug: 'editor')
|
10
|
-
reinitialize_shell
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'tells the user it has been initialized' do
|
14
|
-
home_dir = tmp_dir.to_s
|
15
|
-
message = <<-EOT.gsub(/^\s*\|/, '').chomp
|
16
|
-
|Yap directory not found: #{home_dir}/.yap
|
17
|
-
|
|
18
|
-
|Initializing yap for the first time:
|
19
|
-
|
|
20
|
-
| Creating #{home_dir}/.yap done
|
21
|
-
| Creating default #{home_dir}/.yap/yaprc done
|
22
|
-
|
|
23
|
-
|To tweak yap take a look at #{home_dir}/.yap/yaprc.
|
24
|
-
|
|
25
|
-
|Reloading shell
|
26
|
-
EOT
|
27
|
-
expect { output }.to have_printed(message)
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'creates a $HOME/.yap/ directory for yap things to go' do
|
31
|
-
expect { output }.to have_printed('Reloading shell')
|
32
|
-
|
33
|
-
dot_yap_dir = tmp_dir.join('.yap').to_s
|
34
|
-
expect(Dir.exist?(dot_yap_dir)).to be(true)
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'creates a default .yap/yaprc rcfile' do
|
38
|
-
expect { output }.to have_printed('Reloading shell')
|
39
|
-
|
40
|
-
yaprc = tmp_dir.join('.yap/yaprc').to_s
|
41
|
-
templaterc = yap_dir.join('rcfiles/yaprc')
|
42
|
-
expect(File.exist?(yaprc)).to be(true)
|
43
|
-
expect(IO.read(yaprc)).to eq(IO.read(templaterc))
|
44
|
-
end
|
45
|
-
end
|
@@ -1,81 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Grouping commands', type: :feature do
|
4
|
-
before do
|
5
|
-
write_executable_script 'pass', <<-SCRIPT.strip_heredoc
|
6
|
-
|#!/bin/sh
|
7
|
-
|echo pass $1
|
8
|
-
|exit 0
|
9
|
-
SCRIPT
|
10
|
-
|
11
|
-
write_executable_script 'fail', <<-SCRIPT.strip_heredoc
|
12
|
-
|#!/bin/sh
|
13
|
-
|echo fail $1
|
14
|
-
|exit 1
|
15
|
-
SCRIPT
|
16
|
-
end
|
17
|
-
|
18
|
-
describe 'using parentheses' do
|
19
|
-
it 'works with: (command1 && command2) || command3' do
|
20
|
-
type '(./pass 1 && ./fail 2) || ./pass 3'
|
21
|
-
enter
|
22
|
-
expect { output }.to have_printed(/^pass 1$.*^fail 2$.*^pass 3$/m)
|
23
|
-
clear_all_output
|
24
|
-
|
25
|
-
type '(./fail 1 && ./pass 2) || ./pass 3'
|
26
|
-
enter
|
27
|
-
expect { output }.to have_printed(/^fail 1$.*^pass 3$/m)
|
28
|
-
expect { output }.to have_not_printed(/^pass 2$/m)
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'works with: (command1 && command2 && command3) || command4' do
|
32
|
-
type '(./pass 1 && ./fail 2 && ./pass 3) || ./pass 4'
|
33
|
-
enter
|
34
|
-
expect { output }.to have_printed(/^pass 1$.*^fail 2$.*^pass 4$/m)
|
35
|
-
expect { output }.to have_not_printed(/^pass 1$.*^fail 2$.*^pass 3$.*^pass 4$/m)
|
36
|
-
clear_all_output
|
37
|
-
|
38
|
-
type '(./fail 1 && ./pass 2 && ./pass 3) || ./pass 4'
|
39
|
-
enter
|
40
|
-
expect { output }.to have_printed(/^fail 1$.*^pass 4$/m)
|
41
|
-
expect { output }.to have_not_printed(/^pass 2$.*^pass 3$/m)
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'works with: (command1 || command2) && command4' do
|
45
|
-
type '(./fail 1 || ./pass 2) && ./pass 3'
|
46
|
-
enter
|
47
|
-
expect { output }.to have_printed(/^fail 1$.*^pass 2$.*^pass 3$/m)
|
48
|
-
|
49
|
-
type '(./pass 1 || ./fail 2) && ./pass 3'
|
50
|
-
enter
|
51
|
-
expect { output }.to have_printed(/^pass 1$.*^pass 3$/m)
|
52
|
-
expect { output }.to have_not_printed(/^fail 2$/m)
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'works with: (command1 && command2) && command4' do
|
56
|
-
type '(./fail 1 && ./pass 2) && ./pass 3'
|
57
|
-
enter
|
58
|
-
expect { output }.to have_printed(/^fail 1$/m)
|
59
|
-
expect { output }.to have_not_printed(/^pass 2$.*^pass 3$/m)
|
60
|
-
clear_all_output
|
61
|
-
|
62
|
-
type '(./pass 1 && ./fail 2) && ./pass 3'
|
63
|
-
enter
|
64
|
-
expect { output }.to have_printed(/^pass 1$.*^fail 2$/m)
|
65
|
-
expect { output }.to have_not_printed(/^pass 3$/m)
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'works with: (command1 || command2) || command4' do
|
69
|
-
type '(./fail 1 || ./pass 2) || ./pass 3'
|
70
|
-
enter
|
71
|
-
expect { output }.to have_printed(/^fail 1$.*^pass 2$/m)
|
72
|
-
expect { output }.to have_not_printed(/^pass 3$/m)
|
73
|
-
|
74
|
-
type '(./pass 1 || ./fail 2) || ./pass 3'
|
75
|
-
enter
|
76
|
-
expect { output }.to have_printed(/^pass 1$/m)
|
77
|
-
expect { output }.to have_not_printed(/^fail 2$.*^pass 3$/m)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|