RubyGems Beta Approaching

Eric Hodel | Fri, 05 Oct 2007 18:01:36 GMT

RubyGems 0.9.5 is almost done, and has loads of good stuff in it, including platform support and an improved indexer script:

[W]e were rebuilding the gem index on RubyForge, [...] doing it “in place”, so that the current index would be overwritten and then populated over the course of the build.  These take a fair while – 10 minutes or so – and during that time the index was essentially empty.  Booooo.

Well, no longer.  Eric Hodel has twiddled the gem index builder to build it in a temporary directory and then move it in place.  So those gem index outages should be a thing of the past.  Thanks Eric!

More reliable gem installs via Junior developer

This will also reduce the number of bulk index updates dramatically, since it’ll actually be there nearly all the time.

Also, Wilson Bilkovich added a new Marshal formatted index that will reduce both bandwidth usage and memory consumption. Instead of 120M or so it takes to do a bulk yaml index update, it takes about 30M with a Marshal index update. You’ll have to wait for the beta to test this one out, though.

Posted in ,  | 7 comments

WTF: The Mythical Business Layer

Eric Hodel | Fri, 28 Sep 2007 07:11:43 GMT

Worse Than Failure made a post a few days ago about, among other things, built-in complexity, especially where its unnecessary and unsuited for getting things done.

Just look at the dreadful specs we’re given to work with:

When a Sale is Cleared, only Managers with Void Approval and Executives may issue a Cancellation Request. If the Propagation Status for the Transferable Receivable is not Pending and the Expense Allocation Type is Reversible, the Cancellation Request is issued for Processing; otherwise, it is issued for Approval.

I’m sure those of you who managed to make it through that spec did not have visions of IF-ELSE code blocks swirling through your head. I’ll bet some of you, without even seeing the rest of specs, excitedly envisioned a CancelationWorkflowProvider that inherited from the abstract RequestWorkflowProvider and implemented the IPermissionRequired, IPropogationStatusRequired, and IExpenseAllocationTypeRequired interfaces, and was powered by the all-encompassing WorkflowManager. Why? Because that’s so much more challenging than writing a simple IF-ELSE code block.

The Mythical Business Layer via Worse Than Failure

While the post focuses on the “business layer” of an application, it is applicable to any development. There’s no need to write that extra library! Start with the core of you want to do, and grow, then refactor, then grow again. Reuse what already exists unless it can’t be molded to your will. If your application code gets too big pull a library out. Don’t write the library up-front, you don’t need it and you won’t need it.

Posted in  | 2 comments

RubyGems Tests Pass on 1.9

Eric Hodel | Thu, 20 Sep 2007 10:00:25 GMT

455 tests, 1600 assertions, 0 failures, 0 errors

Wooo!

Here’s some of the changes and notes I made for you:

  • Removed some privates, because life is better without privates.
  • Added Object#send! stub on 1.8.
  • lambda cares about number of arguments now, so add |*a|.
  • ENV['FOO'] = nil becomes ENV.delete 'FOO'. This is the most annoying change, since restoring defaults is a pain.
  • WEBrick’s response object’s #code alias is gone, use #status
  • (i = 0; 5.times do |i| end; i == 4) is false, so use a separate variable like count, and add count = i
  • Kernel#require stores the full path to the require’d file now.
  • There’s something going on with class variable sharing between a module and its singleton class. See [ruby-core:12200].
  • Strings aren’t Array-like anymore, so use things like Kernel#Array instead of String#to_a
  • #methods and #instance_variables return arrays of symbols instead of strings now.

Also, the tests run 20-25% faster on 1.9 than 1.8. Look for a beta of RubyGems coming next week!

Posted in ,  | 4 comments

Firebrigade Home Page Fixed

Eric Hodel | Tue, 18 Sep 2007 02:40:22 GMT

I denormalized a bit and beat the tests back into shape and the Firebrigade home page is back to life! Next I’m going to sand down a few rough edges on RubyGems to get a beta shipped suitable for feedback.

Firebrigade is now fully vladified using perforce.

Here’s the two setup steps you need for perforce:

  1. Require ‘vlad/perforce’ at the top of config/deploy.rb.
  2. Your .p4config goes in the scm/ directory of the server’s checkout.
  3. Run p4 client in the scm/ directory and set your View to //path/to/project/... //clientname/...

Hopefully we can fully automate this so the vlad:setup_app task can handle this automatically.

I also had to do some custom setup for firebrigade because it uses RubyInline and needs the INLINEDIR set. I just added extra stuff to the setup_app task:

namespace :vlad do remote_task :setup_app do cmds = [ "mkdir #{inline_dir}", "sudo chown www:www #{inline_dir}", ] run cmds.join(' && ') end end

Update: Automatic p4 setup is done!

Posted in ,  | 1 comment

Gem Platform Matching

Eric Hodel | Sat, 25 Aug 2007 20:59:31 GMT

RubyGems now figures out if your platform matches the gem you want to install, and here’s how it does it.

First, the platform is compared to the list of legacy platforms. These are the platform strings that currently exist in the gems.rubyforge.org index. If the platform matches one of these it is expanded into an Array of CPU, OS and OS version. (New platforms are already an Array.)

Next the platform is compared with your RubyGems configured platforms (“ruby” and your OS platform by default) to see if any match. A platform’s CPU will match if it matches the local platform’s CPU exactly or if either side is ‘universal’. The OS must match exactly. Either OS version can be nil, or it must match exactly.

A potential improvement to the platform matching would be to upgrade a platform to a real object from an Array and make the OS version a Gem::Version and encode in each OS’ versioning scheme. I don’t think there is much benefit to that at present since most gems with platforms are for win32 which doesn’t have versions in Config::CONFIG[‘arch’].

Posted in  | 2 comments

Dear Lazyweb: Gem Platforms

Eric Hodel | Tue, 21 Aug 2007 02:53:04 GMT

As you may or may not have heard, RubyGems will be merged into Ruby 1.9 sometime in October. Before this can happen RubyGems needs to automatically install dependencies based on platforms. Fortunately I’ve got the automatic install part written. Unfortunately I don’t know if I’ve got figuring out the platforms right. This is where you come in.

Dear Lazyweb,

Here’s my proposal for how we recognize platforms. From Config::CONFIG, take the arch, split it on ’-’ into cpu and os and run os through a case statement to figure out OS and OS version (if any). Combine the cpu, OS and OS version. This value is your platform.

(There will be a rubygems-platforms.gem much like sources.gem that can be updated as necessary.)

Using the tattle data, the following code recognizes 29 unique platforms:

def match(arch)
  cpu, os = arch.split '-', 2
  cpu, os = nil, cpu if os.nil? # java

  cpu = case cpu
        when /i\d86/ then 'x86'
        else cpu
        end

  os = case os
       when /cygwin/ then            [ 'cygwin',  nil ]
       when /darwin(\d+)?/ then      [ 'darwin',  $1  ]
       when /freebsd(\d+)/ then      [ 'freebsd', $1  ]
       when /^java$/ then            [ 'java',    nil ]
       when /^java([\d.]*)/ then     [ 'java',    $1  ]
       when /linux/ then             [ 'linux',   $1  ]
       when /mingw32/ then           [ 'mingw32', nil ]
       when /mswin32/ then           [ 'mswin32', nil ]
       when /openbsd(\d+\.\d+)/ then [ 'openbsd', $1  ]
       when /solaris(\d+\.\d+)/ then [ 'solaris', $1  ]
       else                          [ 'unknown', nil ]
       end

  [cpu, os].flatten.compact.join("-")
end

require 'rbconfig'

arch = Config::CONFIG['arch']
cpu, os = arch.split '-', 2

puts "Your cpu is:   #{cpu.inspect}" 
puts "Your os is:    #{os.inspect}" 
puts "Your platform is: #{match(arch).inspect}" 

raise "need a tattle arch dump yaml file!" if ARGV.empty?

puts "loading archs..." 

require 'yaml'
archs = YAML.load(ARGF.read)['arch'].keys

def recognize(*archs)
  unmatched = {}
  seen = {}

  archs.each do |arch|
    platform = match arch

    seen[platform] = true
    unmatched[arch] = true if platform =~ /-unknown$/
  end

  return unmatched.keys, seen.keys
end

unmatched, unique = recognize(*archs)

puts "found #{unique.length} unique platforms" 
puts
puts unique.sort.join("\n")

unless unmatched.empty? then
  puts
  puts "unmatched" 
  puts
  puts unmatched.join("\n")
end

Lazyweb, I have two major questions for you:

Did I get something wrong? Am I using autoconf’s target_os correctly? Is Solaris 2.8 really incompatible with Solaris 2.9? What is a 64-bit Windows’ target_os value?

Do I have all the platforms people run Ruby and RubyGems on? If the answer to this one is no, do this: gem install tattle; tattle. (Yes, AIX users, I’m talking to you.)

UPDATE: I switched from target_os and target_cpu to arch to support modern JRuby, thanks Nick Sieger! See ruby-talk:265596.

Posted in  | 7 comments

Finding Random Reading

Eric Hodel | Mon, 20 Aug 2007 03:13:43 GMT

I’m really missing what reddit used to give me, which was things I liked to read that I didn’t know I wanted to read on the front page. Now reddit is full of dups and political stuff I don’t care about. It also has a recomendation feature never worked for me, I couldn’t tell the difference between it and the home page.

Google News solves the dup problem but has too much stuff I don’t care about. Sometimes it makes me laugh, but it still doesn’t tell me what to read, or even what I probably will like.

The recommendation service I love is Netflix’s, I’ve rated over 350 movies now and it is spookily good at picking movies I like. For example 11:14 has a silly-sounding plot summary:

Five seemingly random story lines intersect at precisely 11:14 p.m. in this innovative drama-thriller written and directed by newbie filmmaker Greg Marcks. Even though they’re strangers, Buzzy, Mark, Cheri, Jac and Eddie will become a part of one another’s lives—even if it kills them.

I forgot why I added it to my queue. When it arrived I thought it would be silly, but I really enjoyed it, and that wasn’t the first movie I’ve experienced this with. Also, it tells me to watch things like Afro Samurai and Tinker, Tailor, Soldier, Spy that I would never hear about or know about otherwise.

What I really want is Netflix for for my random web reading. I don’t care about what’s popular, I care about what is well-written and interesting. Does this kind of thing exist yet?

Until then, I think I’m going to switch to clicking wikipedia’s Random article button when I get bored.

Posted in  | 5 comments

Two Weeks of Vacation, Vlad, RubyGems

Eric Hodel | Fri, 17 Aug 2007 21:04:05 GMT

I’m not working this month so I can do whatever I want. So far that’s featured:

Building Vlad was a lot of fun. Ryan and I flew up Wilson Bilkovich, watched Bourne Ultimatum, then hacked for four days straight to bring Vlad into the world.

InfoQ published an interview with us about Vlad:

Capistrano, a popular deployment tool for Rails, is challenged by Vlad the Deployer, a tool which offers similar functionality with a much simpler implementation. We talked to the Ruby Hit Squad group that released version 1.0 of Vlad.

Capistrano gets competition: Vlad the Deployer via InfoQ

The RubyGems hacking has been mostly bug fixes and refactoring so far. I’m working towards teaching RubyGems your platform so it can automatically install the correct version.

Here’s a sample of what’s I’ve done to RubyGems so far:

  • —sources is no longer remembered forever, use `gem sources` to manage the permanent list
  • The sources gem is gone, RubyGems uses a built-in list now (but can be upgraded in the future)
  • `gem list` respects its default of just gem names now
  • Only exact gem names are matched on install, “foo_bar 2.0” won’t install instead of “foo 1.0” if you run `gem install foo`
  • RubyGems requires only what it needs when you require 'rubygems'
  • Fewer bulk updates when updating the gem index
  • `gem dep -r` lists dependencies for remote gems
  • `gem info -r` shows information for remote gems
  • `gem -v` turns on “really verbose” mode (verbose mode is the default)
  • `gem_mirror`, `gem_server`, `gemlock`, `gemri`, `gemwhich`, `index_gem_repository.rb` have been merged into `gem`

Posted in , , ,  | 2 comments

David Black Explains Bang Methods

Eric Hodel | Wed, 15 Aug 2007 18:23:07 GMT

I’ve seen an explosion of silly bang methods that don’t follow Ruby’s usage, and I’ve been meaning to write exactly this post:

In Ruby, you can write methods whose names end in ! (exclamation point or “bang”). There’s a lot of confusion surrounding the matter of when, and why, you would want to do so.

The ! in method names that end with ! means, “This method is dangerous”—or, more precisely, this method is the “dangerous” version of an otherwise equivalent method, with the same name minus the !. “Danger” is relative; the ! doesn’t mean anything at all unless the method name it’s in corresponds to a similar but bang-less method name.

Bang methods; or, Danger, Will Rubyist! via DABlog

Posted in  | 7 comments

Sphincter version 1.1.0 has been released!

Eric Hodel | Tue, 14 Aug 2007 03:10:51 GMT

Sphincter uses Dmytro Shteflyuk’s sphinx Ruby API and automatic configuration to make totally rad ActiveRecord searching. Well, you still have to tell Sphincter what models you want to search. It doesn’t read your mind.

When updating to 1.1.0, run: rake sphincter:setup_sphinx

Changes in 1.1.0:

  • 2 major enhancements:
    • Fields across relationships may be included via add_index.
    • Sphincter now automatically configures Dmytro Shteflyuk’s sphinx API. Run `rake sphincter:setup_sphinx` and check in vendor/plugins/sphinx.
  • 1 bug fix:
    • `rake sphincter:index` task didn’t correctly run reindex. Bug submitted by Lee O’Mara.

http://seattlerb.org/Sphincter

Posted in ,  | 2 comments

Older posts: 1 ... 3 4 5 6 7 ... 20