How to change a Ruby on Rails application name?

前端 未结 8 1221
渐次进展
渐次进展 2020-11-30 19:33

I have a Ruby on Rails application that was created using:

rails new old_name -d mysql

Now I want to change the application name to be

8条回答
  •  渐次进展
    2020-11-30 19:43

    Run the following to replace the old_name for new_name from the root of your Rails (3.0.7) project.

    replace old_name new_name -- ./config/environment.rb ./config/application.rb ./Rakefile ./config/initializers/secret_token.rb ./config/environments/production.rb ./config/environments/development.rb ./app/views/layouts/application.html.erb ./config/routes.rb config.ru ./config/environments/test.rb ./config/initializers/session_store.rb
    

    But be sure to run

    fgrep old_name . -iR
    

    Or something similar first to check if there are no occurrences of old_name in your project who not should be replaced.

    EDIT:

    Of course for this you need to have the replace command installed.

    And take in account that your appname will be CamelCased, so maybe you have to try a few different variations, like OldName vs. NewName.

提交回复
热议问题