way_of_working 2.0.1 → 2.2.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 +4 -4
- data/CHANGELOG.md +41 -1
- data/CLAUDE.md +48 -0
- data/CODE_OF_CONDUCT.md +55 -104
- data/CONTRIBUTING.md +62 -0
- data/README.md +240 -23
- data/exe/way_of_working +6 -1
- data/lib/way_of_working/audit/github/auditor.rb +47 -0
- data/lib/way_of_working/audit/github/generators/exec.rb +214 -0
- data/lib/way_of_working/audit/github/rules/base.rb +116 -0
- data/lib/way_of_working/audit/github/rules/registry.rb +44 -0
- data/lib/way_of_working/audit/github/rules/unknown.rb +19 -0
- data/lib/way_of_working/audit/github.rb +25 -0
- data/lib/way_of_working/changelog/keepachangelog/generators/init.rb +118 -0
- data/lib/way_of_working/changelog/keepachangelog/github_audit_rule.rb +32 -0
- data/lib/way_of_working/changelog/keepachangelog/templates/docs/way_of_working/changelog.md +73 -0
- data/lib/way_of_working/changelog/keepachangelog.rb +31 -0
- data/lib/way_of_working/cli.rb +13 -0
- data/lib/way_of_working/code_of_conduct/contributor_covenant/generators/init.rb +69 -0
- data/lib/way_of_working/code_of_conduct/contributor_covenant/github_audit_rule.rb +33 -0
- data/lib/way_of_working/code_of_conduct/contributor_covenant/templates/CODE_OF_CONDUCT.md.tt +83 -0
- data/lib/way_of_working/code_of_conduct/contributor_covenant/templates/docs/way_of_working/code-of-conduct.md +79 -0
- data/lib/way_of_working/code_of_conduct/contributor_covenant.rb +32 -0
- data/lib/way_of_working/completion.rb +60 -0
- data/lib/way_of_working/config.rb +45 -0
- data/lib/way_of_working/decision_record/madr/generators/init.rb +41 -0
- data/lib/way_of_working/decision_record/madr/generators/new.rb +69 -0
- data/lib/way_of_working/decision_record/madr/github_audit_rule.rb +37 -0
- data/lib/way_of_working/decision_record/madr/templates/.github/ISSUE_TEMPLATE/decision-record.md +26 -0
- data/lib/way_of_working/decision_record/madr/templates/docs/decisions/0000-use-markdown-any-decision-records.md +30 -0
- data/lib/way_of_working/decision_record/madr/templates/docs/decisions/README.md +7 -0
- data/lib/way_of_working/decision_record/madr/templates/docs/decisions/adr-template.md.tt +82 -0
- data/lib/way_of_working/decision_record/madr/templates/docs/decisions/index.md +48 -0
- data/lib/way_of_working/decision_record/madr/templates/docs/way_of_working/decision-records.md +195 -0
- data/lib/way_of_working/decision_record/madr.rb +49 -0
- data/lib/way_of_working/git/repo_reader.rb +2 -2
- data/lib/way_of_working/inclusive_language/alex/generators/exec.rb +51 -0
- data/lib/way_of_working/inclusive_language/alex/generators/init.rb +59 -0
- data/lib/way_of_working/inclusive_language/alex/github_audit_rule.rb +42 -0
- data/lib/way_of_working/inclusive_language/alex/templates/.alexignore +2 -0
- data/lib/way_of_working/inclusive_language/alex/templates/.alexrc +3 -0
- data/lib/way_of_working/inclusive_language/alex/templates/.github/workflows/inclusive-language.yml +16 -0
- data/lib/way_of_working/inclusive_language/alex/templates/docs/way_of_working/inclusive-language.md +28 -0
- data/lib/way_of_working/inclusive_language/alex.rb +46 -0
- data/lib/way_of_working/pull_request_template/hdi/generators/init.rb +26 -0
- data/lib/way_of_working/pull_request_template/hdi/github_audit_rule.rb +32 -0
- data/lib/way_of_working/pull_request_template/hdi/templates/.github/pull_request_template.md +51 -0
- data/lib/way_of_working/pull_request_template/hdi/templates/docs/way_of_working/pull-request-template-and-guidelines.md +50 -0
- data/lib/way_of_working/pull_request_template/hdi.rb +31 -0
- data/lib/way_of_working/readme_badge/generators/init.rb +11 -1
- data/lib/way_of_working/readme_badge/paths.rb +5 -2
- data/lib/way_of_working/readme_badge.rb +2 -6
- data/lib/way_of_working/sub_commands/base.rb +12 -0
- data/lib/way_of_working/sub_commands/config.rb +25 -0
- data/lib/way_of_working/sub_commands/init.rb +1 -1
- data/lib/way_of_working/version.rb +1 -1
- data/lib/way_of_working/versioning/semver/generators/init.rb +20 -0
- data/lib/way_of_working/versioning/semver/github_audit_rule.rb +38 -0
- data/lib/way_of_working/versioning/semver/templates/docs/way_of_working/versioning.md +71 -0
- data/lib/way_of_working/versioning/semver.rb +31 -0
- data/lib/way_of_working.rb +22 -0
- data/way_of_working.gemspec +5 -1
- metadata +108 -9
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# ponytail: only what Base itself needs. Every command loads this via readme_badge, so
|
|
4
|
+
# Octokit and the rest of ActiveSupport wait for the auditor (auditor.rb).
|
|
5
|
+
require 'active_support'
|
|
6
|
+
require 'active_support/core_ext/string/inflections'
|
|
7
|
+
require 'base64'
|
|
8
|
+
|
|
9
|
+
module WayOfWorking
|
|
10
|
+
module Audit
|
|
11
|
+
module Github
|
|
12
|
+
module Rules
|
|
13
|
+
# This is the base class for GitHub audit rules
|
|
14
|
+
class Base
|
|
15
|
+
attr_accessor :errors, :name, :rulesets, :warnings
|
|
16
|
+
attr_reader :fix
|
|
17
|
+
|
|
18
|
+
class << self
|
|
19
|
+
# Stores and return the source root for this class
|
|
20
|
+
def source_root(path = nil)
|
|
21
|
+
@source_root = path if path
|
|
22
|
+
@source_root ||= nil
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def initialize(client, name, repo, rulesets, fix = false)
|
|
27
|
+
@client = client
|
|
28
|
+
@name = name
|
|
29
|
+
@repo = repo
|
|
30
|
+
@repo_name = repo.full_name
|
|
31
|
+
@rulesets = rulesets
|
|
32
|
+
@fix = fix
|
|
33
|
+
@errors = []
|
|
34
|
+
@warnings = []
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def status
|
|
38
|
+
@status ||= begin
|
|
39
|
+
result = validate
|
|
40
|
+
|
|
41
|
+
if result == :not_applicable
|
|
42
|
+
result
|
|
43
|
+
else
|
|
44
|
+
@errors.empty? ? :passed : :failed
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Renaming to a predicate would break the plugin rule API (MAJOR version bump)
|
|
50
|
+
def validate # rubocop:disable Naming/PredicateMethod
|
|
51
|
+
$stdout.puts "Rule#valid? has been deprecated, use \"validate\" in #{self.class.name}"
|
|
52
|
+
valid?
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def self.tags
|
|
56
|
+
[:way_of_working]
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# The ID `audit_github --rule` accepts. Defaults to the feature path, e.g.
|
|
60
|
+
# "versioning/semver". Plugins may override it to give their rules shorter IDs.
|
|
61
|
+
# Part of the plugin API: changing a rule's ID is a breaking change.
|
|
62
|
+
def self.rule_id
|
|
63
|
+
return unless name
|
|
64
|
+
|
|
65
|
+
name.delete_prefix('WayOfWorking::').delete_suffix('::GithubAuditRule').underscore
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def tags
|
|
69
|
+
self.class.tags
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
private
|
|
73
|
+
|
|
74
|
+
def repo_file_contents(path)
|
|
75
|
+
response = @client.contents(@repo_name, path: path)
|
|
76
|
+
Base64.decode64(response.content).force_encoding('UTF-8')
|
|
77
|
+
rescue Octokit::NotFound
|
|
78
|
+
nil
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def repo_file_contains_source_file?(path)
|
|
82
|
+
repo_file_contains?(path, File.read(self.class.source_root.join(path)))
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def repo_file_contains?(path, text)
|
|
86
|
+
remote_content = repo_file_contents(path)
|
|
87
|
+
return false if remote_content.nil?
|
|
88
|
+
|
|
89
|
+
remote_content.include?(text)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# This method returns the content of the README file
|
|
93
|
+
def readme_content
|
|
94
|
+
@readme_content ||=
|
|
95
|
+
begin
|
|
96
|
+
response = @client.readme(@repo_name)
|
|
97
|
+
|
|
98
|
+
Base64.decode64(response.content).force_encoding('UTF-8')
|
|
99
|
+
rescue Octokit::NotFound
|
|
100
|
+
''
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# This convenience method returns the branch rules for this repo
|
|
105
|
+
def branch_rules(branch)
|
|
106
|
+
@client.get("repos/#{@repo.full_name}/rules/branches/#{branch}")
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Required after Base is defined: registry -> unknown -> Base would otherwise be
|
|
115
|
+
# a circular require when a rule file loads base first.
|
|
116
|
+
require_relative 'registry'
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'unknown'
|
|
4
|
+
|
|
5
|
+
module WayOfWorking
|
|
6
|
+
module Audit
|
|
7
|
+
module Github
|
|
8
|
+
module Rules
|
|
9
|
+
# This provides the GitHub audit rule factory
|
|
10
|
+
module Registry
|
|
11
|
+
class << self
|
|
12
|
+
attr_accessor :rules
|
|
13
|
+
|
|
14
|
+
def register(klass, rule_name)
|
|
15
|
+
@rules ||= {}
|
|
16
|
+
id = id_for(klass, rule_name)
|
|
17
|
+
clash = @rules.find { |name, other| name != rule_name && id_for(other, name) == id }
|
|
18
|
+
raise ArgumentError, "Audit rule ID #{id.inspect} is already used by #{clash.last}" if clash
|
|
19
|
+
|
|
20
|
+
@rules[rule_name] = klass
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# The rule's `rule_id`, or its registered name for anonymous classes (e.g. in tests)
|
|
24
|
+
def id_for(klass, rule_name)
|
|
25
|
+
klass.rule_id || rule_name.to_s
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def unregister(*rule_names)
|
|
29
|
+
rule_names.each do |rule_name|
|
|
30
|
+
@rules.delete(rule_name)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def rule(rule_name, client, repo)
|
|
35
|
+
klass = Registry.rules.fetch(rule_name, Unknown)
|
|
36
|
+
|
|
37
|
+
klass.new(client, repo)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'base'
|
|
4
|
+
|
|
5
|
+
module WayOfWorking
|
|
6
|
+
module Audit
|
|
7
|
+
module Github
|
|
8
|
+
module Rules
|
|
9
|
+
# This is a stub handler for rules that aren't in the registry.
|
|
10
|
+
class Unknown < Base
|
|
11
|
+
def initialize(client, name, repo, rulesets, fix = false)
|
|
12
|
+
super
|
|
13
|
+
raise 'Error: Unknown client'
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'github/generators/exec'
|
|
4
|
+
|
|
5
|
+
module WayOfWorking
|
|
6
|
+
module Audit
|
|
7
|
+
module Github
|
|
8
|
+
class Error < StandardError; end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
module SubCommands
|
|
13
|
+
# This reopens the "way_of_working exec" sub command
|
|
14
|
+
class Exec
|
|
15
|
+
register(Audit::Github::Generators::Exec, 'audit_github', 'audit_github',
|
|
16
|
+
<<~LONGDESC)
|
|
17
|
+
Description:
|
|
18
|
+
This runs the GitHub audit
|
|
19
|
+
|
|
20
|
+
Example:
|
|
21
|
+
way_of_working exec audit_github
|
|
22
|
+
LONGDESC
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'way_of_working/git/repo_reader'
|
|
4
|
+
|
|
5
|
+
module WayOfWorking
|
|
6
|
+
module Changelog
|
|
7
|
+
module Keepachangelog
|
|
8
|
+
module Generators
|
|
9
|
+
# This class generates the CHANGELOG.md file, generating sections based on
|
|
10
|
+
# git tags and commit messages (where possible).
|
|
11
|
+
class Init < Thor::Group
|
|
12
|
+
include Thor::Actions
|
|
13
|
+
|
|
14
|
+
source_root WayOfWorking.root.join('lib', 'way_of_working', 'changelog', 'keepachangelog', 'templates')
|
|
15
|
+
|
|
16
|
+
HEADER_TEXT = <<~TEXT
|
|
17
|
+
# Changelog
|
|
18
|
+
|
|
19
|
+
All notable changes to this project will be documented in this file.
|
|
20
|
+
|
|
21
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
22
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
23
|
+
|
|
24
|
+
TEXT
|
|
25
|
+
|
|
26
|
+
def add_changelog_to_project
|
|
27
|
+
create_file 'CHANGELOG.md' do
|
|
28
|
+
HEADER_TEXT + releases + footer
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def copy_way_of_working_documentation
|
|
33
|
+
copy_file 'docs/way_of_working/changelog.md'
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
private
|
|
37
|
+
|
|
38
|
+
def releases
|
|
39
|
+
text = "## [Unreleased]\n\n"
|
|
40
|
+
text += added_change_text(:minor)
|
|
41
|
+
text += deprecated_removed_fixed_security_text(:minor)
|
|
42
|
+
|
|
43
|
+
summary_tags.each do |summary_tag|
|
|
44
|
+
text += "## [#{summary_tag.version}] - " \
|
|
45
|
+
"#{summary_tag.commit_date.strftime('%Y-%m-%d')}\n\n"
|
|
46
|
+
|
|
47
|
+
text += added_change_text(summary_tag.change_type)
|
|
48
|
+
text += deprecated_removed_fixed_security_text(summary_tag.change_type)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
text
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def added_change_text(tag_change_type)
|
|
55
|
+
return '' if tag_change_type == :patch
|
|
56
|
+
|
|
57
|
+
change_text('Added', 'Detail new feature(s) here', true) +
|
|
58
|
+
change_text('Change', 'Detail change(s) in existing functionality here',
|
|
59
|
+
tag_change_type == :major)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def deprecated_removed_fixed_security_text(tag_change_type)
|
|
63
|
+
change_text('Deprecated', 'Detail soon-to-be removed features here') +
|
|
64
|
+
change_text('Removed', 'Detail removed features here', tag_change_type == :major) +
|
|
65
|
+
change_text('Fixed', 'Detail any bug fixes here', true) +
|
|
66
|
+
change_text('Security', 'Detail fixes to vulnerabilities here')
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# This method adds all of the reference style markdown links
|
|
70
|
+
def footer
|
|
71
|
+
return '' if summary_tags.empty?
|
|
72
|
+
|
|
73
|
+
previous_tag = nil
|
|
74
|
+
footer_text = ''
|
|
75
|
+
summary_tags.each do |summary_tag|
|
|
76
|
+
footer_text += if previous_tag
|
|
77
|
+
release_link(summary_tag.name, previous_tag.name, previous_tag.version)
|
|
78
|
+
else
|
|
79
|
+
release_link(summary_tag.name, 'HEAD', 'Unreleased')
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
previous_tag = summary_tag
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
footer_text += "[#{previous_tag.version}]: #{url}/releases/tag/#{previous_tag.name}\n"
|
|
86
|
+
|
|
87
|
+
footer_text
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def release_link(start_tag, end_tag, version)
|
|
91
|
+
"[#{version}]: #{url}/compare/#{start_tag}...#{end_tag}\n"
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def change_text(type, description, likely = false)
|
|
95
|
+
text = "### #{type}\n\n- TODO: #{description}" # DevSkim: ignore DS176209 -- placeholder, not a real todo
|
|
96
|
+
text += ' (if any)' unless likely
|
|
97
|
+
text += "\n\n"
|
|
98
|
+
text
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def repo_reader
|
|
102
|
+
@repo_reader ||= ::WayOfWorking::Git::RepoReader.new(::Git.open('.'))
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def summary_tags
|
|
106
|
+
@summary_tags ||= repo_reader.summary_tags.reverse
|
|
107
|
+
rescue ArgumentError
|
|
108
|
+
[]
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def url
|
|
112
|
+
@url ||= repo_reader.likely_upstream_remote_url
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'way_of_working/audit/github/rules/base'
|
|
4
|
+
|
|
5
|
+
module WayOfWorking
|
|
6
|
+
module Changelog
|
|
7
|
+
# The namespace for this plugin
|
|
8
|
+
module Keepachangelog
|
|
9
|
+
# This rule checks for a Keep a Changelog CHANGELOG.md.
|
|
10
|
+
class GithubAuditRule < ::WayOfWorking::Audit::Github::Rules::Base
|
|
11
|
+
def validate
|
|
12
|
+
@errors << 'No Keep a Changelog CHANGELOG.md found' unless keep_a_changelog_found?
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def keep_a_changelog_found?
|
|
18
|
+
response = @client.contents(@repo_name, path: 'CHANGELOG.md')
|
|
19
|
+
decoded_content = Base64.decode64(response.content)
|
|
20
|
+
|
|
21
|
+
decoded_content.include?('Keep a Changelog')
|
|
22
|
+
rescue Octokit::NotFound
|
|
23
|
+
false
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
::WayOfWorking::Audit::Github::Rules::Registry.register(
|
|
28
|
+
GithubAuditRule, 'Keep a Changelog CHANGELOG.md'
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: page
|
|
3
|
+
status: REQUIRED
|
|
4
|
+
enforcement: manual
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Changelog
|
|
8
|
+
|
|
9
|
+
![Keep a Changelog v1.1.0 badge][changelog-badge]
|
|
10
|
+
|
|
11
|
+
## Purpose
|
|
12
|
+
|
|
13
|
+
Maintain a human-readable project history that documents all notable changes between versions in plain English.
|
|
14
|
+
|
|
15
|
+
## Scope
|
|
16
|
+
|
|
17
|
+
All projects must maintain a changelog using [Keep a Changelog v1.1.0][keep-a-changelog] format.
|
|
18
|
+
|
|
19
|
+
## Requirements
|
|
20
|
+
|
|
21
|
+
- Human-written plain English summaries (not commit log dumps)
|
|
22
|
+
- Entry for every version
|
|
23
|
+
- Latest version listed first
|
|
24
|
+
- Release date displayed for each version
|
|
25
|
+
- Changes grouped by type: `Added`, `Changed`, `Deprecated`, `Removed`, `Fixed`, `Security`
|
|
26
|
+
- Versions and sections must be linkable
|
|
27
|
+
- Follow [Semantic Versioning][semver]
|
|
28
|
+
- Update changelog within Pull Requests, not at release time
|
|
29
|
+
|
|
30
|
+
## Setup
|
|
31
|
+
|
|
32
|
+
Initialise a changelog for your project:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
way_of_working init changelog
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
For git-based projects with existing releases, this scaffolds sections based on semantic version tags.
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
1. Update the `Unreleased` section in each Pull Request
|
|
43
|
+
2. Group changes under appropriate headings
|
|
44
|
+
3. Write clear, user-focused descriptions
|
|
45
|
+
4. Move `Unreleased` changes to a version section at release
|
|
46
|
+
5. Use scaffolded commit links to document historical changes
|
|
47
|
+
|
|
48
|
+
## Enforcement
|
|
49
|
+
|
|
50
|
+
- Changelog updates required in Pull Request reviews
|
|
51
|
+
- No automatic commit log dumps permitted
|
|
52
|
+
|
|
53
|
+
## Examples
|
|
54
|
+
|
|
55
|
+
```markdown
|
|
56
|
+
## [1.2.0] - 2025-10-22
|
|
57
|
+
|
|
58
|
+
### Added
|
|
59
|
+
- User authentication via OAuth2
|
|
60
|
+
- Export data to CSV functionality
|
|
61
|
+
|
|
62
|
+
### Fixed
|
|
63
|
+
- Memory leak in background job processor
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Resources
|
|
67
|
+
|
|
68
|
+
- [Keep a Changelog][keep-a-changelog]
|
|
69
|
+
- [Semantic Versioning][semver]
|
|
70
|
+
|
|
71
|
+
[changelog-badge]: https://img.shields.io/badge/changelog-Keep%20a%20Changelog%20v1.1.0-%23E05735
|
|
72
|
+
[keep-a-changelog]: https://keepachangelog.com/en/1.1.0/
|
|
73
|
+
[semver]: https://semver.org
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'keepachangelog/generators/init'
|
|
4
|
+
|
|
5
|
+
# Register the GitHub audit rule (the registry is bundled with this gem)
|
|
6
|
+
require_relative 'keepachangelog/github_audit_rule'
|
|
7
|
+
|
|
8
|
+
module WayOfWorking
|
|
9
|
+
module Changelog
|
|
10
|
+
module Keepachangelog
|
|
11
|
+
class Error < StandardError; end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
module SubCommands
|
|
16
|
+
# This reopens the "way_of_working init" sub command
|
|
17
|
+
class Init
|
|
18
|
+
register(Changelog::Keepachangelog::Generators::Init, 'changelog', 'changelog',
|
|
19
|
+
<<~LONGDESC)
|
|
20
|
+
Description:
|
|
21
|
+
This adds the Keep a Changelog v1.1 changelog to the project
|
|
22
|
+
|
|
23
|
+
Example:
|
|
24
|
+
way_of_working init changelog
|
|
25
|
+
|
|
26
|
+
This will create:
|
|
27
|
+
CHANGELOG.md
|
|
28
|
+
LONGDESC
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
data/lib/way_of_working/cli.rb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require 'thor'
|
|
4
4
|
|
|
5
|
+
require_relative 'sub_commands/config'
|
|
5
6
|
require_relative 'sub_commands/exec'
|
|
6
7
|
require_relative 'sub_commands/init'
|
|
7
8
|
require_relative 'sub_commands/new'
|
|
@@ -9,6 +10,18 @@ require_relative 'sub_commands/new'
|
|
|
9
10
|
module WayOfWorking
|
|
10
11
|
# This class defines the top level interface
|
|
11
12
|
class Cli < Thor
|
|
13
|
+
def self.exit_on_failure?
|
|
14
|
+
true
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
desc 'completion SHELL', 'Prints the bash or zsh completion script, e.g. eval "$(way_of_working completion zsh)"'
|
|
18
|
+
def completion(shell)
|
|
19
|
+
puts Completion.script(shell)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
desc 'config [ACTION]', 'Reads or writes values in the way_of_working config file'
|
|
23
|
+
subcommand 'config', ::WayOfWorking::SubCommands::Config
|
|
24
|
+
|
|
12
25
|
desc 'exec [COMPONENT]', 'Executes (runs) the specific component'
|
|
13
26
|
subcommand 'exec', ::WayOfWorking::SubCommands::Exec
|
|
14
27
|
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'way_of_working/paths'
|
|
4
|
+
require 'way_of_working/config'
|
|
5
|
+
|
|
6
|
+
module WayOfWorking
|
|
7
|
+
module CodeOfConduct
|
|
8
|
+
module ContributorCovenant
|
|
9
|
+
module Generators
|
|
10
|
+
# This class fetches the CODE_OF_CONDUCT.md and inserts the contact method
|
|
11
|
+
class Init < Thor::Group
|
|
12
|
+
include Thor::Actions
|
|
13
|
+
|
|
14
|
+
CONTACT_METHOD_CONFIG_KEY = 'code_of_conduct.contact_method'
|
|
15
|
+
|
|
16
|
+
source_root WayOfWorking.root.join('lib', 'way_of_working', 'code_of_conduct', 'contributor_covenant',
|
|
17
|
+
'templates')
|
|
18
|
+
|
|
19
|
+
class_option :contact_method
|
|
20
|
+
|
|
21
|
+
# Use this method to update the cached template when required
|
|
22
|
+
# def download_and_save_code_of_conduct_template
|
|
23
|
+
# code_of_conduct_file = 'lib/way_of_working/templates/CODE_OF_CONDUCT.md.tt'
|
|
24
|
+
|
|
25
|
+
# get 'https://www.contributor-covenant.org/version/3/0/code_of_conduct/code_of_conduct.md',
|
|
26
|
+
# code_of_conduct_file
|
|
27
|
+
# gsub_file code_of_conduct_file, '[INSERT CONTACT METHOD]',
|
|
28
|
+
# "<<%= contact_method %>>"
|
|
29
|
+
# end
|
|
30
|
+
|
|
31
|
+
def add_code_of_conduct_to_project
|
|
32
|
+
contact_method
|
|
33
|
+
offer_to_remember_contact_method
|
|
34
|
+
template 'CODE_OF_CONDUCT.md'
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def add_way_of_working_documentation
|
|
38
|
+
copy_file 'docs/way_of_working/code-of-conduct.md'
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
private
|
|
42
|
+
|
|
43
|
+
# The contact method comes from --contact-method, falling back to the value
|
|
44
|
+
# stored under CONTACT_METHOD_CONFIG_KEY in way_of_working's config file (see
|
|
45
|
+
# `way_of_working config`), read fresh on every call rather than cached in the
|
|
46
|
+
# class_option default so config changes are picked up within a single process
|
|
47
|
+
# (e.g. across tests, or repeated invocations in bin/console).
|
|
48
|
+
def contact_method
|
|
49
|
+
@contact_method ||= options['contact_method'] || ::WayOfWorking::Config.get(CONTACT_METHOD_CONFIG_KEY)
|
|
50
|
+
@contact_method ||= raise(Thor::Error, 'No contact method provided. Pass --contact-method, or set a ' \
|
|
51
|
+
'default with `way_of_working config set ' \
|
|
52
|
+
"#{CONTACT_METHOD_CONFIG_KEY} you@example.com`")
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def offer_to_remember_contact_method
|
|
56
|
+
return unless options['contact_method']
|
|
57
|
+
return if options['contact_method'] == ::WayOfWorking::Config.get(CONTACT_METHOD_CONFIG_KEY)
|
|
58
|
+
|
|
59
|
+
question = "Remember '#{options['contact_method']}' as your code of conduct contact method " \
|
|
60
|
+
'for next time? (y/n)'
|
|
61
|
+
return unless yes?(question)
|
|
62
|
+
|
|
63
|
+
::WayOfWorking::Config.set(CONTACT_METHOD_CONFIG_KEY, options['contact_method'])
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'way_of_working/audit/github/rules/base'
|
|
4
|
+
|
|
5
|
+
module WayOfWorking
|
|
6
|
+
module CodeOfConduct
|
|
7
|
+
# The namespace for this plugin
|
|
8
|
+
module ContributorCovenant
|
|
9
|
+
# This rule checks for a Contributor Covenant code of conduct.
|
|
10
|
+
class GithubAuditRule < ::WayOfWorking::Audit::Github::Rules::Base
|
|
11
|
+
def validate
|
|
12
|
+
@errors << 'No Contributor Covenant code of conduct found' unless code_of_conduct?
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def code_of_conduct?
|
|
18
|
+
response = @client.contents(@repo_name, path: 'CODE_OF_CONDUCT.md')
|
|
19
|
+
decoded_content = Base64.decode64(response.content)
|
|
20
|
+
|
|
21
|
+
# Only v3 is accepted; previous versions (e.g. v2.1, headed "Contributor Covenant Code of Conduct") fail
|
|
22
|
+
decoded_content.match?(/^# Contributor Covenant 3(\.\d+)* Code of Conduct$/)
|
|
23
|
+
rescue Octokit::NotFound
|
|
24
|
+
false
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
::WayOfWorking::Audit::Github::Rules::Registry.register(
|
|
29
|
+
GithubAuditRule, 'Contributor Covenant Code Of Conduct'
|
|
30
|
+
)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Contributor Covenant 3.0 Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We pledge to make our community welcoming, safe, and equitable for all.
|
|
6
|
+
|
|
7
|
+
We are committed to fostering an environment that respects and promotes the dignity, rights, and contributions of all individuals, regardless of characteristics including race, ethnicity, caste, color, age, physical characteristics, neurodiversity, disability, sex or gender, gender identity or expression, sexual orientation, language, philosophy or religion, national or social origin, socio-economic position, level of education, or other status. The same privileges of participation are extended to everyone who participates in good faith and in accordance with this Covenant.
|
|
8
|
+
|
|
9
|
+
## Encouraged Behaviors
|
|
10
|
+
|
|
11
|
+
While acknowledging differences in social norms, we all strive to meet our community's expectations for positive behavior. We also understand that our words and actions may be interpreted differently than we intend based on culture, background, or native language.
|
|
12
|
+
|
|
13
|
+
With these considerations in mind, we agree to behave mindfully toward each other and act in ways that center our shared values, including:
|
|
14
|
+
|
|
15
|
+
1. Respecting the **purpose of our community**, our activities, and our ways of gathering.
|
|
16
|
+
2. Engaging **kindly and honestly** with others.
|
|
17
|
+
3. Respecting **different viewpoints** and experiences.
|
|
18
|
+
4. **Taking responsibility** for our actions and contributions.
|
|
19
|
+
5. Gracefully giving and accepting **constructive feedback**.
|
|
20
|
+
6. Committing to **repairing harm** when it occurs.
|
|
21
|
+
7. Behaving in other ways that promote and sustain the **well-being of our community**.
|
|
22
|
+
|
|
23
|
+
## Restricted Behaviors
|
|
24
|
+
|
|
25
|
+
We agree to restrict the following behaviors in our community. Instances, threats, and promotion of these behaviors are violations of this Code of Conduct.
|
|
26
|
+
|
|
27
|
+
1. **Harassment.** Violating explicitly expressed boundaries or engaging in unnecessary personal attention after any clear request to stop.
|
|
28
|
+
2. **Character attacks.** Making insulting, demeaning, or pejorative comments directed at a community member or group of people.
|
|
29
|
+
3. **Stereotyping or discrimination.** Characterizing anyone’s personality or behavior on the basis of immutable identities or traits.
|
|
30
|
+
4. **Sexualization.** Behaving in a way that would generally be considered inappropriately intimate in the context or purpose of the community.
|
|
31
|
+
5. **Violating confidentiality**. Sharing or acting on someone's personal or private information without their permission.
|
|
32
|
+
6. **Endangerment.** Causing, encouraging, or threatening violence or other harm toward any person or group.
|
|
33
|
+
7. Behaving in other ways that **threaten the well-being** of our community.
|
|
34
|
+
|
|
35
|
+
### Other Restrictions
|
|
36
|
+
|
|
37
|
+
1. **Misleading identity.** Impersonating someone else for any reason, or pretending to be someone else to evade enforcement actions.
|
|
38
|
+
2. **Failing to credit sources.** Not properly crediting the sources of content you contribute.
|
|
39
|
+
3. **Promotional materials**. Sharing marketing or other commercial content in a way that is outside the norms of the community.
|
|
40
|
+
4. **Irresponsible communication.** Failing to responsibly present content which includes, links or describes any other restricted behaviors.
|
|
41
|
+
|
|
42
|
+
## Reporting an Issue
|
|
43
|
+
|
|
44
|
+
Tensions can occur between community members even when they are trying their best to collaborate. Not every conflict represents a code of conduct violation, and this Code of Conduct reinforces encouraged behaviors and norms that can help avoid conflicts and minimize harm.
|
|
45
|
+
|
|
46
|
+
When an incident does occur, it is important to report it promptly. To report a possible violation, contact the Community Moderators at <<%= contact_method %>>.
|
|
47
|
+
|
|
48
|
+
Community Moderators take reports of violations seriously and will make every effort to respond in a timely manner. They will investigate all reports of code of conduct violations, reviewing messages, logs, and recordings, or interviewing witnesses and other participants. Community Moderators will keep investigation and enforcement actions as transparent as possible while prioritizing safety and confidentiality. In order to honor these values, enforcement actions are carried out in private with the involved parties, but communicating to the whole community may be part of a mutually agreed upon resolution.
|
|
49
|
+
|
|
50
|
+
## Addressing and Repairing Harm
|
|
51
|
+
|
|
52
|
+
If an investigation by the Community Moderators finds that this Code of Conduct has been violated, the following enforcement ladder may be used to determine how best to repair harm, based on the incident's impact on the individuals involved and the community as a whole. Depending on the severity of a violation, lower rungs on the ladder may be skipped.
|
|
53
|
+
|
|
54
|
+
1) Warning
|
|
55
|
+
1) Event: A violation involving a single incident or series of incidents.
|
|
56
|
+
2) Consequence: A private, written warning from the Community Moderators.
|
|
57
|
+
3) Repair: Examples of repair include a private written apology, acknowledgement of responsibility, and seeking clarification on expectations.
|
|
58
|
+
2) Temporarily Limited Activities
|
|
59
|
+
1) Event: A repeated incidence of a violation that previously resulted in a warning, or the first incidence of a more serious violation.
|
|
60
|
+
2) Consequence: A private, written warning with a time-limited cooldown period designed to underscore the seriousness of the situation and give the community members involved time to process the incident. The cooldown period may be limited to particular communication channels or interactions with particular community members.
|
|
61
|
+
3) Repair: Examples of repair may include making an apology, using the cooldown period to reflect on actions and impact, and being thoughtful about re-entering community spaces after the period is over.
|
|
62
|
+
3) Temporary Suspension
|
|
63
|
+
1) Event: A pattern of repeated violation which the Community Moderators have tried to address with warnings, or a single serious violation.
|
|
64
|
+
2) Consequence: A private written warning with conditions for return from suspension. In general, temporary suspensions give the person being suspended time to reflect upon their behavior and possible corrective actions.
|
|
65
|
+
3) Repair: Examples of repair include respecting the spirit of the suspension, meeting the specified conditions for return, and being thoughtful about how to reintegrate with the community when the suspension is lifted.
|
|
66
|
+
4) Permanent Ban
|
|
67
|
+
1) Event: A pattern of repeated code of conduct violations that other steps on the ladder have failed to resolve, or a violation so serious that the Community Moderators determine there is no way to keep the community safe with this person as a member.
|
|
68
|
+
2) Consequence: Access to all community spaces, tools, and communication channels is removed. In general, permanent bans should be rarely used, should have strong reasoning behind them, and should only be resorted to if working through other remedies has failed to change the behavior.
|
|
69
|
+
3) Repair: There is no possible repair in cases of this severity.
|
|
70
|
+
|
|
71
|
+
This enforcement ladder is intended as a guideline. It does not limit the ability of Community Managers to use their discretion and judgment, in keeping with the best interests of our community.
|
|
72
|
+
|
|
73
|
+
## Scope
|
|
74
|
+
|
|
75
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public or other spaces. Examples of representing our community include using an official email address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
76
|
+
|
|
77
|
+
## Attribution
|
|
78
|
+
|
|
79
|
+
This Code of Conduct is adapted from the Contributor Covenant, version 3.0, permanently available at [https://www.contributor-covenant.org/version/3/0/](https://www.contributor-covenant.org/version/3/0/).
|
|
80
|
+
|
|
81
|
+
Contributor Covenant is stewarded by the Organization for Ethical Source and licensed under CC BY-SA 4.0. To view a copy of this license, visit [https://creativecommons.org/licenses/by-sa/4.0/](https://creativecommons.org/licenses/by-sa/4.0/)
|
|
82
|
+
|
|
83
|
+
For answers to common questions about Contributor Covenant, see the FAQ at [https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq). Translations are provided at [https://www.contributor-covenant.org/translations](https://www.contributor-covenant.org/translations). Additional enforcement and community guideline resources can be found at [https://www.contributor-covenant.org/resources](https://www.contributor-covenant.org/resources). The enforcement ladder was inspired by the work of [Mozilla’s code of conduct team](https://github.com/mozilla/inclusion).
|