Is it OK to just require bbcode-to-md in importers?


(Jay Pfaffman) #1

TL;DR: When I submit a PR for vbulletin.rb (I added support for assigning admins and moderators, and maybe something else), can I include code that requires ruby-bbcode-to-md so that it just works?

Painful Explanation

I’ve been running and writing importers for about a year now and this is the first time that I’ve managed to include ruby-bbcode-to-md.

When I follow these directions I get some kind of version error:

If I instead do this:

  puts "echo gem \\'ruby-bbcode-to-md\\' >> Gemfile"
  puts "bundle install"

and

@bbcode_to_md  = true
  require 'ruby-bbcode-to-md'

It works. And there’s no mention of the bbcode-to-me command line argument in vbulletin.rb, so unless someone running the script instinctively reads base.rb, they don’t have much chance of knowing about that. And the importer is pretty much broken without it.

Wait, there is this comment # convert *-tags to li-tags so bbcode-to-md can do its magic on phpBB's lists: but even then, there’s no hint how to make that happen.


(Gerhard Schlager) #2

It’s already in the Gemfile. :wink:

Just set the environment variable IMPORT=1 before your run bundle install or execute the import script.