ruby

How do I upgrade from Ruby 1.8.6 to 1.8.7 on Windows?

On one machine I seemed to have upgrade to 1.8.7 -- mostly because of the TLS support for sending via Gmail -- but I don't remember how I did it, or what to do and have a laptop on Windows 7. How do I upgrade for the 1.8.6 from OneClick? ...

Ruby ICalendar Gem: How to get e-mail reminders working.

I'm trying to work out how to use the icalendar ruby gem, found at: http://icalendar.rubyforge.org/ According to their tutorial, you do something like: cal.event.do # ...other event properties alarm do action "EMAIL" description "This is an event reminder" # email body (required) summary "Alarm notification" ...

Can Ruby access output from shell commands as it appears?

My Ruby script is running a shell command and parsing the output from it. However, it seems the command is first executed and output saved in an array. I would like to be able to access the output lines in real time just as they are printed. I've played around with threads, but haven't got it to work. Any suggestions? ...

May we have Ruby and Rails performance statistics? We're persuading the business to use Rails!

We're convincing our Products officer that we want to use JRuby on Rails, and we're having a hard time coming up with some statistics which show that: Coding time is less using Rails vs. say Struts or Zend Framework or what have you. Ruby (and JRuby in particular) performance isn't horrible (anymore). Rails performance isn't bad either...

RedCloth :sanitize_html rules

the RedCloth documentation states "if +:sanitize_html+ is set, HTML can pass through the Textile processor but unauthorized tags and attributes will be removed." Is there a way to specify the 'unauthorized tags?' ...

What Python based Dashboard options exist?

I want to create a Dashboard on each server to show it's health and the results of some daily processing. I plan to hook up shell scripts and Python programs to collect the data. Instead of writing a web-based interface, I thought it would be good to use a python based web dashboard that could render the results in various business user...

How to generate a unified diff in Ruby?

After reading through this question about Ruby diff packages, I'm still not sure how to generate a unified diff from two text files. I'm not having trouble reading each file into a string (IO.read()), but I'm not finding any package that can generate a unified diff. Does one exist? Is doing a system call to diff even an option I should c...

How do I create Twitter style URLs for my app - Using existing application or app redesign - Ruby on Rails...

I have developed a blog application of sorts that I am trying to allow other users to take advantage of (for free and mostly for family). I wondering if the authentication I have set up will allow for such a thing. Here is the scenario. Currently the application allows for users to sign up for an account and when they do so they can cr...

How to return a dynamic value from a Mocha mock in Ruby

The gist of my problem is as follows:- I'm writing a Mocha mock in Ruby for the method represented as "post_to_embassy" below. It is not really our concern, for the purpose of describing the problem, what the actual method does. But I need the mock to return a dynamic value. The proc '&prc' below is executing rightly in place of the act...

File.open with ruby on windows with a unicode filename

I have a script running on Ruby 1.9.1 on Windows 7 I've distilled my script down to File.open("翻譯測試.txt") and still can't get it to work. I know there are issues with Ruby 1.9 filename handling on windows (Using the Windows ANSI library), but would be happy enough with a work around that is callable from Ruby ...

No rails commands will run

I am trying to learn rails and haven't used it in the last few weeks but today when I try to run any rails commands such as - 'rails -v' - 'script/server' I get not have reinstalled ruby but the didn't don't have a clue what could be wrong Am on a brand new Macbook Pro Jeremy-Geross-MacBook-Pro:~ Jeremy$ rails -v /Library/Ruby/Si...

Call iconv from Ruby through system()

I have a problem with iconv tool. I try to call it from rake file in that way: Dir.glob("*.txt") do |file| system("iconv -f UTF-8 -t 'ASCII//TRANSLIT' #{ file } >> ascii_#{ file }") end But one file is converted partly (size of partialy converted: 10059092 bytes, before convertion: 10081854). Comparing this two files prove that not ...

Removing a pattern from the beggining and end of a string in ruby

So I found myself needing to remove <br /> tags from the beginning and end of strings in a project I'm working on. I made a quick little method that does what I need it to do but I'm not convinced it's the best way to go about doing this sort of thing. I suspect there's probably a handy regular expression I can use to do it in only a cou...

checking if all elements in a drop down menu are present with selenium testing using ruby?

HI how can i check if all elements in an array i created are present in a drop down menu using selenium testing? i have something like this but dosent seem to work ANIMALS = ["snake","cat","dog"] def validate_all_animals_exist(selenium) ANIMALS.each { |animal| assert selenium.is_element_present(animal), "Expected category [#{anim...

What is the subject of Rspecs "#its" method

When you use the its method in rspec like follows its(:code) { should eql(0)} what is 'its' referring to. I have the following spec that works fine describe AdminlwController do shared_examples_for "valid status" do it { should be_an_instance_of(Api::SoapStatus) } it "should have a code of 0" do subject.code.should eq...

How to verify the SSL connection when calling a URI?

Hello, I am developing a web application that is authenticated using CAS (A single-sign-on solution: http://www.ja-sig.org/wiki/display/CAS/Home). For security reasons, I need two things to work: The communication between CAS and my application needs to be secure My application needs to accept the certification coming from CAS, so tha...

RDoc template customization

Hi, how can I change my default RDoc template for my gem environment. I'd like my gem server to look like this RDoc: http://getcloudkit.com/api/ and I've seen that design around so this shouldn't be so difficult. ...

Send commands to Selenium Server

Using Selenium-RC, using the Ruby Client Driver. Some other guys are using Watir and are able to use IRB to attach Watir to an open browser and send it commands. This has enabled them to greatly speed up their development time. Without this ability you have to wait for several test steps to execute (such as logging in and opening the ...

Command output in rails console: Explanation of unwanted output?

I am working with the rails console, and some models. I am running things like: Model.find(:all).each do |x| p x.name end which is nice, this lets me see all the values of a specific column, but after it prints those lines, it prints out the whole model. Why does it do this? How can I stop it? ...

Saving Blob data from SQLite database to a file

Hello, I'm trying to save blob data from a SQLite database (Safari cache: Cache.db) to a file, but for some reason sqlite won't read the whole blob. I eventually would like to do this in ruby, but for now something that works directly in sqlite command prompt is fine. Also, I've read all of the entries that talk about this here on stack...