-
-
Save kamito/6004998 to your computer and use it in GitHub Desktop.
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
# -*- encoding: utf-8 -*- | |
require File.expand_path('../lib/example/version', __FILE__) | |
Gem::Specification.new do |gem| | |
gem.authors = ["John Doe"] | |
gem.email = ["[email protected]"] | |
gem.description = %q{Write a gem description} | |
gem.summary = %q{Write a gem summary} | |
gem.homepage = "" | |
gem.files = `git ls-files`.split($\) | |
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } | |
gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) | |
gem.name = "example" | |
gem.require_paths = ["lib"] | |
gem.version = Example::VERSION | |
# get an array of submodule dirs by executing 'pwd' inside each submodule | |
`git submodule --quiet foreach pwd`.split($\).each do |submodule_path| | |
# for each submodule, change working directory to that submodule | |
Dir.chdir(submodule_path) do | |
# issue git ls-files in submodule's directory | |
submodule_files = `git ls-files`.split($\) | |
# prepend the submodule path to create absolute file paths | |
submodule_files_fullpaths = submodule_files.map do |filename| | |
"#{submodule_path}/#{filename}" | |
end | |
# remove leading path parts to get paths relative to the gem's root dir | |
# (this assumes, that the gemspec resides in the gem's root dir) | |
submodule_files_paths = submodule_files_fullpaths.map do |filename| | |
filename.gsub "#{File.dirname(__FILE__)}/", "" | |
end | |
# add relative paths to gem.files | |
gem.files += submodule_files_paths | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment