Skip to content

Commit

Permalink
Fixed Gemfile
Browse files Browse the repository at this point in the history
  • Loading branch information
yatish27 committed May 15, 2024
1 parent 1070bd7 commit 752b23d
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 35 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ GEM
rdoc (6.6.3.1)
psych (>= 4.0.0)
regexp_parser (2.9.1)
reline (0.5.6)
reline (0.5.7)
io-console (~> 0.5)
rexml (3.2.6)
rubocop (1.63.5)
Expand Down Expand Up @@ -312,7 +312,7 @@ GEM
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.6.13)
zeitwerk (2.6.14)

PLATFORMS
aarch64-linux
Expand Down
72 changes: 54 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,46 +25,82 @@


## Getting Started 💻
Shore is preconfigured base Ruby on Rails application. You can clone this repository and add it to your repo.

```bash
git clone [email protected]:yatish27/shore.git your_new_project_name
```

### Requirements
You will need the following installed to run the application.

### Prerequisites
- Ruby 3.3.1
- Check the [.ruby-version](.ruby-version)
- PostgreSQL 16.3
- Bun 1.1.8
- [Overmind](https://github.com/DarthSim/overmind) (optional), it will be used in place of Foreman - `brew install tmux overmind`

- [Overmind](https://github.com/DarthSim/overmind) (optional), it will be used in place of Foreman.
- Docker & Docker Desktop if you want to use docker compose for local development
Refer [installing prerequisites](./docs/installing_prerequisites.md) to install these dependencies

### Building a new application
All Homebrew dependencies are in `Brewfile`, you can install them in one shot.

1. Clone the base repository
```
git clone [email protected]:yatish27/shore.git your_new_project_name
```bash
brew bundle install --no-upgrade
```
Make sure your postgresSQL server is running.

2. Enter the project directory
```
cd your_new_project_name
### Initial setup

The default name of the application is Shore. You can rename the application to you desired new name.
The name should be in camelcase.

```bash
./bin/replace_name YourNewProjectName
```

3. Replace `Shore` with your application's name. The name should be camelCase.
Copy the `env.sample` to `.env`

The default username and password for database is set to `postgres` and `password`. You can override them in `.env` file.


Run `bin/setup` to setup the application. It prepares the database, install the required ruby gems and javascript packages. The script is idempotent, so you can run it multiple times.

```bash
./bin/setup
```
./bin/replace_name YourNewProjectName

### Running the application
Start your application

```bash
bin/dev
```

4. Run setup

This runs overmind or foreman using the Procfile.dev. It starts the rails server, solid queue background job process and vite server.

Visit `http://localhost:3000` to see the home page 🚀.

### Running locally with docker compose
Shore has support for docker and docker compose for local development.
Refer the [Dockerfile](./Dockerfile.dev) and [docker-compose.yml](./docker-compose.yml).

Once you have cloned the repository and have docker installed

- Run `docker compose build` to build. It will build the images.
- Run `docker compose run --rm web bin/setup` to create and setup the database.
- Run `docker-compose up` to start the application.
Since the local code from your host machine is mounted in the docker container, any change made in the code will be directly reflected. You don't need to rebuild you container.

## Testing 🧪
Running all tests
```
./bin/setup
./bin/rails test:all
```

5. Start your application
Running a single test
```
bin/dev
./bin/rails test test/jobs/hello_world_job_test.rb
```

6. Visit `http://localhost:3000`


12 changes: 0 additions & 12 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,6 @@ FileUtils.chdir APP_ROOT do
# This script is a way to set up or update your development environment automatically.
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
# Add necessary setup steps to this file.

if File.exist?(".env.sample") && !File.exist?(".env")
puts "\n== Copying env.sample files =="
FileUtils.cp ".env.sample", ".env"
puts "Copied .env.sample to .env".green
end

# # Install system dependencies if Homebrew is installed
# if Gem::Platform.local.os.include?("darwin") && command?("brew")
# puts "\n== Installing packages with Homebrew =="
# system("brew bundle check --no-lock --no-upgrade") || system!("brew bundle --no-upgrade --no-lock")
# end

puts "\n== Installing gems =="
system! "gem install bundler --conservative"
Expand Down
21 changes: 18 additions & 3 deletions docs/installing_prerequisites.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ ALTER ROLE postgres WITH PASSWORD 'password';
## Bun
Visit [bun.sh](https://bun.sh/docs/installation) to learn about installation process

### Using homebrew

```
brew install oven-sh/bun/bun
```
Expand All @@ -79,4 +77,21 @@ After installing, check the version

```
bun -v
```
```

## Overmind
Overmind is an alternative to Foreman. It requires tmux
[Overmind](https://github.com/DarthSim/overmind)

```
brew install tmux overmind
```

## Docker
Install docker using homebrew
```
brew install docker
```
Latest version of docker install docker compose along with it.

To install the docker desktop, visit https://www.docker.com/products/docker-desktop/

0 comments on commit 752b23d

Please sign in to comment.