Pennyworth is a command line interface and the perfect companion to Alfred. With Pennyworth, you can unlock the full potential of the Ruby language by leveraging a modern version of Ruby through Alfred Workflows. Perfect for when you want to advance beyond the basic workflows Alfred provides by default.
- Command Line Interface (CLI)
- Code of Conduct
While using a Ruby Version Manager is not a hard requirement, it is strongly encouraged since a version manager will give you the freedom to toggle between different Ruby versions since this gem has strict Ruby version requirements (especially in regards to using a modern version of Ruby).
All of the workflows, scripts, examples for this gem use Bash syntax. That said, if you are comfortable with translating Bash syntax to your shell syntax of choice, you can make this gem work in different shells too. That is beyond the scope of this document, though, so leave that exercise up to you.
To install with security, run:
# 💡 Skip this line if you already have the public certificate installed. gem cert --add <(curl --compressed --location https://alchemists.io/gems.pem) gem install pennyworth --trust-policy HighSecurity
To install without security, run:
gem install pennyworth
When using the
--git_hub CLI option, you’ll want to supply your GitHub login and
Personal Access Token with at least read access via the
following environment variables:
⚠️ When using Alfred Workflow environment variables, please ensure you check the Don’t Export option for these variables so you don’t expose your credentials when exporting/sharing workflows with others.
Command Line Interface (CLI)
From the command line, type
pennyworth to view usage:
While the command line options are nice, the real power comes from using Pennyworth in conjunction with Alfred Script Filters. Without having Alfred wired up to consume the CLI output, you’ll only get a JSON in your console. To explain better, continue reading or skip ahead to the Workflows section.
This gem can be configured via a global configuration:
It can also be configured via XDG environment variables.
The default configuration is as follows:
inflections: - "Base64": "Base64" - "Bigdecimal": "BigDecimal" - "Cgi": "CGI" - "Cmath": "CMath" - "Csv": "CSV" - "Dbm": "DBM" - "Drb": "Distributed Ruby" - "Dry Auto Inject": "Dry AutoInject" - "Dry Cli": "Dry CLI" - "E2mmap": "Exception to Message Mapper" - "Erb": "ERB" - "Fileutils": "File Utilities" - "Gdbm": "GDBM" - "Getoptlong": "Get Option Long" - "Http Fake": "HTTP Fake" - "Io Console": "IO Console" - "Io Nonblock": "IO Nonblock" - "Io Wait": "IO Wait" - "Ipaddr": "IP Address" - "Irb": "IRB" - "Json": "JSON" - "Mac Os Config": "macOS Configuration" - "Mac Os": "MacOS" - "Net Ftp": "Net FTP" - "Net Http": "Net HTTP" - "Net Imap": "Net IMAP" - "Net Pop": "Net POP" - "Net Smtp": "Net SMTP" - "Nkf": "NKF" - "Open Uri": "OpenURI" - "Openssl": "OpenSSL" - "Optparse": "Option Parser" - "Ostruct": "OpenStruct" - "Pkce": "PKCE" - "Pp": "PP" - "Prawn Plus": "Prawn+" - "Prettyprint": "Pretty Print" - "Pstore": "PStore" - "Rbs": "RBS" - "Rdoc": "RDoc" - "Rexml": "REXML" - "Rss": "RSS" - "Rubocop Ast": "RuboCop AST" - "Rubocop Capybara": "RuboCop Capybara" - "Rubocop Factory Bot": "RuboCop FactoryBot" - "Rubocop Md": "RuboCop Markdown" - "Rubocop Performance": "RuboCop Performance" - "Rubocop Rails": "RuboCop Rails" - "Rubocop Rake": "RuboCop Rake" - "Rubocop Rspec": "RuboCop RSpec" - "Rubocop Sequel": "RuboCop Sequel" - "Rubocop Thread Safety": "RuboCop Thread Safety" - "Rubocop": "RuboCop" - "Ruby2_keywords": "Ruby to Keywords" - "Rubygems": "RubyGems" - "Sdbm": "SDBM" - "Securerandom": "Secure Random" - "Stringio": "String IO" - "Strscan": "String Scan" - "Tempfile": "Temporary File" - "Thwait": "Threads Wait" - "Tmpdir": "Temporary Directory" - "Tsort": "TSort" - "Typeprof": "Type Profiler" - "Un": "un" - "Uri": "URI" - "Weakref": "Weak Reference" - "Win32ole": "Windows 32 OLE" - "Xdg": "XDG" - "Xmlrpc": "XMLRPC" - "Yaml": "YAML" git_hub: api_url: "https://api.github.com" http: statuses: url: "https://developer.mozilla.org/docs/Web/HTTP/Status" ruby_gems: api_url: "https://rubygems.org/api/v1" standard_gems: api_url: "https://stdgems.org"
Feel free to take this default configuration, modify, and save as your own custom
Not all workflows require Pennyworth to run properly (see the Other section below for details). For the workflows that do require Pennyworth support, the following assumptions are made:
Your Dotfiles are configured to use Bash and load your environment appropriately. Bash is not a hard requirement, though. You can use any shell you are comfortable with as long as you teach Alfred to load your development environment before running the Alfred Workflow.
You have the latest version of Alfred, Ruby, and Pennyworth installed.
You are using a Ruby Version Manager which ensures Ruby is on your load path. As mentioned in the Requirements section above, this is not a hard requirement so if you have the correct version of Ruby required by this gem on your path, that’ll work too.
With the above requirements in mind, the following sections document how to download and install all Pennyworth workflows that are compatible with Alfred. Should you want to tweak any of these workflows, you’d only need to edit an existing workflow or build your own with these settings:
Before diving into each workflow, I want to highlight that the following capabilities are available to all workflows depending on what kind of item is currently selected within the Alfred UI:
Provides quick access to Alchemists resources.
Provides quick access to Dry RB resources.
Provides quick access to RuboCop resources.
Provides quick access to Ruby resources.
The following workflows don’t require this gem to use but are provided for convenience in case they are of aid to your own productivity.
Expands acronyms so you can think and type in terms of an acronym but appear as if you typed out the full definition each time.
Provides quick access to Alpine Linux resources.
Launches your engineering environment but can be tweaked to your preferences. Using Alfred in this manner ensures your machine boots quickly so you have more control over what is launched.
Provides quick access to Bash resources.
Provides biographical calculations and information.
Provides quick access to browser resources.
Provides quick access to Bundler related resources.
Provides quick access to Circle CI resources.
Provides quick access to Crystal resources.
Provides quick access to CSS resources.
Provides quick access to Docker resources.
Provides quick access to Elm resources.
Provides quick access to Farnam Street resources.
Provides quick access to Git resources.
Provides quick access to GitHub resources.
Provides quick access to the Hanami web framework.
Provides quick access to the HTML language.
Internet Protocol (IP)
Provides quick access to IP tooling and resources.
Provides quick access to Jitsi resources.
Provides quick access to macOS resources.
Provides quick access to Rack resources.
Provides quick access to the Roda web framework.
Provides quick access to Ruby Object Mapper (ROM) resources.
Provides quick access to RSpec resources.
Ruby on Rails
Provides access to the Ruby on Rails web framework.
Provides quick access to search resources.
Provides quick access to Slack resources.
Provides quick access to SSL resources for the security conscious.
Provides quick access to Terraform resources.
Provides general text manipulation utilities beyond the Pennyworth powered text macro which is part of the Ruby workflow (mentioned earlier).
When your Alfred Workflow yields no output, you might want to open the Alfred Debugger, rerun your workflow, and check for errors. You can also jump to the CLI and run Pennyworth directly.
If you get GitHub authorization errors, make sure you have defined the appropriate credentials (mentioned earlier) for both within your shell where you are running Pennyworth or within the Alfred Workflow environment.
To contribute, run:
git clone https://github.com/bkuhlmann/pennyworth cd pennyworth bin/setup
You can also use the IRB console for direct access to all objects:
The following documents the workflow used to process all actions from Alfred.
To test, run: