phpBB 3 Importer (old)

bundle exec script/import_scripts/phpbb3.rb bbcode-to-md fails with:

bundler: not executable: script/import_scripts/phpbb3.rb

I tried using bundle exec ruby script/import_scripts/phpbb3.rb bbcode-to-md too which results in the following error:

/var/www/discourse/script/import_scripts/base.rb:11:in `require': cannot load such file -- ruby-bbcode-to-md (LoadError)
        from /var/www/discourse/script/import_scripts/base.rb:11:in `<top (required)>'
        from script/import_scripts/phpbb3.rb:1:in `require'
        from script/import_scripts/phpbb3.rb:1:in `<main>'

Here are the steps to reproduce this:

  • Bootstrap a new Docker image and log in with ./launcher ssh app
  • Install ruby-bbcode-to-md as root:
    cd /tmp
    git clone https://github.com/nlalonde/ruby-bbcode-to-md.git
    cd ruby-bbcode-to-md
    gem build ruby-bbcode-to-md.gemspec
    gem install ruby-bbcode-to-md-0.0.13.gem
  • Install the mysql2 gem as root:
    apt-get update && apt-get install libmysqlclient-dev
    gem install mysql2
  • Change the user and execute the importer:
    su - discourse
    cd /var/www/discourse
    RAILS_ENV=production ruby script/import_scripts/phpbb3.rb bbcode-to-md

It works without the bbcode-to-md, but fails when that parameter is used. Here’s the complete error message with stacktrace:

/usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.7.0/lib/bundler/runtime.rb:34:in `block in setup': You have already activated i18n 0.6.11, but your Gemfile requires i18n 0.6.9. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
        from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.7.0/lib/bundler/runtime.rb:19:in `setup'
        from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.7.0/lib/bundler.rb:121:in `setup'
        from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.7.0/lib/bundler/setup.rb:7:in `<top (required)>'
        from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `require'
        from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
        from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require'
        from /var/www/discourse/config/boot.rb:6:in `<top (required)>'
        from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /var/www/discourse/config/application.rb:1:in `<top (required)>'
        from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /var/www/discourse/config/environment.rb:2:in `<top (required)>'
        from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /var/www/discourse/script/import_scripts/base.rb:19:in `initialize'
        from script/import_scripts/phpbb3.rb:14:in `initialize'
        from script/import_scripts/phpbb3.rb:295:in `new'
        from script/import_scripts/phpbb3.rb:295:in `<main>'

As I said in my previous post I think it’s because of the ruby-bbcode-to-md gem, which installs a bunch of dependencies:

root@docker-app:/tmp/ruby-bbcode-to-md# gem install ruby-bbcode-to-md-0.0.13.gem
Fetching: i18n-0.6.11.gem (100%)
Successfully installed i18n-0.6.11
Fetching: thread_safe-0.3.4.gem (100%)
Successfully installed thread_safe-0.3.4
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: minitest-5.4.0.gem (100%)
Successfully installed minitest-5.4.0
Fetching: activesupport-4.1.4.gem (100%)
Successfully installed activesupport-4.1.4
Successfully installed ruby-bbcode-to-md-0.0.13
6 gems installed

I’m no Ruby expert, so I’m not sure how to solve this. This looks like dependency hell to me.
@neil Could you please take a look at this? Thanks.