Posts Tagged ‘ruby’

ruby on cygwin “no such file to load — ubygems (LoadError)”

Friday, August 21st, 2009

If you’re getting that error, drop to bash and “env | grep -i ruby”. You’ll no doubt see “RUBYOPT=rubygems”.

Just do an “export RUBYOPT=” and it’ll clear that up.

Yes, this is largely for my own reference. It’s one of those solutions SO obvious that I’ll forget it in about 19 seconds.

You people are driving me batshit

Thursday, August 20th, 2009

So I’m noodling around with learning ruby and I’m trying to find a simple example of unit testing.

But no.

“simple ruby tdd example” yields a metric shitload of screen casts (sorry, no.)

Look people, I’ve been writing software for an awfully long time. I’m not going to sit through 15 minutes of screen casting.

NOR do I give a flying shit about Cucumber, rspec, BDD or, God fucking help me, rails.

Yet.

Just Ruby

Just unit testing.

Just 20 or so lines of code with 2 hello world tests (testing code external to the test code itself) in a complete “./rubytesthelloworld.rb” to make it go script. Let ME figure out what the code does. Trust me on this one. It’ll be quicker and I’ll understand it FAR better than trying to follow some code hippy’s insipid “narrative.”

Can ya point me to that? ’cause I haven’t been able to find it.

UPDATE: Solution found! I hoofed it over to the Barnes & Noble on Court Street and, after a little thumbing around, found on page 7 of ‘Ruby Best Practices’ (which, thank GOD, started with testing) the exact snippet I was looking for:


class MyThingieTest <Test::Unit::TestCase

def test_must_be_empty
# ...
end

def test_muse_be_awesome
# ...
end
end

(Yeah, yeah, indent it properly and all. Could probably use a WP plugin for proper code formatting.)

Reflexive Ruby Reaction

Sunday, March 15th, 2009

Ya know, I keep hearing all about how wonderful Ruby is and every once in a while I think about picking it up. But then I come across something like this and I come to my senses:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  def download
    dl_opts = params[:dl].nil? ?   attachment : inline
    dl_img  = params[:type].nil? ? "" : "_#{params[:type]}"
    dl_file = FileUpload.find_by_item_id(params[:id])
    unless dl_file.nil?
      dl_file_type   = dl_file.mime_type
      dl_file_ext    = dl_file_type.item.self_title
      dl_file_name   = "#{dl_file.original_name}#{dl_img}.#{dl_file_ext}"
      dl_file_path   = "#{RAILS_ROOT}/public/upload/#{dl_file.id}/"
      dl_file_title  = dl_file.item.self_title
      dl_public_name = dl_file_title == dl_file_name ? dl_file_name :
                                                       "#{dl_file_title}#{dl_img}.#{dl_file_ext}"
      send_file("#{dl_file_path}#{dl_file_name}",
                :disposition => dl_opts,
                :encoding    => utf8,
                :type        => dl_file_type.content_type,
                :filename    => URI.encode(dl_public_name))
    end
  end

Small_logo

Ruby makes Perl look like English. Come on. That’s not software. That’s what happens when you throw a cat at your keyboard.

Sure, maybe getting a snippet from “RefactorMyCode” is salting the dig a bit but good god.

FAIL

Scripting Language IDEs?

Tuesday, October 28th, 2008

Lately I’m finding myself doing an awful lot of large scripting projects lately in a variety of languages. PHP, Perl, Python and a smidge of Ruby as I try to figure out WTF the deal is.

I’m generally an XEmacs based programmer but I’ve got to say, I’m becoming spoiled by a lot of the advanced integrated features in modern compiled-language IDEs. The funky searching, code folding, refactoring, plug-in …err… ’stuff’ that’s in Eclipse, Visual Studio, Borland’s IDEs, IntelliJ, etc.

Any ideas? I might try and re-evaluate the Komodo IDE.

But maybe there are enough Eclipse plugins to make that worth trying. I don’t know though, eclipse is a bit big to wrap my head around casually.