@@ -8,6 +8,8 @@ defmodule Mix.Server do
8
8
shell: Mix.Shell.IO , scm: Ordset . new , env: nil , post_config: [ ] ,
9
9
io_done: false
10
10
11
+ defrecord Project , name: nil , config: nil
12
+
11
13
def start_link ( env ) do
12
14
:gen_server . start_link ( { :local , __MODULE__ } , __MODULE__ , env , [ ] )
13
15
end
@@ -56,7 +58,7 @@ defmodule Mix.Server do
56
58
57
59
def handle_call ( :pop_project , _from , config ) do
58
60
case config . projects do
59
- [ { project , _ } | tail ] ->
61
+ [ Project [ name : project ] | tail ] ->
60
62
{ :reply , project , config . projects ( tail ) . io_done ( false ) }
61
63
_ ->
62
64
{ :reply , nil , config }
@@ -106,10 +108,11 @@ defmodule Mix.Server do
106
108
{ :noreply , config . update_tasks Ordset . filter ( fn { t , _ } -> t != task end , & 1 ) }
107
109
end
108
110
109
- def handle_cast ( { :push_project , name , project } , config ) do
110
- project = Keyword . merge ( project , config . post_config )
111
+ def handle_cast ( { :push_project , name , conf } , config ) do
112
+ conf = Keyword . merge ( conf , config . post_config )
113
+ project = Project [ name : name , config: conf ]
111
114
config = config . post_config ( [ ] )
112
- . update_projects ( [ { name , project } | & 1 ] )
115
+ . update_projects ( [ project | & 1 ] )
113
116
. io_done ( false )
114
117
{ :noreply , config }
115
118
end
@@ -136,13 +139,16 @@ defmodule Mix.Server do
136
139
137
140
# Returns if project is part of an umbrella project
138
141
defp in_umbrella? ( config ) do
139
- Enum . any? config . projects , fn { _ , conf } -> conf [ :apps_path ] != nil end
142
+ Enum . any? ( config . projects , fn ( Project [ config : conf ] ) ->
143
+ conf [ :apps_path ] != nil
144
+ end )
140
145
end
141
146
142
147
# Returns if project is an umbrella project
143
148
defp umbrella? ( config ) do
144
149
case config . projects do
145
- [ { h , conf } | _ ] when h != nil -> conf [ :apps_path ] != nil
150
+ [ Project [ name : name , config: config ] | _ ] when name != nil ->
151
+ config [ :apps_path ] != nil
146
152
_ -> false
147
153
end
148
154
end
0 commit comments