env vars and starting work on repo_manager
This commit is contained in:
@@ -1,11 +1,7 @@
|
||||
import ai_generators.ollama_md_generator as omg
|
||||
import trilium.notes as tn
|
||||
<<<<<<< HEAD
|
||||
import repo_management.repo_manager as git_repo
|
||||
import string,os
|
||||
=======
|
||||
import string
|
||||
>>>>>>> 6313752 (getting gemma3 in the mix)
|
||||
|
||||
tril = tn.TrilumNotes()
|
||||
|
||||
@@ -27,7 +23,6 @@ for note in tril_notes:
|
||||
os_friendly_title = convert_to_lowercase_with_underscores(tril_notes[note]['title'])
|
||||
ai_gen = omg.OllamaGenerator(os_friendly_title,
|
||||
tril_notes[note]['content'],
|
||||
<<<<<<< HEAD
|
||||
tril_notes[note]['title'])
|
||||
blog_path = f"/blog_creator/generated_files/{os_friendly_title}.md"
|
||||
ai_gen.save_to_file(blog_path)
|
||||
@@ -37,8 +32,4 @@ for note in tril_notes:
|
||||
git_pass = os.environ["GIT_PASS"]
|
||||
repo_manager = git_repo.GitRepository("blog/", git_user, git_pass)
|
||||
repo_manager.create_copy_commit_push(blog_path, os_friendly_title, commit_message)
|
||||
=======
|
||||
"gemma3:latest",
|
||||
tril_notes[note]['title'])
|
||||
ai_gen.save_to_file(f"/blog_creator/generated_files/{os_friendly_title}.md")
|
||||
>>>>>>> 6313752 (getting gemma3 in the mix)
|
||||
|
||||
@@ -3,7 +3,6 @@ from urllib.parse import quote
|
||||
from git import Repo
|
||||
from git.exc import GitCommandError
|
||||
|
||||
<<<<<<< HEAD
|
||||
class GitRepository:
|
||||
# This is designed to be transitory it will desctruvtively create the repo at repo_path
|
||||
# if you have uncommited changes you can kiss them goodbye!
|
||||
@@ -21,15 +20,7 @@ class GitRepository:
|
||||
git_user = quote(username)
|
||||
git_password = quote(password)
|
||||
remote = f"{git_protocol}://{git_user}:{git_password}@{git_remote}"
|
||||
=======
|
||||
|
||||
def try_something(test):
|
||||
|
||||
# Set the path to your blog repo here
|
||||
blog_repo = "/path/to/your/blog/repo"
|
||||
>>>>>>> d35a456 (set up chroma)
|
||||
|
||||
<<<<<<< HEAD
|
||||
if os.path.exists(repo_path):
|
||||
shutil.rmtree(repo_path)
|
||||
self.repo_path = repo_path
|
||||
@@ -37,19 +28,6 @@ blog_repo = "/path/to/your/blog/repo"
|
||||
self.repo = Repo(repo_path)
|
||||
self.username = username
|
||||
self.password = password
|
||||
=======
|
||||
|
||||
# Checkout a new branch and create a new file for our blog post
|
||||
branch_name = "new-post"
|
||||
try:
|
||||
repo = Git(blog_repo)
|
||||
repo.checkout("-b", branch_name, "origin/main")
|
||||
with open("my-blog-post.md", "w") as f:
|
||||
f.write(content)
|
||||
except InvalidGitRepositoryError:
|
||||
# Handle repository errors gracefully
|
||||
pass
|
||||
>>>>>>> 8575918 (latest commits)
|
||||
|
||||
def clone(self, remote_url, destination_path):
|
||||
"""Clone a Git repository with authentication"""
|
||||
@@ -118,6 +96,3 @@ except InvalidGitRepositoryError:
|
||||
self.add_and_commit(f"'{commit_messge}'")
|
||||
|
||||
self.repo.git.push()
|
||||
|
||||
def remove_repo(self):
|
||||
shutil.rmtree(self.repo_path)
|
||||
|
||||
Reference in New Issue
Block a user