caretaker-core 0.0.1
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 +7 -0
- data/.github/CODEOWNERS +5 -0
- data/.github/CODE_OF_CONDUCT.md +76 -0
- data/.github/CONTRIBUTING.md +9 -0
- data/.github/FUNDING.yml +4 -0
- data/.github/ISSUE_TEMPLATE/ask_question.md +10 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +30 -0
- data/.github/ISSUE_TEMPLATE/config.yml +1 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +28 -0
- data/.github/SECURITY.md +39 -0
- data/.github/SUPPORT.md +8 -0
- data/.gitignore +17 -0
- data/.reek.yml +6 -0
- data/.rspec +3 -0
- data/.rubocop.yml +30 -0
- data/.travis.yml +129 -0
- data/CHANGELOG.md +13 -0
- data/Gemfile +6 -0
- data/LICENSE.md +25 -0
- data/README.md +207 -0
- data/Rakefile +6 -0
- data/VERSION.txt +1 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/caretaker-core.gemspec +41 -0
- data/lib/caretaker-core.rb +40 -0
- data/lib/caretaker-core/config.rb +36 -0
- data/lib/caretaker-core/core.rb +148 -0
- data/lib/caretaker-core/git.rb +72 -0
- data/lib/caretaker-core/process.rb +47 -0
- data/lib/caretaker-core/tags.rb +19 -0
- data/lib/caretaker-core/utils.rb +33 -0
- data/lib/caretaker-core/version.rb +3 -0
- data/stale.yml +17 -0
- data/testing/get-raw.rb +17 -0
- metadata +151 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Description should go here
|
|
3
|
+
#
|
|
4
|
+
class CaretakerCore
|
|
5
|
+
#
|
|
6
|
+
# We want to create everything as a class/static method
|
|
7
|
+
#
|
|
8
|
+
class << self
|
|
9
|
+
private
|
|
10
|
+
|
|
11
|
+
#
|
|
12
|
+
# Are we running this from within a git repo??
|
|
13
|
+
#
|
|
14
|
+
def check_for_git_repo
|
|
15
|
+
raise StandardError.new('Directory does not contain a git repository - aborting') unless execute_command('git rev-parse --show-toplevel')
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
#
|
|
19
|
+
# Has a remote origin been setup?
|
|
20
|
+
#
|
|
21
|
+
def git_remote_origin
|
|
22
|
+
origin = execute_command('git config --get remote.origin.url')
|
|
23
|
+
raise StandardError.new('remote.origin.url is not set - aborting') unless origin
|
|
24
|
+
|
|
25
|
+
origin = origin.delete_suffix('.git') if origin.end_with?('.git')
|
|
26
|
+
origin.gsub(':', '/').gsub('git@', 'https://') if origin.start_with?('git@')
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
#
|
|
30
|
+
# comment to go here
|
|
31
|
+
#
|
|
32
|
+
def retrieve_git_log_entries
|
|
33
|
+
log_entries = execute_command("git log --first-parent --oneline --pretty=format:'%h|%H|%d|%s|%cs'")
|
|
34
|
+
|
|
35
|
+
return false unless log_entries
|
|
36
|
+
|
|
37
|
+
log_entries.split("\n")
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
#
|
|
41
|
+
# comment to go here
|
|
42
|
+
#
|
|
43
|
+
def get_child_messages(parent)
|
|
44
|
+
body = execute_command("git log --pretty=format:'%b' -n 1 #{parent}")
|
|
45
|
+
|
|
46
|
+
body.split("\n").each { |line| line.sub!('*', '') }.map(&:strip).reject(&:empty?).map { |line| line } unless body.empty?
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
#
|
|
50
|
+
# stuff
|
|
51
|
+
#
|
|
52
|
+
def git_repo_details
|
|
53
|
+
origin = git_remote_origin
|
|
54
|
+
uri = URI.parse(origin)
|
|
55
|
+
|
|
56
|
+
slug = uri.path.delete_prefix('/')
|
|
57
|
+
repository = "https://#{uri.host}/#{slug}"
|
|
58
|
+
|
|
59
|
+
[repository, slug]
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
#
|
|
63
|
+
# Execute a given command and return the output from stdout or false if it fails
|
|
64
|
+
#
|
|
65
|
+
def execute_command(cmd)
|
|
66
|
+
Open3.popen3(cmd) do |_stdin, stdout, _stderr, wait_thr|
|
|
67
|
+
return stdout.read.chomp if wait_thr.value.success?
|
|
68
|
+
end
|
|
69
|
+
false
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Description should go here
|
|
3
|
+
#
|
|
4
|
+
class CaretakerCore
|
|
5
|
+
#
|
|
6
|
+
# We want to create everything as a class/static method
|
|
7
|
+
#
|
|
8
|
+
class << self
|
|
9
|
+
#
|
|
10
|
+
# Make everything else private so it cannot be accessed directly
|
|
11
|
+
#
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
# This method reeks of :reek:NestedIterators
|
|
16
|
+
def init_results(parsed)
|
|
17
|
+
chronological = {}
|
|
18
|
+
categorised = {}
|
|
19
|
+
|
|
20
|
+
parsed.each do |tag|
|
|
21
|
+
tag_str = tag.to_s
|
|
22
|
+
|
|
23
|
+
chronological[tag_str] = []
|
|
24
|
+
|
|
25
|
+
categorised[tag_str] = {}
|
|
26
|
+
CATEGORIES.each { |category, _array| categorised[tag_str][category.to_s] = [] }
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
[chronological, categorised]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# This method reeks of :reek:NestedIterators
|
|
33
|
+
def process_results(parsed)
|
|
34
|
+
chronological, categorised = init_results(parsed.keys)
|
|
35
|
+
|
|
36
|
+
parsed.each do |tag, array|
|
|
37
|
+
tag_str = tag.to_s
|
|
38
|
+
|
|
39
|
+
array.each do |arr|
|
|
40
|
+
(chronological[tag_str] ||= []) << arr
|
|
41
|
+
(categorised[tag_str][arr[:category]] ||= []) << arr
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
[chronological, categorised]
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Description should go here
|
|
3
|
+
#
|
|
4
|
+
class CaretakerCore
|
|
5
|
+
#
|
|
6
|
+
# We want to create everything as a class/static method
|
|
7
|
+
#
|
|
8
|
+
class << self
|
|
9
|
+
#
|
|
10
|
+
# Make everything else private so it cannot be accessed directly
|
|
11
|
+
#
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
def generate_tag_list(parsed)
|
|
16
|
+
parsed.keys
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Description should go here
|
|
3
|
+
#
|
|
4
|
+
class CaretakerCore
|
|
5
|
+
#
|
|
6
|
+
# We want to create everything as a class/static method
|
|
7
|
+
#
|
|
8
|
+
class << self
|
|
9
|
+
#
|
|
10
|
+
# Make everything else private so it cannot be accessed directly
|
|
11
|
+
#
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
def split_log_entries(line, tag)
|
|
16
|
+
hash, hash_full, refs, commit_message, date = line.split('|')
|
|
17
|
+
|
|
18
|
+
tag = extract_tag(refs, tag)
|
|
19
|
+
|
|
20
|
+
[date, hash, hash_full, commit_message, tag]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def extract_tag(refs, old_tag)
|
|
24
|
+
tag = old_tag
|
|
25
|
+
if refs.include? 'tag: '
|
|
26
|
+
refs = refs.gsub(/.*tag:/i, '')
|
|
27
|
+
refs = refs.gsub(/,.*/i, '')
|
|
28
|
+
tag = refs.gsub(/\).*/i, '')
|
|
29
|
+
end
|
|
30
|
+
tag.to_s.strip
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
data/stale.yml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Number of days of inactivity before an issue becomes stale
|
|
2
|
+
daysUntilStale: 60
|
|
3
|
+
# Number of days of inactivity before a stale issue is closed
|
|
4
|
+
daysUntilClose: 7
|
|
5
|
+
# Issues with these labels will never be considered stale
|
|
6
|
+
exemptLabels:
|
|
7
|
+
- pinned
|
|
8
|
+
- security
|
|
9
|
+
# Label to use when marking an issue as stale
|
|
10
|
+
staleLabel: wontfix
|
|
11
|
+
# Comment to post when marking an issue as stale. Set to `false` to disable
|
|
12
|
+
markComment: >
|
|
13
|
+
This issue has been automatically marked as stale because it has not had
|
|
14
|
+
recent activity. It will be closed if no further activity occurs. Thank you
|
|
15
|
+
for your contributions.
|
|
16
|
+
# Comment to post when closing a stale issue. Set to `false` to disable
|
|
17
|
+
closeComment: true
|
data/testing/get-raw.rb
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'json'
|
|
4
|
+
|
|
5
|
+
$LOAD_PATH.unshift('./lib')
|
|
6
|
+
|
|
7
|
+
require 'bundler/setup'
|
|
8
|
+
require 'caretaker-core'
|
|
9
|
+
|
|
10
|
+
begin
|
|
11
|
+
results = CaretakerCore.run
|
|
12
|
+
rescue StandardError => e
|
|
13
|
+
puts e.message
|
|
14
|
+
exit
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
puts JSON.pretty_generate(JSON.parse(results))
|
metadata
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: caretaker-core
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Tim Gurney aka Wolf
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2021-03-03 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '2'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '2'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: json
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '2'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '2'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rake
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 12.3.3
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 12.3.3
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rspec
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '3.0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '3.0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: json
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '2'
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '2'
|
|
83
|
+
description: caretaker-core
|
|
84
|
+
email:
|
|
85
|
+
- wolf@tgwolf.com
|
|
86
|
+
executables: []
|
|
87
|
+
extensions: []
|
|
88
|
+
extra_rdoc_files: []
|
|
89
|
+
files:
|
|
90
|
+
- ".github/CODEOWNERS"
|
|
91
|
+
- ".github/CODE_OF_CONDUCT.md"
|
|
92
|
+
- ".github/CONTRIBUTING.md"
|
|
93
|
+
- ".github/FUNDING.yml"
|
|
94
|
+
- ".github/ISSUE_TEMPLATE/ask_question.md"
|
|
95
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
|
96
|
+
- ".github/ISSUE_TEMPLATE/config.yml"
|
|
97
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
|
98
|
+
- ".github/PULL_REQUEST_TEMPLATE.md"
|
|
99
|
+
- ".github/SECURITY.md"
|
|
100
|
+
- ".github/SUPPORT.md"
|
|
101
|
+
- ".gitignore"
|
|
102
|
+
- ".reek.yml"
|
|
103
|
+
- ".rspec"
|
|
104
|
+
- ".rubocop.yml"
|
|
105
|
+
- ".travis.yml"
|
|
106
|
+
- CHANGELOG.md
|
|
107
|
+
- Gemfile
|
|
108
|
+
- LICENSE.md
|
|
109
|
+
- README.md
|
|
110
|
+
- Rakefile
|
|
111
|
+
- VERSION.txt
|
|
112
|
+
- bin/console
|
|
113
|
+
- bin/setup
|
|
114
|
+
- caretaker-core.gemspec
|
|
115
|
+
- lib/caretaker-core.rb
|
|
116
|
+
- lib/caretaker-core/config.rb
|
|
117
|
+
- lib/caretaker-core/core.rb
|
|
118
|
+
- lib/caretaker-core/git.rb
|
|
119
|
+
- lib/caretaker-core/process.rb
|
|
120
|
+
- lib/caretaker-core/tags.rb
|
|
121
|
+
- lib/caretaker-core/utils.rb
|
|
122
|
+
- lib/caretaker-core/version.rb
|
|
123
|
+
- stale.yml
|
|
124
|
+
- testing/get-raw.rb
|
|
125
|
+
homepage: https://github.com/DevelopersToolbox/caretaker-core
|
|
126
|
+
licenses:
|
|
127
|
+
- MIT
|
|
128
|
+
metadata:
|
|
129
|
+
homepage_uri: https://github.com/DevelopersToolbox/caretaker-core
|
|
130
|
+
source_code_uri: https://github.com/DevelopersToolbox/caretaker-core
|
|
131
|
+
changelog_uri: https://github.com/DevelopersToolbox/caretaker-core/blob/master/CHANGELOG.md
|
|
132
|
+
post_install_message:
|
|
133
|
+
rdoc_options: []
|
|
134
|
+
require_paths:
|
|
135
|
+
- lib
|
|
136
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
137
|
+
requirements:
|
|
138
|
+
- - ">="
|
|
139
|
+
- !ruby/object:Gem::Version
|
|
140
|
+
version: 2.5.0
|
|
141
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
|
+
requirements:
|
|
143
|
+
- - ">="
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: '0'
|
|
146
|
+
requirements: []
|
|
147
|
+
rubygems_version: 3.1.4
|
|
148
|
+
signing_key:
|
|
149
|
+
specification_version: 4
|
|
150
|
+
summary: caretaker-core
|
|
151
|
+
test_files: []
|