projectile-rails icon indicating copy to clipboard operation
projectile-rails copied to clipboard

Cannot interact with rails when encounter a conflict

Open victorteokw opened this issue 11 years ago • 4 comments

Below is output

Projectile Rails Compilation started at Fri Jan 23 14:11:28

bundle exec rails generate scaffold Fuck fuck:string
      invoke  active_record
      create    db/migrate/20150123061131_create_fucks.rb
      create    app/models/fuck.rb
      invoke    test_unit
      create      test/models/fuck_test.rb
      create      test/fixtures/fucks.yml
      invoke  resource_route
       route    resources :fucks
      invoke  scaffold_controller
      create    app/controllers/fucks_controller.rb
      invoke    slim
      create      app/views/fucks
      create      app/views/fucks/index.html.slim
      create      app/views/fucks/edit.html.slim
      create      app/views/fucks/show.html.slim
      create      app/views/fucks/new.html.slim
      create      app/views/fucks/_form.html.slim
      invoke    test_unit
      create      test/controllers/fucks_controller_test.rb
      invoke    helper
      create      app/helpers/fucks_helper.rb
      invoke      test_unit
      invoke    jbuilder
      create      app/views/fucks/index.json.jbuilder
      create      app/views/fucks/show.json.jbuilder
      invoke  assets
      invoke    coffee
      create      app/assets/javascripts/fucks.js.coffee
      invoke    scss
      create      app/assets/stylesheets/fucks.css.scss
    conflict    app/assets/stylesheets/scaffolds.css.scss                                                                 
      invoke  scss
  Overwrite /Users/1/Documents/Project/tiehkaiwoo/app/assets/stylesheets/scaffolds.css.scss? (enter "h" for help) [Ynaqdh] 

By changing second argument of compile to t resolves this issue. But all the projectile-rails specific hooks won't run. (e. g. buttons link to file.) I tried redefine projectile-rails-compilation-mode's parent mode to be comint-mode, the issue is still exist.

Any ideas?

victorteokw avatar Jan 23 '15 06:01 victorteokw

The t argument to the compile makes the compile command run it in the compilation-shell-minor-mode which allows for interactions. I've followed the idea of rspec-mode to pass a custom compilation-mode instead of t to be able to add some specific things to the compile buffer (like buttons for instance). As far as I understand after running the generate and encountering a step when a user has to input something it should be sufficient enough to just enable compilation-shell-minor-mode. After that it should be possible to input characters and send them to the process. But I'm getting error "n is undefined" (after hitting "n" key). I'll try to take a closer look at that.

asok avatar Jan 23 '15 11:01 asok

Thanks

victorteokw avatar Jan 23 '15 11:01 victorteokw

Evaluating

(defadvice compile (before ad-compile-smart activate)
  "Advises `compile' so it sets the argument COMINT to t."
  (ad-set-arg 1 t))

(see https://www.masteringemacs.org/article/compiling-running-scripts-emacs)

makes it work for me by using comint-mode.

kisp avatar Feb 15 '24 10:02 kisp

Maybe it would be possible to derive projectile-rails-generate-mode from comint-mode?

kisp avatar Feb 15 '24 10:02 kisp