Gitpod

Sets up Gitpod and enables prebuilds so that dependencies are installed ahead-of-time (so you don't need to wait)
Icons/chart bar
Used 13 times
Created by
G Geoffrey Huntley

Usage

Run this command in your Rails app directory in the terminal:

rails app:template LOCATION="https://railsbytes.com/script/V4Ys50"
Template Source

Review the code before running this template on your machine.

create_file '.gitpod.yml' do <<~YAML
# Learn more about this file at https://www.gitpod.io/docs/references/gitpod-yml
image:
  file: .gitpod.Dockerfile

ports:
  # Rails server
  - port: 3000
    onOpen: open-preview
  # PostgreSQL server
  - port: 5432
    onOpen: ignore

tasks:
  - init: >
      bundle install &&
      yarn install &&
      rake db:create
    command: >
      rails server -b 0.0.0.0

# Enable prebuilds of your project to enable faster workspace start times.
# https://www.gitpod.io/docs/prebuilds/#configure-the-github-app
github:
  prebuilds:
    master: true
    branches: true
    pullRequests: true
    pullRequestsFromForks: true
    addCheck: true

vscode:
  extensions:
    - rebornix.ruby

  YAML
end

create_file '.gitpod.Dockerfile' do <<~DOCKER
FROM gitpod/workspace-full
USER gitpod

# Install the Ruby version specified in '.ruby-version'
COPY --chown=gitpod:gitpod .ruby-version /tmp
RUN echo "rvm_gems_path=/home/gitpod/.rvm" > ~/.rvmrc
RUN bash -lc "rvm reinstall ruby-$(cat /tmp/.ruby-version) && rvm use ruby-$(cat /tmp/.ruby-version) --default && gem install rails"
RUN echo "rvm_gems_path=/workspace/.rvm" > ~/.rvmrc

    DOCKER
end
Comments

Sign up or Login to leave a comment.