Permalink
Browse files

Adding the files

git-svn-id: svn+ssh://rubyforge.org/var/svn/simple-rss/trunk@28 b2309148-6e07-0410-9955-f6886f063a3d
  • Loading branch information...
0 parents commit 437b6a6d698814343dbf6e82ddd2a2216ae932fa cardmagic committed Feb 2, 2006
Showing with 1,857 additions and 0 deletions.
  1. +429 −0 LICENSE
  2. +40 −0 README
  3. +212 −0 Rakefile
  4. +40 −0 install.rb
  5. +131 −0 lib/simple-rss.rb
  6. +51 −0 test/base/base_test.rb
  7. +45 −0 test/data/atom.xml
  8. +8 −0 test/data/not-rss.xml
  9. +79 −0 test/data/rss09.rdf
  10. +818 −0 test/data/rss20.xml
  11. +4 −0 test/test_helper.rb
429 LICENSE

Large diffs are not rendered by default.

Oops, something went wrong.
40 README
@@ -0,0 +1,40 @@
+== Welcome to Simple RSS
+
+Simple RSS is a simple, flexible, extensible, and liberal RSS and Atom reader for Ruby. It is designed to be backwards compatible with the standard RSS parser, but will never do RSS generation.
+
+== Download
+
+* gem install simple-rss
+* http://rubyforge.org/projects/simple-rss
+* svn co http://rufy.com/svn/simple-rss/trunk
+
+=== Usage
+The API is similar to Ruby's standard RSS parser:
+
+ require 'rubygems'
+ require 'simple-rss'
+ require 'open-uri'
+
+ rss = SimpleRSS.parse open('http://slashdot.org/index.rdf')
+
+ rss.channel.title # => "Slashdot"
+ rss.channel.link # => "http://slashdot.org/"
+ rss.items.first.link # => "http://books.slashdot.org/article.pl?sid=05/08/29/1319236&from=rss"
+
+But since the parser can read Atom feeds as easily as RSS feeds, there are optional aliases that allow more atom like reading:
+
+ rss.feed.title # => "Slashdot"
+ rss.feed.link # => "http://slashdot.org/"
+ rss.entries.first.link # => "http://books.slashdot.org/article.pl?sid=05/08/29/1319236&from=rss"
+
+The parser does not care about the correctness of the XML as it does not use an XML library to read the information. Thus it is flexible and allows for easy extending via:
+
+ SimpleRSS.feed_tags << :some_new_tag
+
+== Authors
+* Lucas Carlson (mailto:lucas@rufy.com)
+
+Inspired by Blagg (http://www.raelity.org/lang/perl/blagg) from Rael Dornfest.
+
+This library is released under the terms of the GNU LGPL.
+
212 Rakefile
@@ -0,0 +1,212 @@
+require 'rubygems'
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+require 'rake/gempackagetask'
+require 'rake/contrib/rubyforgepublisher'
+require File.dirname(__FILE__) + '/lib/simple-rss'
+
+PKG_VERSION = SimpleRSS::VERSION
+PKG_NAME = "simple-rss"
+PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
+RUBY_FORGE_PROJECT = "simple-rss"
+RUBY_FORGE_USER = ENV['RUBY_FORGE_USER'] || "cardmagic"
+RELEASE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
+
+PKG_FILES = FileList[
+ "lib/*", "bin/*", "test/**/*", "[A-Z]*", "Rakefile", "html/**/*"
+]
+
+desc "Default Task"
+task :default => [ :test ]
+
+# Run the unit tests
+desc "Run all unit tests"
+Rake::TestTask.new("test") { |t|
+ t.libs << "lib"
+ t.pattern = 'test/*/*_test.rb'
+ t.verbose = true
+}
+
+# Make a console, useful when working on tests
+desc "Generate a test console"
+task :console do
+ verbose( false ) { sh "irb -I lib/ -r 'simple-rss'" }
+end
+
+# Genereate the RDoc documentation
+desc "Create documentation"
+Rake::RDocTask.new("doc") { |rdoc|
+ rdoc.title = "Simple RSS - A Flexible RSS and Atom reader for Ruby"
+ rdoc.rdoc_dir = 'html'
+ rdoc.rdoc_files.include('README')
+ rdoc.rdoc_files.include('lib/*.rb')
+}
+
+# Genereate the package
+spec = Gem::Specification.new do |s|
+
+ #### Basic information.
+
+ s.name = 'simple-rss'
+ s.version = PKG_VERSION
+ s.summary = <<-EOF
+ A simple, flexible, extensible, and liberal RSS and Atom reader for Ruby. It is designed to be backwards compatible with the standard RSS parser, but will never do RSS generation.
+ EOF
+ s.description = <<-EOF
+ A simple, flexible, extensible, and liberal RSS and Atom reader for Ruby. It is designed to be backwards compatible with the standard RSS parser, but will never do RSS generation.
+ EOF
+
+ #### Which files are to be included in this gem? Everything! (Except CVS directories.)
+
+ s.files = PKG_FILES
+
+ #### Load-time details: library and application (you will need one or both).
+
+ s.require_path = 'lib'
+
+ #### Documentation and testing.
+
+ s.has_rdoc = true
+
+ #### Author and project details.
+
+ s.author = "Lucas Carlson"
+ s.email = "lucas@rufy.com"
+ s.homepage = "http://simple-rss.rubyforge.org/"
+end
+
+Rake::GemPackageTask.new(spec) do |pkg|
+ pkg.need_zip = true
+ pkg.need_tar = true
+end
+
+desc "Report code statistics (KLOCs, etc) from the application"
+task :stats do
+ require 'code_statistics'
+ CodeStatistics.new(
+ ["Library", "lib"],
+ ["Units", "test"]
+ ).to_s
+end
+
+desc "Publish new documentation"
+task :publish do
+ Rake::RubyForgePublisher.new('simple-rss', 'cardmagic').upload
+end
+
+
+desc "Publish the release files to RubyForge."
+task :upload => [:package] do
+ files = ["gem", "tar.gz", "zip"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" }
+
+ if RUBY_FORGE_PROJECT then
+ require 'net/http'
+ require 'open-uri'
+
+ project_uri = "http://rubyforge.org/projects/#{RUBY_FORGE_PROJECT}/"
+ project_data = open(project_uri) { |data| data.read }
+ group_id = project_data[/[?&]group_id=(\d+)/, 1]
+ raise "Couldn't get group id" unless group_id
+
+ # This echos password to shell which is a bit sucky
+ if ENV["RUBY_FORGE_PASSWORD"]
+ password = ENV["RUBY_FORGE_PASSWORD"]
+ else
+ print "#{RUBY_FORGE_USER}@rubyforge.org's password: "
+ password = STDIN.gets.chomp
+ end
+
+ login_response = Net::HTTP.start("rubyforge.org", 80) do |http|
+ data = [
+ "login=1",
+ "form_loginname=#{RUBY_FORGE_USER}",
+ "form_pw=#{password}"
+ ].join("&")
+ http.post("/account/login.php", data)
+ end
+
+ cookie = login_response["set-cookie"]
+ raise "Login failed" unless cookie
+ headers = { "Cookie" => cookie }
+
+ release_uri = "http://rubyforge.org/frs/admin/?group_id=#{group_id}"
+ release_data = open(release_uri, headers) { |data| data.read }
+ package_id = release_data[/[?&]package_id=(\d+)/, 1]
+ raise "Couldn't get package id" unless package_id
+
+ first_file = true
+ release_id = ""
+
+ files.each do |filename|
+ basename = File.basename(filename)
+ file_ext = File.extname(filename)
+ file_data = File.open(filename, "rb") { |file| file.read }
+
+ puts "Releasing #{basename}..."
+
+ release_response = Net::HTTP.start("rubyforge.org", 80) do |http|
+ release_date = Time.now.strftime("%Y-%m-%d %H:%M")
+ type_map = {
+ ".zip" => "3000",
+ ".tgz" => "3110",
+ ".gz" => "3110",
+ ".gem" => "1400"
+ }; type_map.default = "9999"
+ type = type_map[file_ext]
+ boundary = "rubyqMY6QN9bp6e4kS21H4y0zxcvoor"
+
+ query_hash = if first_file then
+ {
+ "group_id" => group_id,
+ "package_id" => package_id,
+ "release_name" => RELEASE_NAME,
+ "release_date" => release_date,
+ "type_id" => type,
+ "processor_id" => "8000", # Any
+ "release_notes" => "",
+ "release_changes" => "",
+ "preformatted" => "1",
+ "submit" => "1"
+ }
+ else
+ {
+ "group_id" => group_id,
+ "release_id" => release_id,
+ "package_id" => package_id,
+ "step2" => "1",
+ "type_id" => type,
+ "processor_id" => "8000", # Any
+ "submit" => "Add This File"
+ }
+ end
+
+ query = "?" + query_hash.map do |(name, value)|
+ [name, URI.encode(value)].join("=")
+ end.join("&")
+
+ data = [
+ "--" + boundary,
+ "Content-Disposition: form-data; name=\"userfile\"; filename=\"#{basename}\"",
+ "Content-Type: application/octet-stream",
+ "Content-Transfer-Encoding: binary",
+ "", file_data, ""
+ ].join("\x0D\x0A")
+
+ release_headers = headers.merge(
+ "Content-Type" => "multipart/form-data; boundary=#{boundary}"
+ )
+
+ target = first_file ? "/frs/admin/qrs.php" : "/frs/admin/editrelease.php"
+ http.post(target + query, data, release_headers)
+ end
+
+ if first_file then
+ release_id = release_response.body[/release_id=(\d+)/, 1]
+ raise("Couldn't get release id") unless release_id
+ end
+
+ first_file = false
+ end
+ end
+end
@@ -0,0 +1,40 @@
+require 'rbconfig'
+require 'find'
+require 'ftools'
+
+include Config
+
+# this was adapted from rdoc's install.rb by ways of Log4r
+
+$sitedir = CONFIG["sitelibdir"]
+unless $sitedir
+ version = CONFIG["MAJOR"] + "." + CONFIG["MINOR"]
+ $libdir = File.join(CONFIG["libdir"], "ruby", version)
+ $sitedir = $:.find {|x| x =~ /site_ruby/ }
+ if !$sitedir
+ $sitedir = File.join($libdir, "site_ruby")
+ elsif $sitedir !~ Regexp.quote(version)
+ $sitedir = File.join($sitedir, version)
+ end
+end
+
+makedirs = %w{ shipping }
+makedirs.each {|f| File::makedirs(File.join($sitedir, *f.split(/\//)))}
+
+Dir.chdir("lib")
+begin
+ require 'rubygems'
+ require 'rake'
+rescue LoadError
+ puts
+ puts "Please install Gem and Rake from http://rubyforge.org/projects/rubygems and http://rubyforge.org/projects/rake"
+ puts
+ exit(-1)
+end
+
+files = FileList["**/*"]
+
+# File::safe_unlink *deprecated.collect{|f| File.join($sitedir, f.split(/\//))}
+files.each {|f|
+ File::install(f, File.join($sitedir, *f.split(/\//)), 0644, true)
+}
Oops, something went wrong.

0 comments on commit 437b6a6

Please sign in to comment.