rake-tui
Rake Text-Based User Interface

Other TUI gems you may be interested in:
Pre-requisites
Setup Instructions
Vanilla Ruby
gem install rake-tui
Bundler
gem 'rake-tui', require: false
RVM
rvm @global do gem install rake-tui
Usage
Simply run this command:
rakeui
Or one of the aliases:
rake-ui
raketui
rake-tui
JRuby
If you are using RVM, then rake-tui works in JRuby too.
Otherwise, simply run this command instead:
jrakeui
Or one of the aliases:
jrake-ui
jraketui
jrake-tui
API
To use rake-tui as part of a Ruby app, require the rake-tui gem once at the top of your code:
require 'rake-tui'
Afterwards, simply invoke the Rake::TUI.run method wherever you need to display the TUI to the user:
Rake::TUI.run
If you'd rather specify or limit the tasks shown, then pass the tasks to the constructor before running:
Rake::TUI.new(tasks).run
If you want to make that the default, then set the singleton instance:
Rake::TUI.instance(Rake::TUI.new(tasks))
Rake::TUI.run # this now displays the specified task list
Options
branding_header
The default branding header looks like this (from Rake::TUI::BRANDING_HEADER_DEFAULT):
== rake-tui version 0.2.2 ==
It may be customized by passing in the branding_header option (removed when set to nil).
Example:
Rake::TUI.run(branding_header: '== Glimmer (Ruby Desktop Development GUI Library) ==')
Output:
== Glimmer (Ruby Desktop Development GUI Library) ==
prompt_question
The prompt question is the text that shows up before the help message and looks like this (from Rake::TUI::PROMPT_QUESTION_DEFAULT):
Choose a Rake task:
It may be customized by passing in the prompt_question option:
Example:
Rake::TUI.run(prompt_question: 'Select a Glimmer task:')
Output:
Select a Glimmer task: (Press
task_formatter block
The task formatter (default: Rake::TUI::TASK_FORMATTER_DEFAULT) is responsible for formatting
tasks into task lines presented as choices to the user.
It receives task and tasks list as options.
For example, by default, it prints the same standard output you see from running rake -T:
rake build # Build gem into pkg/
rake clean # Remove any temporary products
rake clobber # Remove any generated files
rake clobber_rdoc # Remove RDoc HTML files
rake console[script] # Start IRB with all runtime dependencies loaded
rake gemcutter:release # Release gem to Gemcutter
rake gemspec # Generate and validate gemspec
rake gemspec:debug # Display the gemspec for debugging purposes, as juwelier knows it (not from the filesystem)
rake gemspec:generate # Regenerate the gemspec on the filesystem
However, it can be customized by passing in a task_formatter block.
Example:
Rake::TUI.new.run { |task, tasks| task.name_with_args }
Output:
build
clean
clobber
clobber_rdoc
console[script]
gemcutter:release
gemspec
gemspec:debug
gemspec:generate
gemspec:release
gemspec:validate
git:release
install
rdoc
TODO
Change Log
Contributing to rake-tui
- Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
- Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
- Fork the project.
- Start a feature/bugfix branch.
- Commit and push until you are happy with your contribution.
- Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
- Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
Copyright
Copyright (c) 2020 Andy Maleh.