@@ -46,8 +46,9 @@ multi MAIN('e', 'l') is export {
4646 MAIN(' ecosystem' , ' list' );
4747}
4848
49+ # TODO: these should do key management on their own and not require re-login
4950multi MAIN (' ecosystem' , ' list' ) is export {
50- my $ known = config-value(' ecosystems' )// {zef => " https://360.zef.pm " };
51+ my $ known = config-value(' ecosystems' )// {zef => from-j( % ? RESOURCES < config.json > >. IO . slurp )< host > };
5152 my $ longest-key = max (0 , | $ known . keys . map (*. chars ));
5253 for $ known . keys -> $ eco {
5354 log (MSG, " { $ eco } { ' ' x ($ longest-key - $ eco . chars )} : { $ known {$ eco }} " );
@@ -59,7 +60,7 @@ multi MAIN('e', 'r', Str $name) is export {
5960}
6061
6162multi MAIN (' ecosystem' , ' remove' , Str $ name ) is export {
62- my $ knowns = config-value(' ecosystems' )// {zef => ' https://360.zef.pm ' };
63+ my $ knowns = config-value(' ecosystems' )// {zef => from-j( % ? RESOURCES < config.json > >. IO . slurp )< host > };
6364
6465 log (FATAL, " zef cannot be removed" ) if $ name eq ' zef' ;
6566 log (FATAL, " $ name is not known by this client" ) if $ knowns {$ name }:! exists ;
@@ -68,12 +69,12 @@ multi MAIN('ecosystem', 'remove', Str $name) is export {
6869 my % new-config = user-config;
6970 % new-config <ecosystems > = $ knowns ;
7071 write-to-user-config(% new-config );
71-
72+
7273 log (MSG, " Successfully removed { $ name } " );
7374}
7475
7576multi MAIN (' ecosystem' , ' add' , Str $ url , Bool : f($ force ) = False ) is export {
76- my $ knowns = config-value(' ecosystems' )// {zef => ' https://360.zef.pm ' };
77+ my $ knowns = config-value(' ecosystems' )// {zef => from-j( % ? RESOURCES < config.json > >. IO . slurp )< host > };
7778 my $ is-known-by = Nil ;
7879 for $ knowns . keys -> $ k {
7980 $ is-known-by = $ k if $ knowns {$ k } eq $ url ;
@@ -94,7 +95,7 @@ multi MAIN('ecosystem', 'add', Str $url, Bool :f($force) = False) is export {
9495 my % new-config = user-config;
9596 % new-config <ecosystems > = $ knowns ;
9697 write-to-user-config(% new-config );
97-
98+
9899 log (MSG, " Successfully added { $ response <message >} " );
99100}
100101
@@ -104,7 +105,7 @@ multi MAIN('e', 'a', Str $url, :f($force) = False) is export {
104105}
105106
106107multi MAIN (' ecosystem' , ' add' , Str $ url , Bool : f($ force ) = False ) is export {
107- my $ knowns = config-value(' ecosystems' )// {zef => ' https://360.zef.pm ' };
108+ my $ knowns = config-value(' ecosystems' )// {zef => from-j( % ? RESOURCES < config.json > >. IO . slurp )< host > };
108109 my $ is-known-by = Nil ;
109110 for $ knowns . keys -> $ k {
110111 $ is-known-by = $ k if $ knowns {$ k } eq $ url ;
@@ -125,7 +126,7 @@ multi MAIN('ecosystem', 'add', Str $url, Bool :f($force) = False) is export {
125126 my % new-config = user-config;
126127 % new-config <ecosystems > = $ knowns ;
127128 write-to-user-config(% new-config );
128-
129+
129130 log (MSG, " Successfully added { $ response <message >} " );
130131}
131132
@@ -134,7 +135,7 @@ multi MAIN('e', 's', Str $name) is export {
134135}
135136
136137multi MAIN (' ecosystem' , ' switch' , Str $ name ) is export {
137- my $ knowns = config-value(' ecosystems' )// {zef => ' https://360.zef.pm ' };
138+ my $ knowns = config-value(' ecosystems' )// {zef => from-j( % ? RESOURCES < config.json > >. IO . slurp )< host > };
138139 if $ knowns {$ name }:! exists {
139140 log (FATAL, " Ecosystem $ name is unknown" );
140141 }
@@ -143,7 +144,7 @@ multi MAIN('ecosystem', 'switch', Str $name) is export {
143144 % new-config <host > = $ knowns {$ name };
144145 % new-config <key > = ' ' ;
145146 write-to-user-config(% new-config );
146-
147+
147148 log (MSG, " Now using { $ name } for distribution, you may need to login or register before continuing" );
148149}
149150
@@ -409,7 +410,7 @@ multi MAIN('review') is export {
409410 }
410411 log (WARN, ' `.rakumod` should be used for module extensions, not `.pm6`' )
411412 if % findings <modfiles >. grep ({ $ _ . ends-with (' .pm6' ) });
412-
413+
413414 if % findings <meta ><production >: exists {
414415 log (WARN,
415416 [' "production" in META is deprecated. Please create a .fez file with the json object' ,
@@ -455,7 +456,7 @@ multi MAIN('review') is export {
455456 ERROR,
456457 " auth does not match logged in user or user's groups\n expected any of: % s\n got: % s" ,
457458 @ group-auths . join (' , ' ),
458- % findings <meta ><auth >,
459+ % findings <meta ><auth >,
459460 );
460461 $ has-error = True ;
461462 }
@@ -668,7 +669,7 @@ multi MAIN('list', Str $name?, Str() :$url = '/index.json') is export {
668669 my @ dists = (get ($ url )|| []). grep ({$ _ <auth > (elem) @ auths })
669670 . grep ({! $ name . defined || $ _ <name >. lc . index ($ name . lc ) ! ~~ Nil })
670671 . sort ({$ ^ a <name >. lc cmp $ ^ b <name >. lc ~~ Same
671- ?? Version . new ($ ^ a <ver >// $ ^ a <vers >// $ ^ a <version >) cmp
672+ ?? Version . new ($ ^ a <ver >// $ ^ a <vers >// $ ^ a <version >) cmp
672673 Version . new ($ ^ b <ver >// $ ^ b <vers >// $ ^ b <version >)
673674 !! $ ^ a <name >. lc cmp $ ^ b <name >. lc })
674675 . map ({$ _ <dist >});
@@ -748,6 +749,7 @@ multi MAIN('plugin', Str $key where * !~~ 'key'|'un', Str $action where * ~~ 're
748749constant template-repl-vals = {
749750 ' $user-config-path' => user-config-path,
750751 ' $system-config-path' => env-config-path,
752+ ' $effective-config' => to-j(% (| user-config, | env-config)),
751753};
752754sub template-repl (Str : D $ in is copy , % replacements = template-repl-vals --> Str ) {
753755 for % replacements . pairs -> $ p {
@@ -805,7 +807,7 @@ multi MAIN('refresh', Bool:D :d(:$dry-run) = False, :q(:$quiet) = False) is expo
805807 my % findings ;
806808 my $ cwd = upcurse-meta();
807809 log (FATAL, ' could not find META6.json' ) unless $ cwd ;
808-
810+
809811 my $ repo-cfg = $ cwd . add(' .fez' ). f
810812 ?? (try {
811813 CATCH { default { log (FATAL, ' error reading .fez: %s' , $ _ ); } };
@@ -818,7 +820,7 @@ multi MAIN('refresh', Bool:D :d(:$dry-run) = False, :q(:$quiet) = False) is expo
818820 ?? parse (| $ cwd . IO . add(' .gitignore' ). IO . slurp . lines , ' .git' , : git-ignore)
819821 !! parse (' **/.precomp' , ' **.swp' , ' .git' );
820822
821- my @ files = ls($ cwd . add(' lib' ), -> $ f {
823+ my @ files = ls($ cwd . add(' lib' ), -> $ f {
822824 ! $ ignorer . match ($ f . relative($ cwd )) && (
823825 $ f . basename . ends-with (' .rakumod' ) || $ f . d || $ f . basename . ends-with (' .pm6' )
824826 );
@@ -943,7 +945,7 @@ multi MAIN('license', Str:D :s(:$set) = '') is export {
943945 my $ meta = from-j($ cwd . add(' META6.json' ). slurp );
944946 $ meta <license > = $ lkey . substr (9 , * -4 );
945947 $ cwd . add(' META6.json' ). spurt : to-j($ meta );
946- log (MSG, ' Updated repo license to: %s' , $ lkey . substr (9 , * -4 ));
948+ log (MSG, ' Updated repo license to: %s' , $ lkey . substr (9 , * -4 ));
947949 }
948950}
949951
@@ -1013,7 +1015,7 @@ multi MAIN('init', Str $module is copy = '', Str:D :l(:$license) = config-value(
10131015 }
10141016 };
10151017
1016- $ meta <license > = $ license-name . substr (9 , * -4 ) if $ license ne ' ' ;
1018+ $ meta <license > = $ license-name . substr (9 , * -4 ) if $ license ne ' ' ;
10171019
10181020 ' .' . IO . add($ dist-name , ' META6.json' ). IO . spurt : to-j($ meta );
10191021
@@ -1022,7 +1024,7 @@ multi MAIN('init', Str $module is copy = '', Str:D :l(:$license) = config-value(
10221024
10231025 log (DEBUG, ' making test directory' );
10241026 mkdir ' .' . IO . add($ dist-name , ' t' );
1025-
1027+
10261028 ' .' . IO . add($ dist-name , ' t' , ' 00-use.rakutest' ). spurt : qq :to /EOF /;
10271029 use Test;
10281030
@@ -1051,7 +1053,7 @@ multi MAIN('module', Str:D $mod, Bool:D :c(:$class) = False) is export {
10511053 my @ module-parts = $ mod . split (' ::' , : skip-empty);
10521054 my $ module-file = @ module-parts . pop ~ " .rakumod" ;
10531055 my $ module-path = ' lib' . IO . add(| @ module-parts , $ module-file );
1054-
1056+
10551057 my $ root = $ cwd . add(' lib' );
10561058 while @ module-parts . elems {
10571059 $ root := $ root . add(@ module-parts . shift );
@@ -1060,9 +1062,9 @@ multi MAIN('module', Str:D $mod, Bool:D :c(:$class) = False) is export {
10601062
10611063 $ module-path . spurt (" unit { $ class ?? ' class' !! ' module' } $ mod ;\n " );
10621064 % meta <provides >{$ mod } = $ module-path . relative($ cwd );
1063-
1065+
10641066 $ cwd . add(' META6.json' ). spurt (to-j(% meta ));
1065- }
1067+ }
10661068
10671069multi MAIN (' dep' , Str : D $ dist , Bool : b(: $ build ) = False , Bool : t(: $ test ) = False , Bool : r(: $ remove ) = False ) is export {
10681070 MAIN(' depends' , $ dist , : $ build , : $ test , : $ remove );
@@ -1146,7 +1148,7 @@ multi MAIN('run', Str:D $command, :t(:$timeout) is copy = 300) is export {
11461148 })})) unless $ dist-cfg . f ;
11471149
11481150 my $ cfg = from-j($ dist-cfg . slurp );
1149-
1151+
11501152 log (FATAL, ' "%s" command not found\navailable commands: %s' , $ command , $ cfg <commands >. keys . sort . join (' , ' ))
11511153 unless $ cfg <commands >{$ command };
11521154
0 commit comments