Skip to content

Commit

Permalink
Initial setup for dependabot-docker
Browse files Browse the repository at this point in the history
  • Loading branch information
greysteil committed Dec 7, 2018
1 parent 598a9f2 commit bfb5040
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions docker/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
inherit_from: ../config/rubocop-default.yml
7 changes: 7 additions & 0 deletions docker/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

source "https://rubygems.org"

gem "dependabot-core", path: "../"

gemspec
17 changes: 17 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## `dependabot-docker`

Docker support for [`dependabot-core`][core-repo].

### Running locally

1. Install Ruby dependencies
```
$ bundle install
```

2. Run tests
```
$ bundle exec rspec spec
```

[core-repo]: https://github.com/dependabot/dependabot-core
44 changes: 44 additions & 0 deletions docker/dependabot-terraform.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# frozen_string_literal: true

require "find"

Gem::Specification.new do |spec|
core_gemspec = Bundler.load_gemspec_uncached("../dependabot-core.gemspec")

spec.name = "dependabot-docker"
spec.summary = "Terraform 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
11 changes: 11 additions & 0 deletions docker/spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

def common_dir
@common_dir ||= Gem::Specification.find_by_name("dependabot-core").gem_dir
end

def require_common_spec(path)
require "#{common_dir}/spec/dependabot/#{path}"
end

require "#{common_dir}/spec/spec_helper.rb"

0 comments on commit bfb5040

Please sign in to comment.