Is there any way to connect the controller generator so that it runs rspec_controller?

I want to do this just to dial script/generate controllerand it will start script/generate rspec_controller. How can i do this?

+3
source share
1 answer

You want you to want this:

  • also run script/generate rspec_controller, or
  • run script/generate rspec_controller?

If 1, then you have several options. The simplest and less intrusive would probably be a simple wrap script/generateas follows:

  • rename script/generateasscript/generate.orig
  • create script/generateanew with the following contents:

    #!/bin/sh
    "`dirname \"$0\"`/generate.orig" "$@"
    if [ "$1" == "controller" ] ; then
      shift
      "`dirname \"$0\"`/generate.orig" rspec_controller "$@"
    fi
    
  • , script/generate .., . chmod a+rx script/generate

  • script/generate.orig script/generate script
0

Source: https://habr.com/ru/post/1739996/


All Articles