[rspec-users] Net:SSH
Guys I'm having a problem with net-ssh, its kinda taking too long to execute a command and give me the results. It takes around 40 seonds to do it. And I have 3-4 commands to run on the remote box. Is there any possibility to speed up the process. Im using the commands to run on a CISCO BTS server. Is there any possibility that I cud keep channel or session open as long s i could and get the results. Each command I run depends on the result of the previous one I run. Since we have to send the exit command to get the ondata, its not helping much in speeding the whole process. Can anyone help me out there to speed this whole porcess. Thanks GUys, heres the code below : def execute_cmd(ssh_ssn, cmd_string) $cmd_rslt = $cmd_done = false puts executing command: #{cmd_string} in session #{ssh_ssn} begin ssh_ssn.open_channel do |channel| channel.on_success do puts pty requested successfully! channel.on_success do puts shell started successfully! channel.send_data cmd_string + \n channel.send_data exit\n end channel.on_data do |ch,data| #puts rcvd #{data} $cmd_rslt data end channel.send_request shell, nil, true end channel.on_failure do puts shell could not be started! end channel.on_close do puts shell terminated $cmd_done = true end channel.request_pty :want_reply = true end rescue Exception = myexp puts myexp $cmd_rslt = ensure $cmd_done = true end end -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Net:SSH
Hi James, i'm afraid this rspec user list is not the right list for your question. Matthias Am 25.04.2008 um 10:59 schrieb James George: Guys I'm having a problem with net-ssh, its kinda taking too long to execute a command and give me the results. It takes around 40 seonds to do it. And I have 3-4 commands to run on the remote box. Is there any possibility to speed up the process. Im using the commands to run on a CISCO BTS server. Is there any possibility that I cud keep channel or session open as long s i could and get the results. Each command I run depends on the result of the previous one I run. Since we have to send the exit command to get the ondata, its not helping much in speeding the whole process. Can anyone help me out there to speed this whole porcess. Thanks GUys, heres the code below : def execute_cmd(ssh_ssn, cmd_string) $cmd_rslt = $cmd_done = false puts executing command: #{cmd_string} in session #{ssh_ssn} begin ssh_ssn.open_channel do |channel| channel.on_success do puts pty requested successfully! channel.on_success do puts shell started successfully! channel.send_data cmd_string + \n channel.send_data exit\n end channel.on_data do |ch,data| #puts rcvd #{data} $cmd_rslt data end channel.send_request shell, nil, true end channel.on_failure do puts shell could not be started! end channel.on_close do puts shell terminated $cmd_done = true end channel.request_pty :want_reply = true end rescue Exception = myexp puts myexp $cmd_rslt = ensure $cmd_done = true end end -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] Rspec output and unicode
Hey there, Rspec output (1.1.3) doesn't seem to be handling unicode characters correctly. I'm expecting to see Japanese katakana (on winXP) and I'm getting numbers instead - the byte representation of the katakana or something.. Should it be producing unicode if I have my environment set right? Cheers, Tim. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] Running spec_server
Hello, I've been using rspec for a while now and just noticed spec_server. I would like to use it, but for some reason, it's not able to start. I have the latest versions of rspec and rspec_on_rails. I'm using WinXp. The specific error I get is the following: script/spec_server:9: undefined method '+' for nil:NilClass (NoMethodError) Any ideas? Thank you Olivier Dupuis ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Spec the Application Controller application.rb
Do this... after do eval IO.read(RAILS_ROOT + /config/routes.rb) end Zach On Thu, Apr 24, 2008 at 2:20 AM, Andy Croll [EMAIL PROTECTED] wrote: This bit however, replaces your other routes, so you cannot use them in your tests before(:each) do ActionController::Routing::Routes.draw do |map| map.resources :foo end end Is there a sensible way to append to the routes.rb that I'm missing? Andy -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Zach Dennis http://www.continuousthinking.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] BDD/Rails/Shoulda
On 25 Apr 2008, at 00:59, Brian Takita wrote: This reminds me of Allister Cockburn's application of Shu Ha Ri in software development. http://alistair.cockburn.us/index.php/ASD_book_extract:_%22Unknowable_and_incommunicable%22 http://www.martinfowler.com/bliki/ShuHaRi.html http://c2.com/cgi/wiki?ShuHaRi Hadn't seen that before. I've only studied chinese arts so hadn't heard the expression before, the idea is the same though. Thanks for the links, the first one especially looks really interesting Ashley -- http://www.patchspace.co.uk/ http://aviewfromafar.net/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] restful controllers with different content types
Simplified example of a controller which takes a POST with a non-xml and non-form-urlencoded content type: class PhotosController ApplicationController def create Photo.create :binary_data = request.body.read, :content_type = 'image/jpg' head :ok end end How can I spec this? The way that I'd like to do it would be something like: it creates a new photo from a posted image file do Photo.should_receive(:create).with(:binary_data = 'the data', :content_type = 'image/jpg') post :create, :body = 'the data' end Adam ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Running spec_server
On Apr 25, 2008, at 3:16 PM, Olivier Dupuis wrote: Hello, I've been using rspec for a while now and just noticed spec_server. I would like to use it, but for some reason, it's not able to start. I have the latest versions of rspec and rspec_on_rails. I'm using WinXp. The specific error I get is the following: script/spec_server:9: undefined method '+' for nil:NilClass (NoMethodError) Have you tried running script/generate rspec ? What version of rspec/rspec_on_rails are you using? Scott ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users