project icon indicating copy to clipboard operation
project copied to clipboard

Add project subcommands

Open bomberstudios opened this issue 15 years ago • 2 comments

I have a somehow complex environment I need to run for my project (think Sphinx, delayed_job, etc...) and a nice addition for project would be to add project subcommands, so you can run stuff when starting a work session and stop stuff when finishing.

I.e, if I have this .project file:

:workflows:
  :default:
    :start:
      - mate %path
      - mysql_start # Start MySQL
      - cd %path && rake ts:start #start Sphinx
      - cd %path && rails server
    :stop:
      - mysql_stop # Stop MySQL
      - cd %path && rake ts:stop #stop Sphinx
:projects:
  :myproject:
    :path: /path/to/project
    :workflow: default

then running

$ project myproject start

would open TextMate, bring MySQL and Sphinx up, and start the Rails server, and

$ project myproject stop

would stop MySQL and Sphinx.

(The 'start' command would be default, so project myproject would be equivalent to project myproject start)

I may have a go at it, but I make no promises... : )

bomberstudios avatar Aug 24 '10 09:08 bomberstudios

That's a really nice idea.

I'm wondering if this could help get around issue #5 by using something like dtach to control a commands background process (to explicitly stop/start daemons). For the sake of making it backwards compatible maybe project could assume that project name has the current yaml configuration but project name subcommand will try to look for the subcommand key within the workflow.

joshnesbitt avatar Aug 24 '10 10:08 joshnesbitt

http://trollop.rubyforge.org/ will work nicely.

joshnesbitt avatar Sep 15 '10 10:09 joshnesbitt