Skip to content

Commit

Permalink
[#1183] Tweak further the project type detection order
Browse files Browse the repository at this point in the history
Push some (subjectively) more common project types earlier in the
resolution order.
  • Loading branch information
bbatsov committed Jan 18, 2018
1 parent 27a8fbb commit 3882404
Showing 1 changed file with 60 additions and 52 deletions.
112 changes: 60 additions & 52 deletions projectile.el
Original file line number Diff line number Diff line change
Expand Up @@ -2312,15 +2312,56 @@ TEST-DIR which specifies the path to the tests relative to the project root."
;; File-based project types
(projectile-register-project-type 'emacs-cask '("Cask")
:compile "cask install")
(projectile-register-project-type 'symfony '("composer.json" "app" "src" "vendor")
(projectile-register-project-type 'r '("DESCRIPTION")
:compile "R CMD INSTALL --with-keep.source ."
:test (concat "R CMD check -o " temporary-file-directory " ."))
(projectile-register-project-type 'haskell-stack '("stack.yaml")
:compile "stack build"
:test "stack build --test")
(projectile-register-project-type 'rust-cargo '("Cargo.toml")
:compile "cargo build"
:test "cargo test")
(projectile-register-project-type 'racket '("info.rkt")
:test "raco test .")
;; Universal
(projectile-register-project-type 'scons '("SConstruct")
:compile "scons"
:test "scons test")
(projectile-register-project-type 'meson '("meson.build")
:compilation-dir "build"
:configure "meson %s"
:compile "ninja"
:test "ninja test")
;; Make & CMake
(projectile-register-project-type 'make '("Makefile")
:compile "make"
:test "make test")
(projectile-register-project-type 'cmake '("CMakeLists.txt")
:configure "cmake %s"
:compile "cmake --build ."
:test "ctest")
;; PHP
(projectile-register-project-type 'php-symfony '("composer.json" "app" "src" "vendor")
:compile "app/console server:run"
:test "phpunit -c app ")
(projectile-register-project-type 'ruby-rspec '("Gemfile" "lib" "spec")
:compile "bundle exec rake"
:test "bundle exec rspec")
(projectile-register-project-type 'ruby-test '("Gemfile" "lib" "test")
:compile"bundle exec rake"
:test "bundle exec rake test")
;; Erlang & Elixir
(projectile-register-project-type 'rebar '("rebar.config")
:compile "rebar"
:test "rebar eunit")
(projectile-register-project-type 'elixir '("mix.exs")
:compile "mix compile"
:test "mix test")
;; JavaScript
(projectile-register-project-type 'grunt '("Gruntfile.js")
:compile "grunt"
:test "grunt test")
(projectile-register-project-type 'gulp '("gulpfile.js")
:compile "gulp"
:test "gulp test")
(projectile-register-project-type 'npm '("package.json")
:compile "npm install"
:test "npm test")
;; Python
(projectile-register-project-type 'django '("manage.py")
:compile "python manage.py runserver"
:test "python manage.py test")
Expand All @@ -2333,9 +2374,7 @@ TEST-DIR which specifies the path to the tests relative to the project root."
(projectile-register-project-type 'python-tox '("tox.ini")
:compile "tox -r --notest"
:test "tox")
(projectile-register-project-type 'scons '("SConstruct")
:compile "scons"
:test "scons test")
;; Java & friends
(projectile-register-project-type 'maven '("pom.xml")
:compile "mvn clean install"
:test "mvn test")
Expand All @@ -2348,6 +2387,9 @@ TEST-DIR which specifies the path to the tests relative to the project root."
(projectile-register-project-type 'grails '("application.properties" "grails-app")
:compile "grails package"
:test "grails test-app")
(projectile-register-project-type 'sbt '("build.sbt")
:compile "sbt compile"
:test "sbt test")
(projectile-register-project-type 'lein-test '("project.clj")
:compile "lein compile"
:test "lein test")
Expand All @@ -2357,47 +2399,13 @@ TEST-DIR which specifies the path to the tests relative to the project root."
(projectile-register-project-type 'boot-clj '("build.boot")
:compile "boot aot"
:test "boot test")
(projectile-register-project-type 'rebar '("rebar.config")
:compile "rebar"
:test "rebar eunit")
(projectile-register-project-type 'sbt '("build.sbt")
:compile "sbt compile"
:test "sbt test")
(projectile-register-project-type 'make '("Makefile")
:compile "make"
:test "make test")
(projectile-register-project-type 'grunt '("Gruntfile.js")
:compile "grunt"
:test "grunt test")
(projectile-register-project-type 'gulp '("gulpfile.js")
:compile "gulp"
:test "gulp test")
(projectile-register-project-type 'haskell-stack '("stack.yaml")
:compile "stack build"
:test "stack build --test")
(projectile-register-project-type 'rust-cargo '("Cargo.toml")
:compile "cargo build"
:test "cargo test")
(projectile-register-project-type 'r '("DESCRIPTION")
:compile "R CMD INSTALL --with-keep.source ."
:test (concat "R CMD check -o " temporary-file-directory " ."))
(projectile-register-project-type 'racket '("info.rkt")
:test "raco test .")
(projectile-register-project-type 'elixir '("mix.exs")
:compile "mix compile"
:test "mix test")
(projectile-register-project-type 'npm '("package.json")
:compile "npm install"
:test "npm test")
(projectile-register-project-type 'meson '("meson.build")
:compilation-dir "build"
:configure "meson %s"
:compile "ninja"
:test "ninja test")
(projectile-register-project-type 'cmake '("CMakeLists.txt")
:configure "cmake %s"
:compile "cmake --build ."
:test "ctest")
;; Ruby
(projectile-register-project-type 'ruby-rspec '("Gemfile" "lib" "spec")
:compile "bundle exec rake"
:test "bundle exec rspec")
(projectile-register-project-type 'ruby-test '("Gemfile" "lib" "test")
:compile"bundle exec rake"
:test "bundle exec rake test")
;; Rails needs to be registered after npm, otherwise `package.json` makes it `npm`.
;; https://github.com/bbatsov/projectile/pull/1191
(projectile-register-project-type 'rails-test '("Gemfile" "app" "lib" "db" "config" "test")
Expand Down Expand Up @@ -2591,7 +2599,7 @@ Fallback to DEFAULT-VALUE for missing attributes."
((member project-type '(rails-rspec ruby-rspec)) (suffix "_spec"))
((member project-type '(rails-test ruby-test lein-test boot-clj go elixir)) (suffix "_test"))
((member project-type '(scons)) (suffix "test"))
((member project-type '(maven symfony)) (suffix "Test"))
((member project-type '(maven php-symfony)) (suffix "Test"))
((member project-type '(gradle gradlew grails)) (suffix "Spec"))
((member project-type '(haskell-cabal haskell-stack sbt)) (suffix "Spec"))
(t (suffix)))))
Expand Down

0 comments on commit 3882404

Please sign in to comment.