{"id":13586908,"url":"https://github.com/piotrmurach/tty-command","last_synced_at":"2025-06-12T13:09:26.108Z","repository":{"id":7003473,"uuid":"55912560","full_name":"piotrmurach/tty-command","owner":"piotrmurach","description":"Execute shell commands with pretty output logging and capture stdout, stderr and exit status.","archived":false,"fork":false,"pushed_at":"2024-02-02T21:36:34.000Z","size":337,"stargazers_count":401,"open_issues_count":8,"forks_count":33,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-05-28T02:42:05.143Z","etag":null,"topics":["cli","logging","ruby-gem","stdout","tty","tty-components"],"latest_commit_sha":null,"homepage":"https://ttytoolkit.org","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/piotrmurach.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"piotrmurach"}},"created_at":"2016-04-10T17:21:25.000Z","updated_at":"2025-05-14T14:23:47.000Z","dependencies_parsed_at":"2024-02-02T22:42:48.656Z","dependency_job_id":null,"html_url":"https://github.com/piotrmurach/tty-command","commit_stats":{"total_commits":389,"total_committers":12,"mean_commits":"32.416666666666664","dds":0.05398457583547556,"last_synced_commit":"2af6354a06da08421b14af160459839f87400c9d"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/piotrmurach/tty-command","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piotrmurach%2Ftty-command","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piotrmurach%2Ftty-command/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piotrmurach%2Ftty-command/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piotrmurach%2Ftty-command/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/piotrmurach","download_url":"https://codeload.github.com/piotrmurach/tty-command/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piotrmurach%2Ftty-command/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259470951,"owners_count":22862999,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","logging","ruby-gem","stdout","tty","tty-components"],"created_at":"2024-08-01T15:05:53.812Z","updated_at":"2025-06-12T13:09:26.083Z","avatar_url":"https://github.com/piotrmurach.png","language":"Ruby","readme":"\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://ttytoolkit.org\"\u003e\u003cimg width=\"130\" src=\"https://github.com/piotrmurach/tty/blob/master/images/tty.png\" alt=\"TTY Toolkit logo\"/\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n# TTY::Command\n\n[![Gem Version](https://badge.fury.io/rb/tty-command.svg)][gem]\n[![Actions CI](https://github.com/piotrmurach/tty-command/actions/workflows/ci.yml/badge.svg)][gh_actions_ci]\n[![Build status](https://ci.appveyor.com/api/projects/status/0150ync7bdkfhmsv?svg=true)][appveyor]\n[![Code Climate](https://codeclimate.com/github/piotrmurach/tty-command/badges/gpa.svg)][codeclimate]\n[![Coverage Status](https://coveralls.io/repos/github/piotrmurach/tty-command/badge.svg)][coverage]\n\n[gem]: http://badge.fury.io/rb/tty-command\n[gh_actions_ci]: https://github.com/piotrmurach/tty-command/actions/workflows/ci.yml\n[appveyor]: https://ci.appveyor.com/project/piotrmurach/tty-command\n[codeclimate]: https://codeclimate.com/github/piotrmurach/tty-command\n[coverage]: https://coveralls.io/github/piotrmurach/tty-command\n\n\u003e Run external commands with pretty output logging and capture stdout, stderr and exit status. Redirect stdin, stdout and stderr of each command to a file or a string.\n\n**TTY::Command** provides independent command execution component for [TTY](https://github.com/piotrmurach/tty) toolkit.\n\n## Motivation\n\nComplex software projects aren't just a single app. These projects usually spawn dozens or hundreds of supplementary standalone scripts which are just as important as the app itself. Examples include - data validation, deployment, monitoring, database maintenance, backup \u0026 restore, configuration management, crawling, ETL, analytics, log file processing, custom reports, etc. One of the contributors to **TTY::Command** counted 222 scripts in the `bin` directory for his startup.\n\nWhy should we be handcuffed to `sh` or `bash` for these scripts when we could be using Ruby? Ruby is easier to write and more fun, and we gain a lot by using a better language. It's nice for everyone to just use Ruby everywhere.\n\n**TTY::Command** tries to add value in other ways. It'll halt automatically if a command fails. It's easy to get verbose or quiet output as appropriate, or even capture output and parse it with Ruby. Escaping arguments is a breeze. These are all areas where traditional shell scripts tend to fall flat.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem \"tty-command\"\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install tty-command\n\n## Contents\n\n* [1. Usage](#1-usage)\n* [2. Interface](#2-interface)\n  * [2.1. Run](#21-run)\n  * [2.2. Run!](#22-run)\n  * [2.3. Logging](#23-logging)\n    * [2.3.1. Color](#231-color)\n    * [2.3.2. UUID](#232-uuid)\n    * [2.3.3. Only output on error](#233-only-output-on-error)\n    * [2.3.4. Verbose](#234-verbose)\n  * [2.4. Dry run](#24-dry-run)\n  * [2.5. Wait](#25-wait)\n  * [2.6. Test](#26-test)\n  * [2.7. Ruby interpreter](#27-ruby-interpreter)\n* [3. Advanced Interface](#3-advanced-interface)\n  * [3.1. Environment variables](#31-environment-variables)\n  * [3.2. Options](#32-options)\n    * [3.2.1. Redirection](#321-redirection)\n    * [3.2.2. Handling input](#322-handling-input)\n    * [3.2.3. Timeout](#323-timeout)\n    * [3.2.4. Binary mode](#324-binary-mode)\n    * [3.2.5. Signal](#325-signal)\n    * [3.2.6. PTY(pseudo-terminal)](#326-ptypseudo-terminal)\n    * [3.2.7. Current directory](#327-current-directory)\n    * [3.2.8. User](#328-user)\n    * [3.2.9. Group](#329-group)\n    * [3.2.10. Umask](#3210-umask)\n  * [3.3. Result](#33-result)\n    * [3.3.1. success?](#331-success)\n    * [3.3.2. failure?](#332-failure)\n    * [3.3.3. exited?](#333-exited)\n    * [3.3.4. each](#334-each)\n  * [3.4. Custom printer](#34-custom-printer)\n* [4. Example](#4-example)\n\n## 1. Usage\n\nCreate a command instance and then run some commands:\n\n```ruby\nrequire \"tty-command\"\n\ncmd = TTY::Command.new\ncmd.run(\"ls -la\")\ncmd.run(\"echo Hello!\")\n```\n\nNote that `run` will throw an exception if the command fails. This is already an improvement over ordinary shell scripts, which just keep on going when things go bad. That usually makes things worse.\n\nYou can use the return value to capture stdout and stderr:\n\n```ruby\nout, err = cmd.run(\"cat ~/.bashrc | grep alias\")\n```\n\nInstead of using a plain old string, you can break up the arguments and they'll get escaped if necessary:\n\n```ruby\npath = \"hello world\"\nFileUtils.touch(path)\ncmd.run(\"sum #{path}\")  # this will fail due to bad escaping\ncmd.run(\"sum\", path)    # this gets escaped automatically\n```\n\n## 2. Interface\n\n### 2.1 Run\n\nRun starts the specified command and waits for it to complete.\n\nThe argument signature of `run` is as follows:\n\n`run([env], command, [argv1, ...], [options])`\n\nThe `env`, `command` and `options` arguments are described in the following sections.\n\nFor example, to display file contents:\n\n```ruby\ncmd.run(\"cat file.txt\")\n```\n\nIf the command succeeds, a `TTY::Command::Result` is returned that records stdout and stderr:\n\n```ruby\nout, err = cmd.run(\"date\")\nputs \"The date is #{out}\"\n# =\u003e \"The date is Tue 10 May 2016 22:30:15 BST\\n\"\n```\n\nYou can also pass a block that gets invoked anytime stdout and/or stderr receive output:\n\n```ruby\ncmd.run(\"long running script\") do |out, err|\n  output \u003c\u003c out if out\n  errors \u003c\u003c err if err\nend\n```\n\nIf the command fails (with a non-zero exit code), a `TTY::Command::ExitError` is raised. The `ExitError` message will include:\n\n  * the name of command executed\n  * the exit status\n  * stdout bytes\n  * stderr bytes\n\nIf the error output is very long, the stderr may contain only a prefix, number of omitted bytes and suffix.\n\n### 2.2 Run!\n\nIf you expect a command to fail occasionally, use `run!` instead. Then you can detect failures and respond appropriately. For example:\n\n```ruby\nif cmd.run!(\"which xyzzy\").failure?\n  cmd.run(\"brew install xyzzy\")\nend\n```\n\n### 2.3 Logging\n\nBy default, when a command is run, the command and the output are printed to `stdout` using the `:pretty` printer. If you wish to change printer you can do so by passing a `:printer` option:\n\n* `:null` - no output\n* `:pretty` - colorful output\n* `:progress` - minimal output with green dot for success and F for failure\n* `:quiet` - only output actual command stdout and stderr\n\nlike so:\n\n```ruby\ncmd = TTY::Command.new(printer: :progress)\n```\n\nBy default the printers log to `stdout` but this can be changed by passing an object that responds to `\u003c\u003c` message:\n\n```ruby\nlogger = Logger.new(\"dev.log\")\ncmd = TTY::Command.new(output: logger)\n```\n\nYou can force the printer to always in print in color by passing the `:color` option:\n\n```ruby\ncmd = TTY::Command.new(color: true)\n```\n\nIf the default printers don't meet your needs you can always create [a custom printer](#34-custom-printer)\n\n#### 2.3.1 Color\n\nWhen using printers you can switch off coloring by using `:color` option set to `false`.\n\n#### 2.3.2 UUID\n\nBy default, when logging is enabled and `pretty` printer is used, each log entry is prefixed by specific command run uuid number. This number can be switched off using the `:uuid` option at initialization:\n\n```ruby\ncmd = TTY::Command.new(uuid: false)\ncmd.run(\"rm -R all_my_files\")\n# =\u003e\n#  Running rm -r all_my_files\n#  ...\n#  Finished in 6 seconds with exit status 0 (successful)\n```\n\nor individually per command run:\n\n```rub\ncmd = TTY::Command.new\ncmd.run(\"echo hello\", uuid: false)\n# =\u003e\n#  Running echo hello\n#      hello\n#  Finished in 0.003 seconds with exit status 0 (successful)\n```\n\n#### 2.3.3 Only output on error\n\nWhen using a command that can fail, setting `:only_output_on_error` option to `true` hides the output if the command succeeds:\n\n```ruby\ncmd = TTY::Command.new\ncmd.run(\"non_failing_command\", only_output_on_error: true)\n```\n\nThis will only print the `Running` and `Finished` lines, while:\n\n```ruby\ncmd.run(\"non_failing_command\")\n```\n\nwill also print any output that the `non_failing_command` might generate.\n\nRunning either:\n\n```ruby\ncmd.run(\"failing_command\", only_output_on_error: true)\n```\n\neither:\n\n```ruby\ncmd.run(\"failing_command\")\n```\n\nwill also print the output.\n\n*Setting this option will cause the output to show at once, at the end of the command.*\n\n#### 2.3.4 Verbose\n\nBy default commands will produce warnings when, for example `pty` option is not supported on a given platform. You can switch off such warnings with `:verbose` option set to `false`.\n\n```ruby\ncmd.run(\"echo '\\e[32mColors!\\e[0m'\", pty: true, verbose: false)\n```\n\n### 2.4 Dry run\n\nSometimes it can be useful to put your script into a \"dry run\" mode that prints commands without actually running them. To simulate execution of the command use the `:dry_run` option:\n\n```ruby\ncmd = TTY::Command.new(dry_run: true)\ncmd.run(:rm, \"all_my_files\")\n# =\u003e [123abc] (dry run) rm all_my_files\n```\n\nTo check what mode the command is in use the `dry_run?` query helper:\n\n```ruby\ncmd.dry_run? # =\u003e true\n```\n\n### 2.5 Wait\n\nIf you need to wait for a long running script and stop it when a given pattern has been matched use `wait` like so:\n\n```ruby\ncmd.wait \"tail -f /var/log/production.log\", /something happened/\n```\n\n### 2.6 Test\n\nTo simulate classic bash test command you case use `test` method with expression to check as a first argument:\n\n```ruby\nif cmd.test \"-e /etc/passwd\"\n  puts \"Sweet...\"\nelse\n  puts \"Ohh no! Where is it?\"\n  exit 1\nend\n```\n\n### 2.7 Ruby interpreter\n\nIn order to run a command with Ruby interpreter do:\n\n```ruby\ncmd.ruby %q{-e \"puts 'Hello world'\"}\n```\n\n## 3. Advanced Interface\n\n### 3.1 Environment variables\n\nThe environment variables need to be provided as hash entries, that can be set directly as a first argument:\n\n```ruby\ncmd.run({\"RAILS_ENV\" =\u003e \"PRODUCTION\"}, :rails, \"server\")\n```\n\nor as an option with `:env` key:\n\n```ruby\ncmd.run(:rails, \"server\", env: {rails_env: :production})\n```\n\nWhen a value in env is nil, the variable is unset in the child process:\n\n```ruby\ncmd.run(:echo, \"hello\", env: {foo: \"bar\", baz: nil})\n```\n\n### 3.2 Options\n\nWhen a hash is given in the last argument (options), it allows to specify a current directory, umask, user, group and zero or more fd redirects for the child process.\n\n#### 3.2.1 Redirection\n\nThere are few ways you can redirect commands output.\n\nYou can directly use shell redirection like so:\n\n```ruby\nout, err = cmd.run(\"ls 1\u0026\u003e2\")\nputs err\n# =\u003e\n# CHANGELOG.md\n# CODE_OF_CONDUCT.md\n# Gemfile\n# ...\n```\n\nYou can provide redirection as additional hash options where the key is one of `:in`, `:out`, `:err`, an integer (a file descriptor for the child process), an IO or array. For example, `stderr` can be merged into stdout as follows:\n\n```ruby\ncmd.run(:ls, :err =\u003e :out)\ncmd.run(:ls, :stderr =\u003e :stdout)\ncmd.run(:ls, 2 =\u003e 1)\ncmd.run(:ls, STDERR =\u003e :out)\ncmd.run(:ls, STDERR =\u003e STDOUT)\n```\n\nThe hash key and value specify a file descriptor in the child process (stderr \u0026 stdout in the examples).\n\nYou can also redirect to a file:\n\n```ruby\ncmd.run(:cat, :in =\u003e \"file\")\ncmd.run(:cat, :in =\u003e open(\"/etc/passwd\"))\ncmd.run(:ls, :out =\u003e \"log\")\ncmd.run(:ls, :out =\u003e \"/dev/null\")\ncmd.run(:ls, :out =\u003e \"out.log\", :err =\u003e \"err.log\")\ncmd.run(:ls, [:out, :err] =\u003e \"log\")\ncmd.run(\"ls 1\u003e\u00262\", :err =\u003e \"log\")\n```\n\nIt is possible to specify flags and permissions of file creation explicitly by passing an array value:\n\n```ruby\ncmd.run(:ls, :out =\u003e [\"log\", \"w\"]) # 0664 assumed\ncmd.run(:ls, :out =\u003e [\"log\", \"w\", 0600])\ncmd.run(:ls, :out =\u003e [\"log\", File::WRONLY|File::EXCL|File::CREAT, 0600])\n```\n\nYou can, for example, read data from one source and output to another:\n\n```ruby\ncmd.run(\"cat\", :in =\u003e \"Gemfile\", :out =\u003e \"gemfile.log\")\n```\n\n#### 3.2.2 Handling Input\n\nYou can provide input to stdin stream using the `:input` key. For instance, given the following executable called `cli` that expects name from `stdin`:\n\n```ruby\nname = $stdin.gets\nputs \"Your name: #{name}\"\n```\n\nIn order to execute `cli` with name input do:\n\n```ruby\ncmd.run(\"cli\", input: \"Piotr\\n\")\n# =\u003e Your name: Piotr\n```\n\nAlternatively, you can pass input via the :in option, by passing a `StringIO` Object. This object might have more than one line, if the executed command reads more than once from STDIN.\n\nAssume you have run a program, that first asks for your email address and then for a password:\n\n```ruby\nin_stream = StringIO.new\nin_stream.puts \"username@example.com\"\nin_stream.puts \"password\"\nin_stream.rewind\n\ncmd.run(\"my_cli_program\", \"login\", in: in_stream).out\n```\n\n#### 3.2.3 Timeout\n\nYou can timeout command execution by providing the `:timeout` option in seconds:\n\n```ruby\ncmd.run(\"while test 1; sleep 1; done\", timeout: 5)\n```\n\nAnd to set it for all commands do:\n\n```ruby\ncmd = TTY::Command.new(timeout: 5)\n```\n\nPlease run `examples/timeout.rb` to see timeout in action.\n\n#### 3.2.4 Binary mode\n\nBy default the standard input, output and error are non-binary. However, you can change to read and write in binary mode by using the `:binmode` option like so:\n\n```ruby\ncmd.run(\"echo 'hello'\", binmode: true)\n```\n\nTo set all commands to be run in binary mode do:\n\n```ruby\ncmd = TTY::Command.new(binmode: true)\n```\n\n#### 3.2.5 Signal\n\nYou can specify process termination signal other than the default `SIGTERM`:\n\n```ruby\ncmd.run(\"whilte test1; sleep1; done\", timeout: 5, signal: :KILL)\n```\n\n#### 3.2.6 PTY(pseudo terminal)\n\nThe `:pty` configuration option causes the command to be executed in subprocess where each stream is a `pseudo terminal`. By default this options is set to `false`.\n\nIf you require to interface with interactive subprocess then setting this option to `true` will enable a `pty` terminal device. For example, a command may emit colored output only if it is running via terminal device. You may also wish to run a program that waits for user input, and simulates typing in commands and reading responses.\n\nThis option will only work on systems that support BSD pty devices such as Linux or OS X, and it will gracefully fallback to non-pty device on all the other.\n\nIn order to run command in `pseudo terminal`, either set the flag globally for all commands:\n\n```ruby\ncmd = TTY::Command.new(pty: true)\n```\n\nor individually for each executed command:\n\n```ruby\ncmd.run(\"echo 'hello'\", pty: true)\n```\n\nPlease note that setting `:pty` to `true` may change how the command behaves. It's important to understand the difference between `interactive` and `non-interactive` modes. For example, executing `git log` to view the commit history in default `non-interactive` mode:\n\n```ruby\ncmd.run(\"git log\") # =\u003e finishes and produces full output\n```\n\nHowever, in `interactive` mode with `pty` flag on:\n\n```ruby\ncmd.run(\"git log\", pty: true) # =\u003e uses pager and waits for user input (never returns)\n```\n\nIn addition, when pty device is used, any input to command may be echoed to the standard output, as well as some redirects may not work.\n\n#### 3.2.7 Current directory\n\nTo change directory in which the command is run pass the `:chdir` option:\n\n```ruby\ncmd.run(:echo, \"hello\", chdir: \"/var/tmp\")\n```\n\n#### 3.2.8 User\n\nTo run command as a given user do:\n\n```ruby\ncmd.run(:echo, \"hello\", user: \"piotr\")\n```\n\n#### 3.2.9 Group\n\nTo run command as part of group do:\n\n```ruby\ncmd.run(:echo, \"hello\", group: \"devs\")\n```\n\n#### 3.2.10 Umask\n\nTo run command with umask do:\n\n```ruby\ncmd.run(:echo, \"hello\", umask: \"007\")\n```\n\n### 3.3 Result\n\nEach time you run command the stdout and stderr are captured and return as result. The result can be examined directly by casting it to tuple:\n\n```ruby\nout, err = cmd.run(:echo, \"Hello\")\n```\n\nHowever, if you want to you can defer reading:\n\n```ruby\nresult = cmd.run(:echo, \"Hello\")\nresult.out\nresult.err\n```\n\n#### 3.3.1 success?\n\nTo check if command exited successfully use `success?`:\n\n```ruby\nresult = cmd.run(:echo, \"Hello\")\nresult.success? # =\u003e true\n```\n\n#### 3.3.2 failure?\n\nTo check if command exited unsuccessfully use `failure?` or `failed?`:\n\n```ruby\nresult = cmd.run(:echo, \"Hello\")\nresult.failure?  # =\u003e false\nresult.failed?   # =\u003e false\n```\n\n#### 3.3.3 exited?\n\nTo check if command ran to completion use `exited?` or `complete?`:\n\n```ruby\nresult = cmd.run(:echo, \"Hello\")\nresult.exited?    # =\u003e true\nresult.complete?  # =\u003e true\n```\n\n#### 3.3.4 each\n\nThe result itself is an enumerable and allows you to iterate over the stdout output:\n\n```ruby\nresult = cmd.run(:ls, \"-1\")\nresult.each { |line| puts line }\n# =\u003e\n#  CHANGELOG.md\n#  CODE_OF_CONDUCT.md\n#  Gemfile\n#  Gemfile.lock\n#  ...\n#  lib\n#  pkg\n#  spec\n#  tasks\n```\n\nBy default the linefeed character `\\n` is used as a delimiter but this can be changed either globally by calling `record_separator`:\n\n```ruby\nTTY::Command.record_separator = \"\\n\\r\"\n```\n\nor configured per `each` call by passing delimiter as an argument:\n\n```ruby\ncmd.run(:ls, \"-1\").each(\"\\t\") { ... }\n```\n\n### 3.4 Custom printer\n\nIf the built-in printers do not meet your requirements you can create your own. A printer is a regular Ruby class that can be registered through `:printer` option to receive notifications about received command data.\n\nAs the command runs the custom printer will be notified when the command starts, when data is printed to stdout, when data is printed to stderr and when the command exits.\n\nPlease see [lib/tty/command/printers/abstract.rb](https://github.com/piotrmurach/tty-command/blob/master/lib/tty/command/printers/abstract.rb) for a full set of methods that you can override.\n\nAt the very minimum you need to specify the `write` method that will be called during the lifecycle of command execution. The `write` accepts two arguments, first the currently run command instance and second the message to be printed:\n\n```ruby\nCustomPrinter \u003c TTY::Command::Printers::Abstract\n  def write(cmd, message)\n    puts cmd.to_command + message\n  end\nend\n\ncmd = TTY::Command.new(printer: CustomPrinter)\n```\n\n## 4. Example\n\nHere's a slightly more elaborate example to illustrate how tty-command can improve on plain old shell scripts. This example installs a new version of Ruby on an Ubuntu machine.\n\n```ruby\ncmd = TTY::Command.new\n\n# dependencies\ncmd.run \"apt-get -y install build-essential checkinstall\"\n\n# fetch ruby if necessary\nif !File.exists?(\"ruby-2.3.0.tar.gz\")\n  puts \"Downloading...\"\n  cmd.run \"wget http://ftp.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.gz\"\n  cmd.run \"tar xvzf ruby-2.3.0.tar.gz\"\nend\n\n# now install\nDir.chdir(\"ruby-2.3.0\") do\n  puts \"Building...\"\n  cmd.run \"./configure --prefix=/usr/local\"\n  cmd.run \"make\"\nend\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/piotrmurach/tty-command. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n## Copyright\n\nCopyright (c) 2016 Piotr Murach. See LICENSE for further details.\n","funding_links":["https://github.com/sponsors/piotrmurach"],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiotrmurach%2Ftty-command","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiotrmurach%2Ftty-command","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiotrmurach%2Ftty-command/lists"}