tracking_number 1.3.2 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,19 +17,28 @@ Gem::Specification.new do |s|
17
17
  ]
18
18
 
19
19
  s.files = `git ls-files`.split("\n")
20
- gem_dir = "#{File.expand_path(File.join(__FILE__, '..'))}/"
21
20
 
21
+ gem_dir = "#{File.expand_path(File.join(__FILE__, '..'))}/"
22
22
  `git submodule --quiet foreach pwd`.split($OUTPUT_RECORD_SEPARATOR).each do |submodule_path|
23
23
  Dir.chdir(submodule_path.chomp) do
24
24
  submodule_relative_path = submodule_path.sub gem_dir, ''
25
- # issue git ls-files in submodule's directory and
25
+
26
+ # issue git ls-files in submodule's directory
27
+ submodule_files = `git ls-files -- couriers/*`.split($OUTPUT_RECORD_SEPARATOR)
28
+
26
29
  # prepend the submodule path to create absolute file paths
30
+ submodule_files_fullpaths = submodule_files.map do |filename|
31
+ "#{submodule_path}/#{filename}"
32
+ end
27
33
 
28
- `git ls-files -- couriers/*`.split($OUTPUT_RECORD_SEPARATOR).each do |filename|
29
- file_path = "#{submodule_relative_path}/#{filename}"
30
- puts "adding file #{file_path}"
31
- s.files << file_path
34
+ # remove leading path parts to get paths relative to the gem's root dir
35
+ # (this assumes, that the gemspec resides in the gem's root dir)
36
+ submodule_files_paths = submodule_files_fullpaths.map do |filename|
37
+ filename.gsub gem_dir, ''
32
38
  end
39
+
40
+ # add relative paths to gem.files
41
+ s.files += submodule_files_paths
33
42
  end
34
43
  end
35
44