Skip to content

kylebowen/local-weather

Repository files navigation

Local Weather App

Welcome to the Local Weather App! This Ruby on Rails project allows users to input an address, city, or zip code and view the current weather forecast.

Screenshot 2023-12-18 at 1 52 58 AM

Getting Started

Prerequisites

Make sure you have the following installed:

  • Ruby (version 3.2.2)
  • Rails (version 7.1.2)
  • PostgreSQL (version 9.3+)

Installation

  1. Clone the repository:

    git clone https://github.com/kylebowen/local-weather.git
  2. Navigate to the project directory:

    cd local-weather
  3. Install dependencies:

    bundle install
  4. [OPTIONAL] Create the database and run migrations:

    rails db:create
    rails db:migrate
  5. Set up your environment variables by creating a .env file:

    touch .env

    Add the following content to the .env file:

    GEOCODER_API_KEY=<your_geocoder_api_key>
    OPEN_WEATHER_API_KEY=<your_open_weather_api_key>

    Replace <your_geocoder_api_key> and <your_open_weather_api_key> with your actual API keys.

  6. Run the specs:

    bin/rspec
  7. [OPTIONAL] Enable local caching:

    rails dev:cache

    Disable local caching by running the same command again. The server will restart itself.

  8. Start the Rails server:

    rails server

    The application will be available at http://localhost:3000.

Features

  • Weather Lookup: Enter an address, city, or zip code to get the current weather forecast.
  • Geolocation: Utilizes the geocoder gem for geolocation services.
  • Weather API: Uses the open-weather-ruby-client gem to fetch weather information.
  • Environment Variables: Requires GEOCODER_API_KEY and OPEN_WEATHER_API_KEY as environment variables.
  • Database: Configured with a PostgreSQL database for upcoming features (not currently used).
  • Caching: Utilizes Rails cache to store weather API responses for 30 minutes.
  • Styling: Uses the tailwindcss-rails gem for styling the front end.
  • Testing: Includes specs using the rspec-rails gem.

Usage

  1. Open your browser and go to http://localhost:3000.
  2. Enter an address, city, or zip code in the provided input field.
  3. Click the search-icon button to see the current weather forecast.

Contributing

If you'd like to contribute to the project, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and submit a pull request.

License

This project is licensed under the MIT License.


Enjoy using the Local Weather App! If you encounter any issues or have suggestions, feel free to open an issue on the GitHub repository. Happy coding!

About

Displays the weather forecast for a given address.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published