Repository navigation
Expand file tree
/
Copy pathmain.dang
More file actions
50 lines (45 loc) · 1.51 KB
/
Copy pathmain.dang
File metadata and controls
50 lines (45 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
pub description = "Test a locked Rails app on its SQLite test database, and serve it"
"""
Rails tests and a development server for one Bundler project. Tests run as
`bin/rails test`, which loads db/schema.rb into the test database itself, so
the development database is never created or migrated.
"""
type Rails {
"""
Project root. See the `ruby` module.
"""
root: String! = "."
"""
Custom Ruby container. See the `ruby` module.
"""
base: Container
"""
Run `bin/rails test` in the project root and fail with its output.
"""
test(ws: Workspace!): Void @check {
ruby(root: root, base: base).run(ws, tool: "Rails tests", command: ["bin/rails", "test"])
}
"""
Serve the app in development with `bin/rails server` on port 3000. Rails
only answers its development hosts, such as localhost.
"""
server(ws: Workspace!): Service! @up {
ruby(root: root, base: base)
.container(ws)
.withEnvVariable("RAILS_ENV", "development")
.withExposedPort(3000)
.asService(args: ["bin/rails", "server", "-b", "0.0.0.0", "-p", "3000"])
}
"""
Precompile assets with `bin/rails assets:precompile` in production and return
public/assets. Rails' dummy secret key stands in for real credentials.
"""
assets(ws: Workspace!): Directory! {
ruby(root: root, base: base)
.container(ws)
.withEnvVariable("RAILS_ENV", "production")
.withEnvVariable("SECRET_KEY_BASE_DUMMY", "1")
.withExec(["bin/rails", "assets:precompile"])
.directory("public/assets")
}
}