You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a guide on [Building your first Ruby Project](https://github.com/bazelruby/rules_ruby/wiki/Build-your-ruby-project) on the Wiki. We encourage you to check it out.
41
+
Note: we have a short guide on [Building your first Ruby Project](https://github.com/bazelruby/rules_ruby/wiki/Build-your-ruby-project) on the Wiki. We encourage you to check it out.
43
42
44
43
## Usage
45
44
45
+
### `WORKSPACE` File
46
+
46
47
Add `ruby_rules_dependencies` and `ruby_register_toolchains` into your `WORKSPACE` file.
47
48
48
49
```python
@@ -65,6 +66,33 @@ ruby_rules_dependencies()
65
66
ruby_register_toolchains()
66
67
```
67
68
69
+
Next, add any external Gem dependencies you may have via `ruby_bundle` command.
70
+
The name of the bundle becomes a reference to this particular Gemfile.lock.
71
+
72
+
Install external gems that can be later referenced as `@<bundle-name>//:<gem-name>`,
73
+
and the executables from each gem can be accessed as `@<bundle-name//:bin/<gem-binary-name>`
74
+
for instance, `@bundle//:bin/rubocop`.
75
+
76
+
You can install more than one bundle per WORKSPACE, but that's not recommended.
77
+
78
+
```python
79
+
ruby_bundle(
80
+
name="bundle",
81
+
gemfile=":Gemfile",
82
+
gemfile_lock=":Gemfile.lock",
83
+
bundler_version="2.1.2",
84
+
)
85
+
86
+
ruby_bundle(
87
+
name="bundle_app_shopping",
88
+
gemfile="//apps/shopping:Gemfile",
89
+
gemfile_lock="//apps/shopping:Gemfile.lock",
90
+
bundler_version="2.1.2",
91
+
)
92
+
```
93
+
94
+
### `BUILD.bazel` files
95
+
68
96
Add `ruby_library`, `ruby_binary` or `ruby_test` into your `BUILD.bazel` files.
0 commit comments