OSC / osc-machete

High level interface to submitting and checking the status of batch jobs (currently OSC specific)
MIT License
1 stars 0 forks source link

Add new osc-machete-rails gem and move Rails specific code to this gem #55

Closed ericfranz closed 8 years ago

ericfranz commented 8 years ago

Rails specific code moved here could be properly tested.

Enables us to add generatores, create a Rails engine with default views and default models that developers could make use of (i.e. BatchSim or Devise).

awesim_rails could be modified to include osc-machete-rails as dependency so we could move non-awesim specific items to osc-machete-rails (assuming the osc-gems are going to be the ones open sourced for open ondemand)

ericfranz commented 8 years ago

For now we will do osc-machete-simplejob as a separate gem and keep awesim_rails for Rails engine specific code.

ericfranz commented 8 years ago

No we will do osc-machete-rails and move the simple job classes to this. We will "alias" SimpleJob for backwards compatibility:

module OSC
  module Machete
    module Rails

    end
    SimpleJob = Rails
  end
end

http://stackoverflow.com/questions/11091740/is-it-possible-to-make-an-alias-for-a-module-in-ruby

ericfranz commented 8 years ago

Because its a rails plugin/gem, it will be easier to have the gem name not be a nested namespace. So instead of osc-machete-rails it will be osc_machete_rails:

module OSCMacheteRails

  # make OSC::Machete::SimpleJob an alias of this module for backwards compatibility
  OSC::Machete::SimpleJob = self
end

When we generate this app, we can start with --mountable. If the namespace isolation causes too many problems, we can take control of the isolation ourselves, so that, for example, it is easier to subclass and/or modify controllers or models, without having to take the approaches the Rails Guides suggest. Also, we could then make the helpers available to the views without requiring the namespace helper to be used.

These are the type of things that can really trip up a developer who is new to Rails and doesn't know these details. So I have serious concerns about --mountable.

See http://crypt.codemancers.com/posts/2013-09-22-isolate-namespace-in-rails-engines/ for a description of some of the problems.

However, the ramifications of this difference are found more in what goes under the app/directory of the gem, which is not relevant for the issues we are facing right now, and it is easy to manually modify this (the primary "offender" being the isolate_namespace method).

ericfranz commented 8 years ago