hsume2-aka 0.3.2 → 0.4.1
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/README.md +11 -3
- data/bin/aka +18 -0
- data/bin/build +37 -0
- data/bin/postinstall +3 -0
- data/bin/postremove +3 -0
- data/lib/aka/configuration.pb.rb +41 -0
- data/lib/aka/configuration.proto +20 -0
- data/lib/aka/link_manager.rb +30 -0
- data/lib/aka/man/aka-add.1 +1 -1
- data/lib/aka/man/aka-add.1.txt +1 -1
- data/lib/aka/man/aka-edit.1 +1 -1
- data/lib/aka/man/aka-edit.1.txt +1 -1
- data/lib/aka/man/aka-generate.1 +1 -1
- data/lib/aka/man/aka-generate.1.txt +1 -1
- data/lib/aka/man/aka-link.1 +1 -1
- data/lib/aka/man/aka-link.1.txt +1 -1
- data/lib/aka/man/aka-list.1 +1 -1
- data/lib/aka/man/aka-list.1.txt +1 -1
- data/lib/aka/man/aka-remove.1 +1 -1
- data/lib/aka/man/aka-remove.1.txt +1 -1
- data/lib/aka/man/aka-show.1 +1 -1
- data/lib/aka/man/aka-show.1.txt +1 -1
- data/lib/aka/man/aka-sync.1 +1 -1
- data/lib/aka/man/aka-sync.1.txt +1 -1
- data/lib/aka/man/aka-upgrade.1 +3 -3
- data/lib/aka/man/aka-upgrade.1.txt +3 -3
- data/lib/aka/man/aka.7 +4 -4
- data/lib/aka/man/aka.7.txt +4 -4
- data/lib/aka/shortcut.rb +43 -0
- data/lib/aka/{shortcuts.rb → shortcut_manager.rb} +16 -34
- data/lib/aka/store.rb +92 -39
- data/lib/aka/upgrader.rb +45 -12
- data/lib/aka/version.rb +1 -1
- data/lib/aka.rb +4 -3
- metadata +23 -74
- data/.gitignore +0 -11
- data/.ruby-version.example +0 -1
- data/.travis.yml +0 -4
- data/Gemfile +0 -8
- data/Guardfile +0 -6
- data/Rakefile +0 -98
- data/aka.gemspec +0 -28
- data/features/aka/add.feature +0 -199
- data/features/aka/edit.feature +0 -196
- data/features/aka/generate.feature +0 -117
- data/features/aka/help.feature +0 -112
- data/features/aka/link.feature +0 -339
- data/features/aka/list.feature +0 -62
- data/features/aka/remove.feature +0 -52
- data/features/aka/show.feature +0 -38
- data/features/aka/upgrade.feature +0 -137
- data/features/step_definitions/aka_steps.rb +0 -3
- data/features/support/env.rb +0 -80
- data/lib/aka/configuration.rb +0 -94
- data/lib/aka/links.rb +0 -33
- data/lib/aka/man/.gitkeep +0 -0
- data/man/aka-add.1.ronn +0 -32
- data/man/aka-edit.1.ronn +0 -67
- data/man/aka-generate.1.ronn +0 -51
- data/man/aka-link.1.ronn +0 -49
- data/man/aka-list.1.ronn +0 -51
- data/man/aka-remove.1.ronn +0 -21
- data/man/aka-show.1.ronn +0 -27
- data/man/aka-sync.1.ronn +0 -31
- data/man/aka-upgrade.1.ronn +0 -22
- data/man/aka.7.ronn +0 -120
- data/test/tc_something.rb +0 -7
data/features/aka/link.feature
DELETED
@@ -1,339 +0,0 @@
|
|
1
|
-
Feature: Link keyboard shortcuts
|
2
|
-
In order to keep my shortcuts up to date
|
3
|
-
I want to have a tool for configuring shell keyboard shortcuts
|
4
|
-
So I don't have to do it myself
|
5
|
-
|
6
|
-
Background:
|
7
|
-
Given a file named ".aka.yml" should not exist
|
8
|
-
And I set the AKA environment variable to the ".aka.yml" file in the working directory
|
9
|
-
And I set the environment variables to:
|
10
|
-
| variable | value |
|
11
|
-
| NO_MAN | 1 |
|
12
|
-
|
13
|
-
|
14
|
-
Scenario: Add a link
|
15
|
-
Given I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
|
16
|
-
And I run `aka add ls "ls -FG" --tag os:darwin`
|
17
|
-
And I run `aka add .. "cd .."`
|
18
|
-
When I run `aka link --tag os:darwin --output .aka.zsh`
|
19
|
-
Then the exit status should be 0
|
20
|
-
And the stdout should contain exactly:
|
21
|
-
"""
|
22
|
-
Created shortcut.
|
23
|
-
Created shortcut.
|
24
|
-
Created shortcut.
|
25
|
-
Saved link.
|
26
|
-
|
27
|
-
"""
|
28
|
-
And the file ".aka.yml" should contain exactly:
|
29
|
-
"""
|
30
|
-
---
|
31
|
-
:version: '1'
|
32
|
-
:shortcuts:
|
33
|
-
1: !ruby/object:OpenStruct
|
34
|
-
table:
|
35
|
-
:shortcut: ls
|
36
|
-
:command: ls -F --color=auto
|
37
|
-
:tag:
|
38
|
-
- os:linux
|
39
|
-
:description: |-
|
40
|
-
ls
|
41
|
-
ls
|
42
|
-
ls
|
43
|
-
:function: true
|
44
|
-
modifiable: true
|
45
|
-
2: !ruby/object:OpenStruct
|
46
|
-
table:
|
47
|
-
:shortcut: ls
|
48
|
-
:command: ls -FG
|
49
|
-
:tag:
|
50
|
-
- os:darwin
|
51
|
-
modifiable: true
|
52
|
-
3: !ruby/object:OpenStruct
|
53
|
-
table:
|
54
|
-
:shortcut: ".."
|
55
|
-
:command: cd ..
|
56
|
-
modifiable: true
|
57
|
-
:links:
|
58
|
-
1: !ruby/object:OpenStruct
|
59
|
-
table:
|
60
|
-
:tag:
|
61
|
-
- os:darwin
|
62
|
-
:output: ".aka.zsh"
|
63
|
-
modifiable: true
|
64
|
-
|
65
|
-
"""
|
66
|
-
|
67
|
-
Scenario: Add the same link
|
68
|
-
Given I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
|
69
|
-
And I run `aka add ls "ls -FG" --tag os:darwin`
|
70
|
-
And I run `aka add .. "cd .."`
|
71
|
-
When I run `aka link --tag os:darwin --output .aka.zsh`
|
72
|
-
And I run `aka link --tag os:darwin --output .aka.zsh`
|
73
|
-
Then the exit status should be 0
|
74
|
-
And the stdout should contain exactly:
|
75
|
-
"""
|
76
|
-
Created shortcut.
|
77
|
-
Created shortcut.
|
78
|
-
Created shortcut.
|
79
|
-
Saved link.
|
80
|
-
Saved link.
|
81
|
-
|
82
|
-
"""
|
83
|
-
And the file ".aka.yml" should contain exactly:
|
84
|
-
"""
|
85
|
-
---
|
86
|
-
:version: '1'
|
87
|
-
:shortcuts:
|
88
|
-
1: !ruby/object:OpenStruct
|
89
|
-
table:
|
90
|
-
:shortcut: ls
|
91
|
-
:command: ls -F --color=auto
|
92
|
-
:tag:
|
93
|
-
- os:linux
|
94
|
-
:description: |-
|
95
|
-
ls
|
96
|
-
ls
|
97
|
-
ls
|
98
|
-
:function: true
|
99
|
-
modifiable: true
|
100
|
-
2: !ruby/object:OpenStruct
|
101
|
-
table:
|
102
|
-
:shortcut: ls
|
103
|
-
:command: ls -FG
|
104
|
-
:tag:
|
105
|
-
- os:darwin
|
106
|
-
modifiable: true
|
107
|
-
3: !ruby/object:OpenStruct
|
108
|
-
table:
|
109
|
-
:shortcut: ".."
|
110
|
-
:command: cd ..
|
111
|
-
modifiable: true
|
112
|
-
:links:
|
113
|
-
1: !ruby/object:OpenStruct
|
114
|
-
table:
|
115
|
-
:tag:
|
116
|
-
- os:darwin
|
117
|
-
:output: ".aka.zsh"
|
118
|
-
modifiable: true
|
119
|
-
|
120
|
-
"""
|
121
|
-
|
122
|
-
Scenario: Add a link with invalid options
|
123
|
-
Given I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
|
124
|
-
And I run `aka add ls "ls -FG" --tag os:darwin`
|
125
|
-
And I run `aka add .. "cd .."`
|
126
|
-
When I run `aka link`
|
127
|
-
Then the exit status should not be 0
|
128
|
-
And the stdout should contain exactly:
|
129
|
-
"""
|
130
|
-
Created shortcut.
|
131
|
-
Created shortcut.
|
132
|
-
Created shortcut.
|
133
|
-
|
134
|
-
"""
|
135
|
-
And the stderr should contain exactly:
|
136
|
-
"""
|
137
|
-
Invalid link.
|
138
|
-
|
139
|
-
"""
|
140
|
-
And the file ".aka.yml" should contain exactly:
|
141
|
-
"""
|
142
|
-
---
|
143
|
-
:version: '1'
|
144
|
-
:shortcuts:
|
145
|
-
1: !ruby/object:OpenStruct
|
146
|
-
table:
|
147
|
-
:shortcut: ls
|
148
|
-
:command: ls -F --color=auto
|
149
|
-
:tag:
|
150
|
-
- os:linux
|
151
|
-
:description: |-
|
152
|
-
ls
|
153
|
-
ls
|
154
|
-
ls
|
155
|
-
:function: true
|
156
|
-
modifiable: true
|
157
|
-
2: !ruby/object:OpenStruct
|
158
|
-
table:
|
159
|
-
:shortcut: ls
|
160
|
-
:command: ls -FG
|
161
|
-
:tag:
|
162
|
-
- os:darwin
|
163
|
-
modifiable: true
|
164
|
-
3: !ruby/object:OpenStruct
|
165
|
-
table:
|
166
|
-
:shortcut: ".."
|
167
|
-
:command: cd ..
|
168
|
-
modifiable: true
|
169
|
-
|
170
|
-
"""
|
171
|
-
|
172
|
-
Scenario: Remove a link
|
173
|
-
Given I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
|
174
|
-
And I run `aka add ls "ls -FG" --tag os:darwin`
|
175
|
-
And I run `aka add .. "cd .."`
|
176
|
-
And I run `aka link --tag os:darwin --output .aka.zsh`
|
177
|
-
When I run `aka link delete 1`
|
178
|
-
Then the exit status should be 0
|
179
|
-
And the stdout should contain exactly:
|
180
|
-
"""
|
181
|
-
Created shortcut.
|
182
|
-
Created shortcut.
|
183
|
-
Created shortcut.
|
184
|
-
Saved link.
|
185
|
-
Deleted link.
|
186
|
-
|
187
|
-
"""
|
188
|
-
And the file ".aka.yml" should contain exactly:
|
189
|
-
"""
|
190
|
-
---
|
191
|
-
:version: '1'
|
192
|
-
:shortcuts:
|
193
|
-
1: !ruby/object:OpenStruct
|
194
|
-
table:
|
195
|
-
:shortcut: ls
|
196
|
-
:command: ls -F --color=auto
|
197
|
-
:tag:
|
198
|
-
- os:linux
|
199
|
-
:description: |-
|
200
|
-
ls
|
201
|
-
ls
|
202
|
-
ls
|
203
|
-
:function: true
|
204
|
-
modifiable: true
|
205
|
-
2: !ruby/object:OpenStruct
|
206
|
-
table:
|
207
|
-
:shortcut: ls
|
208
|
-
:command: ls -FG
|
209
|
-
:tag:
|
210
|
-
- os:darwin
|
211
|
-
modifiable: true
|
212
|
-
3: !ruby/object:OpenStruct
|
213
|
-
table:
|
214
|
-
:shortcut: ".."
|
215
|
-
:command: cd ..
|
216
|
-
modifiable: true
|
217
|
-
|
218
|
-
"""
|
219
|
-
|
220
|
-
Scenario: Sync link
|
221
|
-
Given a file named ".aka.zsh" should not exist
|
222
|
-
And I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
|
223
|
-
And I run `aka add ls "ls -FG" --tag os:darwin`
|
224
|
-
And I run `aka add .. "cd .."`
|
225
|
-
And I run `aka link --tag os:darwin --output .aka.zsh`
|
226
|
-
When I run `aka sync`
|
227
|
-
Then the exit status should be 0
|
228
|
-
And the stdout should contain exactly:
|
229
|
-
"""
|
230
|
-
Created shortcut.
|
231
|
-
Created shortcut.
|
232
|
-
Created shortcut.
|
233
|
-
Saved link.
|
234
|
-
Generated .aka.zsh.
|
235
|
-
|
236
|
-
"""
|
237
|
-
And the file ".aka.zsh" should contain exactly:
|
238
|
-
"""
|
239
|
-
alias ..="cd .."
|
240
|
-
alias ls="ls -FG"
|
241
|
-
|
242
|
-
"""
|
243
|
-
|
244
|
-
Scenario: Sync links
|
245
|
-
Given a file named ".aka.zsh" should not exist
|
246
|
-
And I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
|
247
|
-
And I run `aka add ls "ls -FG" --tag os:darwin`
|
248
|
-
And I run `aka add .. "cd .."`
|
249
|
-
And I run `aka link --tag os:darwin --output .aka.zsh`
|
250
|
-
And I run `aka link --tag os:linux --output .aka2.zsh`
|
251
|
-
When I run `aka sync`
|
252
|
-
Then the exit status should be 0
|
253
|
-
And the stdout should contain exactly:
|
254
|
-
"""
|
255
|
-
Created shortcut.
|
256
|
-
Created shortcut.
|
257
|
-
Created shortcut.
|
258
|
-
Saved link.
|
259
|
-
Saved link.
|
260
|
-
Generated .aka.zsh.
|
261
|
-
Generated .aka2.zsh.
|
262
|
-
|
263
|
-
"""
|
264
|
-
And the file ".aka.zsh" should contain exactly:
|
265
|
-
"""
|
266
|
-
alias ..="cd .."
|
267
|
-
alias ls="ls -FG"
|
268
|
-
|
269
|
-
"""
|
270
|
-
And the file ".aka2.zsh" should contain exactly:
|
271
|
-
"""
|
272
|
-
alias ..="cd .."
|
273
|
-
function ls {
|
274
|
-
ls -F --color=auto
|
275
|
-
}
|
276
|
-
|
277
|
-
"""
|
278
|
-
|
279
|
-
Scenario: Sync specific link
|
280
|
-
Given a file named ".aka.zsh" should not exist
|
281
|
-
And I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
|
282
|
-
And I run `aka add ls "ls -FG" --tag os:darwin`
|
283
|
-
And I run `aka add .. "cd .."`
|
284
|
-
And I run `aka link --tag os:darwin --output .aka.zsh`
|
285
|
-
And I run `aka link --tag os:linux --output .aka2.zsh`
|
286
|
-
When I run `aka sync 2`
|
287
|
-
Then the exit status should be 0
|
288
|
-
And the stdout should contain exactly:
|
289
|
-
"""
|
290
|
-
Created shortcut.
|
291
|
-
Created shortcut.
|
292
|
-
Created shortcut.
|
293
|
-
Saved link.
|
294
|
-
Saved link.
|
295
|
-
Generated .aka2.zsh.
|
296
|
-
|
297
|
-
"""
|
298
|
-
And the file ".aka.zsh" should not exist
|
299
|
-
And the file ".aka2.zsh" should contain exactly:
|
300
|
-
"""
|
301
|
-
alias ..="cd .."
|
302
|
-
function ls {
|
303
|
-
ls -F --color=auto
|
304
|
-
}
|
305
|
-
|
306
|
-
"""
|
307
|
-
|
308
|
-
Scenario: List links
|
309
|
-
Given I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
|
310
|
-
And I run `aka add ls "ls -FG" --tag os:darwin`
|
311
|
-
And I run `aka add .. "cd .."`
|
312
|
-
And I run `aka link --tag os:darwin --output .aka.zsh`
|
313
|
-
When I run `aka list`
|
314
|
-
Then the exit status should be 0
|
315
|
-
And the output should contain exactly:
|
316
|
-
"""
|
317
|
-
Created shortcut.
|
318
|
-
Created shortcut.
|
319
|
-
Created shortcut.
|
320
|
-
Saved link.
|
321
|
-
#default
|
322
|
-
========
|
323
|
-
.. cd ..
|
324
|
-
|
325
|
-
#os:linux
|
326
|
-
=========
|
327
|
-
ls ls; ls; ls
|
328
|
-
|
329
|
-
#os:darwin
|
330
|
-
==========
|
331
|
-
ls ls -FG
|
332
|
-
|
333
|
-
=====
|
334
|
-
Links
|
335
|
-
=====
|
336
|
-
|
337
|
-
[1] .aka.zsh: #os:darwin
|
338
|
-
|
339
|
-
"""
|
data/features/aka/list.feature
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
Feature: List keyboard shortcuts
|
2
|
-
In order to improve productivity
|
3
|
-
I want to have a tool for managing shell keyboard shortcuts
|
4
|
-
So I don't have to do it myself
|
5
|
-
|
6
|
-
Background:
|
7
|
-
Given a file named ".aka.yml" should not exist
|
8
|
-
And I set the AKA environment variable to the ".aka.yml" file in the working directory
|
9
|
-
And I set the environment variables to:
|
10
|
-
| variable | value |
|
11
|
-
| NO_MAN | 1 |
|
12
|
-
|
13
|
-
Scenario: List shortcuts
|
14
|
-
Given I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
|
15
|
-
And I run `aka add ls "ls -FG" --tag os:darwin`
|
16
|
-
And I run `aka add .. "cd .."`
|
17
|
-
When I run `aka list`
|
18
|
-
Then the exit status should be 0
|
19
|
-
And the output should contain exactly:
|
20
|
-
"""
|
21
|
-
Created shortcut.
|
22
|
-
Created shortcut.
|
23
|
-
Created shortcut.
|
24
|
-
#default
|
25
|
-
========
|
26
|
-
.. cd ..
|
27
|
-
|
28
|
-
#os:linux
|
29
|
-
=========
|
30
|
-
ls ls; ls; ls
|
31
|
-
|
32
|
-
#os:darwin
|
33
|
-
==========
|
34
|
-
ls ls -FG
|
35
|
-
|
36
|
-
|
37
|
-
"""
|
38
|
-
|
39
|
-
Scenario: List shortcuts matching tag
|
40
|
-
Given I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
|
41
|
-
And I run `aka add ls "ls -FG" --tag os:darwin`
|
42
|
-
And I run `aka add ... "cd ..." --tag os:windows`
|
43
|
-
And I run `aka add .. "cd .."`
|
44
|
-
When I run `aka list --tag os:darwin`
|
45
|
-
Then the exit status should be 0
|
46
|
-
And the output should contain exactly:
|
47
|
-
"""
|
48
|
-
Created shortcut.
|
49
|
-
Created shortcut.
|
50
|
-
Created shortcut.
|
51
|
-
Created shortcut.
|
52
|
-
#default
|
53
|
-
========
|
54
|
-
.. cd ..
|
55
|
-
|
56
|
-
#os:darwin
|
57
|
-
==========
|
58
|
-
ls ls -FG
|
59
|
-
|
60
|
-
2 shortcut(s) excluded (#os:linux, #os:windows).
|
61
|
-
|
62
|
-
"""
|
data/features/aka/remove.feature
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
Feature: Remove keyboard shortcuts
|
2
|
-
In order to improve productivity
|
3
|
-
I want to have a tool for managing shell keyboard shortcuts
|
4
|
-
So I don't have to do it myself
|
5
|
-
|
6
|
-
Background:
|
7
|
-
Given a file named ".aka.yml" should not exist
|
8
|
-
And I set the AKA environment variable to the ".aka.yml" file in the working directory
|
9
|
-
And I set the environment variables to:
|
10
|
-
| variable | value |
|
11
|
-
| NO_MAN | 1 |
|
12
|
-
|
13
|
-
Scenario: Remove shortcut
|
14
|
-
Given I run `aka add ls "ls -F --color=auto"`
|
15
|
-
When I run `aka remove ls`
|
16
|
-
Then the exit status should be 0
|
17
|
-
And the output should contain exactly:
|
18
|
-
"""
|
19
|
-
Created shortcut.
|
20
|
-
Removed shortcut.
|
21
|
-
|
22
|
-
"""
|
23
|
-
And the file ".aka.yml" should contain exactly:
|
24
|
-
"""
|
25
|
-
---
|
26
|
-
:version: '1'
|
27
|
-
:shortcuts: {}
|
28
|
-
|
29
|
-
"""
|
30
|
-
|
31
|
-
Scenario: Remove missing shortcut
|
32
|
-
Given I run `aka add ls "ls -F --color=auto"`
|
33
|
-
When I run `aka remove ..`
|
34
|
-
Then the exit status should not be 0
|
35
|
-
And the output should contain exactly:
|
36
|
-
"""
|
37
|
-
Created shortcut.
|
38
|
-
No shortcut "..". Aborting.
|
39
|
-
|
40
|
-
"""
|
41
|
-
And the file ".aka.yml" should contain exactly:
|
42
|
-
"""
|
43
|
-
---
|
44
|
-
:version: '1'
|
45
|
-
:shortcuts:
|
46
|
-
1: !ruby/object:OpenStruct
|
47
|
-
table:
|
48
|
-
:shortcut: ls
|
49
|
-
:command: ls -F --color=auto
|
50
|
-
modifiable: true
|
51
|
-
|
52
|
-
"""
|
data/features/aka/show.feature
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
Feature: Show keyboard shortcuts
|
2
|
-
In order to improve productivity
|
3
|
-
I want to have a tool for managing shell keyboard shortcuts
|
4
|
-
So I don't have to do it myself
|
5
|
-
|
6
|
-
Background:
|
7
|
-
Given a file named ".aka.yml" should not exist
|
8
|
-
And I set the AKA environment variable to the ".aka.yml" file in the working directory
|
9
|
-
And I set the environment variables to:
|
10
|
-
| variable | value |
|
11
|
-
| NO_MAN | 1 |
|
12
|
-
|
13
|
-
Scenario: Show shortcut
|
14
|
-
Given I run `aka add ls "ls -F --color=auto" --function --description "1\n2" --tag osx`
|
15
|
-
When I run `aka show ls`
|
16
|
-
Then the exit status should be 0
|
17
|
-
And the output should contain exactly:
|
18
|
-
"""
|
19
|
-
Created shortcut.
|
20
|
-
Shortcut: ls
|
21
|
-
Description:
|
22
|
-
1
|
23
|
-
2
|
24
|
-
Function: y
|
25
|
-
Tags: #osx
|
26
|
-
Command:
|
27
|
-
ls -F --color=auto
|
28
|
-
|
29
|
-
"""
|
30
|
-
|
31
|
-
Scenario: Show missing shortcut
|
32
|
-
When I run `aka show ls`
|
33
|
-
Then the exit status should not be 0
|
34
|
-
And the output should contain exactly:
|
35
|
-
"""
|
36
|
-
Shortcut not found.
|
37
|
-
|
38
|
-
"""
|
@@ -1,137 +0,0 @@
|
|
1
|
-
Feature: Upgrade aka
|
2
|
-
In order to keep the aka configuration up to date
|
3
|
-
I want to upgrade the configuration from the command-line
|
4
|
-
So I don't have to do it manually
|
5
|
-
|
6
|
-
Background:
|
7
|
-
Given I set the AKA environment variable to the ".aka.yml" file in the working directory
|
8
|
-
And I set the environment variables to:
|
9
|
-
| variable | value |
|
10
|
-
| NO_MAN | 1 |
|
11
|
-
|
12
|
-
|
13
|
-
Scenario: Upgrade from v0 to v1
|
14
|
-
Given a file named ".aka.yml" with:
|
15
|
-
"""
|
16
|
-
---
|
17
|
-
1: !ruby/object:OpenStruct
|
18
|
-
table:
|
19
|
-
:shortcut: ls
|
20
|
-
:command: ls -F --color=auto
|
21
|
-
modifiable: true
|
22
|
-
|
23
|
-
"""
|
24
|
-
When I run `aka upgrade`
|
25
|
-
Then the exit status should be 0
|
26
|
-
And the file ".aka.yml" should contain exactly:
|
27
|
-
"""
|
28
|
-
---
|
29
|
-
:version: '1'
|
30
|
-
:shortcuts:
|
31
|
-
1: !ruby/object:OpenStruct
|
32
|
-
table:
|
33
|
-
:shortcut: ls
|
34
|
-
:command: ls -F --color=auto
|
35
|
-
modifiable: true
|
36
|
-
|
37
|
-
"""
|
38
|
-
And the stdout should contain "Upgraded"
|
39
|
-
And the stdout should contain ".aka.yml"
|
40
|
-
And the stdout should contain "Backed up to"
|
41
|
-
And the stdout should contain ".aka.yml.backup"
|
42
|
-
And the file ".aka.yml.backup" should contain exactly:
|
43
|
-
"""
|
44
|
-
---
|
45
|
-
1: !ruby/object:OpenStruct
|
46
|
-
table:
|
47
|
-
:shortcut: ls
|
48
|
-
:command: ls -F --color=auto
|
49
|
-
modifiable: true
|
50
|
-
|
51
|
-
"""
|
52
|
-
|
53
|
-
Scenario: Upgrade from v1 to v2
|
54
|
-
Given a file named ".aka.yml" with:
|
55
|
-
"""
|
56
|
-
---
|
57
|
-
:version: '1'
|
58
|
-
:shortcuts:
|
59
|
-
1: !ruby/object:OpenStruct
|
60
|
-
table:
|
61
|
-
:shortcut: ls
|
62
|
-
:command: ls -F --color=auto
|
63
|
-
:tag:
|
64
|
-
- os:linux
|
65
|
-
:description: |-
|
66
|
-
ls
|
67
|
-
ls
|
68
|
-
ls
|
69
|
-
:function: true
|
70
|
-
modifiable: true
|
71
|
-
:links:
|
72
|
-
- !ruby/object:OpenStruct
|
73
|
-
table:
|
74
|
-
:tag:
|
75
|
-
- os:darwin
|
76
|
-
:output: ".aka.zsh"
|
77
|
-
modifiable: true
|
78
|
-
|
79
|
-
"""
|
80
|
-
When I run `aka upgrade`
|
81
|
-
Then the exit status should be 0
|
82
|
-
And the file ".aka.yml" should contain exactly:
|
83
|
-
"""
|
84
|
-
---
|
85
|
-
:version: '2'
|
86
|
-
:shortcuts:
|
87
|
-
1: !ruby/object:OpenStruct
|
88
|
-
table:
|
89
|
-
:shortcut: ls
|
90
|
-
:command: ls -F --color=auto
|
91
|
-
:tag:
|
92
|
-
- os:linux
|
93
|
-
:description: |-
|
94
|
-
ls
|
95
|
-
ls
|
96
|
-
ls
|
97
|
-
:function: true
|
98
|
-
modifiable: true
|
99
|
-
:links:
|
100
|
-
1: !ruby/object:OpenStruct
|
101
|
-
table:
|
102
|
-
:tag:
|
103
|
-
- os:darwin
|
104
|
-
:output: ".aka.zsh"
|
105
|
-
modifiable: true
|
106
|
-
|
107
|
-
"""
|
108
|
-
And the stdout should contain "Upgraded"
|
109
|
-
And the stdout should contain ".aka.yml"
|
110
|
-
And the stdout should contain "Backed up to"
|
111
|
-
And the stdout should contain ".aka.yml.backup"
|
112
|
-
And the file ".aka.yml.backup" should contain exactly:
|
113
|
-
"""
|
114
|
-
---
|
115
|
-
:version: '1'
|
116
|
-
:shortcuts:
|
117
|
-
1: !ruby/object:OpenStruct
|
118
|
-
table:
|
119
|
-
:shortcut: ls
|
120
|
-
:command: ls -F --color=auto
|
121
|
-
:tag:
|
122
|
-
- os:linux
|
123
|
-
:description: |-
|
124
|
-
ls
|
125
|
-
ls
|
126
|
-
ls
|
127
|
-
:function: true
|
128
|
-
modifiable: true
|
129
|
-
:links:
|
130
|
-
- !ruby/object:OpenStruct
|
131
|
-
table:
|
132
|
-
:tag:
|
133
|
-
- os:darwin
|
134
|
-
:output: ".aka.zsh"
|
135
|
-
modifiable: true
|
136
|
-
|
137
|
-
"""
|
data/features/support/env.rb
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
require 'aruba/cucumber'
|
2
|
-
require 'methadone/cucumber'
|
3
|
-
require 'aruba/in_process'
|
4
|
-
|
5
|
-
ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
6
|
-
LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
|
7
|
-
|
8
|
-
require 'aka.rb'
|
9
|
-
|
10
|
-
class Main
|
11
|
-
def initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel)
|
12
|
-
@argv, @stdin, @stdout, @stderr, @kernel = argv, stdin, stdout, stderr, kernel
|
13
|
-
end
|
14
|
-
|
15
|
-
def execute!
|
16
|
-
original_file = $0
|
17
|
-
original_argv = ::ARGV.dup
|
18
|
-
original_stderr = $original_stderr = $stderr
|
19
|
-
original_stdin = $original_stdin = $stdin
|
20
|
-
original_stdout = $stdout
|
21
|
-
|
22
|
-
Aruba::Api.class_eval do
|
23
|
-
def announcer
|
24
|
-
Aruba::Api::Announcer.new(self,
|
25
|
-
:stdout => $original_stdin,
|
26
|
-
:stderr => $original_stderr,
|
27
|
-
:dir => @announce_dir,
|
28
|
-
:cmd => @announce_cmd,
|
29
|
-
:env => @announce_env)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
begin
|
34
|
-
$0 = File.expand_path(File.dirname(__FILE__) + '/../../bin/aka')
|
35
|
-
|
36
|
-
::ARGV.clear
|
37
|
-
::ARGV.push(*@argv)
|
38
|
-
|
39
|
-
$stderr = @stderr
|
40
|
-
$stdin = @stdin
|
41
|
-
$stdout = @stdout
|
42
|
-
|
43
|
-
if defined?(Aka::App)
|
44
|
-
Aka::App.send(:reset!)
|
45
|
-
load 'aka/app.rb'
|
46
|
-
end
|
47
|
-
|
48
|
-
Aka::App.change_logger(Methadone::CLILogger.new(@stdout, @stderr))
|
49
|
-
|
50
|
-
Aka::App.go!
|
51
|
-
rescue SystemExit => e
|
52
|
-
@kernel.exit(e.status)
|
53
|
-
ensure
|
54
|
-
$0 = original_file
|
55
|
-
|
56
|
-
::ARGV.clear
|
57
|
-
::ARGV.push(*original_argv)
|
58
|
-
|
59
|
-
$stderr = original_stderr
|
60
|
-
$stdin = original_stdin
|
61
|
-
$stdout = original_stdout
|
62
|
-
|
63
|
-
Aka::App.change_logger(Methadone::CLILogger.new($stdout, $stderr))
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
Aruba::InProcess.main_class = Main
|
69
|
-
Aruba.process = Aruba::InProcess
|
70
|
-
|
71
|
-
Before do
|
72
|
-
# Using "announce" causes massive warnings on 1.9.2
|
73
|
-
@puts = true
|
74
|
-
@original_rubylib = ENV['RUBYLIB']
|
75
|
-
ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
|
76
|
-
end
|
77
|
-
|
78
|
-
After do
|
79
|
-
ENV['RUBYLIB'] = @original_rubylib
|
80
|
-
end
|