# jf ruby Configure Ruby/Bundler for dependency resolution and publishing through Artifactory. ## When to Use Use `jf ruby-config` to configure Bundler/RubyGems to resolve gems from Artifactory. After configuration, standard `bundle install` commands resolve from your Artifactory repository. ## Prerequisites * Ruby and Bundler must be installed. * Configure a server with `jf config add` or `jf c add`. * Authentication to Artifactory is required. *** ## Configuration: `jf ruby-config` Generate Ruby/Bundler configuration for dependency resolution and publishing through Artifactory. **Run this once per project before your first `bundle install`.** **To configure Ruby/Bundler for Artifactory:** ### Synopsis ``` jf ruby-config [options] ``` **Aliases:** `rubyc` ### Configuration Options | Flag | Default | Description | | --------------------- | ------- | ------------------------------------------------------------------------------------ | | `--global` | `false` | Set to true for global configuration (all projects). Specific projects can override. | | `--repo-deploy` | — | Repository for artifacts deployment | | `--repo-resolve` | — | Repository for dependencies resolution | | `--server-id-deploy` | — | Artifactory server ID for deployment. Configure with `jf config add`. | | `--server-id-resolve` | — | Artifactory server ID for resolution. Configure with `jf config add`. | ### Configuration Examples #### View Help ```bash jf ruby-config --help ``` #### Non-Interactive Configuration with Flags ```bash jf ruby-config --server-id-resolve= --repo-resolve= ``` Where: * \: The server ID configured using `jf config add` * \: The name of the Ruby repository in Artifactory For example: ```bash jf ruby-config --server-id-resolve=my-server --repo-resolve=ruby-virtual ``` #### Global Configuration ```bash jf ruby-config --global --server-id-resolve= --repo-resolve= ``` ### Why Run Config First? You must run `jf ruby-config` before using `bundle install` with Artifactory. The config sets the gem source to point to your Artifactory repository. Without it, Bundler resolves from the default public gem sources. > **Shortcut**: In CI/CD, pass all flags non-interactively so the config step is fully automated and reproducible. ### Configuration Notes * **Config-only**: There is no `jf ruby` command. After running `jf ruby-config`, use standard Ruby/Bundler commands with Artifactory as the gem source. * **Resolution and deployment**: Use `--repo-resolve` for installing gems and `--repo-deploy` for publishing gems. * **Run once per project**: Re-run when changing repository assignments. ### Expected Output ``` $ jf ruby-config --server-id-resolve=my-server --repo-resolve=ruby-virtual Ruby build configuration saved successfully. ``` ### How to Verify After running, verify the configuration is applied: ```bash bundle config ``` *** ## After Configuration After running `jf ruby-config`, use standard Bundler commands. JFrog CLI configures the gem source to point to Artifactory, so native commands resolve from it automatically: ```bash # 1. Configure once jf ruby-config --server-id-resolve=my-server --repo-resolve=ruby-virtual # 2. Use standard Bundler — dependencies resolve from Artifactory bundle install # 3. To publish a gem (if --repo-deploy was configured) gem push my-gem-1.0.0.gem ``` *** ## Important Notes * **Config-only**: There is no `jf ruby` command. After running `jf ruby-config`, use standard Ruby/Bundler commands with Artifactory as the gem source. * **Resolution and deployment**: Use `--repo-resolve` for installing gems and `--repo-deploy` for publishing gems. ## CI/CD Example (GitHub Actions) ```yaml # .github/workflows/build.yml steps: - uses: actions/checkout@v4 - name: Setup JFrog CLI uses: jfrog/setup-jfrog-cli@v4 env: JF_URL: ${{ vars.JF_URL }} JF_ACCESS_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }} - name: Setup Ruby uses: ruby/setup-ruby@v1 with: ruby-version: '3.2' - name: Configure Ruby run: jf ruby-config --server-id-resolve=setup-jfrog-cli-server --repo-resolve=ruby-virtual - name: Install dependencies run: bundle install ``` ## Troubleshooting | Symptom | Cause | Fix | | --------------------------------------------------------------- | ----------------------------------------------- | ------------------------------------------------------- | | `bundle install` does not resolve from Artifactory after config | Config not applied or gem source not set | Re-run `jf ruby-config` and verify with `bundle config` | | 401 / 403 errors | Invalid credentials or insufficient permissions | Re-run `jf config add` with a valid access token | | `gem push` fails | Deploy repository not configured | Re-run `jf ruby-config` with `--repo-deploy` set | **Enable debug logging:** `export JFROG_CLI_LOG_LEVEL=DEBUG`
## Related Topics * [Build Tools Overview](/artifactory/docs/build-tool-commands) — Capabilities matrix and tool reference * [Native Mode](/artifactory/docs/native-mode) — Supported packages with Native Mode