Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uploaded newversion file #11

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions container_workflow_tool/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ def koji_usage(self):
def git_usage(self):
return CliCommon.git_usage(self) % (self.prg_name, "")


def newversion_usage(self):
return CliCommon.newversion_usage(self) % (self.prg_name, "")

def run(self):
if self.args.command == "build":
method_name = "build_images"
Expand Down
5 changes: 5 additions & 0 deletions container_workflow_tool/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@
actions['dockerhub'] = ['updatefulldescription', ]
actions['utils'] = ['showconfig', 'listimages', 'listupstream', ]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actions['newversion'] is missing here.

Copy link
Author

@powerexploit powerexploit May 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I need some instructions to add commands for newversion.
for #11 .
79c30bf

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take inspiration from the other cwt subcommands like git. This is a part of your job ;)

action_map['newversion'] = {
'add': 'add_new_version',
'show': 'show_changes',
}

COMMAND = ""
30 changes: 30 additions & 0 deletions container_workflow_tool/newversion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import os
import subprocess as sub
import shutil

from git import Repo
from git.exc import GitCommandError

class NewVersion(object,):
powerexploit marked this conversation as resolved.
Show resolved Hide resolved
def __init__(self,_oldversion,_version):
self._oldversion=_oldversion
self._version=_version

def create_newversion(_version):
system('tput setaf 2')
print('[*] Creating new version')
sub.call(['mkdir',self._version])


def move_version(_oldversion,_version):
create_newversion()
sub.call(['git mv ',self._oldversion,self._version])
sub.run(['git commit'],shell=true)


def new_commit(_oldversion,_version):
move_version()
sub.call(['cp -r',self._version,self._oldversion])
sub.call(['git add',self._version])
sub.run(['git commit'],shell=true)