Esempio n. 1
0
    def it_deletes_the_log_file(config):
        gitman.install('gitman_1', depth=1)
        gitman.list()
        expect(os.path.exists(config.log_path)) == True

        gitman.uninstall()
        expect(os.path.exists(config.log_path)) == False
Esempio n. 2
0
    def it_deletes_dependencies_when_they_exist(config):
        gitman.install('gitman_1', depth=1)
        expect(os.path.isdir(config.location)) == True

        expect(gitman.uninstall()) == True

        expect(os.path.exists(config.location)) == False
Esempio n. 3
0
    def it_deletes_dependencies_when_they_exist(config):
        gitman.install('gitman_1', depth=1)
        expect(os.path.isdir(config.location)) == True

        expect(gitman.uninstall(keep_location=True)) == True

        path = os.path.join(config.location, 'gitman_1')
        expect(os.path.exists(path)) == False

        expect(os.path.exists(config.location)) == True

        gitman.uninstall()
Esempio n. 4
0
    def it_merges_sources(config):
        config.__mapper__.text = strip("""
        location: deps
        sources:
        - name: gitman_1
          repo: https://github.com/jacebrowning/gitman-demo
          rev: example-branch
          link:
          scripts:
          -
        sources_locked:
        - name: gitman_2
          repo: https://github.com/jacebrowning/gitman-demo
          rev: example-branch
          link:
          scripts:
          -
        - name: gitman_3
          repo: https://github.com/jacebrowning/gitman-demo
          rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04
          link:
          scripts:
          -
        """)

        expect(gitman.install(depth=1)) == True

        expect(len(os.listdir(config.location))) == 3
Esempio n. 5
0
    def it_updates_the_log(config):
        gitman.install()
        gitman.list()

        with open(config.log_path) as stream:
            contents = stream.read().replace(TMP, "tmp").replace('\\', '/')
        expect(contents) == strip("""
        2012-01-14 12:00:01
        tmp/deps/gitman_1: https://github.com/jacebrowning/gitman-demo @ 1de84ca1d315f81b035cd7b0ecf87ca2025cdacd
        tmp/deps/gitman_1/gitman_sources/gdm_3: https://github.com/jacebrowning/gdm-demo @ 050290bca3f14e13fd616604202b579853e7bfb0
        tmp/deps/gitman_1/gitman_sources/gdm_3/gitman_sources/gdm_3: https://github.com/jacebrowning/gdm-demo @ fb693447579235391a45ca170959b5583c5042d8
        tmp/deps/gitman_1/gitman_sources/gdm_3/gitman_sources/gdm_4: https://github.com/jacebrowning/gdm-demo @ 63ddfd82d308ddae72d31b61cb8942c898fa05b5
        tmp/deps/gitman_1/gitman_sources/gdm_4: https://github.com/jacebrowning/gdm-demo @ 63ddfd82d308ddae72d31b61cb8942c898fa05b5
        tmp/deps/gitman_2: https://github.com/jacebrowning/gitman-demo @ 7bd138fe7359561a8c2ff9d195dff238794ccc04
        tmp/deps/gitman_3: https://github.com/jacebrowning/gitman-demo @ 9bf18e16b956041f0267c21baad555a23237b52e
        """,
                                  end='\n\n')
Esempio n. 6
0
    def it_detects_invalid_repositories(config):
        shell.rm(os.path.join("deps", "gitman_1", ".git"))
        shell.mkdir(os.path.join("deps", "gitman_1", ".git"))

        try:
            with pytest.raises(InvalidRepository):
                expect(gitman.install('gitman_1', depth=1)) == False

        finally:
            shell.rm(os.path.join("deps", "gitman_1"))
Esempio n. 7
0
    def it_can_handle_missing_locked_sources(config):
        config.datafile.text = strip("""
        location: deps
        sources:
          - name: gitman_1
            repo: https://github.com/jacebrowning/gitman-demo
            rev: example-branch
            link:
            scripts:
              -
        sources_locked:
          - name: gitman_2
            type: git
            repo: https://github.com/jacebrowning/gitman-demo
            rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04
            link:
            scripts:
              -
        """)
        config.datafile.load()

        expect(gitman.install('gitman_1', depth=1)) == True

        expect(os.listdir(config.location)) == ['gitman_1']
Esempio n. 8
0
    def it_creates_missing_directories(config):
        shell.rm(config.location)

        expect(gitman.install('gitman_1', depth=1)) == True

        expect(os.listdir(config.location)) == ['gitman_1']
Esempio n. 9
0
 def script_failures_can_be_ignored(config_with_scripts):
     expect(gitman.install(force=True)) == True
Esempio n. 10
0
 def it_detects_failures_in_scripts(config_with_scripts):
     with pytest.raises(RuntimeError):
         expect(gitman.install())
Esempio n. 11
0
        def it_overwrites_files_with_force(config_with_link):
            os.system("touch my_link")

            expect(gitman.install(depth=1, force=True)) == True
Esempio n. 12
0
        def it_should_not_overwrite_files(config_with_link):
            os.system("touch my_link")

            with pytest.raises(RuntimeError):
                gitman.install(depth=1)
Esempio n. 13
0
        def it_should_create_links(config_with_link):
            expect(gitman.install(depth=1)) == True

            expect(os.listdir()).contains('my_link')
Esempio n. 14
0
    def it_should_not_modify_config(config):
        expect(gitman.install('gitman_1', depth=1)) == True

        expect(config.__mapper__.text) == CONFIG
Esempio n. 15
0
 def it_contains_only_the_sparse_paths(config):
     expect(gitman.install(depth=1, force=True)) == True
     dir_listing = os.listdir(os.path.join(config.location, "gitman_1"))
     expect(dir_listing).contains('src')
     expect(len(dir_listing) == 1)
Esempio n. 16
0
 def it_successfully_materializes_the_repo(config):
     expect(gitman.install(depth=1, force=True)) == True
     dir_listing = os.listdir(os.path.join(config.location, "gitman_1"))
     expect(dir_listing).contains('src')