Created
November 12, 2019 13:22
-
-
Save emiltin/d6c0763aa4e11db167df618705daf71f to your computer and use it in GitHub Desktop.
Add submodule files to gemspec
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
gem_dir = Pathname.new(__dir__).expand_path | |
`git submodule --quiet foreach pwd`.split($\).each do |submodule_path| | |
Dir.chdir(submodule_path) do | |
# for each submodule, cd to foler and get path relative to gem root folder | |
submodule_relative_path = Pathname.new(submodule_path).relative_path_from(gem_dir) | |
`git ls-files`.split($\).each do |filename| | |
# for each git file, prepend relative submodule path and add to spec | |
spec.files << submodule_relative_path.join(filename).to_s | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment