Skip to content
Snippets Groups Projects
Commit 2447f92a authored by María José Ramos's avatar María José Ramos
Browse files

Update Files

parent 217af367
No related branches found
No related tags found
No related merge requests found
Showing
with 91 additions and 30 deletions
......@@ -19,19 +19,27 @@ To get all the files in this repository and use the program, clone the file to y
```git clone https://gitmilab.redclara.net/ramosm/git-zenodo-assistant.git```
If you want to have this repository in your own GitLab account, **fork** the repository and then **clone** it with the https from your **own** account.
If you want to have this repository in your own GitLab account, **fork** the repository and then **clone** it with the https from your **own** account.
Before running the program you should set your user name and email address. In order to do so, execute these commands:
```git config --global user.name "yourname"```
```git config --global user.email youremail```
You need to do this only once when you use the ```--global``` option. Git will always use that information for anything you do on that system. If you do not want this to happend, type the commands without the ```--global``` part.
### Requirements
* * *
This program was made to be runned in the **ATLAS Virtual Machine.** It can also be executed locally, if the user has python3 installed, by opening a Linux like Terminal and installing the requirements.
This program was made to be runned in the **ATLAS Virtual Machine** terminal. It can also be executed locally, if the user has python3 installed, by opening a Linux Terminal and installing the requirements.
The requirements in the ```requirements.sh``` file correspond to certain python libraries, which need to be installed in the **ATLAS Virtual Machine** too.
To install the requirements, open the terminal and execute the following commands:
Change directory:
``` cd git_zenodo_assistant```
``` cd git-zenodo-assistant```
Run the requirements file to install the libraries: ``` sh requirements.sh ```
......
......@@ -58,7 +58,8 @@ print(more_message)
input(f"Press {enter} to see the review. Click {done} when you finish.")
git_review()
input(f"Excellent! Let's start the tutorial. Press {enter}")
input(f"Excellent! Let's start the tutorial. Press {enter}.")
os.system("clear")
browser_message = f"""
Before executing your {git} commands, you should be located (pwd) in the
......@@ -89,6 +90,7 @@ print("Changing directory...\n")
time.sleep(2)
os.chdir(git_path)
input(f"Done! Press {enter} to continue.\n")
os.system("clear")
# Git init
......@@ -102,8 +104,10 @@ it wil not overwrite anything.
"""
print(init_message)
cprint("command0: git init ", "green")
input(f"\nPress {enter} to execute your command...")
input(f"\nPress {enter} to execute your command...\n")
time.sleep(2)
os.system("git init")
input(f"\nDone! Press {enter} to continue.\n")
# Remove origin
......@@ -117,8 +121,11 @@ origin.
print(rm_message)
cprint("command1: git remote rm origin ", "green")
input(f"\nPress {enter} to execute your command...")
input(f"\nPress {enter} to execute your command...\n")
time.sleep(2)
os.system("git remote rm origin")
input(f"\nDone! Press {enter} to continue.\n")
os.system("clear")
# Add origin
......@@ -144,35 +151,47 @@ if url_answer == "y":
print(f"Excellent!\n. To {add} the origin we will use the next command.\n")
cprint(f"command2: git remote add origin {url}", "green")
input(f"\nPress {enter} to execute the command...")
input(f"\nPress {enter} to execute the command...\n")
time.sleep(2)
os.system(f"git remote add origin {url}")
input(f"\nDone! Press {enter} to continue.\n")
# Check the new origin
print("\nAnd you can check the new origin by doing: \n")
cprint("command3: git remote -v ", "green")
input(f"\nPress {enter} to execute the command...")
input(f"\nPress {enter} to execute the command...\n")
time.sleep(2)
os.system("git remote -v")
input(f"\nDone! Press {enter} to continue.\n")
os.system("clear")
# Git status
status_message = f"""
{git} status shows the current state of your {git} working directory
and staging area. Green shows file is in {git} repository and
committed with latest changes. Red shows file is in {git} repository
but latest changes has not been committed. If you do not {add} the
and staging area. Green shows file in {git} repository, committed
with latest changes. Red shows file in {git} repository, but with
latest changes that have not been committed. If you do not {add} the
red files before committing, these files will not be included in
your {commit}.
"""
print(status_message)
cprint("command4: git status", "green")
input(f"\n{press} Enter to execute the command...")
input(f"\nPress {enter} to execute the command...\n")
time.sleep(2)
os.system("git status")
input(f"\nDone! Press {enter} to continue.\n")
# Git add
print(f"\nTo {git} {add}, you have to pick a file in red from the list above and copy the name.")
file = input(str("Paste the name of your file and do not forget the extension (example.ipynb)\n"
"or type {allfiles} to add all the files in the directory: "))
print(f"Please, check the name of your file: {file}\n")
add_message =f"""
To {git} {add}, you have to pick a file in red from the list
above and copy the name. Then, paste the name of your file
and do not forget the extension (example.ipynb).
or type {allfiles} to add all the files in the directory.
"""
print(add_message)
file = input(str(f"Please paste the name of your file or type {allfiles}: "))
print(f"\nPlease, check the name of your file: {file}\n")
file_answer = input(str("Is that the right name and extension? y/n: "))
while file_answer != "y":
if file_answer == "n":
......@@ -186,25 +205,35 @@ while file_answer != "y":
file_answer = input(str("Is that the right name and extension? y/n: "))
if file_answer == "y":
print("Excellent!\n By adding a new file, you choose which changes you want to save\n")
print("Excellent!\nBy adding a new file, you choose which changes you want to save\n")
cprint(f"command5: git add {file}", "green")
input(f"\nPress {enter} to execute the command...")
input(f"\nPress {enter} to execute the command...\n")
time.sleep(2)
os.system(f"git add {file}")
input(f"\nDone! Press {enter} to continue.\n")
os.system("clear")
# Git commit
print(f"\nWhen you {commit}, you save these changes. To identify these changes, you can write a {commit} message")
commit = input(f"Type a {commit} message. Make it short and simple: ")
print(f"\nNow, you have to {commit}, to save these changes. To identify the {commit}, you can write a {commit} message")
commit = input(str(f"Type a {commit} message. Make it one word: "))
cprint("command6: git commit -m", "green")
input(f"\nPress {enter} to execute the command...")
input(f"\nPress {enter} to execute the command...\n")
time.sleep(2)
os.system(f"git commit -m {commit}")
input(f"\nDone! Press {enter} to continue.\n")
# Git log
print(f"\nAnd you can see the record of commits that you have done using {git} {log}.")
cprint("command6: git log", "green")
input(f"\nPress {enter} to execute the command...")
input(f"\nPress {enter} to execute the command...\n")
time.sleep(2)
os.system("git log")
input(f"\nDone! Press {enter} to continue.\n")
os.system("clear")
# Git push
git_token = colored('https://github.com/settings/tokens', 'cyan')
push_message = f"""
Finally, {push} to your repository by executing the next command. Note that
you will need to enter your {git} username and password/token. Do not worry if
......@@ -214,16 +243,19 @@ To access your {gitlab} account, you need your {password}.\n
To access your {github} account, you need a {token}.\n
You can generate a token by logging in to your {git} account
and going into this page:
{colored('https://github.com/settings/tokens', 'cyan')}\n
{git_token}
Select only the repo scopes.\n
Remember to {copy} the token so you can {paste} it here.
Remember to {copy} the token so you can {paste} it here
when you are asked for your password.
Press {enter} when you are ready.
"""
input(push_message)
cprint(f"command6: git push {url}", "green")
input(f"\nPress {enter} to execute the command...")
input(f"\nPress {enter} to execute the command...\n")
time.sleep(2)
os.system(f"git push {url}")
input(f"\nDone! Press {enter} to continue.\n")
# Check the git push
print(f"Go to:\n{url}\nto see if the {push} was successful.")
......@@ -235,8 +267,10 @@ while push_answer =="n":
"b) Exit and try the tutorial later?\n"))
if push_error == "a":
cprint(f"command6: git push {url}", "green")
input(f"\nPress {enter} to execute the command...")
input(f"\nPress {enter} to execute the command...\n")
time.sleep(2)
os.system(f"git push {url}")
input(f"\nDone! Press {enter} to continue.\n")
print(f"Go to:\n{url}\nto see if the {push} was successful.")
push_answer = input(str("Has your file been pushed correctly? y/n: "))
elif push_error == "b":
......
......@@ -12,7 +12,9 @@ def start_git():
else:
print(f"\nStarting {c_Git} Tutorial...\n")
time.sleep(2)
os.system("clear")
from git_assistant import git_tutorial
os.system("clear")
input("Press any key to take you back to the main menu.\n")
print(f"Going back to main menu...\n")
time.sleep(2)
......@@ -28,7 +30,9 @@ def start_zenodo():
else:
print(f"\nStarting {c_Zenodo} Assistant...\n")
time.sleep(2)
os.system("clear")
from zenodo_assistant import zenodo_tutorial
os.system("clear")
input("Press any key to take you back to the main menu.\n")
print(f"Going back to main menu...\n")
time.sleep(2)
......
File moved
import os
import time
from termcolor import cprint, colored
......@@ -57,12 +58,13 @@ while open_browser == True:
input(f"The file has been stored. Press {enter} to continue.")
os.system("clear")
# Fill metadata
metadata_message = f"""
To upload a file to your {zenodo} account, you will need to provide some basic
information about the work you will upload to generate the metadata.
Do not worry, you can always change later it in the website.\n
Do not worry, you can always change it later in the website.\n
"""
print(metadata_message)
......@@ -71,14 +73,17 @@ time.sleep(1)
# Title
title = type_title()
os.system("clear")
# Description
description = type_description()
os.system("clear")
# Publication Date
input(f"Press {enter} to open the Calendar to {select} the Publication date.\n")
publication_date = date_input()
input(f"\nThe date has been stored. Press {enter} to continue.\n")
os.system("clear")
# Creators
creators_message = """
......@@ -88,6 +93,7 @@ Be careful of the format.
print(creators_message)
input(f"Press {enter} to continue.\n")
creators = creators_dict()
os.system("clear")
# Upload type
input(f"Press {enter} to open the options menu to {select} and {submit} the type of file.\n")
......@@ -106,6 +112,7 @@ while open_type == True:
open_type = True
upload = upload_metadata(upload_input)
input(f"\nThe upload type has been stored. Press {enter} to continue.\n")
os.system("clear")
# Image type
if upload_input == "Image":
......@@ -126,6 +133,7 @@ if upload_input == "Image":
image = image_metadata(image_input)
publication = "None"
input(f"\nThe image type has been stored. Press {enter} to continue.")
os.system("clear")
# Publication type
elif upload_input == "Publication":
......@@ -146,6 +154,7 @@ elif upload_input == "Publication":
publication = pub_metadata(pub_input)
image = "None"
input(f"\nThe publication type has been stored. Press {enter} to continue.")
os.system("clear")
# In case of different type of upload
else:
......@@ -167,13 +176,17 @@ df = print_md(data)
print(df)
input(f"\nPress {enter} to continue.")
os.system("clear")
# Upload file to Zenodo
token_zenodo = colored('https://zenodo.org/account/settings/applications/tokens/new/', 'cyan')
upload_message = f"""
To upload your file, you need an authentication token. If you do not have one already,
you have to create one by logging in to your {zenodo} account and going into this page:
{colored('https://zenodo.org/account/settings/applications/tokens/new/', 'cyan')}
{token_zenodo}
You will only need a deposit:write token, but you can select all the scopes.
Remember to {copy} the token so you can {paste} it here.
......@@ -185,11 +198,13 @@ input(upload_message)
upload_to_zenodo(path, filename, data)
# End message
deposit_zenodo = colored('https://zenodo.org/deposit', 'cyan')
success_message= f"""
Your file and its metadata were successfully uploaded to your {zenodo} account.
You can check it out here:
{colored('https://zenodo.org/deposit', 'cyan')}
{deposit_zenodo}
This program does not support the publication of files. By publishing a file in {zenodo},
it will go straight online and once it is published, you can no longer delete it.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment