Open orenbenkiki opened 13 years ago
I've been looking at how this might be implemented and wanted to share the different approaches.
The first approach is to just tack these options on to the current add_project script. This is the simplest solution to implement but introduces additional complexity to the add_project script that will only be related to SCM. For example, if we wanted to do some simple argument checking to inform a user that the :watch_for_changes_in switch won't work for them in SVN, we'd need to do a big if statement that branched on the SCM choice in add_project.
To dry that up, I tried dropping in Trollop instead of optsparse because it allows for git-style subcommands. The first issue with this is that the interface would need to change. Instead of cruise add [project_name] -r [repo] -s [scm]
it would be cruise add [project_name] [scm] [scm_options]
or cruise add [scm] [project_name] [scm_options]
. This does not seem incredibly bad to me but it would change how we do some things.
Finally, the other option I was thinking about was to not touch the add_project command and to create an configure_project command that would allow the user to modify a project from the command line. I'm not sure what all of the implications of this are, especially after a project has been created and run a few times.
@bguthrie You got some guidance for this?
Code for the trollop method: https://github.com/thoughtworks/cruisecontrol.rb/pull/74
I like the idea of switching to Trollop rather than extending the existing mess. I'm a little leery about going the subcommand route--are the different options really THAT different? If they are, then this seems like a reasonable way to do it, and a reasonable way to extend the cruise command to boot.
Obviously I can't merge the pull request without a bit more testing but I like where you're going.
You should be able to configure as well as add from the command line, but I don't think adding that in removes the need to improve the existing add command.