Skip to content

Commit

Permalink
Merge pull request #701 from cachix/rails
Browse files Browse the repository at this point in the history
Add RubyOnRails example
  • Loading branch information
domenkozar authored Jul 11, 2023
2 parents cae4522 + 8d246b0 commit b63bdb5
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/rubyonrails/.test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
set -ex
rails new blog -d=postgresql
devenv up&
timeout 20 bash -c 'until echo > /dev/tcp/localhost/5100; do sleep 0.5; done'
(cd blog && rails db:create)
curl -s http://localhost:5100/ | grep "version"
8 changes: 8 additions & 0 deletions examples/rubyonrails/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

source "https://rubygems.org"

ruby "3.2.2"

gem "rails"
gem "puma"
8 changes: 8 additions & 0 deletions examples/rubyonrails/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Based on [the official tutorial](https://guides.rubyonrails.org/getting_started.html).

```shell-session
$ devenv shell
$ rails new blog -d=postgresql
$ devenv up
$ cd blog && rails db:create
```
15 changes: 15 additions & 0 deletions examples/rubyonrails/devenv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{ pkgs, lib, ... }:

{
languages.ruby.enable = true;
languages.ruby.version = "3.2.2";

services.postgres.enable = true;

processes.rails.exec = "rails server";

enterShell = ''
export PATH="$DEVENV_ROOT/blog/bin:$PATH"
bundle
'';
}
8 changes: 8 additions & 0 deletions examples/rubyonrails/devenv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
inputs:
nixpkgs:
url: github:NixOS/nixpkgs/nixpkgs-unstable
nixpkgs-ruby:
url: github:bobvanderlinden/nixpkgs-ruby
inputs:
nixpkgs:
follows: nixpkgs

0 comments on commit b63bdb5

Please sign in to comment.