Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 13
- Log:
Initial import of Typo 2.6.0 sources from a downloaded Tarball.
Typo is a Ruby On Rails based blog engine.
- Author:
- adh
- Date:
- Sat Jul 22 22:25:02 +0100 2006
- Size:
- 1694 Bytes
1 | #!/usr/bin/env ruby |
2 | |
3 | # RSS 0.9/2.0 converter for typo by Chris Lee <clee@kde.org> |
4 | # |
5 | # No need to make a backup of the original blog, really. This takes a URL for a |
6 | # read-only import, so there's not really any chance of it munging the original |
7 | # blog's data, unless somehow an HTTP GET causes your blog server to ignite. |
8 | # |
9 | # Even so, this script is still PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. |
10 | |
11 | require File.dirname(__FILE__) + '/../../config/environment' |
12 | require 'optparse' |
13 | require 'net/http' |
14 | require 'rss/2.0' |
15 | |
16 | class RSSMigrate |
17 | attr_accessor :options |
18 | |
19 | def initialize |
20 | self.options = {} |
21 | self.parse_options |
22 | self.convert_entries |
23 | end |
24 | |
25 | def convert_entries |
26 | feed = Net::HTTP.get(URI.parse(self.options[:url])) |
27 | rss = RSS::Parser.parse(feed) |
28 | puts "Converting #{rss.items.length} entries..." |
29 | rss.items.each do |item| |
30 | puts "Converting '#{item.title}'" |
31 | a = Article.new |
32 | a.author = self.options[:author] |
33 | a.title = item.title |
34 | a.body = item.description |
35 | a.created_at = item.pubDate |
36 | a.save |
37 | end |
38 | end |
39 | |
40 | def parse_options |
41 | OptionParser.new do |opt| |
42 | opt.banner = 'Usage: rss.rb [options]' |
43 | |
44 | opt.on('-a', '--author AUTHOR', 'Username of author in typo') do |a| |
45 | self.options[:author] = a |
46 | end |
47 | |
48 | opt.on('-u', '--url URL', 'URL of RSS feed to import.') do |u| |
49 | self.options[:url] = u |
50 | end |
51 | |
52 | opt.on_tail('-h', '--help', 'Show this message.') do |
53 | puts opt |
54 | exit |
55 | end |
56 | |
57 | opt.parse!(ARGV) |
58 | end |
59 | |
60 | unless self.options.include?(:author) and self.options.include?(:url) |
61 | puts 'See rss.rb --help for help.' |
62 | exit |
63 | end |
64 | end |
65 | end |
66 | |
67 | RSSMigrate.new |