def test_read(self): r = Reader(".") with patch('os.walk', new=mock_walk): with patch('__builtin__.open', new=mock_open, create=True): r.read() self.assertEqual(r.dotfile_map['inputrc'].aggregated_contents(), "Space: magic-space\nset show-all-if-ambiguous on") self.assertEqual(r.dotfile_map['sub/somerc'].aggregated_contents(), "export EDITOR=vim\nHISTFILESIZE=100000000")
def main(): logging.basicConfig(level=logging.INFO) args = argparser.parse_args() confirm_overwrite = (args.no_confirm is False) hooks.run_pre() reader = Reader(".") reader.read() for dotfile in reader.dotfile_map.next_dotfile(): writer = Writer(dirpath=dotfile.dirpath, filename=dotfile.filename, contents=dotfile.aggregated_contents(), confirm_overwrite=confirm_overwrite) writer.write() hooks.run_post()