cornelius / yes_ship_it

The ultimate release script

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Find a nicer way to implement dry run

cornelius opened this issue · comments

The assert method takes a boolean dry_run parameter which controls, if modifications are actually done or it's just shown what would be done.

When implementing assertions it's up to the developer to do the right thing there and implement and respect the option. It would be nicer, if this would be encapsulated by the API somehow, so that the developer would be guided to do the right thing or it would even be enforced by the framework.

We also need to add a system test for the dry run.

Maybe we could use a pattern like this, where we pass an object to do all the modifications to the assert call.

def assert(executor)
  executor.run_command("gem push ...")
  executor.http_put(url, data)
  executor.http_delete(url)
end

Then we can have two objects, one which actually executes things, and one which only prints what it would execute, and depending on the option we would use one or the other.

This would also help with centralizing error handling.