olivierkes / manuskript

A open-source tool for writers
http://www.theologeek.ch/manuskript
GNU General Public License v3.0
1.7k stars 226 forks source link

Script for automatic git push #1288

Open FastusNumen opened 4 months ago

FastusNumen commented 4 months ago

I wrote two scripts to automate the git push.

Since I'm a noob with coding and scripting, I'd like to ask if you think there'll be a problem with them, though.

I first created a "push.sh" file to automate the push to GitHub:

#!/bin/bash

echo "***********************************************************" &>> log_push.txt

date '+%A %d/%m/%Y %X' &>> log_push.txt

git add . &>> log_push.txt

git commit -m 'Routine edit' &>> log_push.txt

git push &>> log_push.txt

Then I created "run_manuskript-push.sh" to automatically start Manuskript and then push to GitHub when I close it:

#!/bin/bash

python ~/Desktop/Manuskript/manuskript/bin/manuskript

sh push.sh

The scripts are both on the folder with the .msk file, where the .git is, and when I double click them they automatically open the script in the Git Bash.

This way, I only have to go to my fiction folder, double-click on "run_manuskript-push.sh", and Manuskript starts.

When I close it, the script starts "push.sh" without me doing anything.

Btw, "push.sh" saves the output of the terminal in "log_push.txt", in case there are problems.

It seems to be working well now, but what do you think?

I'm using Windows 11.

Edit: I added "log_push.txt" to ".gitignore", since I couldn't find a way to write the terminal text only after it finished the commands. There's also still the line feed problem #1287 .

TheJackiMonster commented 4 months ago

I recommend not adding files via git add . because you won't have a lot control over files being committed or not. Instead you could only commit the .msk file and its folder with similar name. That would solve the problem with your log file as well.

There's already an incentive to integrate git into Manuskript as replacement of the currently broken revision system. Maybe you want to add to the discussion: #379 and #871

FastusNumen commented 4 months ago

I recommend not adding files via git add . because you won't have a lot control over files being committed or not. Instead you could only commit the .msk file and its folder with similar name. That would solve the problem with your log file as well.

Thanks for the tip. I have other folders in there, for images and other things, but thinking about it, I can add them separately when I need.

There's already an incentive to integrate git into Manuskript as replacement of the currently broken revision system. Maybe you want to add to the discussion: #379 and #871

I already saw them. I truly wish I could help, but I'm not good at coding. Most of your talks fly over my head, and I'd be more of a disturbance than help. These scripts are just an easy workaround while I wait for you to incorporate git on Manuskript.

I tried to help my way by writing a tutorial on Royal Road (not yet finished) and mentionning it in a few places. Maybe that will pull in some writer with coding experience willing to help. That's all I can do.