Package org.gradle.api.file

Examples of org.gradle.api.file.RelativePath


        maybeVisit(fileDetails.getRelativePath().getParent());
        getVisitor().visitFile(fileDetails);
    }

    public void visitDir(FileVisitDetails dirDetails) {
        RelativePath path = dirDetails.getRelativePath();
        if (!visitedDirs.contains(path)) {
            pendingDirs.put(path, dirDetails);
        }
    }
View Full Code Here


            public void visitFile(FileVisitDetails fileDetails) {
                maybeDelete(fileDetails, false);
            }

            private void maybeDelete(FileVisitDetails fileDetails, boolean isDir) {
                RelativePath path = fileDetails.getRelativePath();
                if (!visited.contains(path)) {
                    if (isDir) {
                        GFileUtils.deleteDirectory(fileDetails.getFile());
                    } else {
                        GFileUtils.deleteQuietly(fileDetails.getFile());
View Full Code Here

    public RenamingCopyAction(Transformer<String> transformer) {
        this.transformer = transformer;
    }

    public void execute(FileCopyDetails fileCopyDetails) {
        RelativePath path = fileCopyDetails.getRelativePath();
        path = path.replaceLastName(transformer.transform(path.getLastName()));
        fileCopyDetails.setRelativePath(path);
    }
View Full Code Here

            read = true;
            return tar;
        }

        public RelativePath getRelativePath() {
            return new RelativePath(!entry.isDirectory(), entry.getName().split("/"));
        }
View Full Code Here

        Visit visit = new Visit(visitor, stopFlag);
        for (Map.Entry<RelativePath, Closure> entry : elements.entrySet()) {
            if (stopFlag.get()) {
                break;
            }
            RelativePath path = entry.getKey();
            Closure generator = entry.getValue();
            visit.visit(path, generator);
        }
        return this;
    }
View Full Code Here

public class NameOnlyPatternMatcherTest {

    @Test public void testLiteralName() {
        Spec<RelativePath> matcher;
        RelativePath path;

        matcher = new NameOnlyPatternMatcher(true, true, "fred.txt");

        path = new RelativePath(true, "fred.txt");
        assertTrue(matcher.isSatisfiedBy(path));

        path = new RelativePath(true, "something.else");
        assertFalse(matcher.isSatisfiedBy(path));
    }
View Full Code Here

        assertFalse(matcher.isSatisfiedBy(path));
    }

    @Test public void testPartialMatch() {
        Spec<RelativePath> matcher;
        RelativePath path;

        matcher = new NameOnlyPatternMatcher(true, true, "fred");
        path = new RelativePath(true, "fred");
        assertTrue(matcher.isSatisfiedBy(path));

        path = new RelativePath(false, "subdir");
        assertTrue(matcher.isSatisfiedBy(path));


        matcher = new NameOnlyPatternMatcher(false, true, "fred");
        path = new RelativePath(true, "fred");
        assertTrue(matcher.isSatisfiedBy(path));

        path = new RelativePath(false, "subdir");
        assertFalse(matcher.isSatisfiedBy(path));
    }
View Full Code Here

        assertFalse(matcher.isSatisfiedBy(path));
    }

    @Test public void testWildcardInName() {
        Spec<RelativePath> matcher;
        RelativePath path;

        matcher = new NameOnlyPatternMatcher(true, true, "*.jsp");
        path = new RelativePath(true, "fred.jsp");
        assertTrue(matcher.isSatisfiedBy(path));

        path = new RelativePath(true, "fred.java");
        assertFalse(matcher.isSatisfiedBy(path));
    }
View Full Code Here

    public void initialRelativePathForFileIsSpecPathPlusFilePath() {
        FileCopyDetails copyDetails = expectActionExecutedWhenFileVisited();

        context.checking(new Expectations(){{
            allowing(spec).getDestPath();
            will(returnValue(new RelativePath(false, "spec")));
            allowing(details).getRelativePath();
            will(returnValue(new RelativePath(true, "file")));
        }});

        assertThat(copyDetails.getRelativePath(), equalTo(new RelativePath(true, "spec", "file")));
    }
View Full Code Here

    public void relativePathForDirIsSpecPathPlusFilePath() {
        FileVisitDetails visitDetails = expectSpecAndDirVisited();

        context.checking(new Expectations(){{
            allowing(spec).getDestPath();
            will(returnValue(new RelativePath(false, "spec")));
            allowing(details).getRelativePath();
            will(returnValue(new RelativePath(false, "dir")));
        }});

        assertThat(visitDetails.getRelativePath(), equalTo(new RelativePath(false, "spec", "dir")));
    }
View Full Code Here

TOP

Related Classes of org.gradle.api.file.RelativePath

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.