Hello all;
I needed a working cog in far less time than it will take for me to
understand the intricacies of RAILS plugins and how they interact with
Typo. So, for now, here is the solution I implemented. It uses the
command line LJ posting client 'Clive' -
http://sourceforge.net/projects/ljclive/ to do the actual cross
posting. Eventually I'll re-implement it to use one of the fully
forged Ruby LiveJournal posting APIs.
Here are the diffs to models/article.rb:
---
[EMAIL PROTECTED]/blog/blind_not_dumb/app/models% diff article.rb.1 article.rb
247a248
> after_create :lj_crosspost
269a271,285
> def lj_crosspost
> if (self.body =~ /lj-crosspost: yes/i)
> logger.debug('article: lj_crosspost: Crossposting at ' + Time.now.to_s);
> ljpost = BlueCloth.new(self.body).to_html();
> ljpost.gsub!(/<.?p>/,"");
> logger.debug('ljpost is: ' + ljpost);
> ljpost_path="/tmp/lj_crosspost_#{$$}";
> ljpost_file = File.open(ljpost_path,"w") do |ljc|
> ljc.puts(ljpost);
> end
> logger.debug("about to run command: " + "cat
> #{ljpost_path}|/usr/local/bin/clive -u myljuser -w myljpassword -s
> \"#{self.title}\"");
> logger.debug('output of ljpost command is: ' + `cat
> #{ljpost_path}|/usr/local/bin/clive -u feoh -w d1rtylaundry -s
> "#{self.title}"`);
> end
> end
>
---
A few questions:
* Is there some better place than the article model for me to be
grafting in this kind of cross posting
post processing?
* Where should I start looking if I want to implement this as a plugin?
Thanks for any clues.
-Chris
--
Chris Patti --- Y!: feoh -- AIM: chrisfeohpatti --- E-Mail: [EMAIL PROTECTED]
"The greatest dangers to liberty lurk in insidious encroachment by men of
zeal,well-meaning but without understanding."-- Justice Louis O. Brandeis
(Olmstead vs. United States)
_______________________________________________
Typo-list mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/typo-list