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.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -3
  3. data/bin/aka +18 -0
  4. data/bin/build +37 -0
  5. data/bin/postinstall +3 -0
  6. data/bin/postremove +3 -0
  7. data/lib/aka/configuration.pb.rb +41 -0
  8. data/lib/aka/configuration.proto +20 -0
  9. data/lib/aka/link_manager.rb +30 -0
  10. data/lib/aka/man/aka-add.1 +1 -1
  11. data/lib/aka/man/aka-add.1.txt +1 -1
  12. data/lib/aka/man/aka-edit.1 +1 -1
  13. data/lib/aka/man/aka-edit.1.txt +1 -1
  14. data/lib/aka/man/aka-generate.1 +1 -1
  15. data/lib/aka/man/aka-generate.1.txt +1 -1
  16. data/lib/aka/man/aka-link.1 +1 -1
  17. data/lib/aka/man/aka-link.1.txt +1 -1
  18. data/lib/aka/man/aka-list.1 +1 -1
  19. data/lib/aka/man/aka-list.1.txt +1 -1
  20. data/lib/aka/man/aka-remove.1 +1 -1
  21. data/lib/aka/man/aka-remove.1.txt +1 -1
  22. data/lib/aka/man/aka-show.1 +1 -1
  23. data/lib/aka/man/aka-show.1.txt +1 -1
  24. data/lib/aka/man/aka-sync.1 +1 -1
  25. data/lib/aka/man/aka-sync.1.txt +1 -1
  26. data/lib/aka/man/aka-upgrade.1 +3 -3
  27. data/lib/aka/man/aka-upgrade.1.txt +3 -3
  28. data/lib/aka/man/aka.7 +4 -4
  29. data/lib/aka/man/aka.7.txt +4 -4
  30. data/lib/aka/shortcut.rb +43 -0
  31. data/lib/aka/{shortcuts.rb → shortcut_manager.rb} +16 -34
  32. data/lib/aka/store.rb +92 -39
  33. data/lib/aka/upgrader.rb +45 -12
  34. data/lib/aka/version.rb +1 -1
  35. data/lib/aka.rb +4 -3
  36. metadata +23 -74
  37. data/.gitignore +0 -11
  38. data/.ruby-version.example +0 -1
  39. data/.travis.yml +0 -4
  40. data/Gemfile +0 -8
  41. data/Guardfile +0 -6
  42. data/Rakefile +0 -98
  43. data/aka.gemspec +0 -28
  44. data/features/aka/add.feature +0 -199
  45. data/features/aka/edit.feature +0 -196
  46. data/features/aka/generate.feature +0 -117
  47. data/features/aka/help.feature +0 -112
  48. data/features/aka/link.feature +0 -339
  49. data/features/aka/list.feature +0 -62
  50. data/features/aka/remove.feature +0 -52
  51. data/features/aka/show.feature +0 -38
  52. data/features/aka/upgrade.feature +0 -137
  53. data/features/step_definitions/aka_steps.rb +0 -3
  54. data/features/support/env.rb +0 -80
  55. data/lib/aka/configuration.rb +0 -94
  56. data/lib/aka/links.rb +0 -33
  57. data/lib/aka/man/.gitkeep +0 -0
  58. data/man/aka-add.1.ronn +0 -32
  59. data/man/aka-edit.1.ronn +0 -67
  60. data/man/aka-generate.1.ronn +0 -51
  61. data/man/aka-link.1.ronn +0 -49
  62. data/man/aka-list.1.ronn +0 -51
  63. data/man/aka-remove.1.ronn +0 -21
  64. data/man/aka-show.1.ronn +0 -27
  65. data/man/aka-sync.1.ronn +0 -31
  66. data/man/aka-upgrade.1.ronn +0 -22
  67. data/man/aka.7.ronn +0 -120
  68. data/test/tc_something.rb +0 -7
@@ -1,199 +0,0 @@
1
- Feature: Add 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
-
14
- Scenario: Create new shortcut
15
- When I run `aka add ls "ls -F --color=auto"`
16
- Then the exit status should be 0
17
- And the output should contain:
18
- """
19
- Created shortcut.
20
- """
21
- And the file ".aka.yml" should contain exactly:
22
- """
23
- ---
24
- :version: '1'
25
- :shortcuts:
26
- 1: !ruby/object:OpenStruct
27
- table:
28
- :shortcut: ls
29
- :command: ls -F --color=auto
30
- modifiable: true
31
-
32
- """
33
-
34
- Scenario: Create new shortcut with tag
35
- When I run `aka add ls "ls -F --color=auto" -t os:darwin`
36
- Then the exit status should be 0
37
- And the output should contain:
38
- """
39
- Created shortcut.
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
- :tag:
51
- - os:darwin
52
- modifiable: true
53
-
54
- """
55
-
56
- Scenario: Create new shortcut with multiple tags
57
- When I run `aka add ls "ls -F --color=auto" -t A,B`
58
- Then the exit status should be 0
59
- And the output should contain:
60
- """
61
- Created shortcut.
62
- """
63
- And the file ".aka.yml" should contain exactly:
64
- """
65
- ---
66
- :version: '1'
67
- :shortcuts:
68
- 1: !ruby/object:OpenStruct
69
- table:
70
- :shortcut: ls
71
- :command: ls -F --color=auto
72
- :tag:
73
- - A
74
- - B
75
- modifiable: true
76
-
77
- """
78
-
79
- Scenario: Create new shortcut with new tag
80
- Given I run `aka add ls "ls -FG" -t A,B`
81
- When I run `aka add ls "ls -FG" -t C`
82
- Then the exit status should be 0
83
- And the output should contain:
84
- """
85
- Created shortcut.
86
- """
87
- And the file ".aka.yml" should contain exactly:
88
- """
89
- ---
90
- :version: '1'
91
- :shortcuts:
92
- 1: !ruby/object:OpenStruct
93
- table:
94
- :shortcut: ls
95
- :command: ls -FG
96
- :tag:
97
- - A
98
- - B
99
- modifiable: true
100
- 2: !ruby/object:OpenStruct
101
- table:
102
- :shortcut: ls
103
- :command: ls -FG
104
- :tag:
105
- - C
106
- modifiable: true
107
-
108
- """
109
-
110
- Scenario: Don't overwrite existing shortcut
111
- Given I run `aka add ls "ls -F --color=auto"`
112
- When I run `aka add ls "ls -FG"`
113
- Then the exit status should not be 0
114
- And the output should contain exactly:
115
- """
116
- Created shortcut.
117
- Shortcut "ls" exists. Pass --force to overwrite. Or provide a new --tag.
118
-
119
- """
120
- And the file ".aka.yml" should contain exactly:
121
- """
122
- ---
123
- :version: '1'
124
- :shortcuts:
125
- 1: !ruby/object:OpenStruct
126
- table:
127
- :shortcut: ls
128
- :command: ls -F --color=auto
129
- modifiable: true
130
-
131
- """
132
-
133
- Scenario: Overwrite existing shortcut with force
134
- Given I run `aka add ls "ls -F --color=auto"`
135
- When I run `aka add ls "ls -FG" -f`
136
- Then the exit status should be 0
137
- And the output should contain exactly:
138
- """
139
- Created shortcut.
140
- Overwrote shortcut.
141
-
142
- """
143
- And the file ".aka.yml" should contain exactly:
144
- """
145
- ---
146
- :version: '1'
147
- :shortcuts:
148
- 1: !ruby/object:OpenStruct
149
- table:
150
- :shortcut: ls
151
- :command: ls -FG
152
- modifiable: true
153
-
154
- """
155
-
156
- Scenario: Create new shortcut as function
157
- When I run `aka add ls "ls -F --color=auto" --function`
158
- Then the exit status should be 0
159
- And the output should contain:
160
- """
161
- Created shortcut.
162
- """
163
- And the file ".aka.yml" should contain exactly:
164
- """
165
- ---
166
- :version: '1'
167
- :shortcuts:
168
- 1: !ruby/object:OpenStruct
169
- table:
170
- :shortcut: ls
171
- :command: ls -F --color=auto
172
- :function: true
173
- modifiable: true
174
-
175
- """
176
-
177
- Scenario: Create new shortcut with description
178
- When I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls"`
179
- Then the exit status should be 0
180
- And the output should contain:
181
- """
182
- Created shortcut.
183
- """
184
- And the file ".aka.yml" should contain exactly:
185
- """
186
- ---
187
- :version: '1'
188
- :shortcuts:
189
- 1: !ruby/object:OpenStruct
190
- table:
191
- :shortcut: ls
192
- :command: ls -F --color=auto
193
- :description: |-
194
- ls
195
- ls
196
- ls
197
- modifiable: true
198
-
199
- """
@@ -1,196 +0,0 @@
1
- Feature: Edit 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: Edit
14
- Given I run `aka add ls "ls -F --color=auto"`
15
- And a file named "input.txt" with:
16
- """
17
- Shortcut: lsf
18
- Description:
19
- 1
20
- 2
21
- 3
22
- Function (y/n): y
23
- Tags: zsh, bash
24
- Command:
25
- ls -F
26
- """
27
- When I run `aka edit ls -i input.txt`
28
- Then the exit status should be 0
29
- And the output should contain exactly:
30
- """
31
- Created shortcut.
32
- Saved shortcut.
33
-
34
- """
35
- And the file ".aka.yml" should contain exactly:
36
- """
37
- ---
38
- :version: '1'
39
- :shortcuts:
40
- 1: !ruby/object:OpenStruct
41
- table:
42
- :shortcut: lsf
43
- :command: ls -F
44
- :description: |-
45
- 1
46
- 2
47
- 3
48
- :function: true
49
- :tag:
50
- - zsh
51
- - bash
52
- modifiable: true
53
-
54
- """
55
-
56
- Scenario: Edit to remove tag
57
- Given I run `aka add ls "ls -F --color=auto" --tag zsh`
58
- And a file named "input.txt" with:
59
- """
60
- Shortcut: lsf
61
- Description:
62
- 1
63
- 2
64
- 3
65
- Function (y/n): y
66
- Tags:
67
- Command:
68
- ls -F
69
- """
70
- When I run `aka edit ls -i input.txt`
71
- Then the exit status should be 0
72
- And the output should contain exactly:
73
- """
74
- Created shortcut.
75
- Saved shortcut.
76
-
77
- """
78
- And the file ".aka.yml" should contain exactly:
79
- """
80
- ---
81
- :version: '1'
82
- :shortcuts:
83
- 1: !ruby/object:OpenStruct
84
- table:
85
- :shortcut: lsf
86
- :command: ls -F
87
- :description: |-
88
- 1
89
- 2
90
- 3
91
- :function: true
92
- modifiable: true
93
-
94
- """
95
-
96
- Scenario: Edit that clears command
97
- Given I run `aka add ls "ls -F --color=auto" --tag zsh`
98
- And a file named "input.txt" with:
99
- """
100
- Shortcut: lsf
101
- Description:
102
- 1
103
- 2
104
- 3
105
- Function (y/n): y
106
- Tags:
107
- Command:
108
- """
109
- When I run `aka edit ls -i input.txt`
110
- Then the exit status should be 0
111
- And the output should contain exactly:
112
- """
113
- Created shortcut.
114
- Saved shortcut.
115
-
116
- """
117
- And the file ".aka.yml" should contain exactly:
118
- """
119
- ---
120
- :version: '1'
121
- :shortcuts:
122
- 1: !ruby/object:OpenStruct
123
- table:
124
- :shortcut: lsf
125
- :command: ''
126
- :description: |-
127
- 1
128
- 2
129
- 3
130
- :function: true
131
- modifiable: true
132
-
133
- """
134
- When I run `aka list`
135
- Then the exit status should be 0
136
- And the output should contain exactly:
137
- """
138
- Created shortcut.
139
- Saved shortcut.
140
- #default
141
- ========
142
- lsf 1; 2; 3
143
-
144
-
145
- """
146
-
147
- # When in interactive mode, edit the shorcut so it looks like this:
148
- # Shortcut: lsf
149
- # Description:
150
- # 1
151
- # 2
152
- # 3
153
- # Function (y/n): y
154
- # Tags: zsh, bash
155
- # Command:
156
- # ls -F
157
- @interactive
158
- Scenario: Edit interactively
159
- Given I run `aka add ls "ls -F --color=auto"`
160
- When I run `aka edit ls` interactively
161
- Then the exit status should be 0
162
- And the output should contain exactly:
163
- """
164
- Created shortcut.
165
- Saved shortcut.
166
-
167
- """
168
- And the file ".aka.yml" should contain exactly:
169
- """
170
- ---
171
- :version: '1'
172
- :shortcuts:
173
- 1: !ruby/object:OpenStruct
174
- table:
175
- :shortcut: lsf
176
- :command: ls -F
177
- :description: |-
178
- 1
179
- 2
180
- 3
181
- :function: true
182
- :tag:
183
- - zsh
184
- - bash
185
- modifiable: true
186
-
187
- """
188
-
189
- Scenario: Edit: Missing shortcut
190
- When I run `aka edit ls`
191
- Then the exit status should not be 0
192
- And the output should contain exactly:
193
- """
194
- Shortcut not found.
195
-
196
- """
@@ -1,117 +0,0 @@
1
- Feature: Generate commands for loading keyboard shortcuts into your shell
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: Generate script to file
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 generate --output .aka.zsh`
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
- Generated .aka.zsh.
25
-
26
- """
27
- And the file ".aka.zsh" should contain exactly:
28
- """
29
- alias ..="cd .."
30
- alias ls="ls -FG"
31
- function ls {
32
- ls -F --color=auto
33
- }
34
-
35
- """
36
-
37
- Scenario: Generate script to stdout
38
- Given I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
39
- And I run `aka add ls "ls -FG" --tag os:darwin`
40
- And I run `aka add .. "cd .."`
41
- When I run `aka generate`
42
- Then the exit status should be 0
43
- And the output should contain exactly:
44
- """
45
- Created shortcut.
46
- Created shortcut.
47
- Created shortcut.
48
- alias ..="cd .."
49
- alias ls="ls -FG"
50
- function ls {
51
- ls -F --color=auto
52
- }
53
-
54
- """
55
-
56
- Scenario: Generate script matching tag
57
- Given I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
58
- And I run `aka add ls "ls -FG" --tag os:darwin`
59
- And I run `aka add .. "cd .."`
60
- When I run `aka generate --tag os:darwin`
61
- Then the exit status should be 0
62
- And the stdout should contain exactly:
63
- """
64
- Created shortcut.
65
- Created shortcut.
66
- Created shortcut.
67
- alias ..="cd .."
68
- alias ls="ls -FG"
69
-
70
- """
71
- And the stderr should contain exactly:
72
- """
73
- 1 shortcut(s) excluded (#os:linux).
74
-
75
- """
76
-
77
- Scenario: Generate script with function
78
- Given I run `aka add ls "ls -F --color=auto" --function`
79
- When I run `aka generate --output .aka2.zsh`
80
- Then the exit status should be 0
81
- And the output should contain exactly:
82
- """
83
- Created shortcut.
84
- Generated .aka2.zsh.
85
-
86
- """
87
- And the file ".aka2.zsh" should contain exactly:
88
- """
89
- function ls {
90
- ls -F --color=auto
91
- }
92
-
93
- """
94
-
95
- Scenario: Generate script shortcuts before functions
96
- Given I run `aka add ls "ls -F --color=auto" --function`
97
- And I run `aka add sc "script/console"`
98
- And I run `aka add sg "script/generate"`
99
- When I run `aka generate --output .aka.zsh`
100
- Then the exit status should be 0
101
- And the output should contain exactly:
102
- """
103
- Created shortcut.
104
- Created shortcut.
105
- Created shortcut.
106
- Generated .aka.zsh.
107
-
108
- """
109
- And the file ".aka.zsh" should contain exactly:
110
- """
111
- alias sc="script/console"
112
- alias sg="script/generate"
113
- function ls {
114
- ls -F --color=auto
115
- }
116
-
117
- """
@@ -1,112 +0,0 @@
1
- Feature: Help with aka
2
- In order to learn how to use aka
3
- I want to view help info in the command-line
4
- So I don't have to scour the web for information
5
-
6
- Background:
7
- Given I set the environment variables to:
8
- | variable | value |
9
- | NO_MAN | 1 |
10
-
11
- Scenario: Run aka
12
- When I run `aka`
13
- Then the exit status should be 0
14
- And the output should contain:
15
- """
16
- aka - Manage Shell Keyboard Shortcuts
17
- """
18
-
19
- Scenario: Get help
20
- When I run `aka --help`
21
- Then the exit status should be 0
22
- And the output should contain:
23
- """
24
- aka - Manage Shell Keyboard Shortcuts
25
- """
26
-
27
- Scenario: Get help with invalid arguments
28
- When I run `aka -z`
29
- Then the exit status should be 64
30
- And the output should contain:
31
- """
32
- aka - Manage Shell Keyboard Shortcuts
33
- """
34
-
35
- Scenario: Get version
36
- When I run `aka --version`
37
- Then the exit status should be 0
38
- And the output should contain exactly:
39
- """
40
- aka version 0.3.2
41
-
42
- """
43
-
44
- Scenario: Help creating new shortcut
45
- When I run `aka -h add`
46
- Then the exit status should be 0
47
- And the output should contain:
48
- """
49
- aka-add - Add keyboard shortcuts
50
- """
51
-
52
- Scenario: Help listing shortcuts
53
- When I run `aka -h list`
54
- Then the exit status should be 0
55
- And the output should contain:
56
- """
57
- aka-list - List keyboard shortcuts
58
- """
59
-
60
- Scenario: Help generating shortcuts
61
- When I run `aka -h generate`
62
- Then the exit status should be 0
63
- And the output should contain "aka-generate"
64
- And the output should contain "Generate commands for loading keyboard shortcuts into"
65
-
66
- Scenario: Help removing shortcuts
67
- When I run `aka -h remove`
68
- Then the exit status should be 0
69
- And the output should contain:
70
- """
71
- aka-remove - Remove keyboard shortcuts
72
- """
73
-
74
- Scenario: Help showing shortcuts
75
- When I run `aka -h show`
76
- Then the exit status should be 0
77
- And the output should contain:
78
- """
79
- aka-show - Show keyboard shortcuts
80
- """
81
-
82
- Scenario: Help editing shortcuts
83
- When I run `aka -h edit`
84
- Then the exit status should be 0
85
- And the output should contain:
86
- """
87
- aka-edit - Edit keyboard shortcuts
88
- """
89
-
90
- Scenario: Help linking shortcuts
91
- When I run `aka -h link`
92
- Then the exit status should be 0
93
- And the output should contain:
94
- """
95
- aka-link - Link keyboard shortcuts
96
- """
97
-
98
- Scenario: Help syncing shortcuts
99
- When I run `aka -h sync`
100
- Then the exit status should be 0
101
- And the output should contain:
102
- """
103
- aka-sync - Synchronize keyboard shortcuts
104
- """
105
-
106
- Scenario: Help upgrading shortcuts
107
- When I run `aka -h upgrade`
108
- Then the exit status should be 0
109
- And the output should contain:
110
- """
111
- aka-upgrade - Upgrade keyboard shortcuts
112
- """