delano / rye

Safe, parallel access to Unix shells from Ruby
http://delano.github.com/rye
MIT License
234 stars 32 forks source link

Add rudimentary DSL for Rye #27

Closed randywallace closed 11 years ago

randywallace commented 11 years ago

Still much work to be done, but it works pretty well in the example.

Inspiration somewhat due to Fabric (Python) and the features implemented here:

http://tav.espians.com/fabric-python-with-cleaner-api-and-parallel-deployment-support.html

-- Let me know what you think, and whether or not I should continue, thoughts, whatnot

delano commented 11 years ago

Looks good. I need to think more about how rye should work (there was an executable in previous versions) but I like it so far.

randywallace commented 11 years ago

I see that you use http://stackoverflow.com/questions/3386233/how-to-get-exit-status-with-rubys-netssh-library to get the exit status. Likewise, its mentioned in the code that Net::SSH based Rye::Rap objects return the exit code of SSH, not the actual command. Is there any way to get the 'correct' exit code?

delano commented 11 years ago

I might be misunderstanding the question, but Rye does get the exit status from the executed command (via channel.on_request("exit-status"). However, the exit codes returned by standard utils differ between implementations (some versions of ls return 1 if a file path is not found, others return 0).

On Sat, Dec 29, 2012 at 11:42 AM, Randy D. Wallace Jr. < notifications@github.com> wrote:

I see that you use http://stackoverflow.com/questions/3386233/how-to-get-exit-status-with-rubys-netssh-libraryto get the exit status. Likewise, its mentioned in the code that Net::SSH based Rye::Rap objects return the exit code of SSH, not the actual command. Is there any way to get the 'correct' exit code?

— Reply to this email directly or view it on GitHubhttps://github.com/delano/rye/pull/27#issuecomment-11756849.

randywallace commented 11 years ago

Ah, I know what I did. Been doing this long enough that I should have remembered that grep will grep itself in the ps list. At two in the morning I should have caught that.

delano commented 11 years ago

No prob.

On Sun, Dec 30, 2012 at 1:32 AM, Randy D. Wallace Jr. < notifications@github.com> wrote:

Ah, I know what I did. Been doing this long enough that I should have remembered that grep will grep itself in the ps list. At two in the morning I should have caught that.

— Reply to this email directly or view it on GitHubhttps://github.com/delano/rye/pull/27#issuecomment-11762945.

delano commented 11 years ago

If you can remove the colorize dependency, the '#puts data.read_long' line in rye/box.rb, and (for now) bin/rye, I'll pull in the dsl for the next release.

This is definitely the direction to go. If you like I'd be happy to chat/email about next steps.

randywallace commented 11 years ago

I'll remove bin/rye and colorize from the Gemfile, refactor the output sections to quasi-hard-code the colorizing (which are just terminal codes) and leave it commented for future use, and fix that debug line I put in rye/box.rb (I forgot to remove that!).

I'll PM you my email.

randywallace commented 11 years ago

I rebased out the changes you requested. For colorizing, it just puts in the ANSI codes directly now, which should, at most, cause minor annoyance.

delano commented 11 years ago

Thanks. I pulled in the patch. I also removed bin/rye (as mentioned above) and the color codes. The colors can improve readability in a lot of cases but can be a pain in others (I would look for a to do it via include, a la require "rye/rgb").