rake-tui 0.1.1 → 0.2.0
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 +17 -0
- data/README.md +55 -1
- data/VERSION +1 -1
- data/bin/jrake-tui +22 -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 +92 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc7cc20145ab71318914fd1b32c00da9e20337c548128a4f6cc8f84c753c5c6d
|
4
|
+
data.tar.gz: f3f5224f1879623d6977e7bb6dec008c0c545ff15f4b8aef2ff4db99118310b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c34001ed3bcaa9de37038d2730a6523203c8519cd99b408469a2feaa37825bb2c03e449e245f82504df78fc473aae97a2b7bb60787164de485d79f10361d881
|
7
|
+
data.tar.gz: 18e260dffd57d776ed3518968c92cd7078a8d074c9649a2f4bfd8075b78f57d0b512dc036808cf86e7a47d5e51f11cfc3d7241508af72e5a535adf2b675b694e
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
## 0.2.0
|
4
|
+
|
5
|
+
- Optimized performance for JRuby
|
6
|
+
- rakeui, raketui, jrakeui, and jraketui shorter alternative commands
|
7
|
+
- Enter arguments when a rake task needs them
|
8
|
+
- Added an API for direct Ruby use
|
9
|
+
- Specify/limit tasks displayed
|
10
|
+
|
11
|
+
## 0.1.1
|
12
|
+
|
13
|
+
- jrake-tui to support JRuby without RVM
|
14
|
+
|
15
|
+
## 0.1.0
|
16
|
+
|
17
|
+
- 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/)
|
@@ -34,6 +37,14 @@ rvm @global do gem install rake-tui
|
|
34
37
|
Simply run this command:
|
35
38
|
|
36
39
|
```
|
40
|
+
rakeui
|
41
|
+
```
|
42
|
+
|
43
|
+
Or one of the aliases:
|
44
|
+
|
45
|
+
```
|
46
|
+
rake-ui
|
47
|
+
raketui
|
37
48
|
rake-tui
|
38
49
|
```
|
39
50
|
|
@@ -44,9 +55,52 @@ If you are using [RVM](https://rvm.io/), then `rake-tui` works in [JRuby](https:
|
|
44
55
|
Otherwise, simply run this command instead:
|
45
56
|
|
46
57
|
```
|
58
|
+
jrakeui
|
59
|
+
```
|
60
|
+
|
61
|
+
Or one of the aliases:
|
62
|
+
|
63
|
+
```
|
64
|
+
jrake-ui
|
65
|
+
jraketui
|
47
66
|
jrake-tui
|
48
67
|
```
|
49
68
|
|
69
|
+
## API
|
70
|
+
|
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:
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
require 'rake-tui'
|
75
|
+
```
|
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
|
+
## TODO
|
97
|
+
|
98
|
+
[TODO.md](TODO.md)
|
99
|
+
|
100
|
+
## Change Log
|
101
|
+
|
102
|
+
[CHANGELOG.md](CHANGELOG.md)
|
103
|
+
|
50
104
|
## Contributing to rake-tui
|
51
105
|
|
52
106
|
- Check out the latest master to make sure the feature hasn't been
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/bin/jrake-tui
CHANGED
@@ -1,3 +1,25 @@
|
|
1
1
|
#!/usr/bin/env jruby
|
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/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,92 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rake'
|
4
|
+
Rake::TaskManager.record_task_metadata = true
|
5
|
+
|
6
|
+
module Rake
|
7
|
+
class TUI
|
8
|
+
class << self
|
9
|
+
# Singleton instance (if argument is specified, it is used to set instance)
|
10
|
+
def instance(tui=nil)
|
11
|
+
if tui.nil?
|
12
|
+
@instance ||= new
|
13
|
+
else
|
14
|
+
@instance = tui
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# Run TUI (recommended for general use)
|
19
|
+
def run
|
20
|
+
instance.run
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Initialize a new TUI object
|
25
|
+
def initialize(tasks=Rake.application.tasks)
|
26
|
+
if tasks.empty?
|
27
|
+
Rake.application.init
|
28
|
+
Rake.application.load_rakefile
|
29
|
+
tasks = Rake.application.tasks
|
30
|
+
end
|
31
|
+
|
32
|
+
tasks = tasks.reject {|task| task.comment.nil?}
|
33
|
+
|
34
|
+
max_task_size = !tasks.empty? && (tasks.map(&:name_with_args).map(&:size).max + 1)
|
35
|
+
@rake_task_lines = tasks.map do |task|
|
36
|
+
"rake #{task.name_with_args.ljust(max_task_size)} # #{task.comment}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# Run TUI
|
41
|
+
def run
|
42
|
+
version = File.read(File.expand_path('../../../../../VERSION', __FILE__)).strip
|
43
|
+
puts "== rake-tui version #{version} =="
|
44
|
+
|
45
|
+
unless @rake_task_lines&.detect {|l| l.start_with?('rake ')}
|
46
|
+
puts "No Rake tasks found!"
|
47
|
+
puts "Exiting..."
|
48
|
+
exit(0)
|
49
|
+
end
|
50
|
+
|
51
|
+
require 'tty-prompt'
|
52
|
+
|
53
|
+
prompt = TTY::Prompt.new
|
54
|
+
|
55
|
+
prompt.on(:keyescape) do |event|
|
56
|
+
puts # a new line is needed
|
57
|
+
puts "Exiting..."
|
58
|
+
exit(0)
|
59
|
+
end
|
60
|
+
|
61
|
+
begin
|
62
|
+
rake_task_lines = @rake_task_lines.map do |line|
|
63
|
+
bound = TTY::Screen.width - 6
|
64
|
+
line.size <= bound ? line : "#{line[0..(bound - 3)]}..."
|
65
|
+
end
|
66
|
+
rake_task_line = prompt.select("Choose a Rake task: ", rake_task_lines, cycle: true, per_page: [TTY::Screen.height - 5, 1].max, filter: true, show_help: :always, help: "(Press ↑/↓ arrow to move, Enter to select, CTRL+Enter to run without arguments, and letters to filter)") do |list|
|
67
|
+
list.singleton_class.define_method(:keyspace) do |event|
|
68
|
+
return unless filterable?
|
69
|
+
|
70
|
+
if event.value = " "
|
71
|
+
@filter << event.value
|
72
|
+
@active = 1
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
rake_task_with_args = rake_task_line.split('#').first.strip.split[1]
|
78
|
+
rake_task, rake_task_arg_names = rake_task_with_args.sub(']', '').split('[')
|
79
|
+
rake_task_arg_names = rake_task_arg_names&.split(',').to_a
|
80
|
+
rake_task_arg_values = rake_task_arg_names.map do |rake_task_arg_name|
|
81
|
+
prompt.ask("Enter [#{rake_task_arg_name}] (default=nil):")
|
82
|
+
end
|
83
|
+
Rake::Task[rake_task].invoke(*rake_task_arg_values) # TODO support args
|
84
|
+
rescue TTY::Reader::InputInterrupt => e
|
85
|
+
# No Op
|
86
|
+
puts # a new line is needed
|
87
|
+
puts "Exiting..."
|
88
|
+
exit(0)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
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.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- andy_maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-prompt
|
@@ -127,17 +127,32 @@ email: andy.am@gmail.com
|
|
127
127
|
executables:
|
128
128
|
- rake-tui
|
129
129
|
- jrake-tui
|
130
|
+
- raketui
|
131
|
+
- jraketui
|
132
|
+
- rake-ui
|
133
|
+
- jrake-ui
|
134
|
+
- rakeui
|
135
|
+
- jrakeui
|
130
136
|
extensions: []
|
131
137
|
extra_rdoc_files:
|
138
|
+
- CHANGELOG.md
|
132
139
|
- LICENSE.txt
|
133
140
|
- README.md
|
134
141
|
files:
|
142
|
+
- CHANGELOG.md
|
135
143
|
- LICENSE.txt
|
136
144
|
- README.md
|
137
145
|
- VERSION
|
138
146
|
- bin/jrake-tui
|
147
|
+
- bin/jrake-ui
|
148
|
+
- bin/jraketui
|
149
|
+
- bin/jrakeui
|
139
150
|
- bin/rake-tui
|
151
|
+
- bin/rake-ui
|
152
|
+
- bin/raketui
|
153
|
+
- bin/rakeui
|
140
154
|
- lib/rake-tui.rb
|
155
|
+
- lib/rake-tui/ext/rake/tui.rb
|
141
156
|
homepage: http://github.com/AndyObtiva/rake-tui
|
142
157
|
licenses:
|
143
158
|
- MIT
|