be nice to ducks or I will mock you
When I first started programming Ruby I lurked on the Seattle.rb mailing list and then gathered the courage to finally attend a meeting. At the time I had written a Perl script that did the basics of what MMS2R does and it was lucky for me that Aaron Patterson who coincidently maintains WWW::Mechanize was also a member of Seattle.rb. My Perl script was using Perl’s original version of WWW::Mechanize to scrape pictures from MMS that were sent by mobile subscribers to Sprint.
I knew that it would be a great experience to me if I converted the Perl script into a Gem. I would be contributing to the Ruby community, I would be learning how to author a Gem, and I would improve on my coding and testing abilities.
A testing problem I was perplexed with was how should I test my code that reaches out to Sprint’s content servers to scrape images? The other cellular carriers actually deliver their images mime-encoded in the MMS payload so testing them in a closed environment is simple enough with a fixture.
Posted in Ruby, Seattle.rb |
handling a rcov non-dependency in your gem on firebrigade
MMS2R was not showing any tests in its firebridge entry because I had a non-dependency for a rcov task that I had included in the MMS2R gem’s Rakefile
This is what Eric says on firebrigade:
This is how to rescue the LoadError exception around the require statement for rcov in the Rakefile :
begin
require 'rcov/rcovtask'
rescue LoadError
end
and this is how I rescue the NameError exception in the rcov task:
begin
Rcov::RcovTask.new do |t|
t.test_files = FileList['test/test*.rb']
t.verbose = true
t.rcov_opts << "--exclude rcov.rb,hpricot.rb,hpricot/.*\.rb"
end
rescue NameError
end
update
07/04/2007
Actually MMS2R is not being tested on the firebrigade currently. The problem stems from a bug in Gems 0.9.4 where MMS2R being dependent on Hpricot and Tinderbox getting a Gem::RemoteInstallationCancelled exception (line 106 of lib/tinderbox/gem_runner.rb) that Eric transforms into a Tinderbox::ManualInstallError
/usr/local/lib/ruby/gems/1.8/gems/tinderbox-1.0.0/lib/tinderbox/gem_runner.rb:108:in `install’: Installation of mms2r-1.1.2 requires manual intervention (Tinderbox::ManualInstallError)
from /usr/local/lib/ruby/gems/1.8/gems/tinderbox-1.0.0/lib/tinderbox/gem_runner.rb:265:in `run’
from /usr/local/lib/ruby/gems/1.8/gems/tinderbox-1.0.0/bin/tinderbox_gem_build:9
from /usr/local/bin/tinderbox_gem_build:16:in `load’
from /usr/local/bin/tinderbox_gem_build:16
Eric says its an known bug in Gems 0.9.4 and should bug them about it!
update
08/01/2007
Eric says that “automatic platform selection to RubyGems” will be fixed on his vacation
Posted in Gems, MMS2R, Ruby, Seattle.rb |
mms2r 1.0.7 Released!
mms2r version 1.0.7 has been released!
http://mms2r.rubyforge.org/== DESCRIPTION:
MMS2R is a library that decodes the parts of an MMS message to disk while
stripping out advertising injected by the cellphone carriers. MMS messages are
multipart email and the carriers often inject branding into these messages. Use
MMS2R if you want to get at the real user generated content from a MMS without
having to deal with the garbage from the carriers.
If MMS2R is not aware of a particular carrier no extra processing is done
to the MMS other than decoding and consolidating its media.
Contact the author to add additional carriers to be processed by the
library. Suggestions and patches appreciated and welcomed!
Corpus of carriers currently processed by MMS2R:
- AT&T/Cingular => mmode.com
- Cingular => mms.mycingular.com
- Cingular => cingularme.com
- Dobson/Cellular One => mms.dobson.net
- Nextel => messaging.nextel.com
- Sprint => pm.sprint.com
- Sprint => messaging.sprintpcs.com
- T-Mobile => tmomail.net
- Verizon => vzwpix.com
- Verizon => vtext.com
Changes:
== 1.0.7 / 2007-04-27 (Senator Stampingston)
- patch submitted by Luke Francl
- added a get_subject method that returns nil when any MMS has a default carrier subject
- get_subject returns nil for ‘’, ’Multimedia message’, ‘(no subject)’, ‘You have new Picture Mail!’
Posted in Gems, Nuby Rails, Ruby, Seattle.rb |
Processing Cellphone MMS Messages With Ruby
Cellphone Multimedia Message Service (MMS) messages that your cellphone sends are really just email formatted text. You can send MMS to other cellphones or to a real email address. I wrote a post about using the Rails receive method in ActionMailer::Base to process email decoding email attachments with ActionMailer::Base receive If you just want to process the mail but don’t need the hook into Rails then just use the TMail class’s parse method directly
mail = TMail::Mail.parse(raw_email)
I’ve been processing MMS emails via TMail recently and have found the cellphone carriers often modify user generated content (text, videos, images) to include advertising for their services.
Posted in Nuby Rails, Ruby, Seattle.rb, web2.0 |
Test Driven Development In Rails (TDD)
I was talking to Geoffrey Grosenbach (of nuby on rails fame) at Seattle.rb tonight mostly about Typo and his new Peep Code screen casts. Somehow he told us that his next Peep Code screen cast was going to be on TDD. That was my opening to complain about actually writing the test first. To be frank, I put my foot in my mouth, and unit testing in Rails has changed the way I code and in turn has made me a better programmer.
Posted in Rails, Ruby, Seattle.rb, Typo |