drone-hunter 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e480e4c3cedc73d1c18070de5285a2a9ec12a01e203d87d96d33a4b3cd4239a
4
- data.tar.gz: 5d5ff07a714bad22fac37ee885fa65f020a2a1c77f25975a375a54aa6083b512
3
+ metadata.gz: eaeb14dc51de2fee5541c680a5a100e6adfaaab2826185f63824aceb0e4039d6
4
+ data.tar.gz: ac3aa67b76d86918e93658123ad05c72ca5be17e86d68a0eeb13e7a7232f9208
5
5
  SHA512:
6
- metadata.gz: e59220a2943629071563fe2d3c05571a31637801ef42782c40d44a60676d537e29d303868bc2f1021a3e69952acc26de41409eb6b60f429b18e0d5b6b51b235a
7
- data.tar.gz: a3d03c03c714a27d1091f228473f638181008780dd665afb0d7fcf0d59a59515a029cbcbf49541a2bd4c1078209f38023e03569e284c0ede4158abe8e2f3ec26
6
+ metadata.gz: 1bce4e1e93f683b9638aa51194c6a853334e425800285d3aafba6243563398522ee54fae9f610945de1ecb1b77a87656ed3891dc8ddc36b134364d7d49e81dcc
7
+ data.tar.gz: d474676013e09f8b3e7dbef82ddd83d4f7ae64ffe8fddb8a6a90c530ee6af71b92600036998fb5ad72c886329da03c07f178f7b2bf29efcd902cece06c595cb3
@@ -2,9 +2,8 @@ name: Ruby Gem
2
2
 
3
3
  on:
4
4
  push:
5
- branches: [ "master" ]
6
- pull_request:
7
- branches: [ "master" ]
5
+ tags:
6
+ - '*'
8
7
 
9
8
  jobs:
10
9
  build:
@@ -32,7 +31,14 @@ jobs:
32
31
  env:
33
32
  GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
34
33
  OWNER: ${{ github.repository_owner }}
35
-
34
+ - name: Publish to Release Assets
35
+ uses: softprops/action-gh-release@v1
36
+ if: startsWith(github.ref, 'refs/tags/')
37
+ with:
38
+ files: |
39
+ *.gem
40
+ LICENSE.txt
41
+ CHANGELOG.md
36
42
  # - name: Publish to RubyGems
37
43
  # run: |
38
44
  # mkdir -p $HOME/.gem
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.4.0
4
+
5
+ - [feature] added `--match-basename` option to override file basename filter.
6
+ - [feature] added `--match-suffix` option to override file suffix filter.
7
+
3
8
  ## 0.3.0
4
9
 
5
10
  - [feature] added `--ignore-archived` option to skip archived repositories.
data/bin/drone-hunter CHANGED
@@ -67,6 +67,10 @@ config = {
67
67
  cache: {
68
68
  dir: File.expand_path(ENV.fetch("DRONE_HUNTER_CACHE_DIR", './drone-hunter.cache'))
69
69
  },
70
+ match: {
71
+ basename: Regexp.new(ENV.fetch("DRONE_HUNTER_MATCH_BASENAME", "drone")),
72
+ suffix: Regexp.new(ENV.fetch("DRONE_HUNTER_MATCH_SUFFIX", "[.]ya?ml") + "$")
73
+ },
70
74
  github: {
71
75
  auto_paginate: boolean_from(ENV.fetch("DRONE_HUNTER_GITHUB_AUTO_PAGINATE", "true")),
72
76
  access_token: github_access_token_from_environment
@@ -97,6 +101,8 @@ OptionParser.new do |options|
97
101
  options.on("-p", "--output-path=PATH", "env: DRONE_HUNTER_OUTPUT_PATH") { |argument| config[:output][:path] = File.expand_path(argument) }
98
102
  options.on("-N", "--[no-]output-normalize", "env: DRONE_HUNTER_OUTPUT_NORMALIZE") { |argument| config[:output][:normalize] = argument }
99
103
  options.on("-A", "--[no-]ignore-archived", "env: DRONE_HUNTER_IGNORE_ARCHIVED") { |argument| config[:ignore][:archived] = argument }
104
+ options.on("-B", "--match-basename=REGEXP", "env: DRONE_HUNTER_MATCH_BASENAME") { |argument| config[:match][:basename] = Regexp.new(argument) }
105
+ options.on("-S", "--match-suffix=REGEXP", "env: DRONE_HUNTER_MATCH_SUFFIX") { |argument| config[:match][:suffix] = Regexp.new(argument + "$") }
100
106
  end.parse!
101
107
 
102
108
  #################
@@ -138,7 +144,7 @@ cache = Moneta.new(:File, dir: config[:cache][:dir])
138
144
  # Main Program #
139
145
  ################
140
146
 
141
- hunt = DroneHunter.new(owners: ARGV, log: log, github: github, cache: cache, ignore: config[:ignore])
147
+ hunt = DroneHunter.new(owners: ARGV, log: log, github: github, cache: cache, ignore: config[:ignore], match: config[:match])
142
148
 
143
149
  if config[:hacking]
144
150
  require "pry"
data/drone-hunter.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
- tag = `git describe --tags --abbrev=0`.chomp
3
-
2
+ tag = `git describe --tags --always`.chomp
3
+
4
4
  gem.name = 'drone-hunter'
5
5
  gem.homepage = 'https://github.com/colstrom/drone-hunter'
6
6
  gem.summary = 'Hunts for Drone CI files across many repositories'
data/lib/drone_hunter.rb CHANGED
@@ -7,6 +7,7 @@
7
7
  require "base64"
8
8
  require "logger"
9
9
  require "set"
10
+ require "yaml"
10
11
 
11
12
  #########################
12
13
  # External Dependencies #
@@ -22,6 +23,7 @@ class DroneHunter
22
23
  @cache ||= options.fetch(:cache) { Moneta.new(:File, dir: 'drone-hunter.cache') }
23
24
  @owners ||= Set.new(options.fetch(:owners, []))
24
25
  @ignoring ||= { archived: false }.merge(options.fetch(:ignore, {}))
26
+ @match ||= { basename: /drone/, suffix: /[.]ya?ml$/ }.merge(options.fetch(:match, {}))
25
27
  end
26
28
 
27
29
  attr_reader :log
@@ -29,6 +31,7 @@ class DroneHunter
29
31
  attr_reader :cache
30
32
  attr_reader :owners
31
33
  attr_reader :ignoring
34
+ attr_reader :match
32
35
 
33
36
  def ignoring_archived?
34
37
  ignoring.fetch(:archived, false)
@@ -81,8 +84,8 @@ class DroneHunter
81
84
  def blobs
82
85
  trees.map do |repo, tree|
83
86
  blobs = tree
84
- .select { |entry| entry.path.match?(/ya?ml$/) }
85
- .select { |entry| entry.path.match?(/drone/) }
87
+ .select { |entry| entry.path.match?(match[:suffix]) }
88
+ .select { |entry| entry.path.match?(match[:basename]) }
86
89
  .map do |entry|
87
90
  {
88
91
  entry.path => cached("blob/#{repo}/#{entry.sha}") { github.blob(repo, entry.sha) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drone-hunter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Olstrom
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-05 00:00:00.000000000 Z
11
+ date: 2022-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit