File tree Expand file tree Collapse file tree 12 files changed +34
-20
lines changed Expand file tree Collapse file tree 12 files changed +34
-20
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ mod tests {
72
72
use std:: env;
73
73
74
74
use pretty_assertions:: assert_str_eq;
75
+ use test_log:: test;
75
76
76
77
use crate :: cli:: tests:: grep;
77
78
use crate :: dirs;
Original file line number Diff line number Diff line change @@ -67,8 +67,13 @@ Examples:
67
67
68
68
#[ cfg( test) ]
69
69
mod tests {
70
+ use test_log:: test;
71
+
72
+ use crate :: test:: reset;
73
+
70
74
#[ test]
71
75
fn test_plugin_list_remote ( ) {
76
+ reset ( ) ;
72
77
let stdout = assert_cli ! ( "plugin" , "ls-remote" ) ;
73
78
assert ! ( stdout. contains( "tiny" ) ) ;
74
79
}
Original file line number Diff line number Diff line change @@ -269,7 +269,8 @@ pub fn is_executable(path: &Path) -> bool {
269
269
}
270
270
271
271
#[ cfg( unix) ]
272
- pub fn make_executable ( path : & Path ) -> Result < ( ) > {
272
+ pub fn make_executable < P : AsRef < Path > > ( path : P ) -> Result < ( ) > {
273
+ let path = path. as_ref ( ) ;
273
274
let mut perms = path. metadata ( ) ?. permissions ( ) ;
274
275
perms. set_mode ( perms. mode ( ) | 0o111 ) ;
275
276
fs:: set_permissions ( path, perms)
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ impl BunPlugin {
87
87
. join ( "bun" ) ,
88
88
self . bun_bin ( & ctx. tv ) ,
89
89
) ?;
90
- file:: make_executable ( & self . bun_bin ( & ctx. tv ) ) ?;
90
+ file:: make_executable ( self . bun_bin ( & ctx. tv ) ) ?;
91
91
file:: make_symlink ( Path :: new ( "./bun" ) , & ctx. tv . install_path ( ) . join ( "bin/bunx" ) ) ?;
92
92
Ok ( ( ) )
93
93
}
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ impl DenoPlugin {
87
87
file:: create_dir_all ( tv. install_path ( ) . join ( "bin" ) ) ?;
88
88
file:: unzip ( tarball_path, & tv. download_path ( ) ) ?;
89
89
file:: rename ( tv. download_path ( ) . join ( "deno" ) , self . deno_bin ( tv) ) ?;
90
- file:: make_executable ( & self . deno_bin ( tv) ) ?;
90
+ file:: make_executable ( self . deno_bin ( tv) ) ?;
91
91
Ok ( ( ) )
92
92
}
93
93
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ impl ErlangPlugin {
66
66
& self . kerl_path ( ) ,
67
67
None ,
68
68
) ?;
69
- file:: make_executable ( & self . kerl_path ( ) ) ?;
69
+ file:: make_executable ( self . kerl_path ( ) ) ?;
70
70
Ok ( ( ) )
71
71
}
72
72
Original file line number Diff line number Diff line change @@ -193,7 +193,7 @@ impl NodePlugin {
193
193
fn install_npm_shim ( & self , tv : & ToolVersion ) -> Result < ( ) > {
194
194
file:: remove_file ( self . npm_path ( tv) ) . ok ( ) ;
195
195
file:: write ( self . npm_path ( tv) , include_str ! ( "assets/node_npm_shim" ) ) ?;
196
- file:: make_executable ( & self . npm_path ( tv) ) ?;
196
+ file:: make_executable ( self . npm_path ( tv) ) ?;
197
197
Ok ( ( ) )
198
198
}
199
199
Original file line number Diff line number Diff line change @@ -76,10 +76,31 @@ pub fn reset() {
76
76
Config :: reset ( ) ;
77
77
forge:: reset ( ) ;
78
78
config_file:: reset ( ) ;
79
+ file:: remove_all ( & * env:: HOME . join ( "cwd" ) ) . unwrap ( ) ;
80
+ file:: create_dir_all ( & * env:: HOME . join ( "cwd" ) ) . unwrap ( ) ;
79
81
env:: set_current_dir ( env:: HOME . join ( "cwd" ) ) . unwrap ( ) ;
80
82
env:: remove_var ( "MISE_FAILURE" ) ;
81
83
file:: remove_all ( & * dirs:: TRUSTED_CONFIGS ) . unwrap ( ) ;
82
84
file:: remove_all ( & * dirs:: TRACKED_CONFIGS ) . unwrap ( ) ;
85
+ file:: create_dir_all ( ".mise/tasks" ) . unwrap ( ) ;
86
+ file:: write (
87
+ ".mise/tasks/filetask" ,
88
+ indoc ! { r#"#!/usr/bin/env bash
89
+ # mise alias=["ft"]
90
+ # mise description="This is a test build script"
91
+ # mise depends=["lint", "test"]
92
+ # mise sources=[".test-tool-versions"]
93
+ # mise outputs=["$MISE_PROJECT_ROOT/test/test-build-output.txt"]
94
+ # mise env={TEST_BUILDSCRIPT_ENV_VAR = "VALID"}
95
+
96
+ set -euxo pipefail
97
+ cd "$MISE_PROJECT_ROOT" || exit 1
98
+ echo "running test-build script"
99
+ echo "TEST_BUILDSCRIPT_ENV_VAR: $TEST_BUILDSCRIPT_ENV_VAR" > test-build-output.txt
100
+ "# } ,
101
+ )
102
+ . unwrap ( ) ;
103
+ file:: make_executable ( ".mise/tasks/filetask" ) . unwrap ( ) ;
83
104
file:: write (
84
105
env:: HOME . join ( ".test-tool-versions" ) ,
85
106
indoc ! { r#"
Original file line number Diff line number Diff line change 2
2
! data /plugins
3
3
cache /
4
4
state /
5
- cwd /man /
5
+ cwd /
6
6
test-build-output.txt
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments