Skip to content

Commit b966573

Browse files
committed
Simplified usage
1 parent 609366a commit b966573

File tree

2 files changed

+61
-14
lines changed

2 files changed

+61
-14
lines changed

README.md

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,46 @@
11
# shopify-ruby-definitions
22

3-
This repository contains [ruby-build](https://github.com/rbenv/ruby-build/) definitions of Rubies we use at Shopify. These builds are generally API complient with release Rubies, but with additional backports for bugfixes and performance.
3+
This repository contains [ruby-build](https://github.com/rbenv/ruby-build/) definitions of Rubies we use at Shopify.
4+
These builds are API complient with release Rubies, but with additional backports for bugfixes and performance.
45

5-
## Quick start
6+
## rbenv integration
7+
8+
If you use `rbenv`, you can add the custom rubies with:
9+
10+
```bash
11+
$ gem install shopify-ruby-definitions
12+
$ eval "$(shopify-ruby env)"
13+
```
14+
15+
## standalone ruby-build
16+
17+
If you are using another ruby version manager or no manager at all:
618

719
1. Install ruby-build by [following the instructions](https://github.com/rbenv/ruby-build/#installation).
8-
1. Install the gem:
9-
```
20+
21+
2. Install the gem:
22+
```bash
1023
$ gem install shopify-ruby-definitions
1124
```
12-
1. Acquire the specific Ruby version of the Ruby version you want to install. Ruby 3.2 is used as an example here:
13-
```
14-
$ export RUBY_VERSION=`ruby -rshopify_ruby_definitions -e 'puts ShopifyRubyDefinitions.resolve_version("3.2")'`
15-
```
16-
1. Set the definitions path for ruby-build:
17-
```
18-
$ export RUBY_BUILD_DEFINITIONS=`ruby -rshopify_ruby_definitions -e 'puts ShopifyRubyDefinitions::RubyVersions::VERSIONS_DIRECTORY'`
19-
```
20-
1. Install the Ruby version using ruby-build:
25+
26+
3. List the custom Ruby versions available:
27+
```bash
28+
$ shopify-ruby versions
29+
3.0.0-pshopify9
30+
3.0.1-pshopify2
31+
3.0.2-pshopify3
32+
3.1.0-pshopify1
33+
3.1.1-pshopify2
34+
3.1.2-pshopify2
35+
3.1.3-pshopify1
36+
3.1.4-pshopify1
37+
3.2.0-pshopify2
38+
3.2.1-pshopify5
39+
3.2.2-pshopify3
40+
3.2.2-pshopify4
2141
```
22-
ruby-build $RUBY_VERSION
42+
43+
4. Install the Ruby version you want, [options are the same than regular `ruby-build`](https://github.com/rbenv/ruby-build#advanced-usage):
44+
```bash
45+
$ shopify-ruby build 3.2.2-pshopify4 ~/.rubies/versions/3.2.2
2346
```

exe/shopify-ruby

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
require "shopify_ruby_definitions"
5+
6+
definitions = [
7+
ENV["RUBY_BUILD_DEFINITIONS"],
8+
ShopifyRubyDefinitions::RubyVersions::VERSIONS_DIRECTORY,
9+
].compact.join(":")
10+
11+
case ARGV.shift
12+
when "versions"
13+
puts ShopifyRubyDefinitions::RubyVersions::ALL_VERSIONS
14+
when "build"
15+
Process.exec({ "RUBY_BUILD_DEFINITIONS" => definitions }, "ruby-build", *ARGV)
16+
when "env"
17+
puts %{export RUBY_BUILD_DEFINITIONS="#{definitions}"}
18+
else
19+
$stderr.puts <<~USAGE
20+
Usage: shopify-ruby list
21+
shopify-ruby build [-kpv] <definition> <prefix>
22+
shopify-ruby env
23+
USAGE
24+
end

0 commit comments

Comments
 (0)