drone-hunter 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37b22b2b6edd120ad5b68d96f69e4dbfea113c69aca6c605b6f2b72405d11d51
4
- data.tar.gz: b1f6c55a257b4be6367e2dbfef217f7191e50413bead70043e7e1d068f2cd6c8
3
+ metadata.gz: 6e480e4c3cedc73d1c18070de5285a2a9ec12a01e203d87d96d33a4b3cd4239a
4
+ data.tar.gz: 5d5ff07a714bad22fac37ee885fa65f020a2a1c77f25975a375a54aa6083b512
5
5
  SHA512:
6
- metadata.gz: acf5462f956910eb483b81b9b19467e05ca7b86d50e52a6015d90d108d3a6c2823b15acc1c02f033844ce6961b8f3bdb97aa3d6c61a5789488b94ac4f63328b4
7
- data.tar.gz: 05d681deef5afc54234bd4dfee9600666a3deb8bffb4318af0f068e8b6f1b969156c4c83897728dc5f0827d36e1df922eafd63ed67acbcad083dec13d801b101
6
+ metadata.gz: e59220a2943629071563fe2d3c05571a31637801ef42782c40d44a60676d537e29d303868bc2f1021a3e69952acc26de41409eb6b60f429b18e0d5b6b51b235a
7
+ data.tar.gz: a3d03c03c714a27d1091f228473f638181008780dd665afb0d7fcf0d59a59515a029cbcbf49541a2bd4c1078209f38023e03569e284c0ede4158abe8e2f3ec26
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.3.0
4
+
5
+ - [feature] added `--ignore-archived` option to skip archived repositories.
6
+
3
7
  ## 0.2.0
4
8
 
5
9
  - [config] added `--github-auto-paginate` option if you want to turn this off for some reason.
data/bin/drone-hunter CHANGED
@@ -71,6 +71,9 @@ config = {
71
71
  auto_paginate: boolean_from(ENV.fetch("DRONE_HUNTER_GITHUB_AUTO_PAGINATE", "true")),
72
72
  access_token: github_access_token_from_environment
73
73
  },
74
+ ignore: {
75
+ archived: boolean_from(ENV.fetch("DRONE_HUNTER_IGNORE_ARCHIVED", "false"))
76
+ },
74
77
  log: {
75
78
  level: log_level_from(ENV.fetch("DRONE_HUNTER_LOG_LEVEL", "info"))
76
79
  },
@@ -93,6 +96,7 @@ OptionParser.new do |options|
93
96
  options.on("-o", "--output-format=FORMAT", "env: DRONE_HUNTER_OUTPUT_FORMAT") { |argument| config[:output][:format] = output_format_from(argument) }
94
97
  options.on("-p", "--output-path=PATH", "env: DRONE_HUNTER_OUTPUT_PATH") { |argument| config[:output][:path] = File.expand_path(argument) }
95
98
  options.on("-N", "--[no-]output-normalize", "env: DRONE_HUNTER_OUTPUT_NORMALIZE") { |argument| config[:output][:normalize] = argument }
99
+ options.on("-A", "--[no-]ignore-archived", "env: DRONE_HUNTER_IGNORE_ARCHIVED") { |argument| config[:ignore][:archived] = argument }
96
100
  end.parse!
97
101
 
98
102
  #################
@@ -134,7 +138,7 @@ cache = Moneta.new(:File, dir: config[:cache][:dir])
134
138
  # Main Program #
135
139
  ################
136
140
 
137
- hunt = DroneHunter.new(owners: ARGV, log: log, github: github, cache: cache)
141
+ hunt = DroneHunter.new(owners: ARGV, log: log, github: github, cache: cache, ignore: config[:ignore])
138
142
 
139
143
  if config[:hacking]
140
144
  require "pry"
data/lib/drone_hunter.rb CHANGED
@@ -21,12 +21,18 @@ class DroneHunter
21
21
  @github ||= options.fetch(:client) { Octokit::Client.new(auto_paginate: true) }
22
22
  @cache ||= options.fetch(:cache) { Moneta.new(:File, dir: 'drone-hunter.cache') }
23
23
  @owners ||= Set.new(options.fetch(:owners, []))
24
+ @ignoring ||= { archived: false }.merge(options.fetch(:ignore, {}))
24
25
  end
25
26
 
26
27
  attr_reader :log
27
28
  attr_reader :github
28
29
  attr_reader :cache
29
30
  attr_reader :owners
31
+ attr_reader :ignoring
32
+
33
+ def ignoring_archived?
34
+ ignoring.fetch(:archived, false)
35
+ end
30
36
 
31
37
  def cached(key, *rest, &block)
32
38
  if cache.key?(key)
@@ -41,7 +47,9 @@ class DroneHunter
41
47
  def repositories(owner = nil)
42
48
  case owner
43
49
  when String then cached("repositories/#{owner}") { github.repositories(owner) }
44
- when nil then owners.flat_map { |owner| repositories(owner) }
50
+ when nil then owners.flat_map { |owner| repositories(owner) }.reject do |repo|
51
+ ignoring_archived? && repo.archived
52
+ end
45
53
  else raise TypeError
46
54
  end
47
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drone-hunter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Olstrom