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.
Make sure you have the following installed:
- Ruby (version 3.2.2)
- Rails (version 7.1.2)
- PostgreSQL (version 9.3+)
-
Clone the repository:
git clone https://github.com/kylebowen/local-weather.git
-
Navigate to the project directory:
cd local-weather
-
Install dependencies:
bundle install
-
[OPTIONAL] Create the database and run migrations:
rails db:create rails db:migrate
-
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. -
Run the specs:
bin/rspec
-
[OPTIONAL] Enable local caching:
rails dev:cache
Disable local caching by running the same command again. The server will restart itself.
-
Start the Rails server:
rails server
The application will be available at http://localhost:3000.
- 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
andOPEN_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.
- Open your browser and go to http://localhost:3000.
- Enter an address, city, or zip code in the provided input field.
- Click the
search-icon
button to see the current weather forecast.
If you'd like to contribute to the project, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and submit a pull request.
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!