command_kit 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog.md +6 -0
- data/README.md +3 -0
- data/command_kit.gemspec +7 -2
- data/lib/command_kit/completion/install.rb +276 -0
- data/lib/command_kit/env/prefix.rb +41 -0
- data/lib/command_kit/env/shell.rb +58 -0
- data/lib/command_kit/version.rb +1 -1
- metadata +4 -64
- data/spec/arguments/argument_spec.rb +0 -133
- data/spec/arguments/argument_value_spec.rb +0 -66
- data/spec/arguments_spec.rb +0 -279
- data/spec/bug_report_spec.rb +0 -266
- data/spec/colors_spec.rb +0 -771
- data/spec/command_kit_spec.rb +0 -8
- data/spec/command_name_spec.rb +0 -130
- data/spec/command_spec.rb +0 -123
- data/spec/commands/auto_load/subcommand_spec.rb +0 -82
- data/spec/commands/auto_load_spec.rb +0 -159
- data/spec/commands/auto_require_spec.rb +0 -142
- data/spec/commands/fixtures/test_auto_load/cli/commands/test1.rb +0 -10
- data/spec/commands/fixtures/test_auto_load/cli/commands/test2.rb +0 -10
- data/spec/commands/fixtures/test_auto_require/lib/test_auto_require/cli/commands/test1.rb +0 -10
- data/spec/commands/help_spec.rb +0 -66
- data/spec/commands/parent_command_spec.rb +0 -40
- data/spec/commands/subcommand_spec.rb +0 -99
- data/spec/commands_spec.rb +0 -865
- data/spec/description_spec.rb +0 -179
- data/spec/edit_spec.rb +0 -72
- data/spec/env/home_spec.rb +0 -46
- data/spec/env/path_spec.rb +0 -84
- data/spec/env_spec.rb +0 -123
- data/spec/examples_spec.rb +0 -211
- data/spec/exception_handler_spec.rb +0 -103
- data/spec/file_utils_spec.rb +0 -59
- data/spec/fixtures/template.erb +0 -5
- data/spec/help/man_spec.rb +0 -345
- data/spec/help_spec.rb +0 -94
- data/spec/inflector_spec.rb +0 -166
- data/spec/interactive_spec.rb +0 -415
- data/spec/main_spec.rb +0 -179
- data/spec/man_spec.rb +0 -46
- data/spec/open_app_spec.rb +0 -85
- data/spec/options/option_spec.rb +0 -343
- data/spec/options/option_value_spec.rb +0 -171
- data/spec/options/parser_spec.rb +0 -274
- data/spec/options/quiet_spec.rb +0 -51
- data/spec/options/verbose_spec.rb +0 -51
- data/spec/options/version_spec.rb +0 -146
- data/spec/options_spec.rb +0 -465
- data/spec/os/linux_spec.rb +0 -164
- data/spec/os_spec.rb +0 -233
- data/spec/package_manager_spec.rb +0 -806
- data/spec/pager_spec.rb +0 -217
- data/spec/printing/fields_spec.rb +0 -167
- data/spec/printing/indent_spec.rb +0 -132
- data/spec/printing/lists_spec.rb +0 -99
- data/spec/printing/tables/border_style.rb +0 -43
- data/spec/printing/tables/cell_builer_spec.rb +0 -135
- data/spec/printing/tables/row_builder_spec.rb +0 -165
- data/spec/printing/tables/style_spec.rb +0 -377
- data/spec/printing/tables/table_builder_spec.rb +0 -252
- data/spec/printing/tables/table_formatter_spec.rb +0 -1190
- data/spec/printing/tables_spec.rb +0 -1069
- data/spec/printing_spec.rb +0 -106
- data/spec/program_name_spec.rb +0 -70
- data/spec/spec_helper.rb +0 -3
- data/spec/stdio_spec.rb +0 -264
- data/spec/sudo_spec.rb +0 -51
- data/spec/terminal_spec.rb +0 -231
- data/spec/usage_spec.rb +0 -237
- data/spec/xdg_spec.rb +0 -191
data/spec/os_spec.rb
DELETED
@@ -1,233 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'command_kit/os'
|
3
|
-
|
4
|
-
describe CommandKit::OS do
|
5
|
-
module TestOS
|
6
|
-
class TestCommand
|
7
|
-
include CommandKit::OS
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
let(:command_class) { TestOS::TestCommand }
|
12
|
-
subject { command_class.new }
|
13
|
-
|
14
|
-
describe ".os" do
|
15
|
-
subject { command_class }
|
16
|
-
|
17
|
-
context "when RUBY_PLATFORM contains 'linux'" do
|
18
|
-
before { stub_const('RUBY_PLATFORM','x86_64-linux') }
|
19
|
-
|
20
|
-
it { expect(subject.os).to be(:linux) }
|
21
|
-
end
|
22
|
-
|
23
|
-
context "when RUBY_PLATFORM contains 'darwin'" do
|
24
|
-
before { stub_const('RUBY_PLATFORM','aarch64-darwin') }
|
25
|
-
|
26
|
-
it { expect(subject.os).to be(:macos) }
|
27
|
-
end
|
28
|
-
|
29
|
-
context "when RUBY_PLATFORM contains 'freebsd'" do
|
30
|
-
before { stub_const('RUBY_PLATFORM','x86_64-freebsd') }
|
31
|
-
|
32
|
-
it { expect(subject.os).to be(:freebsd) }
|
33
|
-
end
|
34
|
-
|
35
|
-
context "when RUBY_PLATFORM contains 'openbsd'" do
|
36
|
-
before { stub_const('RUBY_PLATFORM','x86_64-openbsd') }
|
37
|
-
|
38
|
-
it { expect(subject.os).to be(:openbsd) }
|
39
|
-
end
|
40
|
-
|
41
|
-
context "when RUBY_PLATFORM contains 'netbsd'" do
|
42
|
-
before { stub_const('RUBY_PLATFORM','x86_64-netbsd') }
|
43
|
-
|
44
|
-
it { expect(subject.os).to be(:netbsd) }
|
45
|
-
end
|
46
|
-
|
47
|
-
context "when Gem.win_platform? returns true" do
|
48
|
-
before do
|
49
|
-
stub_const('RUBY_PLATFORM','x86_64-mswin')
|
50
|
-
|
51
|
-
expect(Gem).to receive(:win_platform?).and_return(true)
|
52
|
-
end
|
53
|
-
|
54
|
-
it { expect(subject.os).to be(:windows) }
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
describe "#initialize" do
|
59
|
-
it "must default #os to self.class.os" do
|
60
|
-
expect(subject.os).to eq(command_class.os)
|
61
|
-
end
|
62
|
-
|
63
|
-
context "when initialized with the os: keyword" do
|
64
|
-
let(:os) { :netbsd }
|
65
|
-
|
66
|
-
subject { command_class.new(os: os) }
|
67
|
-
|
68
|
-
it "must set #os" do
|
69
|
-
expect(subject.os).to eq(os)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
describe "#linux?" do
|
75
|
-
context "when #os is :linux" do
|
76
|
-
subject { command_class.new(os: :linux) }
|
77
|
-
|
78
|
-
it { expect(subject.linux?).to be(true) }
|
79
|
-
end
|
80
|
-
|
81
|
-
context "when #os is not :linux" do
|
82
|
-
subject { command_class.new(os: :windows) }
|
83
|
-
|
84
|
-
it { expect(subject.linux?).to be(false) }
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
describe "#macos?" do
|
89
|
-
context "when #os is :macos" do
|
90
|
-
subject { command_class.new(os: :macos) }
|
91
|
-
|
92
|
-
it { expect(subject.macos?).to be(true) }
|
93
|
-
end
|
94
|
-
|
95
|
-
context "when #os is not :macos" do
|
96
|
-
subject { command_class.new(os: :windows) }
|
97
|
-
|
98
|
-
it { expect(subject.macos?).to be(false) }
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
describe "#freebsd?" do
|
103
|
-
context "when #os is :freebsd" do
|
104
|
-
subject { command_class.new(os: :freebsd) }
|
105
|
-
|
106
|
-
it { expect(subject.freebsd?).to be(true) }
|
107
|
-
end
|
108
|
-
|
109
|
-
context "when #os is not :freebsd" do
|
110
|
-
subject { command_class.new(os: :windows) }
|
111
|
-
|
112
|
-
it { expect(subject.freebsd?).to be(false) }
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
describe "#openbsd?" do
|
117
|
-
context "when #os is :openbsd" do
|
118
|
-
subject { command_class.new(os: :openbsd) }
|
119
|
-
|
120
|
-
it { expect(subject.openbsd?).to be(true) }
|
121
|
-
end
|
122
|
-
|
123
|
-
context "when #os is not :openbsd" do
|
124
|
-
subject { command_class.new(os: :windows) }
|
125
|
-
|
126
|
-
it { expect(subject.openbsd?).to be(false) }
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
describe "#netbsd?" do
|
131
|
-
context "when #os is :netbsd" do
|
132
|
-
subject { command_class.new(os: :netbsd) }
|
133
|
-
|
134
|
-
it { expect(subject.netbsd?).to be(true) }
|
135
|
-
end
|
136
|
-
|
137
|
-
context "when #os is not :netbsd" do
|
138
|
-
subject { command_class.new(os: :windows) }
|
139
|
-
|
140
|
-
it { expect(subject.netbsd?).to be(false) }
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
describe "#bsd?" do
|
145
|
-
context "when #os is :freebsd" do
|
146
|
-
subject { command_class.new(os: :freebsd) }
|
147
|
-
|
148
|
-
it { expect(subject.bsd?).to be(true) }
|
149
|
-
end
|
150
|
-
|
151
|
-
context "when #os is :openbsd" do
|
152
|
-
subject { command_class.new(os: :openbsd) }
|
153
|
-
|
154
|
-
it { expect(subject.bsd?).to be(true) }
|
155
|
-
end
|
156
|
-
|
157
|
-
context "when #os is :netbsd" do
|
158
|
-
subject { command_class.new(os: :netbsd) }
|
159
|
-
|
160
|
-
it { expect(subject.bsd?).to be(true) }
|
161
|
-
end
|
162
|
-
|
163
|
-
context "when #os is :macos" do
|
164
|
-
subject { command_class.new(os: :macos) }
|
165
|
-
|
166
|
-
it { expect(subject.bsd?).to be(false) }
|
167
|
-
end
|
168
|
-
|
169
|
-
context "when #os is :linux" do
|
170
|
-
subject { command_class.new(os: :linux) }
|
171
|
-
|
172
|
-
it { expect(subject.bsd?).to be(false) }
|
173
|
-
end
|
174
|
-
|
175
|
-
context "when #os is :windows" do
|
176
|
-
subject { command_class.new(os: :windows) }
|
177
|
-
|
178
|
-
it { expect(subject.bsd?).to be(false) }
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
|
-
describe "#unix?" do
|
183
|
-
context "when #os is :freebsd" do
|
184
|
-
subject { command_class.new(os: :freebsd) }
|
185
|
-
|
186
|
-
it { expect(subject.unix?).to be(true) }
|
187
|
-
end
|
188
|
-
|
189
|
-
context "when #os is :openbsd" do
|
190
|
-
subject { command_class.new(os: :openbsd) }
|
191
|
-
|
192
|
-
it { expect(subject.unix?).to be(true) }
|
193
|
-
end
|
194
|
-
|
195
|
-
context "when #os is :netbsd" do
|
196
|
-
subject { command_class.new(os: :netbsd) }
|
197
|
-
|
198
|
-
it { expect(subject.unix?).to be(true) }
|
199
|
-
end
|
200
|
-
|
201
|
-
context "when #os is :macos" do
|
202
|
-
subject { command_class.new(os: :macos) }
|
203
|
-
|
204
|
-
it { expect(subject.unix?).to be(true) }
|
205
|
-
end
|
206
|
-
|
207
|
-
context "when #os is :linux" do
|
208
|
-
subject { command_class.new(os: :linux) }
|
209
|
-
|
210
|
-
it { expect(subject.unix?).to be(true) }
|
211
|
-
end
|
212
|
-
|
213
|
-
context "when #os is :windows" do
|
214
|
-
subject { command_class.new(os: :windows) }
|
215
|
-
|
216
|
-
it { expect(subject.unix?).to be(false) }
|
217
|
-
end
|
218
|
-
end
|
219
|
-
|
220
|
-
describe "#windows?" do
|
221
|
-
context "when #os is :windows" do
|
222
|
-
subject { command_class.new(os: :windows) }
|
223
|
-
|
224
|
-
it { expect(subject.windows?).to be(true) }
|
225
|
-
end
|
226
|
-
|
227
|
-
context "when #os is not :windows" do
|
228
|
-
subject { command_class.new(os: :linux) }
|
229
|
-
|
230
|
-
it { expect(subject.windows?).to be(false) }
|
231
|
-
end
|
232
|
-
end
|
233
|
-
end
|