1
+ home = Path . expand ( "../tmp/.home" , __DIR__ )
2
+ File . mkdir_p! ( home )
3
+ System . put_env ( "HOME" , home )
4
+
5
+ mix = Path . expand ( "../tmp/.mix" , __DIR__ )
6
+ File . mkdir_p! ( mix )
7
+ System . put_env ( "MIX_HOME" , mix )
8
+
9
+ System . delete_env ( "XDG_DATA_HOME" )
10
+ System . delete_env ( "XDG_CONFIG_HOME" )
11
+
12
+ ## Setup Mix
13
+
1
14
Mix . start ( )
2
15
Mix . shell ( Mix.Shell.Process )
3
16
Application . put_env ( :mix , :colors , enabled: false )
4
17
5
18
Logger . remove_backend ( :console )
6
19
Application . put_env ( :logger , :backends , [ ] )
7
20
21
+ ## Setup ExUnit
22
+
8
23
os_exclude = if match? ( { :win32 , _ } , :os . type ( ) ) , do: [ unix: true ] , else: [ windows: true ]
9
24
epmd_exclude = if match? ( { :win32 , _ } , :os . type ( ) ) , do: [ epmd: true ] , else: [ ]
10
25
git_exclude = if Mix.SCM.Git . git_version ( ) <= { 1 , 7 , 4 } , do: [ git_sparse: true ] , else: [ ]
@@ -212,27 +227,14 @@ defmodule MixTest.Case do
212
227
end
213
228
end
214
229
215
- ## Set up globals
216
-
217
- home = MixTest.Case . tmp_path ( ".home" )
218
- File . mkdir_p! ( home )
219
- System . put_env ( "HOME" , home )
220
-
221
- mix = MixTest.Case . tmp_path ( ".mix" )
222
- File . mkdir_p! ( mix )
223
- System . put_env ( "MIX_HOME" , mix )
224
-
225
- System . delete_env ( "XDG_DATA_HOME" )
226
- System . delete_env ( "XDG_CONFIG_HOME" )
230
+ ## Set up Rebar fixtures
227
231
228
232
rebar3_source = System . get_env ( "REBAR3" ) || Path . expand ( "fixtures/rebar3" , __DIR__ )
229
233
[ major , minor | _ ] = String . split ( System . version ( ) , "." )
230
234
rebar3_target = Path . join ( [ mix , "elixir" , "#{ major } -#{ minor } " , "rebar3" ] )
231
235
File . mkdir_p! ( Path . dirname ( rebar3_target ) )
232
236
File . cp! ( rebar3_source , rebar3_target )
233
237
234
- ## Copy fixtures to tmp
235
-
236
238
fixtures = ~w( rebar_dep rebar_override)
237
239
238
240
Enum . each ( fixtures , fn fixture ->
@@ -242,12 +244,13 @@ Enum.each(fixtures, fn fixture ->
242
244
File . cp_r! ( source , dest )
243
245
end )
244
246
245
- ## Generate Git repo fixtures
247
+ ## Set up Git fixtures
248
+
246
249
System . cmd ( "git" , ~w[ config --global user.email [email protected] ] )
247
250
System . cmd ( "git" , ~w[ config --global user.name mix-repo] )
248
251
System . cmd ( "git" , ~w[ config --global init.defaultBranch not-main] )
249
252
250
- # Git repo
253
+ ### Git repo
251
254
target = Path . expand ( "fixtures/git_repo" , __DIR__ )
252
255
253
256
unless File . dir? ( target ) do
@@ -329,7 +332,7 @@ unless File.dir?(target) do
329
332
end )
330
333
end
331
334
332
- # Deps on Git repo
335
+ ### Deps on Git repo
333
336
target = Path . expand ( "fixtures/deps_on_git_repo" , __DIR__ )
334
337
335
338
unless File . dir? ( target ) do
@@ -423,7 +426,7 @@ Enum.each([:invalidapp, :invalidvsn, :noappfile, :nosemver, :ok], fn dep ->
423
426
File . mkdir_p! ( Path . expand ( "fixtures/deps_status/deps/#{ dep } /.git" , __DIR__ ) )
424
427
end )
425
428
426
- # Archive ebin
429
+ ### Archive ebin
427
430
target = Path . expand ( "fixtures/archive" , __DIR__ )
428
431
429
432
unless File . dir? ( Path . join ( target , "ebin" ) ) do
0 commit comments