예제 #1
0
 def run(self):
     kwargs = self.kwargs
     project = Project(self.project_path)
     builds_path = get_parent_dir(project.get_export_path())
     pip_path = project.get_config_folder(self.project_path)
     run(['rm', '-rf', builds_path])
     run(['rm', '-rf', pip_path])
     color_print("Pipeline files and Builds were removed", WHITE)
예제 #2
0
 def check_inited(self):
     if not Project.is_initialized(self.project_path):
         if question_yes_no("Project is not initialized. Initialize it now?", color=YELLOW):
             init_project(self.project_path, self.kwargs)
         else:
             return False
     return True
예제 #3
0
    def run(self):
        project = Project(self.project_path)

        if self.command in ['list', 'ls']:
            print(yaml.dump(project.commands, default_flow_style=False))
            return

        if self.command not in project.commands:
            color_print(
                "Command %s is not defined for this project" % self.command,
                RED)

        cmd = project.commands[self.command]
        if isinstance(cmd, str):
            shell_cmd = self._format(project, cmd)
            cwd = os.getcwd()
            run(shell_cmd.split(" "), cwd)
        else:
            commands = [cmd['command']] if isinstance(cmd['command'],
                                                      str) else cmd['command']
            for command in commands:
                shell_cmd = self._format(project, command)
                cwd = self._format(
                    project, cmd['cwd']) if 'cwd' in cmd else os.getcwd()
                run(shell_cmd.split(" "),
                    os.path.abspath(os.path.expanduser(cwd)))
예제 #4
0
    def run(self):
        kwargs = self.kwargs
        start_time = time.time()

        if not Project.is_initialized(self.project_path) or kwargs.get(
                'force', False):
            InitMode(kwargs).start()
        ExportMode(kwargs).start()
        FastlaneMode(kwargs).start()

        elapsed_min = str(round((time.time() - start_time) / 60))
        color_print("Pipeline just saved you " + elapsed_min + " min", WHITE)
예제 #5
0
 def _check_all(self):
     if not self._check_project_folder():
         color_print("Project path %s is not exist or not writable" %
                     self.project_path, RED)
         return False
     if not self._check_if_unity_project():
         color_print("No Unity project detected in %s" %
                     self.project_path, RED)
         return False
     if Project.is_initialized(self.project_path):
         if not self.forced:
             color_print(
                 "Project already initialized. Use --force flag to reinitialize", RED)
             return False
         else:
             color_print(
                 "Project already initialized, but you've used --force flag!", YELLOW)
             project = Project(self.project_path)
             file_name = f":backup_before_init_{time.time()}"
             project.backup(Project.BUILD_TYPE_XCODE, file_name)
     return True
예제 #6
0
    def run(self):
        project = Project(self.project_path)
        color_print("Exporting project", GREEN)
        detected_unity = Unity.detect_version(self.project_path)
        use_append_strategy = detected_unity.version == project.unity.version

        is_first_export = not os.path.exists(
            project.get_export_path(Project.BUILD_TYPE_XCODE))
        if is_first_export:
            color_print(
                "No exported project detected. Performing clean export",
                YELLOW)
            return self._export(project, False)

        if not use_append_strategy:
            warning = "Detected Unity version difference was: {} now: {}" \
                .format(project.unity.version, detected_unity.version)
            color_print(warning, YELLOW)
            color_print("Using REPLACE strategy for project build")
        else:
            color_print("Using APPEND strategy for project build")
        self._export(project, use_append_strategy)
예제 #7
0
    def run(self):
        if not self._check_all():
            return

        unity = Unity.detect_version(self.project_path)
        xcode_project_path = self._detect_xcode_project_path()
        if not unity or not xcode_project_path:
            return color_print("Project cannot be initialized", RED)

        use_backups = question_yes_no("Enable exported project backups?")

        ptrn = re.compile(pattern)
        username = question(
            "Please, provide your appleID (email) for further usage by fastlane",
            example="*****@*****.**",
            check_answer=lambda p: re.match(ptrn, p),
            incorrect_answer=lambda p: "Email %s is invalid" % p
        )

        bundleID = question(
            "Please, provide your app bundle id for further usage by fastlane",
            example="com.default.test",
            check_answer=lambda p: len(p) >= 8,
            incorrect_answer=lambda p: "Bundle ID %s is too short" % p
        )

        teamID = question(
            "Please, provide your apple team id for further usage by fastlane",
            example="7NS7GL82HF",
            check_answer=lambda p: len(p) == 10,
            incorrect_answer=lambda p: "Team ID %s should have 10 symbols, neither less nor more" % p
        )

        project = Project.factory(
            self.project_path, unity, xcode_project_path, use_backups, username, bundleID, teamID)
        project.save()
        try:
            self._copy_stubs(project)
            color_print("Project successfully initialized!")
        except Exception as e:
            project.drop()
            color_print("Project initialization fail", RED)
            raise e
예제 #8
0
 def run(self):
     project = Project(self.project_path)
     fastlane = Fastlane(project)
     fastlane.execute(self.options)