aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@batsov.com>2020-06-16 19:59:30 +0300
committerBozhidar Batsov <bozhidar@batsov.com>2020-06-16 19:59:30 +0300
commit95bcc7d805cbe7116f54e46480563452537b20ef (patch)
tree9e2d0ad62675927aaadb5d7f3bd7e9da164fadbc /doc
parent1ef18c2e4cf371d875ca70da0f1ee324496a1723 (diff)
Add a `:project-file` param to `projectile-register-project-type`
Diffstat (limited to 'doc')
-rw-r--r--doc/modules/ROOT/pages/projects.adoc45
1 files changed, 44 insertions, 1 deletions
diff --git a/doc/modules/ROOT/pages/projects.adoc b/doc/modules/ROOT/pages/projects.adoc
index d635a69..0390dd3 100644
--- a/doc/modules/ROOT/pages/projects.adoc
+++ b/doc/modules/ROOT/pages/projects.adoc
@@ -121,6 +121,7 @@ initialization code
[source,elisp]
----
(projectile-register-project-type 'npm '("package.json")
+ :project-file "package.json"
:compile "npm install"
:test "npm test"
:run "npm start"
@@ -130,17 +131,59 @@ initialization code
What this does is:
. add your own type of project, in this case `npm` package.
-. add a file in a root of the project that helps to identify the type, in this case it is `package.json`.
+. add a list of files and/or folders in a root of the project that helps to identify the type, in this case it is only `package.json`.
+* add _root-marker_, which is typically the primary project configuration file. In this case that's `package.json`.
. add _compile-command_, in this case it is `npm install`.
. add _test-command_, in this case it is `npm test`.
. add _run-command_, in this case it is `npm start`.
. add test files suffix for toggling between implementation/test files, in this case it is `.spec`, so the implementation/test file pair could be `service.js`/`service.spec.js` for example.
+Let's see a couple of more complex examples.
+
+[source,elisp]
+----
+;; Ruby
+(projectile-register-project-type 'ruby-rspec '("Gemfile" "lib" "spec")
+ :project-file "Gemfile"
+ :compile "bundle exec rake"
+ :src-dir "lib/"
+ :test "bundle exec rspec"
+ :test-dir "spec/"
+ :test-suffix "_spec")
+
+(projectile-register-project-type 'ruby-test '("Gemfile" "lib" "test")
+ :project-file "Gemfile"
+ :compile"bundle exec rake"
+ :src-dir "lib/"
+ :test "bundle exec rake test"
+ :test-suffix "_test")
+
+(projectile-register-project-type 'rails-test '("Gemfile" "app" "lib" "db" "config" "test")
+ :project-file "Gemfile"
+ :compile "bundle exec rails server"
+ :src-dir "lib/"
+ :test "bundle exec rake test"
+ :test-suffix "_test")
+
+(projectile-register-project-type 'rails-rspec '("Gemfile" "app" "lib" "db" "config" "spec")
+ :project-file "Gemfile"
+ :compile "bundle exec rails server"
+ :src-dir "lib/"
+ :test "bundle exec rspec"
+ :test-dir "spec/"
+ :test-suffix "_spec")
+----
+
+All those projects are using `Gemfile` (`bundler`'s project file), but they have different directory structures.
+
The available options are:
|===
| Option | Documentation
+| :project-file
+| A file, relative to the project root, typically the main project file (e.g. `pom.xml` for Maven projects).
+
| :compilation-dir
| A path, relative to the project root, from where to run the tests and compilation commands.