Beispiel #1
0
 def gitHubAccessGet(self, args, githubAccess):
     try:
         githubAccessHook = repo().organizationRepoAccessGet(args, githubAccess)
         self.getRepoPrivateAccessStatus(args, githubAccessHook)
         return githubAccessHook
     except Exception as e:
         try:
             args.repo_organization = utils().organizationNameGet(args.deploy_github_url)
             githubAccessHook = repo().organizationRepoAccessGet(args, githubAccess)
             self.getRepoPrivateAccessStatus(args, githubAccessHook)
             return githubAccessHook
         except Exception as e:
             raise Exception("[!] Invalid GitHub repository URL")
Beispiel #2
0
    def test_repo_init(self):
        with self.assertRaises(TypeError):
            r = repo()

        with self.assertRaises(TypeError):
            r = repo(path=self.path)

        with self.assertRaises(TypeError):
            r = repo(data=self.data)

        r = repo(path=self.path, data=self.data)
        self.assertEqual(r._path, self.path)
        self.assertEqual(r._data, self.data)
Beispiel #3
0
 def test_execute(self):
     r = repo(self.path, self.data)
     d = {
         'pull': True,
         'push': True
     }
     self.assertDictEqual(r.execute(), d)
Beispiel #4
0
def main():
    try:
        args = argsData().argsGet()

        # Debug mode
        if (args.debug_mode == True):
            print("\r\n[Debug] args:")
            print(args)

        if (args.github_personal_access_token or args.bitbucket_tag_operation):
            # Repository Deployment Operations
            if (args.deployment):
                githubAccess = Github(args.github_personal_access_token)
                deploy().performDeployOperations(args, githubAccess)
                print("[*] tool-github-deploy deployment operation done")

            # Repository Operations
            if (args.repo_operation or args.repo_update):
                githubAccess = Github(args.github_personal_access_token)
                repo().performRepoOperations(args, githubAccess)
                print("[*] tool-github-deploy repository operation done")

            # Repository Release Operations
            if (args.release_operation):
                githubAccess = Github(args.github_personal_access_token)
                release().performReleaseOperations(args, githubAccess)
                print("[*] tool-github-deploy release operation done")

            # Bitbucket Tag Operations
            if (args.bitbucket_tag_operation):
                bitbucket().performBitbucketOperations(args)
                print("[*] tool-github-deploy Bitbucket Tag operation done")

            if (args.validate_deploy_operation):
                githubAccess = Github(args.github_personal_access_token)
                deploymentValidator().performDeploymentValidatorOperations(
                    args, githubAccess)

            sys.exit(0)
        elif (args.validate_deploy_operation):
            deploymentValidator().performDeploymentValidatorOperations(
                args, None)
        else:
            print("[!] Invalid github_personal_access_token key")
    except Exception as e:
        print(e)
        sys.exit(1)
Beispiel #5
0
 def test_repo_str(self):
     r = repo(self.path, self.data)
     d = {
         'path': self.path,
         'expand_path': self.expand_path,
         'data': self.data
     }
     self.assertEqual(str(r), str(d))
Beispiel #6
0
 def test_git_commit_distance(self):
     r = repo('~/workspace/prepost', self.data)
     # git log --oneline
     # e02e693 :hammer: パスが有効かチェックする命令を追加
     # e9468b5 :sparkles: テストを満たす関数を作成
     # fbc1a76 :sparkles: テスト追加
     # 144ec46 :sparkles: テストを満たすように関数を修正
     # ac676ec :bug: 例外を投げるのは微妙に感じたのでtrue/falseに変更
     self.assertEqual(r.git_commit_distance('ac676ec', 'e02e693'), 4)
     self.assertEqual(r.git_commit_distance('e02e693', 'ac676ec'), -4)
     self.assertEqual(r.git_commit_distance('e02e693', 'e02e693'), 0)
Beispiel #7
0
 def test_is_pulled(self):
     r = repo(self.path, self.data)
     self.assertTrue(r.is_pulled())
Beispiel #8
0
 def test_get_expand_path(self):
     r = repo(self.path, self.data)
     self.assertEqual(self.expand_path, r.get_expand_path())
Beispiel #9
0
 def test_get_data(self):
     r = repo(self.path, self.data)
     self.assertDictEqual(self.data, r.get_data())
Beispiel #10
0
 def test_is_exists_commit_hash(self):
     r = repo(self.path, self.data)
     self.assertFalse(r.is_exists_commit_hash(0))
     self.assertTrue(r.is_exists_commit_hash('ac676ec'))
Beispiel #11
0
 def test_is_committed(self):
     r = repo(self.path, self.data)
     self.assertTrue(r.is_committed())