Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
30 changes: 30 additions & 0 deletions node_port/git_add.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import os,subprocess


os.chdir("../git_check")

cmd = "git add ."
subprocess.check_output(cmd, shell=True)

status= "git status -s"
returned_value = subprocess.check_output(status, shell=True)

print('updated files:', returned_value)

if not returned_value==b'':
commit_message='"Added/Updated Following files '
if len(str(returned_value).split(r'\n'))>0:
for file_name in str(returned_value).split(r'\n'):
commit_message=commit_message+file_name[5:]+" "
cmd= "git commit -m "+commit_message+r'"'
print("Commit message ",subprocess.check_output(cmd, shell=True))
try:
cmd= "git push origin master"
result = subprocess.check_output(cmd, shell=True)
print(result)
except:
cmd = "git pull"
returned_value = subprocess.check_output(cmd, shell=True)
cmd = "git push origin master"
result = subprocess.check_output(cmd, shell=True)
print(result)
24 changes: 24 additions & 0 deletions node_port/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const express = require("express");
const { spawn } = require("child_process");
const app = express();
const port = 3000;
app.get("/", (req, res) => {
var dataToSend;
// spawn new child process to call the python script
const python = spawn("python", ["git_add.py"]);
// collect data from script
python.stdout.on("data", function (data) {
console.log("Pipe data from python script ...");
dataToSend = data.toString();
});
// in close event we are sure that stream from child process is closed
python.on("close", (code) => {
console.log(`child process close all stdio with code ${code}`);
// send data to browser
res.send(dataToSend);
});
});
app.listen(port, () =>
console.log(`Example app listening on port
${port}!`)
);
15 changes: 15 additions & 0 deletions node_port/node_modules/.bin/mime

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions node_port/node_modules/.bin/mime.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

236 changes: 236 additions & 0 deletions node_port/node_modules/accepts/HISTORY.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions node_port/node_modules/accepts/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading