Skip to content

Commit 07b7974

Browse files
authored
Rails Sample (#39)
Fixes #4
1 parent 6e8b2fb commit 07b7974

54 files changed

Lines changed: 1855 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,13 @@ jobs:
3535
run: |
3636
bundle install
3737
bundle exec srb tc
38+
39+
- name: Lint and test Rails app
40+
working-directory: rails_app
41+
env:
42+
NO_EAGER_TEMPORAL_CLIENT: 1
43+
run: |
44+
bundle install
45+
bin/rails db:migrate
46+
bin/rails db:seed
47+
bundle exec rake

.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ AllCops:
22
NewCops: enable
33
TargetRubyVersion: 3.2
44
SuggestExtensions: false
5+
# Rails has a different rubocop expectation
6+
Exclude:
7+
- 'rails_app/**/*'
58

69
# Don't need super for activities or workflows
710
Lint/MissingSuper:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Prerequisites:
2828
* [context_propagation](context_propagation) - Use interceptors to propagate thread/fiber local data from clients
2929
through workflows/activities.
3030
* [message_passing_simple](message_passing_simple) - Simple workflow that accepts signals, queries, and updates.
31+
* [rails_app](rails_app) - Basic Rails API application using Temporal workflows and activities.
3132
* [sorbet_generic](sorbet_generic) - Proof of concept of how to do _advanced_ Sorbet typing with the SDK.
3233
* [worker_specific_task_queues](worker_specific_task_queues) - Use a unique Task Queue for each Worker to run a sequence of Activities on the same Worker.
3334

rails_app/.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# See https://git-scm.com/docs/gitattributes for more about git attribute files.
2+
3+
# Mark the database schema as having been generated.
4+
db/schema.rb linguist-generated
5+
6+
# Mark any vendored files as having been vendored.
7+
vendor/* linguist-vendored
8+
config/credentials/*.yml.enc diff=rails_credentials
9+
config/credentials.yml.enc diff=rails_credentials

rails_app/.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
2+
#
3+
# Temporary files generated by your text editor or operating system
4+
# belong in git's global ignore instead:
5+
# `$XDG_CONFIG_HOME/git/ignore` or `~/.config/git/ignore`
6+
7+
# Ignore bundler config.
8+
/.bundle
9+
10+
# Ignore all environment files.
11+
/.env*
12+
13+
# Ignore all logfiles and tempfiles.
14+
/log/*
15+
/tmp/*
16+
17+
# Ignore storage (uploaded files in development and any SQLite databases).
18+
/storage/*
19+
20+
# Ignore master key for decrypting credentials and more.
21+
/config/master.key

rails_app/.rubocop.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Omakase Ruby styling for Rails
2+
inherit_gem: { rubocop-rails-omakase: rubocop.yml }
3+
4+
# Overwrite or add rules to create your own house style
5+
#
6+
# # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`
7+
# Layout/SpaceInsideArrayLiteralBrackets:
8+
# Enabled: false

rails_app/Gemfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
source "https://rubygems.org"
2+
3+
# Temporal SDK
4+
gem "temporalio"
5+
6+
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
7+
gem "rails", "~> 8.0.2"
8+
# Use sqlite3 as the database for Active Record
9+
gem "sqlite3", ">= 2.1"
10+
# Use the Puma web server [https://github.com/puma/puma]
11+
gem "puma", ">= 5.0"
12+
13+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
14+
gem "tzinfo-data", platforms: %i[ windows jruby ]
15+
16+
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin Ajax possible
17+
# gem "rack-cors"
18+
19+
group :development, :test do
20+
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
21+
gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
22+
# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
23+
gem "rubocop-rails-omakase", require: false
24+
end

0 commit comments

Comments
 (0)