You could write it in one line, which I think is a bit more DRY:

```ruby
"TERM= pecl install --alldeps #{@package_name}#{@package_version ? "-#{@package_version}" : nil }"
```

Or maybe like this:

```ruby
cmd = "TERM= pecl install --alldeps #{@package_name}"
cmd << "-#{@package_version}" if @package_version
```