-
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the NAMESPACE=1 release issue (#203)
* Fix the NAMESPACE=1 release issue As we are using relative paths, we need to rewrite the boot file and two app-related definitions and references. * Correct the command in README
- Loading branch information
Showing
7 changed files
with
149 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
defmodule Mix.Tasks.Namespace do | ||
def app_mappings do | ||
%{ | ||
common: Lexical.Common, | ||
remote_control: Lexical.RemoteControl, | ||
lexical_shared: Lexical.Shared, | ||
lexical_plugin: Lexical.Plugin, | ||
sourceror: Sourceror, | ||
path_glob: PathGlob, | ||
server: Lexical.Server, | ||
protocol: Lexical.Protocol, | ||
proto: Proto | ||
} | ||
end | ||
|
||
def apps_to_namespace do | ||
Map.keys(app_mappings()) | ||
end | ||
|
||
def root_modules do | ||
Map.values(app_mappings()) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
defmodule Mix.Tasks.Namespace.Module do | ||
alias Mix.Tasks.Namespace | ||
|
||
@deps_to_namespace ~w(Sourceror PathGlob) | ||
|
||
def apply(module_name) do | ||
apps_to_namespace = Namespace.apps_to_namespace() -- ~w(proto protocol server)a | ||
|
||
if module_name in apps_to_namespace do | ||
:"lx_#{module_name}" | ||
else | ||
module_name | ||
|> Atom.to_string() | ||
|> String.split(".") | ||
|> maybe_namespace_split_module(module_name) | ||
end | ||
end | ||
|
||
defp maybe_namespace_split_module(["Lexical"], _) do | ||
LXRelease | ||
end | ||
|
||
defp maybe_namespace_split_module(["Elixir" | rest], _) do | ||
rest | ||
|> Enum.map(fn | ||
"Lexical" -> | ||
"LXRelease" | ||
|
||
name when name in @deps_to_namespace -> | ||
"LX#{name}" | ||
|
||
other -> | ||
other | ||
end) | ||
|> Module.concat() | ||
end | ||
|
||
defp maybe_namespace_split_module(_, erlang_module) do | ||
erlang_module | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters