The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Okay, finally done with infrastructure (for now)

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Gregory Brown

Posts: 172
Nickname: greg7224
Registered: Nov, 2005

Gregory Brown is the author of Ruby Reports (ruport)
Okay, finally done with infrastructure (for now) Posted: Jun 10, 2006 5:36 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Gregory Brown.
Original Post: Okay, finally done with infrastructure (for now)
Feed Title: Ruby Reports Blog
Feed URL: http://www.cwinters.com/blog/index.rss
Feed Description: News and Updates regarding the Ruby Reports library and toolset.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Gregory Brown
Latest Posts From Ruby Reports Blog

Advertisement

Now that I have my nice little vim integration script for Infogami, I'm happy.

If anyone is curious, here's what it looks like:

require "rubygems"
require "mechanize"
require "redcloth"

class WWW::Form
  def field(field_name)
    self.fields.find { |f| f.name.eql? field_name }
  end
end

entry = ARGF.read.to_a
title = entry[0].chomp
body  = entry[2..-1].join
url = title.gsub(" ","_").downcase

agent = WWW::Mechanize.new

agent.get "http://ruport.infogami.com/_edit/blog/_add"
form = agent.page.forms[0]

form.field("url").value = url
form.field("title").value = title
form.field("body").value = RedCloth.new(body).to_html

begin
  agent.submit(form, form.buttons.first)
rescue WWW::ResponseCodeError
  nil
end

Now that I've got a happy home, I can start working on Ruport's Fetchable module, which will abstract data acquisition, and hopefully politely open the doors to ActiveRecord.

There's no turning back, Ruport on Rails is a go.

Read: Okay, finally done with infrastructure (for now)

Topic: You Can Have Your Tada List - I'll Take the Milk Previous Topic   Next Topic Topic: Borat finds a new stakeholder

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use