Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #84 from mauricerkelly/support-different-mix-envir…
Browse files Browse the repository at this point in the history
…onments

Include mixEnv parameter and apply to environment
  • Loading branch information
Arcanemagus authored Mar 2, 2017
2 parents 333b74d + 517ed7d commit 89c389c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Plugin should work with default settings. If not:

5. `always use elixirc` option - leave it disabled, unless `mix compile` is too slow.

6. `mix env` option - Allows changing the Mix environment for lint runs. If using IEx at the same time as Atom this can be changed to allow IEx to pick up code changes.

## Usage

If you open folder with mix project (`mix.exs` exists in project's root
Expand Down
7 changes: 7 additions & 0 deletions lib/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const elixirProjectPathCache = new Map();
let elixircPath;
let mixPath;
let forceElixirc;
let mixEnv;

function regexp(string, flags) {
return new RegExp(
Expand Down Expand Up @@ -243,6 +244,7 @@ const getOpts = async filePath => ({
throwOnStdErr: false,
stream: 'both',
allowEmptyStderr: true,
env: { MIX_ENV: mixEnv },
});

const getDepsPa = async (filePath) => {
Expand Down Expand Up @@ -322,6 +324,11 @@ export default {
forceElixirc = value;
}),
);
this.subscriptions.add(
atom.config.observe('linter-elixirc.mixEnv', (value) => {
mixEnv = value;
}),
);
},

deactivate() {
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
"title": "Always use elixirc",
"description": "Activating this will force the plugin to never use `mix compile` and always use `elixirc`.",
"default": false
},
"mixEnv": {
"type": "string",
"title": "Mix environment to use for linting",
"description": "Setting the Mix environment can avoid collisions between linter compiles and IEx sessions.",
"default": "dev"
}
},
"providedServices": {
Expand Down

0 comments on commit 89c389c

Please sign in to comment.