# Updating the google group importer

**URL:** <https://meta.discourse.org/t/updating-the-google-group-importer/59075>\
**Category:** Development\
**Created:** [2017 年 3 月 14 日午後 12:18 UTC](https://meta.discourse.org/t/updating-the-google-group-importer/59075 "2017-03-14T12:18:04Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![pacharanero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pacharanero/32/500583_2.png) [@pacharanero](https://meta.discourse.org/u/pacharanero)\
**Post date:** [2017 年 3 月 14 日午後 12:18 UTC](https://meta.discourse.org/t/updating-the-google-group-importer/59075/1 "2017-03-14T12:18:04Z")

</div>

Hi

I have now written 2 iterations of importers for Google Groups into Discourse. The most recent one is here: [GitHub - pacharanero/google\_group.to\_discourse: Import script from a private Google Group into a Discourse forum · GitHub](https://github.com/pacharanero/google_group.to_discourse).

It’s broken since some updates to Discourse, so I’m in the process of updating it. In particular I’m hoping with this version to get it good enough that I can submit it to Discourse as a part of Discourse itself, so I want to make it a) run well and b) not to break any other importers.

The require and subclassing lines are thus:

```
require File.expand_path(File.dirname( __FILE__ ) + "/mbox.rb")

class ImportScripts::GoogleGroups < ImportScripts::Mbox

  def initialize(google_group_name)
  ...

```

I am subclassing the standard Discourse importer script `mbox.rb` in order to use the methods it contains.

### problem

The last line of `mbox.rb` instantiates and runs `ImportScripts::Mbox#perform`, which is a problem since the whole thing gets run as soon as Ruby executes the `require`. This is before I’ve been able to set any of the environment variables etc, so of course it fails with an error.

I want to be able to subclass `mbox.rb` without instantiating it and running #perform (until I’m ready)

Is there any way of doing this? Apologies if this is a bit of a basic/dumb question - I am a **very** part-time Rubyist.

Or is it better to change `mbox.rb` so that it doesn’t instantiate and run itself (the instantiation and running part could be extracted out into another script)? It doesn’t look as though any other scripts are subclassing `mbox.rb` or depending on it in any other way, so this is unlikely to break anything else.

I’d be interested in any thoughts, particularly from @erlend_sh (who originally suggested I could submit it to DIscourse) and other Discourse Team @sam @codinghorror

Marcus

---

_[View the full topic](https://meta.discourse.org/t/updating-the-google-group-importer/59075)._
