Bugs: Browse | Submit New | Admin

[#26496] My mods to rubyforge gem

Date:
2009-07-02 20:22
Priority:
3
Submitted By:
Tom Copeland (tom)
Assigned To:
Tom Copeland (tom)
Category:
None
State:
Closed
Summary:
My mods to rubyforge gem

Detailed description
Attached.

Add A Comment: Notepad

Please login


Followup

Message
Date: 2009-10-06 23:37
Sender: Tom Copeland

We can close this since the changes have all been merged in and
new versions of the rubyforge gem have been released.
Date: 2009-08-18 15:47
Sender: Tom Copeland

Also, would you mind reposting your comment over on the forum?
That way other folks can see it and weigh in... thanks!

Yours,

Tom
Date: 2009-08-18 15:46
Sender: Tom Copeland

Hi 7rans -

Will reply more later, but just FYI, I had "7rans"
in the beta list - I've changed that to "transami"
so that you can use that account instead.

Yours,

Tom
Date: 2009-08-17 15:58
Sender: 7rans 

Hi--

Looked over the code this afternoon. I'm glad to see this is
coming along.

I have one significant issue I'd like to see addressed. I'd like
to see an extra layer of code separation in the design. Right
now the calls are tightly tied into how rubyforge qua execuable
handles configuration. In other words I'd like to see a clean
functional layer below the current one --something others can
use to easily interact with Rubyforge if they wish to do so in
a way other then how the rubyforge program does.

Let me give an specific example to be clear. In the code:

  def add_release(group_id, package_id, release_name, *files)
    group_id        = lookup "group", group_id
    package_id      = lookup "package", package_id
    release_date    = @userconfig["release_date"]
    release_notes   = @userconfig["release_notes"]
    release_changes = @userconfig["release_changes"]
    preformatted    = @userconfig["preformatted"]
    ...

Notice the settings release_* are being pulled from @userconfig.
This function ends by calling #run. In #run we see:

  def run(page, form, extheader={}) # :nodoc:
    uri = self.uri + page
    puts "client.post_content #{uri.inspect}, #{form.inspect},
#{extheader.inspect}" if $DEBUG
    response = client.post_content uri, form, extheader,
@userconfig
    puts response if $DEBUG
    response
  end

And here we see the whole of @userconfig being passed to the
backend client. This is tight coupling, as well as redundant.
It would be cleaner to create a completely separate layer as
a superclass of the current one that defines something like:

  def add_release(group_id, package_id, release_name, config,
*files)
    group_id        = group_id
    package_id      = package_id
    release_date    = config["release_date"]
    release_notes   = config["release_notes"]
    release_changes = config["release_changes"]
    preformatted    = config["preformatted"]
    ...

And likewise for #run, that does not depend on any global config,
but rather must receive all relevant parameters via the method
interface.

The separation should be clean enough that conceivably we could
create a 'rubyforge-api' gem that the 'rubyforge' gem depends
on (though separate gems are not necessary, I'm just clarifying
the point about the clean code separation).

HTH. Let me know if you would like me to put a little elbow grease
behind this idea (I would need some help with certain details,
but I could certainly do the bulk of the work).
Date: 2009-08-06 14:55
Sender: Tom Copeland

Updated with json dependency.
Date: 2009-08-06 13:49
Sender: Tom Copeland

A test rubyforge 1.0.5 gem.
Date: 2009-07-03 02:20
Sender: Tom Copeland

Nope.  Blah.
Date: 2009-07-03 02:20
Sender: Tom Copeland

Can't seem to delete old file... maybe needs a comment?
Date: 2009-07-03 02:20
Sender: Tom Copeland

Fixed.
Date: 2009-07-03 01:00
Sender: Tom Copeland

Bah, there's another call that needs to be translated from HTML
scraping to /users/:username.  I'll fix that.

Attached Files:

Name Description Download
rubyforge-1.0.5.gem Tue Aug 11 10:00:31 EDT 2009 Download
mods.tar.gz mods to rubyforge gem Download
mods.tar.gz gem code Download
rubyforge-1.0.5.gem Thu Aug 6 09:49:02 EDT 2009 Download
rubyforge-1.0.5.gem Thu Aug 6 10:54:50 EDT 2009 Download
rubyforge-1.0.5.gem Thu Aug 27 21:26:07 EDT 2009 Download
rubyforge-1.1.0.gem Fri Sep 18 13:55:39 EDT 2009 Download
rubyforge-1.1.0.gem Fri Sep 18 14:43:25 EDT 2009 Download
rubyforge-2.0.0.gem Fri Sep 18 21:57:45 EDT 2009 Download

Changes:

Field Old Value Date By
status_idOpen2009-10-06 23:37tom
assigned_tonone2009-10-06 23:37tom
close_date2009-10-06 23:372009-10-06 23:37tom
File Added4734: rubyforge-2.0.0.gem2009-09-19 01:57tom
File Added4733: rubyforge-1.1.0.gem2009-09-18 18:43tom
File Added4731: rubyforge-1.1.0.gem2009-09-18 17:55tom
File Added4702: rubyforge-1.0.5.gem2009-08-28 01:26tom
File Added4677: rubyforge-1.0.5.gem2009-08-11 14:01tom
File Added4668: rubyforge-1.0.5.gem2009-08-06 14:55tom
File Added4667: rubyforge-1.0.5.gem2009-08-06 13:49tom
File Added4592: mods.tar.gz2009-07-03 02:19tom
File Added4591: mods.tar.gz2009-07-02 20:22tom