rake-tui 0.1.0 → 0.2.3
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/CHANGELOG.md +29 -0
- data/README.md +177 -8
- data/VERSION +1 -1
- data/bin/jrake-tui +25 -0
- data/bin/jrake-ui +25 -0
- data/bin/jraketui +25 -0
- data/bin/jrakeui +25 -0
- data/bin/rake-tui +22 -0
- data/bin/rake-ui +25 -0
- data/bin/raketui +25 -0
- data/bin/rakeui +25 -0
- data/lib/rake-tui.rb +24 -42
- data/lib/rake-tui/ext/rake/tui.rb +113 -0
- data/rake-tui.gemspec +69 -0
- metadata +21 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4982123b5ac9d9339b1d753b92a8e234434f7dde48b4bb5e35931416950bde15
|
4
|
+
data.tar.gz: e7f6f3a898a75b40be96b88a7f37c22fe31c139eb85fe79f2d134a9180b1f7ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 358dccc0992f11ff52a99ab08746272c9fa28b9bef5738522b2d26a491ee1f804eb6f56cebd302656bc32346db7a20ef0102eff23b6828c145780840df07e266
|
7
|
+
data.tar.gz: 35b62d8deaf05e51a98f263ac3452bf7b134264454fac07e1cc312e0e9b9832e2584a38565ce776f94f2a3acbd8aa4f6d0e67ad5d4c61d425c0860ed4b401773
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
## 0.2.3
|
4
|
+
|
5
|
+
- Fixed issue with adding rake task list twice
|
6
|
+
|
7
|
+
## 0.2.2
|
8
|
+
|
9
|
+
- Improve compatibility with older tty-prompt v0.21.0 by setting select choices via block argument when using a block
|
10
|
+
|
11
|
+
## 0.2.1
|
12
|
+
|
13
|
+
- `branding_header`, `prompt_question`, and `task_formatter` block options
|
14
|
+
|
15
|
+
## 0.2.0
|
16
|
+
|
17
|
+
- Optimized performance for JRuby
|
18
|
+
- rakeui, raketui, jrakeui, and jraketui shorter alternative commands
|
19
|
+
- Enter arguments when a rake task needs them
|
20
|
+
- Added an API for direct Ruby use
|
21
|
+
- Specify/limit tasks displayed
|
22
|
+
|
23
|
+
## 0.1.1
|
24
|
+
|
25
|
+
- jrake-tui to support JRuby without RVM
|
26
|
+
|
27
|
+
## 0.1.0
|
28
|
+
|
29
|
+
- Initial version supporting listing and execution of rake tasks (without passing arguments)
|
data/README.md
CHANGED
@@ -5,6 +5,9 @@
|
|
5
5
|
|
6
6
|

|
7
7
|
|
8
|
+
Other TUI gems you may be interested in:
|
9
|
+
- [rvm-tui](https://github.com/AndyObtiva/rvm-tui)
|
10
|
+
|
8
11
|
## Pre-requisites
|
9
12
|
|
10
13
|
- [Ruby](https://www.ruby-lang.org/en/)
|
@@ -20,7 +23,7 @@ gem install rake-tui
|
|
20
23
|
### Bundler
|
21
24
|
|
22
25
|
```ruby
|
23
|
-
gem 'rake-tui'
|
26
|
+
gem 'rake-tui', require: false
|
24
27
|
```
|
25
28
|
|
26
29
|
### [RVM](https://rvm.io/)
|
@@ -29,26 +32,192 @@ gem 'rake-tui'
|
|
29
32
|
rvm @global do gem install rake-tui
|
30
33
|
```
|
31
34
|
|
35
|
+
## Usage
|
36
|
+
|
37
|
+
Simply run this command:
|
38
|
+
|
39
|
+
```
|
40
|
+
rakeui
|
41
|
+
```
|
42
|
+
|
43
|
+
Or one of the aliases:
|
44
|
+
|
45
|
+
```
|
46
|
+
rake-ui
|
47
|
+
raketui
|
48
|
+
rake-tui
|
49
|
+
```
|
50
|
+
|
32
51
|
### [JRuby](https://www.jruby.org/)
|
33
52
|
|
34
|
-
|
53
|
+
If you are using [RVM](https://rvm.io/), then `rake-tui` works in [JRuby](https://www.jruby.org/) too.
|
35
54
|
|
36
|
-
|
55
|
+
Otherwise, simply run this command instead:
|
56
|
+
|
57
|
+
```
|
58
|
+
jrakeui
|
59
|
+
```
|
37
60
|
|
38
|
-
|
61
|
+
Or one of the aliases:
|
39
62
|
|
40
63
|
```
|
41
|
-
|
64
|
+
jrake-ui
|
65
|
+
jraketui
|
66
|
+
jrake-tui
|
42
67
|
```
|
43
68
|
|
44
|
-
##
|
69
|
+
## API
|
45
70
|
|
46
|
-
|
71
|
+
To use [rake-tui](https://rubygems.org/gems/rake-tui) as part of a Ruby app, require the [rake-tui](https://rubygems.org/gems/rake-tui) gem once at the top of your code:
|
47
72
|
|
73
|
+
```ruby
|
74
|
+
require 'rake-tui'
|
48
75
|
```
|
49
|
-
|
76
|
+
|
77
|
+
Afterwards, simply invoke the `Rake::TUI.run` method wherever you need to display the TUI to the user:
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
Rake::TUI.run
|
81
|
+
```
|
82
|
+
|
83
|
+
If you'd rather specify or limit the tasks shown, then pass the tasks to the constructor before running:
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
Rake::TUI.new(tasks).run
|
87
|
+
```
|
88
|
+
|
89
|
+
If you want to make that the default, then set the singleton instance:
|
90
|
+
|
91
|
+
```ruby
|
92
|
+
Rake::TUI.instance(Rake::TUI.new(tasks))
|
93
|
+
Rake::TUI.run # this now displays the specified task list
|
94
|
+
```
|
95
|
+
|
96
|
+
## Options
|
97
|
+
|
98
|
+
### `branding_header`
|
99
|
+
|
100
|
+
The default branding header looks like this (from `Rake::TUI::BRANDING_HEADER_DEFAULT`):
|
101
|
+
|
102
|
+
```
|
103
|
+
== rake-tui version 0.2.3 ==
|
104
|
+
```
|
105
|
+
|
106
|
+
It may be customized by passing in the `branding_header` option (removed when set to `nil`).
|
107
|
+
|
108
|
+
Example:
|
109
|
+
|
110
|
+
```ruby
|
111
|
+
Rake::TUI.run(branding_header: '== Glimmer (Ruby Desktop Development GUI Library) ==')
|
112
|
+
```
|
113
|
+
|
114
|
+
Output:
|
115
|
+
|
116
|
+
```
|
117
|
+
== Glimmer (Ruby Desktop Development GUI Library) ==
|
118
|
+
```
|
119
|
+
|
120
|
+
### `prompt_question`
|
121
|
+
|
122
|
+
The prompt question is the text that shows up before the help message and looks like this (from `Rake::TUI::PROMPT_QUESTION_DEFAULT`):
|
123
|
+
|
124
|
+
```
|
125
|
+
Choose a Rake task:
|
126
|
+
```
|
127
|
+
|
128
|
+
It may be customized by passing in the `prompt_question` option:
|
129
|
+
|
130
|
+
Example:
|
131
|
+
|
132
|
+
```ruby
|
133
|
+
Rake::TUI.run(prompt_question: 'Select a Glimmer task:')
|
134
|
+
```
|
135
|
+
|
136
|
+
Output:
|
137
|
+
|
138
|
+
```
|
139
|
+
Select a Glimmer task: (Press ↑/↓ arrow to move, Enter to select and letters to filter)
|
50
140
|
```
|
51
141
|
|
142
|
+
### `task_formatter` block
|
143
|
+
|
144
|
+
The task formatter (default: `Rake::TUI::TASK_FORMATTER_DEFAULT`) is responsible for formatting
|
145
|
+
tasks into task lines presented as choices to the user.
|
146
|
+
|
147
|
+
It receives `task` and `tasks` list as options.
|
148
|
+
|
149
|
+
For example, by default, it prints the same standard output you see from running `rake -T`:
|
150
|
+
|
151
|
+
```
|
152
|
+
rake build # Build gem into pkg/
|
153
|
+
rake clean # Remove any temporary products
|
154
|
+
rake clobber # Remove any generated files
|
155
|
+
rake clobber_rdoc # Remove RDoc HTML files
|
156
|
+
rake console[script] # Start IRB with all runtime dependencies loaded
|
157
|
+
rake gemcutter:release # Release gem to Gemcutter
|
158
|
+
rake gemspec # Generate and validate gemspec
|
159
|
+
rake gemspec:debug # Display the gemspec for debugging purposes, as juwelier knows it (not from the filesystem)
|
160
|
+
rake gemspec:generate # Regenerate the gemspec on the filesystem
|
161
|
+
‣ rake gemspec:release # Regenerate and validate gemspec, and then commits and pushes to git
|
162
|
+
rake gemspec:validate # Validates the gemspec on the filesystem
|
163
|
+
rake git:release # Tag and push release to git
|
164
|
+
rake install # Build and install gem using `gem install`
|
165
|
+
rake rdoc # Build RDoc HTML files
|
166
|
+
rake release # Release gem
|
167
|
+
rake rerdoc # Rebuild RDoc HTML files
|
168
|
+
rake simplecov # Code coverage detail
|
169
|
+
rake spec # Run RSpec code examples
|
170
|
+
rake version # Displays the current version
|
171
|
+
rake version:bump:major # Bump the major version by 1
|
172
|
+
rake version:bump:minor # Bump the a minor version by 1
|
173
|
+
rake version:bump:patch # Bump the patch version by 1
|
174
|
+
rake version:write # Writes out an explicit version
|
175
|
+
```
|
176
|
+
|
177
|
+
However, it can be customized by passing in a `task_formatter` block.
|
178
|
+
|
179
|
+
Example:
|
180
|
+
|
181
|
+
```ruby
|
182
|
+
Rake::TUI.new.run { |task, tasks| task.name_with_args }
|
183
|
+
```
|
184
|
+
|
185
|
+
Output:
|
186
|
+
|
187
|
+
```
|
188
|
+
build
|
189
|
+
clean
|
190
|
+
clobber
|
191
|
+
clobber_rdoc
|
192
|
+
console[script]
|
193
|
+
gemcutter:release
|
194
|
+
gemspec
|
195
|
+
gemspec:debug
|
196
|
+
gemspec:generate
|
197
|
+
gemspec:release
|
198
|
+
gemspec:validate
|
199
|
+
git:release
|
200
|
+
install
|
201
|
+
rdoc
|
202
|
+
‣ release
|
203
|
+
rerdoc
|
204
|
+
simplecov
|
205
|
+
spec
|
206
|
+
version
|
207
|
+
version:bump:major
|
208
|
+
version:bump:minor
|
209
|
+
version:bump:patch
|
210
|
+
version:write
|
211
|
+
```
|
212
|
+
|
213
|
+
## TODO
|
214
|
+
|
215
|
+
[TODO.md](TODO.md)
|
216
|
+
|
217
|
+
## Change Log
|
218
|
+
|
219
|
+
[CHANGELOG.md](CHANGELOG.md)
|
220
|
+
|
52
221
|
## Contributing to rake-tui
|
53
222
|
|
54
223
|
- Check out the latest master to make sure the feature hasn't been
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.3
|
data/bin/jrake-tui
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
|
3
|
+
# Copyright (c) 2020 Andy Maleh
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
# a copy of this software and associated documentation files (the
|
7
|
+
# "Software"), to deal in the Software without restriction, including
|
8
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
# the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be
|
14
|
+
# included in all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
require_relative '../lib/rake-tui.rb'
|
25
|
+
Rake::TUI.run
|
data/bin/jrake-ui
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
|
3
|
+
# Copyright (c) 2020 Andy Maleh
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
# a copy of this software and associated documentation files (the
|
7
|
+
# "Software"), to deal in the Software without restriction, including
|
8
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
# the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be
|
14
|
+
# included in all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
require_relative '../lib/rake-tui.rb'
|
25
|
+
Rake::TUI.run
|
data/bin/jraketui
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
|
3
|
+
# Copyright (c) 2020 Andy Maleh
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
# a copy of this software and associated documentation files (the
|
7
|
+
# "Software"), to deal in the Software without restriction, including
|
8
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
# the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be
|
14
|
+
# included in all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
require_relative '../lib/rake-tui.rb'
|
25
|
+
Rake::TUI.run
|
data/bin/jrakeui
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
|
3
|
+
# Copyright (c) 2020 Andy Maleh
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
# a copy of this software and associated documentation files (the
|
7
|
+
# "Software"), to deal in the Software without restriction, including
|
8
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
# the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be
|
14
|
+
# included in all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
require_relative '../lib/rake-tui.rb'
|
25
|
+
Rake::TUI.run
|
data/bin/rake-tui
CHANGED
@@ -1,3 +1,25 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
# Copyright (c) 2020 Andy Maleh
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
# a copy of this software and associated documentation files (the
|
7
|
+
# "Software"), to deal in the Software without restriction, including
|
8
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
# the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be
|
14
|
+
# included in all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
3
24
|
require_relative '../lib/rake-tui.rb'
|
25
|
+
Rake::TUI.run
|
data/bin/rake-ui
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Copyright (c) 2020 Andy Maleh
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
# a copy of this software and associated documentation files (the
|
7
|
+
# "Software"), to deal in the Software without restriction, including
|
8
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
# the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be
|
14
|
+
# included in all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
require_relative '../lib/rake-tui.rb'
|
25
|
+
Rake::TUI.run
|
data/bin/raketui
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Copyright (c) 2020 Andy Maleh
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
# a copy of this software and associated documentation files (the
|
7
|
+
# "Software"), to deal in the Software without restriction, including
|
8
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
# the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be
|
14
|
+
# included in all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
require_relative '../lib/rake-tui.rb'
|
25
|
+
Rake::TUI.run
|
data/bin/rakeui
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Copyright (c) 2020 Andy Maleh
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
# a copy of this software and associated documentation files (the
|
7
|
+
# "Software"), to deal in the Software without restriction, including
|
8
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
# the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be
|
14
|
+
# included in all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
require_relative '../lib/rake-tui.rb'
|
25
|
+
Rake::TUI.run
|
data/lib/rake-tui.rb
CHANGED
@@ -1,44 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
version = File.read(File.expand_path('../../VERSION', __FILE__)).strip
|
4
|
-
puts "== rake-tui version #{version} =="
|
5
|
-
|
6
|
-
require 'tty-prompt'
|
1
|
+
# frozen_string_literal: true
|
7
2
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
3
|
+
# Copyright (c) 2020 Andy Maleh
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
# a copy of this software and associated documentation files (the
|
7
|
+
# "Software"), to deal in the Software without restriction, including
|
8
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
# the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be
|
14
|
+
# included in all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
$LOAD_PATH.unshift(File.expand_path('..', __FILE__))
|
30
25
|
|
31
|
-
|
32
|
-
@filter << event.value
|
33
|
-
@active = 1
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
rake_task = rake_task_line.split('#').first.strip
|
38
|
-
system rake_task
|
39
|
-
rescue TTY::Reader::InputInterrupt => e
|
40
|
-
# No Op
|
41
|
-
puts # a new line is needed
|
42
|
-
puts "Exiting..."
|
43
|
-
exit(0)
|
44
|
-
end
|
26
|
+
require 'rake-tui/ext/rake/tui'
|
@@ -0,0 +1,113 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rake'
|
4
|
+
Rake::TaskManager.record_task_metadata = true
|
5
|
+
|
6
|
+
module Rake
|
7
|
+
class TUI
|
8
|
+
VERSION = File.read(File.expand_path('../../../../../VERSION', __FILE__)).strip
|
9
|
+
BRANDING_HEADER_DEFAULT = "== rake-tui version #{VERSION} =="
|
10
|
+
PROMPT_QUESTION_DEFAULT = "Choose a Rake task: "
|
11
|
+
TASK_FORMATTER_DEFAULT = lambda do |task, tasks|
|
12
|
+
max_task_size = tasks.map(&:name_with_args).map(&:size).max + 1
|
13
|
+
line = "rake #{task.name_with_args.ljust(max_task_size)} # #{task.comment}"
|
14
|
+
bound = TTY::Screen.width - 6
|
15
|
+
line.size <= bound ? line : "#{line[0..(bound - 3)]}..."
|
16
|
+
end
|
17
|
+
|
18
|
+
class << self
|
19
|
+
# Singleton instance (if argument is specified, it is used to set instance)
|
20
|
+
def instance(tui=nil)
|
21
|
+
if tui.nil?
|
22
|
+
@instance ||= new
|
23
|
+
else
|
24
|
+
@instance = tui
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# Runs TUI (recommended for general use)
|
29
|
+
#
|
30
|
+
# Optionally takes a `branding_header` to customize the branding header or take it off when set to `nil`.
|
31
|
+
#
|
32
|
+
# Optionally takes a `prompt_question` to customize the question for selecting a rake task.
|
33
|
+
#
|
34
|
+
# Optionally pass a task_formatter mapping block to
|
35
|
+
# transform every rake task line into a different format
|
36
|
+
# e.g. Rake::TUI.new.run { |task, tasks| task.name_with_args }
|
37
|
+
# This makes tasks show up without `rake` prefix or `# description` suffix
|
38
|
+
def run(branding_header: BRANDING_HEADER_DEFAULT, prompt_question: PROMPT_QUESTION_DEFAULT, &task_formatter)
|
39
|
+
instance.run(branding_header: branding_header, prompt_question: prompt_question, &task_formatter)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# Initializes a new TUI object
|
44
|
+
def initialize(tasks=Rake.application.tasks)
|
45
|
+
if tasks.empty?
|
46
|
+
Rake.application.init
|
47
|
+
Rake.application.load_rakefile
|
48
|
+
tasks = Rake.application.tasks
|
49
|
+
end
|
50
|
+
|
51
|
+
@tasks = tasks.reject {|task| task.comment.nil?}
|
52
|
+
end
|
53
|
+
|
54
|
+
# Runs TUI
|
55
|
+
#
|
56
|
+
# Optionally takes a `branding_header` to customize the branding header or take it off when set to `nil`.
|
57
|
+
#
|
58
|
+
# Optionally takes a `prompt_question` to customize the question for selecting a rake task.
|
59
|
+
#
|
60
|
+
# Optionally takes a `task_formatter` mapping block to
|
61
|
+
# transform every rake task line into a different format
|
62
|
+
# e.g. Rake::TUI.new.run { |task, tasks| task.name_with_args }
|
63
|
+
# This makes tasks show up without `rake` prefix or `# description` suffix
|
64
|
+
def run(branding_header: BRANDING_HEADER_DEFAULT, prompt_question: PROMPT_QUESTION_DEFAULT, &task_formatter)
|
65
|
+
puts branding_header unless branding_header.nil?
|
66
|
+
|
67
|
+
if @tasks.empty?
|
68
|
+
puts "No Rake tasks found!"
|
69
|
+
puts "Exiting..."
|
70
|
+
exit(0)
|
71
|
+
end
|
72
|
+
|
73
|
+
require 'tty-prompt'
|
74
|
+
|
75
|
+
prompt = TTY::Prompt.new
|
76
|
+
|
77
|
+
prompt.on(:keyescape) do |event|
|
78
|
+
puts # a new line is needed
|
79
|
+
puts "Exiting..."
|
80
|
+
exit(0)
|
81
|
+
end
|
82
|
+
|
83
|
+
begin
|
84
|
+
task_formatter ||= TASK_FORMATTER_DEFAULT
|
85
|
+
rake_task_lines = @tasks.map {|task, tasks| task_formatter.call(task, @tasks)}
|
86
|
+
rake_task_line = prompt.select(prompt_question, cycle: true, per_page: [TTY::Screen.height - 5, 1].max, filter: true, show_help: :always) do |list|
|
87
|
+
list.choices rake_task_lines
|
88
|
+
list.singleton_class.define_method(:keyspace) do |event|
|
89
|
+
return unless filterable?
|
90
|
+
|
91
|
+
if event.value = " "
|
92
|
+
@filter << event.value
|
93
|
+
@active = 1
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
selected_task = @tasks[rake_task_lines.index(rake_task_line)]
|
99
|
+
rake_task = selected_task.name
|
100
|
+
rake_task_arg_names = selected_task.arg_names
|
101
|
+
rake_task_arg_values = rake_task_arg_names.map do |rake_task_arg_name|
|
102
|
+
prompt.ask("Enter [#{rake_task_arg_name}] (default=nil):")
|
103
|
+
end
|
104
|
+
Rake::Task[rake_task].invoke(*rake_task_arg_values) # TODO support args
|
105
|
+
rescue TTY::Reader::InputInterrupt => e
|
106
|
+
# No Op
|
107
|
+
puts # a new line is needed
|
108
|
+
puts "Exiting..."
|
109
|
+
exit(0)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
data/rake-tui.gemspec
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# Generated by juwelier
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: rake-tui 0.2.3 ruby lib
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "rake-tui".freeze
|
9
|
+
s.version = "0.2.3"
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib".freeze]
|
13
|
+
s.authors = ["AndyMaleh".freeze]
|
14
|
+
s.date = "2020-09-24"
|
15
|
+
s.description = "Rake Text-based User Interface".freeze
|
16
|
+
s.email = "andy.am@gmail.com".freeze
|
17
|
+
s.executables = ["rake-tui".freeze, "jrake-tui".freeze, "raketui".freeze, "jraketui".freeze, "rake-ui".freeze, "jrake-ui".freeze, "rakeui".freeze, "jrakeui".freeze]
|
18
|
+
s.extra_rdoc_files = [
|
19
|
+
"CHANGELOG.md",
|
20
|
+
"LICENSE.txt",
|
21
|
+
"README.md"
|
22
|
+
]
|
23
|
+
s.files = [
|
24
|
+
"CHANGELOG.md",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"README.md",
|
27
|
+
"VERSION",
|
28
|
+
"bin/jrake-tui",
|
29
|
+
"bin/jrake-ui",
|
30
|
+
"bin/jraketui",
|
31
|
+
"bin/jrakeui",
|
32
|
+
"bin/rake-tui",
|
33
|
+
"bin/rake-ui",
|
34
|
+
"bin/raketui",
|
35
|
+
"bin/rakeui",
|
36
|
+
"lib/rake-tui.rb",
|
37
|
+
"lib/rake-tui/ext/rake/tui.rb",
|
38
|
+
"rake-tui.gemspec"
|
39
|
+
]
|
40
|
+
s.homepage = "http://github.com/AndyObtiva/rake-tui".freeze
|
41
|
+
s.licenses = ["MIT".freeze]
|
42
|
+
s.rubygems_version = "3.1.4".freeze
|
43
|
+
s.summary = "Rake TUI".freeze
|
44
|
+
|
45
|
+
if s.respond_to? :specification_version then
|
46
|
+
s.specification_version = 4
|
47
|
+
end
|
48
|
+
|
49
|
+
if s.respond_to? :add_runtime_dependency then
|
50
|
+
s.add_runtime_dependency(%q<tty-prompt>.freeze, [">= 0"])
|
51
|
+
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
|
52
|
+
s.add_development_dependency(%q<rdoc>.freeze, ["~> 3.12"])
|
53
|
+
s.add_development_dependency(%q<bundler>.freeze, [">= 1.0"])
|
54
|
+
s.add_development_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
|
55
|
+
s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
|
56
|
+
s.add_development_dependency(%q<e2mmap>.freeze, ["~> 0.1.0"])
|
57
|
+
s.add_development_dependency(%q<puts_debuggerer>.freeze, [">= 0"])
|
58
|
+
else
|
59
|
+
s.add_dependency(%q<tty-prompt>.freeze, [">= 0"])
|
60
|
+
s.add_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
|
61
|
+
s.add_dependency(%q<rdoc>.freeze, ["~> 3.12"])
|
62
|
+
s.add_dependency(%q<bundler>.freeze, [">= 1.0"])
|
63
|
+
s.add_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
|
64
|
+
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
|
65
|
+
s.add_dependency(%q<e2mmap>.freeze, ["~> 0.1.0"])
|
66
|
+
s.add_dependency(%q<puts_debuggerer>.freeze, [">= 0"])
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake-tui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-prompt
|
@@ -126,16 +126,34 @@ description: Rake Text-based User Interface
|
|
126
126
|
email: andy.am@gmail.com
|
127
127
|
executables:
|
128
128
|
- rake-tui
|
129
|
+
- jrake-tui
|
130
|
+
- raketui
|
131
|
+
- jraketui
|
132
|
+
- rake-ui
|
133
|
+
- jrake-ui
|
134
|
+
- rakeui
|
135
|
+
- jrakeui
|
129
136
|
extensions: []
|
130
137
|
extra_rdoc_files:
|
138
|
+
- CHANGELOG.md
|
131
139
|
- LICENSE.txt
|
132
140
|
- README.md
|
133
141
|
files:
|
142
|
+
- CHANGELOG.md
|
134
143
|
- LICENSE.txt
|
135
144
|
- README.md
|
136
145
|
- VERSION
|
146
|
+
- bin/jrake-tui
|
147
|
+
- bin/jrake-ui
|
148
|
+
- bin/jraketui
|
149
|
+
- bin/jrakeui
|
137
150
|
- bin/rake-tui
|
151
|
+
- bin/rake-ui
|
152
|
+
- bin/raketui
|
153
|
+
- bin/rakeui
|
138
154
|
- lib/rake-tui.rb
|
155
|
+
- lib/rake-tui/ext/rake/tui.rb
|
156
|
+
- rake-tui.gemspec
|
139
157
|
homepage: http://github.com/AndyObtiva/rake-tui
|
140
158
|
licenses:
|
141
159
|
- MIT
|