Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/s-mage/rush
Ruby replacement for bash
https://github.com/s-mage/rush
Last synced: about 2 months ago
JSON representation
Ruby replacement for bash
- Host: GitHub
- URL: https://github.com/s-mage/rush
- Owner: s-mage
- Archived: true
- Fork: true (adamwiggins/rush)
- Created: 2014-02-26T14:03:36.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-06-24T06:25:32.000Z (over 7 years ago)
- Last Synced: 2024-05-12T02:42:13.042Z (5 months ago)
- Language: Ruby
- Homepage:
- Size: 558 KB
- Stars: 105
- Watchers: 12
- Forks: 10
- Open Issues: 5
-
Metadata Files:
- Readme: README.rdoc
Awesome Lists containing this project
README
= rush -- manage your unix systems with pure Ruby
rush is a unix integration library and an interactive shell which uses pure Ruby syntax. Walk directory trees; create, copy, search, and destroy files; find and kill processes - everything you'd normally do with shell commands, now in the strict and elegant world of Ruby.
{}[https://drone.io/github.com/s-mage/rush]
== Install
Install v.0.6.8 from rubygems.org ~ no longer maintained
sudo gem install rush
Install last stable version (yes, it named rush2 and I know that it's ugly, but still):
sudo gem install rush2
Or for the bleeding edge:
git clone git://github.com/s-mage/rush.git
cd rush
gem build *.gemspec
sudo gem install *.gemIf you want the development version, you will need the development headers for ruby (eg. ruby-dev in most package managers) and change that last command to:
git clone git://github.com/s-mage/rush.git
cd rush
bundle install # to get the dependencies
rake spec # to run the tests
rake rdoc # to generate a local copy of the docs from your sourcetree (optional)sudo rake install # install your default gem location
To uninstall
sudo gem uninstall rush
== Usage
Count the number of classes in your project using bash:
find myproj -name \*.rb | xargs grep '^\s*class' | wc -l
In rush, this is:
myproj['**/*.rb'].search(/^\s*class/).lines.size
Pesky stray mongrels? In bash:
kill `ps aux | grep mongrel_rails | grep -v grep | cut -c 10-20`
In rush:
processes.filter(:cmdline => /mongrel_rails/).kill
== As a library
require 'rubygems'
require 'rush'file = Rush['/tmp/myfile']
file.write "hello"
puts file.contents
file.destroyputs Rush.my_process.pid
puts Rush.processes.size
puts Rush.bash("echo SHELL COMMAND | tr A-Z a-z")
puts Rush.launch_dir['*.rb'].search(/Rush/).entries.inspect== Invoking the shell
Run the "rush" binary to enter the interactive shell.
== Remote access and clustering
rush can control any number of remote machines from a single location. Copy files or directories between servers as seamlessly as if it was all local.
Example of remote access:
local = Rush::Box.new('localhost')
remote = Rush::Box.new('my.remote.server.com')
local_dir = local['/Users/adam/myproj/']
remote_dir = remote['/home/myproj/app/']local_dir.copy_to remote_dir
remote_dir['**/.svn/'].each { |d| d.destroy }Clustering:
local_dir = Rush::Box.new('localhost')['/Users/adam/server_logs/'].create
servers = %w(www1 www2 www3).map { |n| Rush::Box.new(n) }
servers.each { |s| s['/var/log/nginx/access.log'].copy_to local_dir["#{s.host}_access.log"] }== Reference
For more details on syntax and commands, see:
* Rush
* Rush::Entry
* Rush::File
* Rush::Dir
* Rush::Commands
* Rush::Box
* Rush::Process== Meta
What follows is the meta from the original project, which is no longer maintained.
The mailinglist is still functional and the new website for this fork is:
https://github.com/s-mage/rushCreated by Adam Wiggins
Patches contributed by Chihiro Ito, Gabriel Ware, Michael Schutte, Ricardo Chimal Jr., and Nicholas Schlueter, Pedro Belo, and Martin Kuehl
Logo by James Lindenbaum
Now maintained by Sergey Smagin. Ask me if something is unclear: [email protected]
Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
http://groups.google.com/group/ruby-shell