Ejemplo n.º 1
0
    def handle(self, *args, **options):
        """
        :param args:
        :param options:
        :return:
        """
        counter = 0
        for key in options:
            if options[key]:
                counter += 1

        # If no options are set, do a normal patch
        if counter == 1:
            options['default'] = True
        ###########################################################################################

        tag_succeed = 1

        if APISettings.GIT_TAG_AUTO_COMMIT:
            Git.add()
            Git.commit()

        if options['default']:
            tag_succeed = Git.tag()

        if options['staging']:
            tag_succeed = Git.tag(APISettings.GIT_STAGING_PRE_TAG)

        if options['production']:
            tag_succeed = Git.tag(APISettings.GIT_ACTIVATE_PRE_TAG)

        if options['push'] | APISettings.GIT_TAG_AUTO_TAG_PUSH:
            if tag_succeed:
                Git.push_tags()
Ejemplo n.º 2
0
    def handle(self, *args, **options):
        arguments = []

        for key in options:
            if options[key]:
                arguments.append('--' + key)

        # Remove --verbosity
        arguments.remove('--verbosity')

        # Add the files
        Git.add(arguments)
Ejemplo n.º 3
0
    def handle(self, *args, **options):

        """
        Check, how much options are true.
        If option '--force', '-f' is set this part will be skipped.
        """
        if not options['force']:
            counter = 0
            for key in options:
                if options[key]:
                    counter += 1

            # If no options are set, do a normal patch
            if counter == 1:
                options['patch'] = True

            # more then one options are not enabled per default
            if counter >= 3:
                # TODO: Raise Error!
                exit('It is not recommended to use more then one parameter. Use -f to force your command.')
        ###########################################################################################

        if options['major']:
            Version.set_major()

        if options['minor']:
            Version.set_minor()

        if options['patch']:
            Version.set_patch()

        if options['dev']:
            Version.set_patch(Version.DEV)

        if options['alpha']:
            Version.set_patch(Version.ALPHA)

        if options['beta']:
            Version.set_patch(Version.BETA)

        if options['rc']:
            Version.set_patch(Version.RC)

        """
        Automatic commands.
        Depends on User Settings.
        """
        if APISettings.PATCH_AUTO_COMMIT:
            Git.add()
            Git.commit()

        if APISettings.PATCH_AUTO_TAG:
            Git.tag()
            if APISettings.PATCH_AUTO_TAG_PUSH:
                Git.push_tags()
Ejemplo n.º 4
0
 def handle(self, *args, **options):
     Git.add()