Exemple #1
0
    def test_ignore__ignores(self):

        repo = TemplateRepo()

        self.tmpdir.mkdir('node_modules')
        self.tmpdir.mkdir('node_modules/hello')
        self.tmpdir.mkdir('.git')
        self.tmpdir.mkdir('hi')

        to_ignore = repo.ignore(
            str(self.tmpdir),
            [
                # -- ignore: node_modules and all its children
                'node_modules',
                'node_modules/hello',
                'node_modules/angular.ts',

                # -- ignore: .git and all its children
                '.git',
                '.git/hooks',
                '.git/whatever.json',

                # -- no ignore .ts
                'hello.ts',
                'hi/hello.ts',
            ])

        assert set(to_ignore) == set([
            '.git',
            '.git/hooks',
            '.git/whatever.json',
            'node_modules',
            'node_modules/hello',
            'node_modules/angular.ts',
        ])
Exemple #2
0
    def test_ignore__keeps(self):

        repo = TemplateRepo()

        self.tmpdir.mkdir('x')
        self.tmpdir.mkdir('x/y')

        to_ignore = repo.ignore(
            str(self.tmpdir),
            [
                # -- exceptions
                'a/karma.conf.js',
                'a/browserslist',
                'a/.npmignore',
                'a/.gitkeep',

                # -- ts
                'a/hi.ts',
                'a/b/service.ts',

                # -- html
                'b/app.html',
                'b/c/what.html',

                # -- json
                'hi.json',
                'c/wat.json',

                # -- ico
                'hi.ico',
                'c/wat.ico',

                # -- css
                'hi.css',
                'c/wat.css',

                # -- all other directories
                'x/what.json',
                'x/y/whatever.ts',
            ])

        # -- all to keep
        assert to_ignore == []