Ruby on Rails
GenerateDestroyGenerateBadBehavior

Destroy is overreaching, as detailed in the example below:

$ ./script/generate scaffold Comment
  dependency  model
      exists    app/models/
      exists    test/unit/
      exists    test/fixtures/
      create    app/models/comment.rb
      create    test/unit/comment_test.rb
      create    test/fixtures/comments.yml
      exists  app/controllers/
      exists  app/helpers/
      create  app/views/comments
      exists  test/functional/
      create  app/controllers/comments_controller.rb
      create  test/functional/comments_controller_test.rb
      create  app/helpers/comments_helper.rb
      create  app/views/layouts/comments.rhtml
overwrite public/stylesheets/scaffold.css? [Ynaq] n
        skip  public/stylesheets/scaffold.css
      create  app/views/comments/list.rhtml
      create  app/views/comments/show.rhtml
      create  app/views/comments/new.rhtml
      create  app/views/comments/edit.rhtml
      create  app/views/comments/_form.rhtml

$ ./script/destroy scaffold Comment
          rm  app/views/comments/edit.rhtml
          rm  app/views/comments/new.rhtml
          rm  app/views/comments/show.rhtml
          rm  app/views/comments/list.rhtml
          rm  public/stylesheets/scaffold.css
          rm  app/views/layouts/comments.rhtml
          rm  app/helpers/comments_helper.rb
          rm  test/functional/comments_controller_test.rb
          rm  app/controllers/comments_controller.rb
    notempty  test/functional
    notempty  test
    notempty  app/views/comments
    notempty  app/views
    notempty  app
    notempty  app/helpers
    notempty  app
    notempty  app/controllers
    notempty  app
  dependency  model
          rm    test/fixtures/comments.yml
          rm    test/unit/comment_test.rb
          rm    app/models/comment.rb
    notempty    test/fixtures
    notempty    test
    notempty    test/unit
    notempty    test
    notempty    app/models
    notempty    app
$ ./script/generate scaffold Comment
  dependency  model
      exists    app/models/
      exists    test/unit/
      exists    test/fixtures/
      create    app/models/comment.rb
      create    test/unit/comment_test.rb
      create    test/fixtures/comments.yml
      exists  app/controllers/
      exists  app/helpers/
      exists  app/views/comments
      exists  test/functional/
      create  app/controllers/comments_controller.rb
      create  test/functional/comments_controller_test.rb
      create  app/helpers/comments_helper.rb
      create  app/views/layouts/comments.rhtml
      create  public/stylesheets/scaffold.css
      create  app/views/comments/list.rhtml
      create  app/views/comments/show.rhtml
      create  app/views/comments/new.rhtml
      create  app/views/comments/edit.rhtml
overwrite app/views/comments/_form.rhtml? [Ynaq] y
       force  app/views/comments/_form.rhtml

Destroy will rm files that Generate was told not to touch, without asking whether they should be removed. In the example, look at scaffold.css.


This is a bit of an annoyance. Maybe scripts/destroy should ask “File has been changed since it was generated, delete anyway? [yNaq]”