This project is archived and is in readonly mode.

#2163 ✓wontfix
rubymood

Interactive Rails template

Reported by rubymood | March 7th, 2009 @ 03:11 PM | in 2.x

UPDATED

Rails template runner enhancement:

run_ruby_script merged into run method.
  Now use: run "ruby_script.rb", :ruby_script=>true

:show_response option to check command response or when interaction is needed
  run "compass --rails -f blueprint .", :show_reponse=>true

:puts option for automatized tasks
   run "compass --rails -f blueprint .", :puts=>["y","n"]

Comments and changes to this ticket

  • rubymood

    rubymood March 7th, 2009 @ 03:13 PM

    Making Rails template interactive, so user can interaction whit the running command.

    Example for compass gem: if yes?("Do you wanna manually config compass?") run "compass --rails -f #{ask("Wich framework want to use?")} .", :interactive=>true else run "compass --rails -f blueprint .", :puts=>["y","n"] end :puts sends arguments to stdin, so it could be use for automatic configuration.

  • rubymood

    rubymood March 7th, 2009 @ 03:16 PM

    Making Rails template interactive, so user can interaction whit the running command.

    Example for compass gem:

    if yes?("Do you wanna manually config compass?") 
      run "compass --rails -f #{ask("Wich framework want to use?")} .", :interactive=>true 
    else 
      run "compass --rails -f blueprint .", :puts=>["y","n"] 
    end 
    

    :puts sends arguments to stdin, so it could be use for automatic configuration.

  • CancelProfileIsBroken

    CancelProfileIsBroken March 7th, 2009 @ 03:47 PM

    • Assigned user set to “Pratik”
    • Tag changed from template_runner to patch, template_runner
  • Pratik

    Pratik March 7th, 2009 @ 03:55 PM

    • State changed from “new” to “wontfix”

    I think this is making the API more complex than needed. If more people ask for this, I'd be happy to commit. What's the alternative you are using at the moment ?

    Thanks.

  • rubymood

    rubymood March 7th, 2009 @ 04:28 PM

    I'm using the approaches in the patch in my template file when is needed. But I think it's a good option to run commands only with the run method and passing params to it how to run. (so I'm think the run_ruby_script isnt needed, because when running ruby command in windows you should simply put ruby before the command, but FYI this method is not removed from my patch)

  • rubymood

    rubymood March 7th, 2009 @ 04:31 PM

    Or we should maybe merge run_ruby_script with run method.

  • rubymood

    rubymood March 7th, 2009 @ 05:49 PM

    Some more explanation and patch update.

    When somebody - with the current Rails version - want to generating new Rails app with template file and in this process want to config/install something that needing some interaction, the rails app generating will stop, waiting the input and don't show anything.

    new patch: * run_ruby_script merged into run * well documented

  • rubymood

    rubymood March 7th, 2009 @ 09:53 PM

    sorry, my last patch works on windows just for ruby scripts.. and for now I've changed more things:

    Now for ruby script:

    run "ruby_script.rb", :ruby_script => true

    To check command response or when interaction is needed:

    run "compass --rails -f blueprint .", :show_reponse=>true

    For automatized tasks:

    run "compass --rails -f blueprint .", :puts=>["y","n"]

  • Jeremy McAnally

    Jeremy McAnally March 7th, 2009 @ 10:11 PM

    In my opinion, we're getting outside of the original intent of the feature here. If you need some sort of interactive input beyond yes/no or some basic text input, then it should be a separate script or something that's run post-generation. At that point it's not a template, it's a Turing-complete application.

    I'm just thinking about the 80% (or probably more likely 95%) case here. It seems like this could live as a gem if people needed it or something, since it's a rather small-scale use case.

  • rubymood

    rubymood March 8th, 2009 @ 03:04 PM

    Jeremy, thanks for your response.

    The time will answer the question, that the community is needing or not this kind of support for generating application.

    Anyway, I upload a working script, to whom it may concern.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Pages