Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a mode so one call install from git #690

Merged
merged 1 commit into from
Feb 1, 2025
Merged

Conversation

ericcurtin
Copy link
Collaborator

@ericcurtin ericcurtin commented Jan 31, 2025

If you have git clone'd the project, you now have the option of doing:

./install.sh -l

And it will install the version from the git repo.

Summary by Sourcery

New Features:

  • Added a -l flag to the install.sh script to install the CLI from a local git clone.

If you have git clone'd the project, you now have the option of
doing:

./install.sh -l

And it will install the version from the git repo.

Signed-off-by: Eric Curtin <[email protected]>
Copy link
Contributor

sourcery-ai bot commented Jan 31, 2025

Reviewer's Guide by Sourcery

This pull request introduces a new local install mode that allows users to install the application directly from a git repository, instead of downloading it from a remote server. This is achieved by adding a new '-l' flag to the install script.

Sequence diagram for local vs remote installation

sequenceDiagram
    participant User
    participant Script as Install Script
    participant Local as Local Git Repo
    participant Remote as Remote Server

    User->>Script: Run install.sh
    alt With -l flag
        Script->>Local: Copy files from local repo
        Local-->>Script: Return local files
    else Without -l flag
        Script->>Remote: Request files via HTTPS
        Remote-->>Script: Return remote files
    end
    Script->>Script: Install files to system
    Script-->>User: Installation complete
Loading

Flow diagram for the updated installation process

graph TD
    Start[Start Installation] --> ParseArgs[Parse Command Line Arguments]
    ParseArgs --> CheckFlag{Check -l flag}
    CheckFlag -->|Local Install| GitRepo[Use Git Repository Files]
    CheckFlag -->|Remote Install| RemoteServer[Download from Remote Server]
    GitRepo --> CheckPlatform[Check Platform Requirements]
    RemoteServer --> CheckPlatform
    CheckPlatform --> InstallDeps[Install Dependencies]
    InstallDeps --> SetupFiles[Setup RamaLama Files]
    SetupFiles --> Cleanup[Cleanup Temporary Files]
    Cleanup --> End[End Installation]
Loading

File-Level Changes

Change Details Files
Added a new local install mode.
  • Added a new '-l' flag to the install script.
  • Added a new local_install variable to control the install mode.
  • Modified the download function to copy files locally when the local install mode is enabled.
  • Modified the setup_ramalama function to use local paths when the local install mode is enabled.
  • Modified the check_platform function to skip platform checks when the local install mode is enabled.
install.sh
Modified the install script to use a temporary directory.
  • Replaced the TMP variable with a tmp variable.
  • Modified the cleanup function to use the tmp variable.
install.sh
Added a check to ensure the script is not run as root on macOS.
  • Added a check to ensure the script is not run as root on macOS.
  • Added a check to ensure brew is installed on macOS.
install.sh

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @ericcurtin - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider keeping the uppercase TMP variable name for consistency with Unix conventions and to avoid breaking existing scripts that might reference it.
  • Error handling should be made consistent across functions - some return explicit error codes while others don't return anything.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

return 2
fi
if [ "$os" = "Darwin" ]; then
install_mac_dependencies
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): The return value from install_mac_dependencies() should be checked

install_mac_dependencies() returns different error codes, but these aren't being handled. This could lead to silent failures during installation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use set -e in this script so I don't think there's a need

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your feedback, we will generate fewer comments like this in the future.

@rhatdan
Copy link
Member

rhatdan commented Feb 1, 2025

LGTM

@rhatdan rhatdan merged commit 38974ff into main Feb 1, 2025
11 checks passed
@ericcurtin ericcurtin deleted the install-local branch February 1, 2025 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants