Example #1
0
def test_glob_project_modules_can_include_path_in_non_dot_source_dir(
        tmpdir, elm_version, make_elm_project):
    project_dir = make_elm_project(
        elm_version,
        tmpdir,
        sources={
            'src': [
                'Main.elm',
                'MissingModuleComment.elm',
            ],
        },
        copy_elm_stuff=False,
    )
    project = elm_project.from_path(Path(str(project_dir)))
    config = elm_project.ProjectConfig(
        include_paths=_resolve_paths(project_dir, 'src/Main.elm'),
        exclude_modules=[],
        force_exclusion=False,
    )
    modules = list(_glob_project_modules(project, config))
    assert set(modules) == set(['Main'])
Example #2
0
def test_glob_project_modules_includes_all_by_default(
        tmpdir, elm_version, make_elm_project):
    project_dir = make_elm_project(
        elm_version,
        tmpdir,
        sources={
            '.': [
                'Main.elm',
                'MissingModuleComment.elm',
            ],
        },
        copy_elm_stuff=False,
    )
    project = elm_project.from_path(Path(str(project_dir)))
    config = elm_project.ProjectConfig(
        include_paths=[],
        exclude_modules=[],
        force_exclusion=False,
    )
    modules = list(_glob_project_modules(project, config))
    assert set(modules) == set(['Main', 'MissingModuleComment'])
Example #3
0
def test_glob_project_modules_excludes_take_precedence_over_includes_if_forced(
        tmpdir, elm_version, make_elm_project):
    project_dir = make_elm_project(
        elm_version,
        tmpdir,
        sources={
            '.': [
                'Main.elm',
                'MissingModuleComment.elm',
                'PublicFunctionNotInAtDocs.elm',
            ],
        },
        copy_elm_stuff=False,
    )
    project = elm_project.from_path(Path(str(project_dir)))
    config = elm_project.ProjectConfig(
        include_paths=_resolve_paths(project_dir, 'Main.elm', 'MissingModuleComment.elm'),
        exclude_modules=['MissingModuleComment'],
        force_exclusion=True,
    )
    modules = list(_glob_project_modules(project, config))
    assert set(modules) == set(['Main'])
Example #4
0
def test_glob_project_modules_exclude_source_directories(
        tmpdir, elm_version, make_elm_project):
    project_dir = make_elm_project(
        elm_version,
        tmpdir,
        sources={
            'src1': [
                'Main.elm',
            ],
            'src2': [
                'PublicFunctionNotInAtDocs.elm',
            ],
        },
        copy_elm_stuff=False,
    )
    project = elm_project.from_path(Path(str(project_dir)))
    config = elm_project.ProjectConfig(
        include_paths=[],
        exclude_source_directories=['src2'],
        force_exclusion=True,
    )
    modules = list(_glob_project_modules(project, config))
    assert set(modules) == set(['Main'])
Example #5
0
def test_glob_project_modules_ignores_dot_directories(
        tmpdir, elm_version, make_elm_project):
    project_dir = make_elm_project(
        elm_version,
        tmpdir,
        sources={
            '.': [
                'Main.elm',
            ],
        },
        copy_elm_stuff=False,
    )
    dot_dir_file = Path(str(project_dir / '.elm-doc' / 'Extra.elm'))
    dot_dir_file.parent.mkdir()
    dot_dir_file.touch()
    project = elm_project.from_path(Path(str(project_dir)))
    config = elm_project.ProjectConfig(
        include_paths=[],
        exclude_modules=[],
        force_exclusion=False,
    )
    modules = list(_glob_project_modules(project, config))
    assert set(modules) == set(['Main'])
Example #6
0
                ],
                cwd=str(repo_path),
                stderr=subprocess.STDOUT,
            )
        except subprocess.CalledProcessError as e:
            print('\nSTDOUT:\n' + e.stdout.decode('utf8'))
            print('\nSTDERR:\n' + e.stderr.decode('utf8'))
            raise e


# build docs for the workspace project

workspace_path = Path(__file__).parent / 'workspace'
output_path = workspace_path / 'build' / 'docs'
elm_path = workspace_path / 'node_modules' / '.bin' / 'elm'
config = elm_project.ProjectConfig()


def task_install_workspace_elm():
    yield {
        'name': 'install_elm',
        'file_dep': [workspace_path / 'elm.json'],
        'targets': [elm_path],
        'actions': [(_install_elm, (workspace_path, ))]
    }


def _install_elm(project_path: Path):
    elm_version = _read_elm_version(project_path / 'elm.json')
    conftest.install_elm(project_path, elm_version)