forked from dependabot/dependabot-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dependabot-dep.gemspec
45 lines (33 loc) · 1.36 KB
/
dependabot-dep.gemspec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# frozen_string_literal: true
require "find"
Gem::Specification.new do |spec|
common_gemspec =
Bundler.load_gemspec_uncached("../common/dependabot-common.gemspec")
spec.name = "dependabot-dep"
spec.summary = "Go dep support for dependabot"
spec.version = common_gemspec.version
spec.description = common_gemspec.description
spec.author = common_gemspec.author
spec.email = common_gemspec.email
spec.homepage = common_gemspec.homepage
spec.license = common_gemspec.license
spec.require_path = "lib"
spec.files = []
spec.required_ruby_version = common_gemspec.required_ruby_version
spec.required_rubygems_version = common_gemspec.required_ruby_version
spec.add_dependency "dependabot-common", Dependabot::VERSION
common_gemspec.development_dependencies.each do |dep|
spec.add_development_dependency dep.name, dep.requirement.to_s
end
next unless File.exist?("../.gitignore")
ignores = File.readlines("../.gitignore").grep(/\S+/).map(&:chomp)
next unless File.directory?("lib") && File.directory?("helpers")
prefix = "/" + File.basename(File.expand_path(__dir__)) + "/"
Find.find("lib", "helpers") do |path|
if ignores.any? { |i| File.fnmatch(i, prefix + path, File::FNM_DOTMATCH) }
Find.prune
else
spec.files << path unless File.directory?(path)
end
end
end