Skip to content

Commit

Permalink
fix: minor ui and logging fixes (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
ccerv1 authored Jan 22, 2024
1 parent 83156a1 commit 286fec6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 50 deletions.
11 changes: 8 additions & 3 deletions src/scripts/toml_adder.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
LOCAL_PATH = os.path.join(os.path.dirname(__file__), "..", "..", "data", "projects")
CRYPTO_SNAPSHOT = "crypto_ecosystems_snapshot.yaml"
OSSD_SNAPSHOT = LOCAL_PATH + "/ossd_repo_snapshot.yaml"
LOGGING_PATH = "data/logs/toml_adder.log"


def map_crypto_ecosystems(ecosystems_path, load_snapshot=False):
Expand Down Expand Up @@ -45,8 +46,8 @@ def initialize_session():
Initializes a new session by creating a new log file and prompting the user to enter the path to the ecosystems directory.
Rteturns a dictionary containing the ecosystem name, the mapping of ecosystem titles to TOML file paths, and the snapshot of the repos already in oss directory.
'''
# Create a new log file for the session
logging.basicConfig(filename='data/logs/toml_adder.log', filemode='w', format='%(asctime)s - %(levelname)s - %(message)s', level=logging.INFO)
# Generate log for the session
logging.basicConfig(filename=LOGGING_PATH, filemode='a', format='%(asctime)s - %(levelname)s - %(message)s', level=logging.INFO)

# Prompt user to enter the path to the ecosystems directory
ecosystems_path = input("Enter the path to the ecosystems directory: ")
Expand Down Expand Up @@ -118,6 +119,7 @@ def process_project_toml_file(toml_path, ossd_repo_snapshot):
url = github_org.lower().strip().strip("/")
if url in ossd_repo_snapshot:
slug = ossd_repo_snapshot[url]
print(f"Slug for {url} already exists: {slug}")
logging.info(f"Slug for {url} already exists: {slug}")
else:
slug = parse_url(url)
Expand All @@ -132,6 +134,9 @@ def process_project_toml_file(toml_path, ossd_repo_snapshot):
generate_yaml(url, slug, title)
ossd_repo_snapshot[url] = slug
logging.info(f"Added slug for {url} to ossd_repo_snapshot: {slug}")
else:
logging.info(f"Skipping {url}")
continue
slugs.append(slug)
return slugs

Expand All @@ -157,7 +162,7 @@ def process_collection_toml_file(ecosystem_name, crypto_ecosystems_map, ossd_rep
sub_ecosystem_slugs = process_project_toml_file(sub_ecosystem_toml_path, ossd_repo_snapshot)
if not sub_ecosystem_slugs:
continue
add_slugs = input(f"Add slugs for {title} to {toml_path}? (Y/N): ").strip().lower()
add_slugs = input(f"Add slugs {sub_ecosystem_slugs} for {title} to {ecosystem_name} collection? (Y/N): ").strip().lower()
if add_slugs == 'y':
slugs.extend(sub_ecosystem_slugs)
else:
Expand Down
47 changes: 0 additions & 47 deletions src/types/blockchain-address.ts

This file was deleted.

0 comments on commit 286fec6

Please sign in to comment.