3

私はプログラミングとRailsに不慣れで、いくつかのことを無害に試すために使用しているRailsアプリのコピーを作成したいと思います。それを実現する簡単な方法はありますか?

4

1 に答える 1

9

はい、できます。これらのコマンドは私のような初心者には明白ではなく、他の誰かを助けるかもしれません...

まず、新しくデプロイしたアプリの呼び出しに応じて、herokuで現在使用可能な名前を見つけます。

古いルートから作成され、新しいRailsアプリが作成されます。

$ cp -R old_directory new_directory
$ cd new_directory
$ rm -rf .git
# find and replace all references to old_director found within new_directory
# the command at the terminal 'grep -ri "old_director" .' may help to locate 
# all of the references to the old_directory
$ git init
$ git add .
$ git ci -am “First commit after copying from old_app”
# create new_directory repository at github.  Follow along their 
# directions for new repository with appropriate modifications.  
$ git remote add origin git@github.com:[github username]/[new_directory].git
$ git push -u origin master
$ rake db:migrate
$ heroku create [new_app]
$ git push heroku master

新しいアプリの新しい秘密鍵を生成するには:

$ rake secret  # generate new secret key for new app
5ed8c7d9a3bda9cec3887b61f22aa95bf430a3a550407642b96751c7ef0ce8946a161506d6739da0dcaaea8c8f4f8b3335b1fb549e3cc54f0a4cec554ede05f8

次に、次のコマンドを使用して、新しく作成した秘密鍵を環境変数としてHerokuに保存します。

$ heroku config:set SECRET_KEY_BASE=5ed8c7d9a3bda9cec3887b61f22aa95bf430a3a550407642b96751c7ef0ce8946a161506d6739da0dcaaea8c8f4f8b3335b1fb549e3cc54f0a4cec554ede05f8

環境変数としての秘密鍵の保存などの詳細については、DanielFoneのブログを参照してください。

ついに:

$ heroku run rake db:migrate
于 2012-07-31T01:44:09.330 に答える