bundle exec rails g plugin DiscoursePluginName
Assumes that you created a plugin called =PLUGIN_NAME= and want to add a =NEWROUTE= route. For each file, replace action
with =NEWROUTE=
. Be careful not to replace before_action
with before_=NEWROUTE=
.
cd plugins/=PLUGIN_NAME=
cp ./app/controllers/=PLUGIN_NAME=/actions_controller.rb ./app/controllers/=PLUGIN_NAME=/=NEWROUTE=s_controller.rb
cp ./assets/javascripts/discourse/adapters/action.js.es6 ./assets/javascripts/discourse/adapters/=NEWROUTE=.js.es6
cp ./assets/javascripts/discourse/routes/=PLUGIN_NAME=-actions-index.js.es6 ./assets/javascripts/discourse/routes/=PLUGIN_NAME=-=NEWROUTE=s-index.js.es6
cp ./assets/javascripts/discourse/routes/=PLUGIN_NAME=-actions-show.js.es6 ./assets/javascripts/discourse/routes/=PLUGIN_NAME=-=NEWROUTE=s-show.js.es6
cp ./assets/javascripts/discourse/routes/=PLUGIN_NAME=-actions.js.es6 ./assets/javascripts/discourse/routes/=PLUGIN_NAME=-=NEWROUTE=s.js.es6
cp ./assets/javascripts/discourse/controllers/actions.js.es6 ./assets/javascripts/discourse/controllers/=NEWROUTE=s.js.es6
cp ./assets/javascripts/discourse/controllers/actions-index.js.es6 ./assets/javascripts/discourse/controllers/=NEWROUTE=s-index.js.es6
cp ./assets/javascripts/discourse/controllers/actions-show.js.es6 ./assets/javascripts/discourse/controllers/=NEWROUTE=s-show.js.es6
cp ./assets/javascripts/discourse/templates/actions-show.hbs ./assets/javascripts/discourse/templates/=NEWROUTE=s-show.hbs
cp ./assets/javascripts/discourse/templates/actions-index.hbs ./assets/javascripts/discourse/templates/=NEWROUTE=s-index.hbs
cp ./assets/javascripts/discourse/templates/actions.hbs ./assets/javascripts/discourse/templates/=NEWROUTE=s.hbs
cp ./assets/javascripts/discourse/models/action.js.es6 ./assets/javascripts/discourse/models/=NEWROUTE=.js.es6
cp ./spec/requests/actions_controller_spec.rb ./spec/requests/=NEWROUTE=s_controller_spec.rb
cd ./app/controllers/*
cp actions_controller.rb =NEWROUTE=s_controller.rb
cd ..
emacsclient assets/javascripts/discourse/=PLUGIN_NAME=-route-map.js.es6 config/routes.rb
emacsclient $(find . -name "*=NEWROUTE=*")