summaryrefslogtreecommitdiff
path: root/feed2imap-test
diff options
context:
space:
mode:
authorAntonio Terceiro <terceiro@softwarelivre.org>2013-08-27 23:21:16 -0300
committerAntonio Terceiro <terceiro@softwarelivre.org>2013-08-27 23:23:57 -0300
commit4ef193a6116eac53b64551fd54e934ec5804b94e (patch)
tree1df27a4f81d6fc55a0b25300a430c2c1d7e1e8b5 /feed2imap-test
parent247cbbc6961508d4c8fee78a98a5ac0a841a67fd (diff)
downloadfeed2imap-4ef193a6116eac53b64551fd54e934ec5804b94e.tar.gz
feed2imap-4ef193a6116eac53b64551fd54e934ec5804b94e.tar.bz2
feed2imap-4ef193a6116eac53b64551fd54e934ec5804b94e.zip
Add program for manual tests
Diffstat (limited to '')
-rwxr-xr-xfeed2imap-test40
1 files changed, 40 insertions, 0 deletions
diff --git a/feed2imap-test b/feed2imap-test
new file mode 100755
index 0000000..b976bea
--- /dev/null
+++ b/feed2imap-test
@@ -0,0 +1,40 @@
+#!/usr/bin/ruby
+
+require 'fileutils'
+require 'yaml'
+
+base = File.expand_path(File.dirname(__FILE__))
+tmp = File.join(base, 'tmp')
+
+FileUtils.rm_rf(tmp)
+FileUtils.mkdir_p(tmp)
+
+# target maildir
+maildir = File.join(tmp,'Mail')
+FileUtils.mkdir_p(File.join(maildir, 'new'))
+FileUtils.mkdir_p(File.join(maildir, 'cur'))
+FileUtils.mkdir_p(File.join(maildir, 'tmp'))
+
+cache = File.join(tmp, 'cache')
+config_data = <<EOF
+cache: #{cache}
+feeds:
+ - name: CNPQ
+ url: http://www.cnpq.br/web/guest/noticias/-/asset_publisher/6QsO/rss?p_p_cacheability=cacheLevelPage
+ target: maildir://#{maildir}
+ - name: XKCD
+ url: http://www.xkcd.com/atom.xml
+ target: maildir://#{maildir}
+EOF
+config = File.join(tmp, 'feed2imap.yaml')
+File.open(config, 'w') do |f|
+ f.write(config_data)
+end
+
+system('ruby', "-I#{base}/lib", "#{base}/bin/feed2imap", '--config', config, '--verbose') || exit(1)
+
+print "Open target maildir with mutt? [Y/n]"
+response = gets.strip
+if response.downcase == 'y' || response == ''
+ exec('mutt', '-f', maildir)
+end