Transparency
Transparency

Reputation: 365

rails zeus custom_plan for server port modification

I want to use zeus s -p 12345 in my project. Of course I could use shell alias to make this like

alias zsp='zeus s -p 12345'

I'd like to know if there's a way to directly modify the custom plan to make this? So next time only need to type zeus s than it automatically use the port in the custom_plan or zeus.json file.

Thanks.

Upvotes: 2

Views: 316

Answers (1)

Attila O.
Attila O.

Reputation: 16615

You can force a custom port with a 'custom_plan.rb' like this:

require 'zeus/rails'

module CustomPort
  def options
    super.merge Port: 12345
  end
end

class CustomPlan < Zeus::Rails
  def development_environment
    require 'rails/commands/server'
    ::Rails::Server.include CustomPort
    super
  end
end

Zeus.plan = CustomPlan.new

I know this is ugly but this was the only way I could get this to work. I think overriding default_options would be better but it doesn't work.

Upvotes: 1

Related Questions