As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I'm digging around trying to find a good set of tools for creating console applications, as most of the settings I expect to be using Ruby in the coming months won't be webapps, but server-side scripts.
I know of highline, and I do plan on using that for user and possible password prompts, but I know that the Console application world should be chock-full of other gems to assist and/or enrich your plain 'ol command-line apps.
Does anyone have some good suggestions? I'm not exactly sure what I'm really looking for, but I wouldn't be surprised if there were gems in Ruby to help with colorizing, ascii-like art, user-interaction (similar to bash-completion), man-page similar tools (or generators) or just helpers for making the work of creating a richer console app not come across as being so difficult to understand, or plain and cryptic.
Here's some console related gems I've written you may like:
bond - Custom readline autocompletion of methods, arguments and more.
hirb - Framework for formatting ruby objects. Comes with tables, trees, selection menus and a smart pager.
alias - Creates, manages and saves aliases for class methods, instance methods, constants, delegated methods.
My table_print gem lets you see IRB output in easy-to-scan table format. Super simple, lightweight, customizable. http://tableprintgem.com
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I have written Ruby code to convert a number to words.
Am running it on my ruby console locally.
So now, am considering a very simple webpage with an input text field for users to enter the number and an output field to display the result.
I could have written the code in Javascript, but I preferred to hide the code from users, and at the same time I wanted to get my hands dirty trying to learn Ruby.
So now, what are my options, should I use Sinatra (heard it is the most basic framework) or can it be done without any framework?
There are quite a few ruby frameworks to pick from. Sinatra, but also Rails, Padrino, and a few lightweight ones line Camping.
If you really want to get your hands dirty, you could also build a Rack app without using any of them:
http://m.onkey.org/ruby-on-rack-1-hello-rack
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
We all know that Puppet and Chef are the superstars of the IT automation area, and they are developed in Ruby (though Chef 11 server was rewritten in Erlang).
In my working environment, a very large group of the operations team uses Python as the primary language to develop operation tools or basic system applications.
I want to find why both Puppet and Chef were written in Ruby? What are the advantages? Ruby supports DSLs well. Can Python do such thing?
From Luke Kanies, Puppet’s author:
I was a sysadmin by trade and had mostly developed in perl, but when I
tried to write the prototype I had in mind, I couldn’t get the class
relationships I wanted in perl. I tried Python, because this was
around 2003 and Python was the next new thing and everyone was saying
how great it is, but I just can’t seem to write in Python at all. A
friend had said he’d heard Ruby was cool, so I gave it a try, and in
four hours I went from never having seen a line of it to having a
working prototype. I haven’t looked back since then, and haven’t
regretted the choice.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I've been working with Ruby and many of it's web frameworks for about a year now.
I am aware that rails is built largely using 'meta-programming'. And while I have tried to inspect the source, often not all of it makes sense.
I tried to publish a small gem, and used a few methods like _send, instance_eval, class_eval which was cool but as a general principle we are told to stay far away from eval in it's various forms.
Other programming constructs I know where I can use. Like data serialization in applications or where I can / should implement the Builder Pattern when making web apps.
My question is in two parts:
What are the common or apt use cases / programming problems for which meta-programming is used?
When using the meta-programming bits of ruby, what are the best practices that I should follow?
Have you ever used attr_accessor? Then you have used metaprogramming: it is a method that generates methods.
I have found that meta-programming is largely the domain of library APIs. Often you won't use much of it directly when creating an end-user application. But you can be sure, the many gems your application depends upon do use it extensively. Rails is a perfect example. It uses a great deal of Ruby's meta-programming chops to make all that Rails magic possible.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm looking for a good Ruby interactive shell. The shell I'm looking for must have the following features:
autocompletion
syntax highlighting
smart ident
previous command retrieval
automatic display of function arguments
automatic display of function documentation
works on Windows
fast and responsive
The shell I'm looking for would have been nice had it featured the following:
automatic completion of file names
automatically adds parenthesis when coding a function call
a division of the window into a history box (with previous commands and their outputs) and a code box (where I write my code). DreamPie is an example of a Python shell which features that concept.
Any suggestions for such a Ruby interactive shell?
The two main ruby shells that exist currently are irb and pry, neither of which accomplishes all of your requirements. Also, you may be able to fulfill more of your needs using an IDE like RubyMine or by hacking on a plugin to a text editor like Sublime.
Having a fully capable ruby shell like this could be great for the community. Drop a link if you're working on one :)
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
What publicly available open source Ruby applications (not frameworks) exist apart from web applications?
This question is similar to Ruby off the rails , except that's about anecdotes of what Ruby applications they've created, which aren't necessarily publicly available.
These applications should be non-trivial: ideally multiple committers, with well-designed code to handle the complexity of their task.
One example would be the Metasploit Project.
Background: Asking in response to Framework for non-web Ruby project, where I realised that I haven't seen any examples of Ruby applications that aren't one-person projects.
Take a look at Chef. This Ruby project is becoming the de-facto tool for managing cloud architectures.
Have you seen hackety hack? Non-trivial, but you will find plenty of interesting ideas in the source code if you're adventurous. Being written by _why, it's pretty fanciful.
There are a number of Mac OS X applications written in Ruby-Cocoa (LimeChat is an example; I think Colloquy used to be, though its website implies that that may have changed).
As far as not seeing Ruby projects by more than one person...huh? True, most open-source Ruby development these days seems to be in the Rails world, but within that community there are lots of huge projects with many developers.
You might ask this question on the Ruby mailing list; you'll almost certainly get more good answers.