-
-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,10 @@ gem "rubywarrior" | |
source "http://localhost:9292/upstream/#{CGI.escape("https://my.gem-source.local")}" do | ||
gem "my-gem" | ||
end | ||
source "http://localhost:9292/upstream/my-other.gem-source.local" do | ||
gem "my-other-gem" | ||
end | ||
``` | ||
|
||
Notice the `CGI.escape` call in the second source. This is important, as | ||
|
@@ -57,6 +61,53 @@ you want. The `/upstream` prefix tells Gemstash to use a gem source | |
other than the default source. You can now bundle with the additional | ||
source. | ||
|
||
Notice that the third source doesn't need to be escaped. | ||
This is because the `https://` is used by default when no schema is set, | ||
and the source URL does not contain any chars that need to be escaped. | ||
|
||
## Authentication with Multiple Sources | ||
|
||
You can use basic authentication or API keys on sources directly in Gemfile | ||
or using ENV variables on the Gemstash instance. | ||
|
||
Example `Gemfile`: | ||
```ruby | ||
# ./Gemfile | ||
require "cgi" | ||
source "http://localhost:9292" | ||
source "http://localhost:9292/upstream/#{CGI.escape("user:[email protected]")}" do | ||
gem "my-gem" | ||
end | ||
source "http://localhost:9292/upstream/#{CGI.escape("[email protected]")}" do | ||
gem "my-other-gem" | ||
end | ||
``` | ||
|
||
If you set `GEMSTASH_<HOST>` ENV variable with your authentication information, | ||
you can omit it from the `Gemfile`: | ||
|
||
```ruby | ||
# ./Gemfile | ||
source "http://localhost:9292" | ||
source "http://localhost:9292/upstream/my.gem-source.local" do | ||
gem "my-gem" | ||
end | ||
``` | ||
|
||
And run the Gemstash with the credentials set in an ENV variable: | ||
|
||
```bash | ||
GEMSTASH_MY__GEM___SOURCE__LOCAL=user:password gemstash start --no-daemonize --config-file config.yml.erb | ||
``` | ||
|
||
The name of the ENV variable is the uppercase version of the host name, | ||
with all `.` characters replaced with `__`, all `-` with `___` and a `GEMSTASH_` prefix. | ||
|
||
Example: `my.gem-source.local` => `GEMSTASH_MY__GEM___SOURCE__LOCAL` | ||
|
||
## Redirecting | ||
|
||
Gemstash supports an alternate mode of specifying your gem sources. If | ||
|