joshnesbitt / project

A streamlined approach to working with multiple projects and tasks
http://rubygems.org/gems/project
MIT License
47 stars 6 forks source link

workflow with multiple paths doesn't load #8

Closed millisami closed 14 years ago

millisami commented 14 years ago

The path variable can't be passed arbitrarily. I want to open multiple projects at once. So I setup another workflow sso as below with multiple paths. When I run it, it complains about the path variable not set. Why does it looks for the path var only?

:workflows:
  :default:
    - mate %path
    - cd %path
    - open 'http://%app'
  :sso:
    - mate %path1
    - cd %path1
    - mate %path2
    - mate %path3
:projects:
  :projectA:
    :path1: /Users/millisami/apps/projectA
    :app: project.local
    :path2: /Users/millisami/apps/projectB
    :path3: /Users/millisami/apps/projectC
    :workflow: sso

And here is the error:

ree-1.8.7-2010.02 [~] ➔ project projectA
* Opening project 'projectA' using workflow 'sso'
/Users/millisami/.rvm/gems/ree-1.8.7-2010.02@global/gems/project-1.0.0/lib/project/template.rb:17:in `parse!': No variable named %path was found on the specified project. (Project::MissingTemplateVariable)
    from /Users/millisami/.rvm/gems/ree-1.8.7-2010.02@global/gems/project-1.0.0/lib/project/template.rb:15:in `each'
    from /Users/millisami/.rvm/gems/ree-1.8.7-2010.02@global/gems/project-1.0.0/lib/project/template.rb:15:in `parse!'
    from /Users/millisami/.rvm/gems/ree-1.8.7-2010.02@global/gems/project-1.0.0/lib/project/runner.rb:22:in `run!'
    from /Users/millisami/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/ostruct.rb:83:in `each_with_index'
    from /Users/millisami/.rvm/gems/ree-1.8.7-2010.02@global/gems/project-1.0.0/lib/project/runner.rb:21:in `each'
    from /Users/millisami/.rvm/gems/ree-1.8.7-2010.02@global/gems/project-1.0.0/lib/project/runner.rb:21:in `each_with_index'
    from /Users/millisami/.rvm/gems/ree-1.8.7-2010.02@global/gems/project-1.0.0/lib/project/runner.rb:21:in `run!'
    from /Users/millisami/.rvm/gems/ree-1.8.7-2010.02@global/gems/project-1.0.0/bin/project:5
    from /Users/millisami/.rvm/gems/ree-1.8.7-2010.02@global/bin/project:19:in `load'
    from /Users/millisami/.rvm/gems/ree-1.8.7-2010.02@global/bin/project:19
joshnesbitt commented 14 years ago

This was an issue with the regular expression that was parsing the template variables. Can you update the gem to 1.1.0 and see if this fixes it? I'm working on getting a command line parser into the gem so you can provide overrides too, but at the moment I can' find one that suits what's needed.

joshnesbitt commented 14 years ago

Hi millisami, have you had any luck with the newer version on this issue?

millisami commented 14 years ago

Yup, that does work. But now the cd %path doesn't get executed. Noting error is also thrown out.

joshnesbitt commented 14 years ago

If you were to do cd %path in one command and assume that you are in a particular directory for the next this will not work. To cd to a directory then run a command, for now, run cd %path && mycommand.