ashfurrow / danger-ruby-swiftlint

A Danger plugin for SwiftLint.
https://rubygems.org/gems/danger-swiftlint
MIT License
203 stars 80 forks source link

Unable to install danger swiftlint behind Artifactory #180

Closed nehabans closed 2 years ago

nehabans commented 2 years ago

Hi, I am trying to install danger swiftlint version 0.26.0 on a mac but I am trying to download it using Artifactory package manager which does not allow me to use github.com with rubygems.org. I want the gem installer to go via artifactory for portable_swiftlint package and not go directly to github.com. I am not sure which rakefile or config file danger_swiftlint is using to download portable_swiftint, the one which I updated inside /ext/swiftlint gets changed everytime I run the below command and keeps pointing to github.com.

tcagent@Wolf swiftlint % gem install danger-swiftlint -v 0.26.0   
Ignoring danger-swiftlint-0.26.0 because its extensions are not built. Try: gem pristine danger-swiftlint --version 0.26.0
Building native extensions. This could take a while...
ERROR:  Error installing danger-swiftlint:
    ERROR: Failed to build gem native extension.

    current directory: /Users/tcagent/.rvm/gems/ruby-3.1.0/gems/danger-swiftlint-0.26.0/ext/swiftlint
/Users/tcagent/.rvm/rubies/ruby-3.1.0/bin/ruby -I/Users/tcagent/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0 -rrubygems /Users/tcagent/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/rake-13.0.6/exe/rake RUBYARCHDIR\=/Users/tcagent/.rvm/gems/ruby-3.1.0/extensions/x86_64-darwin-20/3.1.0/danger-swiftlint-0.26.0 RUBYLIBDIR\=/Users/tcagent/.rvm/gems/ruby-3.1.0/extensions/x86_64-darwin-20/3.1.0/danger-swiftlint-0.26.0
Ignoring danger-swiftlint-0.26.0 because its extensions are not built. Try: gem pristine danger-swiftlint --version 0.26.0
mkdir -p '/Users/tcagent/.rvm/gems/ruby-3.1.0/gems/danger-swiftlint-0.26.0/ext/swiftlint/bin' && curl -s -L https://github.com/realm/SwiftLint/releases/download/0.41.0/portable_swiftlint.zip -o portable_swiftlint.zip && unzip -q portable_swiftlint.zip -d '/Users/tcagent/.rvm/gems/ruby-3.1.0/gems/danger-swiftlint-0.26.0/ext/swiftlint/bin' && rm portable_swiftlint.zip
Downloading swiftlint@0.41.0
rake aborted!
Command failed with status (6): [mkdir -p '/Users/tcagent/.rvm/gems/ruby-3....]
/Users/tcagent/.rvm/gems/ruby-3.1.0/gems/danger-swiftlint-0.26.0/ext/swiftlint/Rakefile:17:in `block (2 levels) in <top (required)>'
Tasks: TOP => default => swiftlint:install
(See full trace by running task with --trace)

rake failed, exit code 1

Gem files will remain installed in /Users/tcagent/.rvm/gems/ruby-3.1.0/gems/danger-swiftlint-0.26.0 for inspection.
Results logged to /Users/tcagent/.rvm/gems/ruby-3.1.0/extensions/x86_64-darwin-20/3.1.0/danger-swiftlint-0.26.0/gem_make.out
tcagent@Wolf swiftlint %
ashfurrow commented 2 years ago

You can specify the binary_path config option (described in the readme) to point to a custom SwiftLint install path, and skip the SwiftLint installation by setting the DANGER_SKIP_SWIFTLINT_INSTALL environment variable equal to YES:

https://github.com/ashfurrow/danger-ruby-swiftlint/blob/7c33f610349f40fabd28746a6ee2576b0aed7307/ext/swiftlint/Rakefile#L8

We could probably do a better job of documenting that. Could you verify that works for you, and if you have time, open up a pull request for our readme?

nehabans commented 2 years ago

Thanks @ashfurrow, appreciate your quick response. It worked for us and solved a big issue within our organisation. I have raised a PR with an update to ReadMe.

ashfurrow commented 2 years ago

Wonderful! Thanks for the PR and following up that this worked. I’ll close the issue.