#NEWLINE# @ staticmethod #NEWLINE# def initialize( root_dir ) : #NEWLINE# #INDENT# '\n        Initialize a new workspace .mx.yml file\n        ' #NEWLINE# dirs = next ( os . walk ( root_dir ) ) [ 1 ] #NEWLINE# repos = [ ] #NEWLINE# skipped = [ ] #NEWLINE# for directory in dirs : #NEWLINE# #INDENT# os . chdir ( os . path . join ( root_dir , directory ) ) #NEWLINE# if Git . is_git_repo ( ) : #NEWLINE# #INDENT# log . echo ( ' [blue]::[reset] Found directory `[white]{}[reset]`' . format ( directory ) ) #NEWLINE# url = Git . get_remote_url ( ) #NEWLINE# name = url . replace ( ':' , '/' ) #NEWLINE# name = re . sub ( '.git$' , '' , name ) #NEWLINE# name = '/' . join ( name . split ( '/' ) [ ( - 2 ) : ] ) #NEWLINE# if ( name . split ( '/' ) [ 1 ] == directory ) : #NEWLINE# #INDENT# repos . append ( name ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# repos . append ( { #NEWLINE# #INDENT# 'dir' : directory , #NEWLINE# 'name' : name , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# skipped . append ( name ) #NEWLINE# #UNINDENT# #UNINDENT# log . echo ( ' [blue]::[yellow] Skipped[reset] non-git repositories: {}' . format ( ', ' . join ( skipped ) ) ) #NEWLINE# return { #NEWLINE# #INDENT# 'name' : os . path . basename ( root_dir ) , #NEWLINE# 'dir' : root_dir , #NEWLINE# 'repos' : repos , #NEWLINE# #UNINDENT# }