Skip to content

Commit 2fe8ae8

Browse files
authored
Merge pull request #988 from tutuf/add-with-ssh-exec-build-flag
Add `--with-ssh-exec` build flag for `USE_SSH=exec`
2 parents 668ba59 + 9fa2acd commit 2fe8ae8

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

README.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Rugged is a self-contained gem. You can install it by running:
1818
$ gem install rugged
1919

2020
## Prerequisites
21-
You need to have CMake and `pkg-config` installed on your system to be able to build the included version of `libgit2`.
21+
You need to have CMake and `pkg-config` installed on your system to be able to build the included version of `libgit2`.
2222

2323
### Debian, Including Ubuntu
2424
All Debian-derived Linux distros provide `apt`:
@@ -42,23 +42,34 @@ Please follow the above in case installation of the gem fails with `ERROR: CMake
4242

4343
If you want to build Rugged with HTTPS and SSH support, check out the list of optional [libgit2 dependencies](https://github.com/libgit2/libgit2#optional-dependencies).
4444

45-
To install `rugged` with SSH support ensure you have the `LibSSH2` library present, then pass the required `CMAKE_FLAGS`:
45+
For SSH suport you have 2 options: libssh2 (recommended) or OpenSSH command execution (handy
46+
when you want to configure SSH behavior through `.ssh/config`):
47+
48+
1. To use `Libssh2`, ensure libssh2 library is present and either pass the required `CMAKE_FLAGS`:
4649
```bash
4750
CMAKE_FLAGS='-DUSE_SSH=ON' gem install rugged
4851
```
49-
50-
Or pass the `--with-ssh` build option:
52+
or the `--with-ssh` build option:
5153
```bash
5254
gem install rugged -- --with-ssh
5355
```
56+
2. To execute external OpenSSH commands instead of libssh2, either pass the required `CMAKE_FLAGS`:
57+
58+
```bash
59+
CMAKE_FLAGS='-DUSE_SSH=exec' gem install rugged
60+
```
61+
or the `--with-ssh-exec` build option:
62+
```bash
63+
gem install rugged -- --with-ssh-exec
64+
```
5465

5566
If you're using bundler and want to bundle `libgit2` with Rugged, you can use the `:submodules` option:
5667

5768
```ruby
5869
gem 'rugged', git: 'git://github.com/libgit2/rugged.git', submodules: true
5970
```
6071

61-
If you would like to bundle rugged with SSH support add the `--with-ssh` build option to the bundler config:
72+
If you would like to bundle rugged with SSH support add the `--with-ssh` or `--with-ssh-exec` build option to the bundler config:
6273
```bash
6374
bundle config build.rugged --with-ssh
6475
```
@@ -329,7 +340,7 @@ blob.content # => Gives you the content of the blob.
329340

330341
There is currently no way to stream data from a blob, because `libgit2` itself does not (yet) support
331342
streaming blobs out of the git object database. While there are hooks and interfaces for supporting it,
332-
the default file system backend always loads the entire blob contents into memory.
343+
the default file system backend always loads the entire blob contents into memory.
333344

334345
If you need to access a Blob object through an IO-like API, you can wrap it with the `StringIO` class.
335346
Note that the only advantage here is a stream-compatible interface, the complete blob object will still

ext/rugged/extconf.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818
cmake_flags << "-DBUILD_TESTS=OFF"
1919
cmake_flags << "-DREGEX_BACKEND=builtin"
2020
cmake_flags << "-DUSE_SHA1DC=ON" if with_config("sha1dc")
21-
cmake_flags << "-DUSE_SSH=ON" if with_config("ssh")
21+
if with_config("ssh")
22+
cmake_flags << "-DUSE_SSH=ON"
23+
elsif with_config("ssh-exec")
24+
cmake_flags << "-DUSE_SSH=exec"
25+
end
2226

2327
def sys(cmd)
2428
puts " -- #{cmd}"

0 commit comments

Comments
 (0)