ぐらめぬ・ぜぷつぇんのはてダ(2007 to 2011)

2007年~2011年ごろまで はてなダイアリー に書いてた記事を引っ越してきました。

script/destroyコマンドは助かる。

script/generateでモデル名やコントローラ名をtypoした時、作られたファイルを一々手動で消すのは面倒。script/destroy使えばオッケー。
モデルを作って、消してみる。

> ruby script\generate model Hoges
      exists  app/models/
      exists  test/unit/
      exists  test/fixtures/
      create  app/models/hoges.rb
      create  test/unit/hoges_test.rb
      create  test/fixtures/hoges.yml
      exists  db/migrate
      create  db/migrate/002_create_hoges.rb

>ruby script\destroy model Hoges
    notempty  db/migrate
    notempty  db
          rm  db/migrate/002_create_hoges.rb
          rm  test/fixtures/hoges.yml
          rm  test/unit/hoges_test.rb
          rm  app/models/hoges.rb
    notempty  test/fixtures
    notempty  test
    notempty  test/unit
    notempty  test
    notempty  app/models
    notempty  app

コントローラを作って、消してみる。

>ruby script\generate controller Hellos
      exists  app/controllers/
      exists  app/helpers/
      create  app/views/hellos
      exists  test/functional/
      create  app/controllers/hellos_controller.rb
      create  test/functional/hellos_controller_test.rb
      create  app/helpers/hellos_helper.rb

>ruby script\destroy controller Hellos
          rm  app/helpers/hellos_helper.rb
          rm  test/functional/hellos_controller_test.rb
          rm  app/controllers/hellos_controller.rb
       rmdir  test/functional
    notempty  test
       rmdir  app/views/hellos
    notempty  app/views
    notempty  app
    notempty  app/helpers
    notempty  app
    notempty  app/controllers
    notempty  app