bbatsov / projectile

Project Interaction Library for Emacs
https://docs.projectile.mx
GNU General Public License v3.0
3.97k stars 584 forks source link

Project type detection fails for rebar projects #965

Closed jaseemabid closed 5 years ago

jaseemabid commented 8 years ago

Consider a project with the following files.

├── Makefile
├── rebar
├── rebar.config
├── src
│   └── foo.erl
└── test
    └── foo_SUITE.erl

2 directories, 5 files

(projectile-project-type) returns 'make but I think it should be 'rebar. This breaks the toggle b/w source and test functionality. The feature works fine if I explicitly modify the hash table like (puthash (projectile-project-root) 'rebar projectile-project-type-cache) and apply the following patch.

diff --git a/projectile.el b/projectile.el
index d5957eb..a67e378 100644
--- a/projectile.el
+++ b/projectile.el
@@ -1651,7 +1651,7 @@ a COMPILE-CMD, a TEST-CMD, and a RUN-CMD."
 (projectile-register-project-type 'lein-test '("project.clj") "lein compile" "lein test")
 (projectile-register-project-type 'lein-midje '("project.clj" ".midje.clj") "lein compile" "lein midje")
 (projectile-register-project-type 'boot-clj '("build.boot") "boot aot" "boot test")
-(projectile-register-project-type 'rebar '("rebar") "rebar" "rebar eunit")
+(projectile-register-project-type 'rebar '("rebar.config") "rebar" "rebar eunit")
 (projectile-register-project-type 'sbt '("build.sbt") "sbt compile" "sbt test")
 (projectile-register-project-type 'make '("Makefile") "make" "make test")
 (projectile-register-project-type 'grunt '("Gruntfile.js") "grunt" "grunt test")
@@ -1808,6 +1808,7 @@ It assumes the test/ folder is at the same level as src/."
 (defun projectile-test-suffix (project-type)
   "Find default test files suffix based on PROJECT-TYPE."
   (cond
+   ((member project-type '(rebar)) "_SUITE")
    ((member project-type '(emacs-cask)) "-test")
    ((member project-type '(rails-rspec ruby-rspec)) "_spec")
    ((member project-type '(rails-test ruby-test lein-test boot-clj go)) "_test")
jaseemabid commented 8 years ago

Also I believe projectile should be looking for the config file rebar.config and not the executable rebar which may or maynot be part of the project.

bbatsov commented 8 years ago

Guess you can convert your patch to a PR - the changes look good to me.

jaseemabid commented 8 years ago

@bbatsov Detection of the project still fails, but https://github.com/bbatsov/projectile/pull/976 adds other things.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

stale[bot] commented 5 years ago

This issues been automatically closed due to lack of activity. Feel free to re-open it if you ever come back to it.