forked from dependabot/dependabot-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dependabot-dep.gemspec
44 lines (32 loc) · 1.33 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
# frozen_string_literal: true
require "find"
Gem::Specification.new do |spec|
core_gemspec = Bundler.load_gemspec_uncached("../dependabot-core.gemspec")
spec.name = "dependabot-dep"
spec.summary = "Go dep support for dependabot-core"
spec.version = core_gemspec.version
spec.description = core_gemspec.description
spec.author = core_gemspec.author
spec.email = core_gemspec.email
spec.homepage = core_gemspec.homepage
spec.license = core_gemspec.license
spec.require_path = "lib"
spec.files = []
spec.required_ruby_version = core_gemspec.required_ruby_version
spec.required_rubygems_version = core_gemspec.required_ruby_version
spec.add_dependency "dependabot-core", Dependabot::VERSION
core_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