Skip to content

Commit

Permalink
adding logs
Browse files Browse the repository at this point in the history
  • Loading branch information
yzainee committed Nov 15, 2018
1 parent 643d15b commit e7bd48f
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions f8a_worker/workers/git_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,58 @@
class GitOperationTask(BaseTask):
"""Do the git operations to get manifest files."""

@staticmethod
def generate_files_for_maven(path, files):
os.system("cd " + path + "; ls -l ;mvn install; "
"mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.1:collect"
" -DoutputFile=direct-dependencies.txt "
"-DincludeScope=runtime "
"-DexcludeTransitive=true; "
"mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.1:collect"
" -DoutputFile=transitive-dependencies.txt "
"-DincludeScope=runtime "
"-DexcludeTransitive=false")
files.append(FileStorage
(open(path + "/direct-dependencies.txt", 'rb'),
filename='direct-dependencies.txt'))
files.append(FileStorage
(open(path + "/transitive-dependencies.txt", 'rb'),
filename='transitive-dependencies.txt'))
return files

@staticmethod
def generate_files_for_node(path, files):
npm_installer = "https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh"
os.system("cd " + path + "; ls -l ;npm install; "
" curl -o- " + npm_installer + " | bash;"
" source ~/.nvm/nvm.sh"
" nvm install node; nvm use node; npm install; "
"npm list --prod --json >> npm-list.json")
files.append(FileStorage(open(path + "/npm-list.json", 'rb'),
filename='npm-list.json'))
return files

@staticmethod
def create_repo_and_generate_files(giturl, ecosystem, files):
"""Create a repo and generate dep files."""
repo_name = giturl.split("/")[-1]
path = _dir_path + "/" + repo_name
Repo.clone_from(giturl, path)
if ecosystem == "maven":
files = RepoDependencyCreator.generate_files_for_maven(
path, files
)

elif ecosystem == "npm":
files = RepoDependencyCreator.generate_files_for_node(
path, files
)

def execute(self, arguments):
"""Perform the git operations."""
self.log.error("YUSUF: Hello World")
self.log.info("YUSUF: Hello World")
self.log.debug("YUSUF: Hello World")
print("YUSUF: Hello World")
self.log.error(arguments.get('git_url'))
self.log.error(arguments.get('ecosystem'))

0 comments on commit e7bd48f

Please sign in to comment.