Skip to content

Commit

Permalink
Merge pull request #71 from siri-chandana-macha/new
Browse files Browse the repository at this point in the history
Added Project Structure
  • Loading branch information
Shubham-Zone authored Nov 9, 2024
2 parents f83ee40 + 027c89b commit c411bff
Show file tree
Hide file tree
Showing 3 changed files with 487 additions and 0 deletions.
101 changes: 101 additions & 0 deletions .github/scripts/update_structure.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import os
import github
from github import Github

# Helper function to recursively build the repo structure and include file extensions
def get_repo_structure(path='.', prefix=''):
structure = []
try:
items = sorted(os.listdir(path))
except FileNotFoundError:
print(f"Path not found: {path}")
return structure

for i, item in enumerate(items):
if item.startswith('.'):
continue # Skip hidden files and directories
item_path = os.path.join(path, item)
is_last = i == len(items) - 1
current_prefix = '└── ' if is_last else '├── '

if os.path.isdir(item_path):
# Directory case
structure.append(f"{prefix}{current_prefix}{item}/")
next_prefix = prefix + (' ' if is_last else '│ ')
structure.extend(get_repo_structure(item_path, next_prefix))
else:
# File case with extension
file_name, file_extension = os.path.splitext(item)
structure.append(f"{prefix}{current_prefix}{file_name}{file_extension}")

return structure

# Function to update the repo_structure.txt file
def update_structure_file(structure):
try:
with open('repo_structure.txt', 'w') as f:
f.write('\n'.join(structure))
print("repo_structure.txt updated successfully.")
except IOError as e:
print(f"Error writing to repo_structure.txt: {e}")

# Function to update the README.md with the new structure
def update_README(structure):
try:
with open('PROJECT_STRUCTURE.md', 'r') as f:
content = f.read()
except FileNotFoundError:
print("PROJECT_STRUCTURE.md not found.")
return

start_marker = '<!-- START_STRUCTURE -->'
end_marker = '<!-- END_STRUCTURE -->'

start_index = content.find(start_marker)
end_index = content.find(end_marker)

if start_index != -1 and end_index != -1:
new_content = (
content[:start_index + len(start_marker)] +
'\n```\n' + '\n'.join(structure) + '\n```\n' +
content[end_index:]
)
try:
with open('PROJECT_STRUCTURE.md', 'w') as f:
f.write(new_content)
print("PROJECT_STRUCTURE.md updated with new structure.")
except IOError as e:
print(f"Error writing to PROJECT_STRUCTURE.md: {e}")
else:
print("Markers not found in PROJECT_STRUCTURE.md. Structure not updated.")

# Main function to compare and update repository structure
def main():
gh_token = os.getenv('GH_TOKEN')
gh_repo = os.getenv('GITHUB_REPOSITORY')

if not gh_token or not gh_repo:
print("Environment variables GH_TOKEN and GITHUB_REPOSITORY must be set.")
return

g = Github(gh_token)
repo = g.get_repo(gh_repo)

current_structure = get_repo_structure()

try:
# Fetch the contents of repo_structure.txt from GitHub
contents = repo.get_contents("repo_structure.txt")
existing_structure = contents.decoded_content.decode().split('\n')
except github.GithubException:
existing_structure = None

if current_structure != existing_structure:
update_structure_file(current_structure)
update_README(current_structure)
print("Repository structure updated.")
else:
print("No changes in repository structure.")

if __name__ == "__main__":
main()
193 changes: 193 additions & 0 deletions PROJECT_STRUCTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
Citizen_Squad
├── .gitHub
│ ├── ISSUE_TEMPLATE
│ │ └── bug-report.yml
│ ├── scripts
│ │ └── update_structure.py
│ └── workflows
│ ├── build_apk.yml
│ ├── issue-open-close.yml
│ └── pr-merge.yml
├── .vscode
│ └── launch.json
├── android
│ ├── .gitignore
│ ├── .gradle
│ │ ├── 8.3
│ │ ├── checksums
│ │ ├── checksums.lock
│ │ ├── fileChanges
│ │ ├── last-build.bin
│ │ ├── fileHashes
│ │ ├── fileHashes.lock
│ │ ├── gc.properties
│ │ ├── vcsMetadata
│ │ └── vcs-1
│ ├── app
│ │ ├── build.gradle
│ │ ├── google-services.json
│ │ └── src
│ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── kotlin
│ │ │ └── com
│ │ │ └── open_innov
│ │ │ └── hackingly_new
│ │ │ └── MainActivity.kt
│ │ └── res
│ │ ├── drawable
│ │ │ └── launch_background.xml
│ │ ├── drawable-v21
│ │ │ └── launch_background.xml
│ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── values
│ │ │ └── styles.xml
│ │ ├── values-night
│ │ │ └── styles.xml
│ │ └── profile
│ │ └── AndroidManifest.xml
│ ├── build.gradle
│ ├── gradle
│ │ └── wrapper
│ │ └── gradle-wrapper.properties
│ ├── gradle.properties
│ └── settings.gradle
├── assets
│ ├── images
│ │ ├── abnCar.png
│ │ ├── auth.png
│ │ ├── car.jpeg
│ │ ├── garbage.jpeg
│ │ ├── garbage2.png
│ │ ├── potHoles.jpeg
│ │ └── road.png
│ └── lottie
│ ├── auth1.json
│ ├── auth2.json
│ ├── authentication.json
│ ├── loading.json
│ ├── otp.json
│ └── plane.json
├── ios
│ ├── .gitignore
│ ├── Flutter
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ └── Release.xcconfig
│ ├── Podfile
│ ├── Podfile.lock
│ ├── Runner
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ │ ├── LaunchImage.imageset
│ │ ├── Contents.json
│ │ ├── LaunchImage.png
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ └── README.md
│ │ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── Runner-Bridging-Header.h
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ ├── IDEWorkspaceChecks.plist
│ │ └── WorkspaceSettings.xcsettings
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ ├── IDEWorkspaceChecks.plist
│ └── WorkspaceSettings.xcsettings
│ └── RunnerTests
│ └── RunnerTests.swift
├── lib
│ ├── admin_dashboard
│ │ └── admin_dashboard.dart
│ ├── controllers
│ │ └── navigation_bar_controller.dart
│ ├── firebase_options.dart
│ ├── main.dart
│ ├── models
│ │ ├── report.dart
│ │ ├── reports_model.dart
│ │ └── user_model.dart
│ ├── pages
│ │ ├── authentication
│ │ ├── otp_delivery.dart
│ │ └── phone_auth.dart
│ │ ├── components
│ │ └── index.dart
│ │ ├── screens
│ │ ├── admin
│ │ └── rto_admin.dart
│ │ ├── user
│ │ ├── home_screen.dart
│ │ ├── profile.dart
│ │ └── reports_screen.dart
│ │ ├── utilities
│ │ ├── abandoned_cars.dart
│ │ ├── garbage.dart
│ │ ├── potholes_report.dart
│ │ └── tracking.dart
│ │ └── welcome_screen
│ │ └── splash_screen.dart
│ ├── providers
│ │ ├── abandoned_cars_provider.dart
│ │ ├── admin_dashboard.dart
│ │ ├── garbage_report_provider.dart
│ │ ├── mongo_provider.dart
│ │ └── user_provider.dart
│ ├── services
│ │ ├── address_service.dart
│ │ ├── firebase_storage_service.dart
│ │ ├── image_picker_service.dart
│ │ ├── report_submission_service.dart
│ │ └── text_recognition_service.dart
│ ├── utils
│ │ └── constants.dart
│ └── widgets
│ └── CustomWidgets.dart
├── linux
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── flutter
│ │ ├── CMakeLists.txt
Loading

0 comments on commit c411bff

Please sign in to comment.