colinsurprenant / redstorm

JRuby on Storm
Other
298 stars 56 forks source link

Expose SubmitOptions via a submit_options block #98

Closed ismith closed 10 years ago

ismith commented 10 years ago

This PR will expose SubmitOptions to the DSL in a block similar to the configure block. For example:

class MyTopology < RedStorm
  submit_options do |env|
    set_initial_status TopologyInitialStatus.valueOf('INACTIVE')
  end

  configure 'my_topology' do |env|
    debug true
    ...
  end
ismith commented 10 years ago

Plausibly this could be improved by having code somewhere (ala configurator) so that you could call set_initial_status 'INACTIVE' and have it turn that into TopologyInitialStatus.valueOf('INACTIVE'), and error if the given string isn't one of ['INACTIVE', 'ACTIVE']. And there might be other SubmitOptions that could use some DSL love along those lines.

But I think that's lower priority than exposing SubmitOptions at all in the DSL.

coveralls commented 10 years ago

Coverage Status

Coverage decreased (-0.26%) when pulling b5d66ec0e8707c5492ddef2441d353d602f6d0d3 on ismith:submit_options into 5546b71fecfd300961cf4f4b415a20079c26872b on colinsurprenant:master.

ismith commented 10 years ago

(Re: coveralls ... this commit currently lacks tests. I'll add something later once I get feedback that this is change approximately the right thing to do here.)

colinsurprenant commented 10 years ago

Yup, this makes sense. It's just a bummer that the whole SubmitOptions class exists for only one option. Your proposal will make this future proof if new options are added, otherwise we could have just added a special case for initial_status in the configuration block for example.

ismith commented 10 years ago

Closing; moved this patch to a fresh repo/branch, reopened as #104