[ANN] rubyrss-1.0

Dear Ruby community,

I'm glad to announce initial release of RubyRSS tool.
http://rubyforge.org/projects/rubyrss/

WHAT IS A RUBYRSS

Elegant as Ruby RSS parser and generator intended to help you bring
together Ruby and RSS in your project. Features include creation of
custom (x)HTML news blocks from remote RSS feeds, generation of
RSS-feeds using templates, and more.

HOW TO PARSE RSS-FEED

require "rubyrss"

rss = RubyRSS.new "http://www.games-mix.com/rss-feed.xml"
rss.parse

HOW TO GENERATE RSS-FEED

require "rubyrss"

rss = RubyRSS.new "rss-feed.xml"
rss.title = "Sample RSS-feed"
rss.link = "http://www.rubyrss.com"
rss.desc = "Sample RSS-feed generated by RubyRSS"
rss.date = Time.now.gmtime
1.upto(10) { |i|
  rss.items << RubyRSS::Item.new(
    "title-" + i.to_s,
    "#" + String(i),
    "description-#{i}",
    Time.now.gmtime
  )
}
rss.generate "rss2.0"

I'll be happy to hear your feedback.

···

--
Sincerely,
Sergey Tikhonov
http://dairon.net

Hi!

Dear Ruby community,

I'm glad to announce initial release of RubyRSS tool.
http://rubyforge.org/projects/rubyrss/

<snip>

I'll be happy to hear your feedback.

--
Sincerely,
Sergey Tikhonov
http://dairon.net

Hey Sergey-

  Looks like a nice little package. But I think you overlooked one thing. You need to mention in your README that your library requires simple-rss from rubyforge to be installed before your library will work.

Cheers-
-Ezra

···

On Jun 9, 2006, at 9:50 AM, Sergey Tikhonov wrote:

Hi,

In <1245215241.20060609234946@iplayful.com>
  "[ANN] rubyrss-1.0" on Sat, 10 Jun 2006 01:50:00 +0900,

HOW TO GENERATE RSS-FEED

require "rubyrss"

rss = RubyRSS.new "rss-feed.xml"
rss.title = "Sample RSS-feed"
rss.link = "http://www.rubyrss.com"
rss.desc = "Sample RSS-feed generated by RubyRSS"
rss.date = Time.now.gmtime
1.upto(10) { |i|
  rss.items << RubyRSS::Item.new(
    "title-" + i.to_s,
    "#" + String(i),
    "description-#{i}",
    Time.now.gmtime
  )
}
rss.generate "rss2.0"

We can use RSS Maker standard distributed library:

  require 'rss/maker'

  rss = RSS::Maker.make("2.0") do |maker|
    maker.channel.title = "Sample RSS-feed"
    maker.channel.link = "http://www.rubyrss.com"
    maker.channel.description = "Smaple RSS-feed generated by RubyRSS"
    maker.channel.date = Time.now.gmtime
    1.upto(10) do |i|
      item = maker.items.new_item
      item.title = "title-#{i}"
      item.link = "##{i}"
      item.description = "description-#{i}"
      item.date = Time.now.gmtime
    end
  end

  File.open("rss-feed.xml", "w") do |f|
    f.print(rss.to_s)
  end

Thanks,

···

Sergey Tikhonov <st@iplayful.com> wrote:
--
kou

Dear Ezra,

Thank you. I've added following info to README:

RubyRSS depends on SimpleRSS library. To install it you can
use following command:

···

gem install simple-rss --remote

--
Sincerely,
Sergey Tikhonov
http://dairon.net

Original message (10.06.2006, 3:20) follows.

Hey Sergey-

  Looks like a nice little package. But I think you overlooked one
thing. You need to mention in your README that your library requires
simple-rss from rubyforge to be installed before your library will
work.

Cheers-
-Ezra

Inasmuch as it is possible, I really think that the RSS libraries
should implement a generic RSS-style description framework and then
have version-specific generators.

This is something that I was working on a few years ago, but I have
long-since decided that when I get back to working on Ruwiki, RSS will
be templatized. It's far easier to deal with templates than a full-on
RSS library.

-austin

···

--
Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/
               * austin@halostatue.ca * http://www.halostatue.ca/feed/
               * austin@zieglers.ca

No. Use rubygems' dependency feature.

···

On Jun 9, 2006, at 7:34 PM, Sergey Tikhonov wrote:

Original message (10.06.2006, 3:20) follows.

Looks like a nice little package. But I think you overlooked one
thing. You need to mention in your README that your library requires
simple-rss from rubyforge to be installed before your library will
work.

Thank you. I've added following info to README:

RubyRSS depends on SimpleRSS library. To install it you can
use following command:

gem install simple-rss --remote

--
Eric Hodel - drbrain@segment7.net - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com

Hi,

In <9e7db9110606140759y89c73bet614a9b1708de4186@mail.gmail.com>
  "Re: [ANN] rubyrss-1.0" on Wed, 14 Jun 2006 23:59:25 +0900,

Inasmuch as it is possible, I really think that the RSS libraries
should implement a generic RSS-style description framework and then
have version-specific generators.

rss/maker standard distributed library may have features
what you want. What you want features are showed by the
following code?

  def setup_maker(maker)
    maker.channel.XXX = XXX
    ...
    item = maker.items.new_item
    # We can set content:encoded whenever specified version
    # is "0.91", "1.0" or "2.0". If specified version is
    # "0.91" or "2.0", the value is just ignored.
    item.content_encoded = XXX
    ...
  end

  ["0.91", "1.0", "2.0"].each do |version|
    rss = RSS::Maker.make(version) do |maker|
      setup_maker(maker)
    end
    File.open("#{veresion}.xml", "w") do |f|
      f.print(rss.to_s)
    end
  end

I may not understand what you mean. Can I satisfy you?

Thanks,

···

"Austin Ziegler" <halostatue@gmail.com> wrote:
--
kou

In <9e7db9110606140759y89c73bet614a9b1708de4186@mail.gmail.com>
  "Re: [ANN] rubyrss-1.0" on Wed, 14 Jun 2006 23:59:25 +0900,

Inasmuch as it is possible, I really think that the RSS libraries
should implement a generic RSS-style description framework and then
have version-specific generators.

rss/maker standard distributed library may have features
what you want. What you want features are showed by the
following code?

  def setup_maker(maker)
    maker.channel.XXX = XXX
    ...
    item = maker.items.new_item
    # We can set content:encoded whenever specified version
    # is "0.91", "1.0" or "2.0". If specified version is
    # "0.91" or "2.0", the value is just ignored.
    item.content_encoded = XXX
    ...
  end

  ["0.91", "1.0", "2.0"].each do |version|
    rss = RSS::Maker.make(version) do |maker|
      setup_maker(maker)
    end
    File.open("#{veresion}.xml", "w") do |f|
      f.print(rss.to_s)
    end
  end

I'm thinking more something like:

  rss = RSS.new do |r|
    r.channel.XXX = XXX
  ...
  r.items.new_item do |i|
    i.content_encoded = YYY
  end
  ...
  end

  %w(0.91 1.0 2.0).each do |version|
    File.open("#{version}.xml", "w") do |f|
    f.print(rss.to_xml(version))
  end
  end

The difference is that you create three "external" objects to satisfy
0.91, 1.0, and 2.0. I would create one "external" object and create
other objects on-the-fly. This might be:

  class RSS
    def to_xml(version = nil)
    version ||= @default_version
    rss.to_version(version).to_xml
  end
  end

Similarly, it would be nice to have something like:

  rss = RSS.from_file("0.91.xml")
  File.open("2.0.xml") { |f| f.print rss.to_xml("2.0") }

I may not understand what you mean. Can I satisfy you?

Probably not, but that's because I'm not really looking to use an RSS
class to generate RSS these days; I really have become convinced that
templates are the right answer.

The above, however, is the direction I was headed when I was working on
an RSS library, and I still think that it's the right direction. I
shouldn't have to care what *version* I'm in until I output and if I
specify a version on object creation, it should be advisory only (or the
default output version, as shown above).

-austin

···

On 6/14/06, Kouhei Sutou <kou@cozmixng.org> wrote:

  "Austin Ziegler" <halostatue@gmail.com> wrote:

--
Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/
               * austin@halostatue.ca * You are in a maze of twisty little passages, all alike. // halo • statue
               * austin@zieglers.ca

Hi,

In <9e7db9110606140929i710f5c61n2d7f93ab6bae503@mail.gmail.com>
  "Re: [ANN] rubyrss-1.0" on Thu, 15 Jun 2006 01:29:29 +0900,

I'm thinking more something like:

  rss = RSS.new do |r|
    r.channel.XXX = XXX
  ...
  r.items.new_item do |i|
    i.content_encoded = YYY
  end
  ...
  end

It seems good that items.new_item do ... end style. I'll
add codes that support your style to RSS Maker.

  %w(0.91 1.0 2.0).each do |version|
    File.open("#{version}.xml", "w") do |f|
    f.print(rss.to_xml(version))
  end
  end

The difference is that you create three "external" objects to satisfy
0.91, 1.0, and 2.0. I would create one "external" object and create
other objects on-the-fly. This might be:

  class RSS
    def to_xml(version = nil)
    version ||= @default_version
    rss.to_version(version).to_xml
  end
  end

I see. I probably understand your idea. What about the
following idea:

  require 'rss'

  module RSS
    module RootElementMixin
      def to_xml(version=nil)
        if version.nil? or version == @rss_version
          to_s
        else
          RSS::Maker.make(version) do |maker|
            setup_maker(maker)
          end.to_s
        end
      end
    end
  end

  rss = RSS::Maker.make(...) do
    ...
  end

  %w(0.91 1.0 2.0).each do |version|
    File.open("#{version}.xml", "w") do |f|
      f.print(rss.to_xml(version))
    end
  end

Similarly, it would be nice to have something like:

  rss = RSS.from_file("0.91.xml")
  File.open("2.0.xml") { |f| f.print rss.to_xml("2.0") }

Now, we can write like the following:

  rss = RSS::Parser.parse("0.91.xml")
  File.open("2.0.xml") {|f| f.print rss.to_xml("2.0")}

If the above RSS::RootElementMixin#to_xml satisfies you,
I'll commit those changes to Ruby's CVS.

Thanks,

···

"Austin Ziegler" <halostatue@gmail.com> wrote:
--
kou

I think it'd work. It'll save having to deal with the conversion and
extra objects until they are absolutely needed.

-austin

···

On 6/15/06, Kouhei Sutou <kou@cozmixng.org> wrote:

If the above RSS::RootElementMixin#to_xml satisfies you,
I'll commit those changes to Ruby's CVS.

--
Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/
               * austin@halostatue.ca * You are in a maze of twisty little passages, all alike. // halo • statue
               * austin@zieglers.ca