ossy 0.1.3 → 0.3.2
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 +12 -0
- data/lib/ossy.rb +1 -1
- data/lib/ossy/cli.rb +2 -2
- data/lib/ossy/cli/changelogs/generate.rb +12 -12
- data/lib/ossy/cli/changelogs/update.rb +9 -9
- data/lib/ossy/cli/commands.rb +29 -23
- data/lib/ossy/cli/configs/merge.rb +34 -12
- data/lib/ossy/cli/github/member.rb +7 -7
- data/lib/ossy/cli/github/membership.rb +9 -9
- data/lib/ossy/cli/github/tagger.rb +7 -7
- data/lib/ossy/cli/github/update_file.rb +6 -6
- data/lib/ossy/cli/github/workflow.rb +10 -10
- data/lib/ossy/cli/releases/generate.rb +64 -0
- data/lib/ossy/cli/templates/compile.rb +13 -13
- data/lib/ossy/container.rb +7 -7
- data/lib/ossy/github/client.rb +12 -14
- data/lib/ossy/github/workflow.rb +1 -1
- data/lib/ossy/import.rb +1 -1
- data/lib/ossy/release.rb +3 -3
- data/lib/ossy/struct.rb +1 -1
- data/lib/ossy/types.rb +3 -3
- data/lib/ossy/version.rb +1 -1
- metadata +28 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 692163075005596e24fcd369ab7a65bae9cf32fbaa9fd4ba7443059b398d7744
|
4
|
+
data.tar.gz: aa9d30379da6adcace2c88605dd781e40395fb04eca3d483402f1214edcc8281
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba6e94b22f3309d56f2df084ba0b27b4069d47aaa13b0789799d7b9b29b291dc64a974157ce90f74f0fbd2bbb9ae774acec296894ed0f885ce2dd0b810a2276c
|
7
|
+
data.tar.gz: 131df202b10b86c1d2d147ce73c44bb8a9bc6de334afde09bec4c13f9d342344b51964bea6357d00e2ec176fa4cb14e91f545f5e053270d4562b4366a19c02df
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## 0.2.0 2021-01-02
|
2
|
+
|
3
|
+
### Added
|
4
|
+
|
5
|
+
- `configs merge` now supports merging array of hashes (@solnic)
|
6
|
+
|
7
|
+
## 0.1.4 2020-01-23
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
|
11
|
+
- `github workflow` no longer crashes after switching to `faraday` (@solnic)
|
12
|
+
|
1
13
|
## 0.1.3 2020-01-23
|
2
14
|
|
3
15
|
### Changed
|
data/lib/ossy.rb
CHANGED
data/lib/ossy/cli.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
3
|
+
require "ossy/cli/commands/core"
|
4
|
+
require "ossy/import"
|
5
|
+
require "ossy/release"
|
6
6
|
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
7
|
+
require "yaml"
|
8
|
+
require "tilt"
|
9
|
+
require "ostruct"
|
10
10
|
|
11
11
|
module Ossy
|
12
12
|
module CLI
|
@@ -23,13 +23,13 @@ module Ossy
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
desc
|
26
|
+
desc "Generates a changelog markdown file from a yaml config"
|
27
27
|
|
28
|
-
argument :config_path, required: true, desc:
|
29
|
-
argument :output_path, required: true, desc:
|
30
|
-
argument :template_path, required: true, desc:
|
28
|
+
argument :config_path, required: true, desc: "The path to the changelog config"
|
29
|
+
argument :output_path, required: true, desc: "The path to the output md file"
|
30
|
+
argument :template_path, required: true, desc: "The path to the changelog ERB template"
|
31
31
|
|
32
|
-
option :data_path, required: false, desc:
|
32
|
+
option :data_path, required: false, desc: "Optional path to additional data yaml file"
|
33
33
|
|
34
34
|
def call(config_path:, output_path:, template_path:, data_path: nil)
|
35
35
|
puts "Generating #{output_path} from #{config_path} using #{template_path}"
|
@@ -40,7 +40,7 @@ module Ossy
|
|
40
40
|
context = Context.new(ctx_data)
|
41
41
|
|
42
42
|
if data_path
|
43
|
-
key = File.basename(data_path).gsub(
|
43
|
+
key = File.basename(data_path).gsub(".yml", "")
|
44
44
|
data = YAML.load_file(data_path)
|
45
45
|
|
46
46
|
context.update(key => OpenStruct.new(data))
|
@@ -1,19 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
3
|
+
require "ossy/cli/commands/core"
|
4
|
+
require "ossy/import"
|
5
|
+
require "ossy/release"
|
6
6
|
|
7
|
-
require
|
7
|
+
require "yaml"
|
8
8
|
|
9
9
|
module Ossy
|
10
10
|
module CLI
|
11
11
|
module Changelogs
|
12
12
|
class Update < Commands::Core
|
13
|
-
desc
|
13
|
+
desc "Adds a new entry to a changelog config"
|
14
14
|
|
15
|
-
argument :config_path, required: true, desc:
|
16
|
-
argument :message, required: true, desc:
|
15
|
+
argument :config_path, required: true, desc: "The path to the changelog config"
|
16
|
+
argument :message, required: true, desc: "Message text including the entry"
|
17
17
|
|
18
18
|
KEYS = %w[version summary date fixed added changed].freeze
|
19
19
|
|
@@ -21,8 +21,8 @@ module Ossy
|
|
21
21
|
attrs = YAML.load(message)
|
22
22
|
target = YAML.load_file(config_path)
|
23
23
|
|
24
|
-
version = attrs[
|
25
|
-
entry = target.detect { |e| e[
|
24
|
+
version = attrs["version"] || target[0]["version"]
|
25
|
+
entry = target.detect { |e| e["version"].eql?(version) } || {}
|
26
26
|
|
27
27
|
release = Release.new(attrs.merge(version: version))
|
28
28
|
|
data/lib/ossy/cli/commands.rb
CHANGED
@@ -1,44 +1,50 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "dry/cli/registry"
|
4
4
|
|
5
5
|
module Ossy
|
6
6
|
module CLI
|
7
7
|
module Commands
|
8
8
|
extend Dry::CLI::Registry
|
9
9
|
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require
|
14
|
-
require
|
10
|
+
require "ossy/cli/github/workflow"
|
11
|
+
require "ossy/cli/github/membership"
|
12
|
+
require "ossy/cli/github/tagger"
|
13
|
+
require "ossy/cli/github/member"
|
14
|
+
require "ossy/cli/github/update_file"
|
15
15
|
|
16
|
-
require
|
17
|
-
require
|
16
|
+
require "ossy/cli/changelogs/generate"
|
17
|
+
require "ossy/cli/changelogs/update"
|
18
18
|
|
19
|
-
require
|
19
|
+
require "ossy/cli/releases/generate"
|
20
20
|
|
21
|
-
require
|
21
|
+
require "ossy/cli/configs/merge"
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
github.register
|
27
|
-
github.register
|
28
|
-
github.register
|
23
|
+
require "ossy/cli/templates/compile"
|
24
|
+
|
25
|
+
register "github", aliases: %w[gh] do |github|
|
26
|
+
github.register "workflow", Github::Workflow, aliases: %w[w]
|
27
|
+
github.register "membership", Github::Membership, aliases: %w[m]
|
28
|
+
github.register "tagger", Github::Tagger, aliases: %w[t]
|
29
|
+
github.register "member", Github::Member, aliases: %w[om]
|
30
|
+
github.register "update_file", Github::UpdateFile, aliases: %w[uf]
|
31
|
+
end
|
32
|
+
|
33
|
+
register "templates", aliases: %w[t] do |templates|
|
34
|
+
templates.register "compile", Templates::Compile, aliases: %w[c]
|
29
35
|
end
|
30
36
|
|
31
|
-
register
|
32
|
-
|
37
|
+
register "changelogs", aliases: %w[ch] do |changelogs|
|
38
|
+
changelogs.register "generate", Changelogs::Generate, aliases: %w[g]
|
39
|
+
changelogs.register "update", Changelogs::Update, aliases: %w[u]
|
33
40
|
end
|
34
41
|
|
35
|
-
register
|
36
|
-
|
37
|
-
changelogs.register 'update', Changelogs::Update, aliases: %w[u]
|
42
|
+
register "releases", aliases: %w[r] do |releases|
|
43
|
+
releases.register "generate", Releases::Generate, aliases: %w[g]
|
38
44
|
end
|
39
45
|
|
40
|
-
register
|
41
|
-
configs.register
|
46
|
+
register "configs", aliases: %w[c] do |configs|
|
47
|
+
configs.register "merge", Configs::Merge, aliases: %w[m]
|
42
48
|
end
|
43
49
|
end
|
44
50
|
end
|
@@ -1,39 +1,61 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "ossy/cli/commands/core"
|
4
|
+
require "ossy/import"
|
5
5
|
|
6
|
-
require
|
6
|
+
require "yaml"
|
7
7
|
|
8
8
|
module Ossy
|
9
9
|
module CLI
|
10
10
|
module Configs
|
11
11
|
class Merge < Commands::Core
|
12
|
-
desc
|
12
|
+
desc "Merge two yaml config files into a new one"
|
13
13
|
|
14
|
-
argument :source_path, required: true, desc:
|
15
|
-
argument :target_path, required: true, desc:
|
16
|
-
argument :output_path, required: true, desc:
|
14
|
+
argument :source_path, required: true, desc: "The path to the source file"
|
15
|
+
argument :target_path, required: true, desc: "The path to the target file"
|
16
|
+
argument :output_path, required: true, desc: "The path to the output file"
|
17
17
|
|
18
|
-
|
18
|
+
option :identifiers, required: false, default: "",
|
19
|
+
desc: "Key identifier that should be used for merging arrays of hashes"
|
20
|
+
|
21
|
+
def call(source_path:, target_path:, output_path:, **opts)
|
19
22
|
puts "Merging #{source_path} + #{target_path} into #{output_path}"
|
20
23
|
|
24
|
+
identifiers = opts[:identifiers].split(",").map { |s| s.split(":") }.to_h
|
25
|
+
|
21
26
|
source = YAML.load_file(source_path)
|
22
27
|
target = YAML.load_file(target_path)
|
23
28
|
|
24
|
-
output = deep_merge(source, target)
|
29
|
+
output = deep_merge(source, target, identifiers)
|
25
30
|
|
26
31
|
File.write(output_path, YAML.dump(output))
|
27
32
|
end
|
28
33
|
|
29
34
|
private
|
30
35
|
|
31
|
-
def deep_merge(h1, h2, &block)
|
36
|
+
def deep_merge(h1, h2, identifiers, &block)
|
32
37
|
h1.merge(h2) do |key, val1, val2|
|
33
38
|
if val1.is_a?(Hash) && val2.is_a?(Hash)
|
34
|
-
deep_merge(val1, val2, &block)
|
39
|
+
deep_merge(val1, val2, identifiers, &block)
|
35
40
|
elsif val1.is_a?(Array) && val2.is_a?(Array)
|
36
|
-
(
|
41
|
+
if (id = identifiers[key])
|
42
|
+
arr = (val1 + val2)
|
43
|
+
.group_by { |el| el.fetch(id) }
|
44
|
+
.values
|
45
|
+
.map { |arr| arr.size.equal?(2) ? deep_merge(*arr, identifiers) : arr }
|
46
|
+
.flatten(1)
|
47
|
+
.uniq
|
48
|
+
|
49
|
+
arr
|
50
|
+
.map
|
51
|
+
.with_index { |el, idx|
|
52
|
+
(after = el.delete("_after")) ?
|
53
|
+
[el, arr.index(arr.detect { |a| a[id].eql?(after) }) + 1] :
|
54
|
+
[el, idx]
|
55
|
+
}.sort_by(&:last).map(&:first)
|
56
|
+
else
|
57
|
+
(val1 + val2).uniq
|
58
|
+
end
|
37
59
|
else
|
38
60
|
val2
|
39
61
|
end
|
@@ -1,24 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "ossy/cli/commands/core"
|
4
|
+
require "ossy/import"
|
5
5
|
|
6
6
|
module Ossy
|
7
7
|
module CLI
|
8
8
|
module Github
|
9
9
|
class Member < Commands::Core
|
10
|
-
include Import[
|
10
|
+
include Import["github.client"]
|
11
11
|
|
12
|
-
desc
|
12
|
+
desc "Return org member identified by the full name"
|
13
13
|
|
14
|
-
argument :name, required: true, desc:
|
15
|
-
argument :org, required: true, desc:
|
14
|
+
argument :name, required: true, desc: "The member name"
|
15
|
+
argument :org, required: true, desc: "The org name"
|
16
16
|
|
17
17
|
def call(name:, org:)
|
18
18
|
result = client.member(name, org: org)
|
19
19
|
|
20
20
|
if result
|
21
|
-
puts result[
|
21
|
+
puts result["login"]
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -1,26 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "ossy/cli/commands/core"
|
4
|
+
require "ossy/import"
|
5
5
|
|
6
6
|
module Ossy
|
7
7
|
module CLI
|
8
8
|
module Github
|
9
9
|
class Membership < Commands::Core
|
10
|
-
include Import[
|
10
|
+
include Import["github.client"]
|
11
11
|
|
12
|
-
desc
|
12
|
+
desc "Check if a given user has an active membership in a team"
|
13
13
|
|
14
|
-
argument :username, required: true, desc:
|
15
|
-
argument :org, required: true, desc:
|
16
|
-
argument :team, required: true, desc:
|
14
|
+
argument :username, required: true, desc: "The username"
|
15
|
+
argument :org, required: true, desc: "The name of the org"
|
16
|
+
argument :team, required: true, desc: "The name of the team"
|
17
17
|
|
18
18
|
option :verify, required: false
|
19
19
|
|
20
|
-
def call(username:, org:, team:, verify:
|
20
|
+
def call(username:, org:, team:, verify: "false")
|
21
21
|
result = client.membership?(username, org: org, team: team)
|
22
22
|
|
23
|
-
if verify.eql?(
|
23
|
+
if verify.eql?("true")
|
24
24
|
exit(1) unless result
|
25
25
|
else
|
26
26
|
puts "#{username} has active membership in #{org}/@#{team}"
|
@@ -1,24 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "ossy/cli/commands/core"
|
4
|
+
require "ossy/import"
|
5
5
|
|
6
6
|
module Ossy
|
7
7
|
module CLI
|
8
8
|
module Github
|
9
9
|
class Tagger < Commands::Core
|
10
|
-
include Import[
|
10
|
+
include Import["github.client"]
|
11
11
|
|
12
|
-
desc
|
12
|
+
desc "Return tagger email for a verified tag"
|
13
13
|
|
14
|
-
argument :repo, required: true, desc:
|
15
|
-
argument :tag, required: true, desc:
|
14
|
+
argument :repo, required: true, desc: "The repo"
|
15
|
+
argument :tag, required: true, desc: "The tag name"
|
16
16
|
|
17
17
|
def call(repo:, tag:)
|
18
18
|
result = client.tagger(repo: repo, tag: tag)
|
19
19
|
|
20
20
|
if result && result[:verified].equal?(true)
|
21
|
-
puts result[:tagger][
|
21
|
+
puts result[:tagger]["name"]
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -1,17 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "ossy/cli/commands/core"
|
4
|
+
require "open-uri"
|
5
5
|
|
6
6
|
module Ossy
|
7
7
|
module CLI
|
8
8
|
module Github
|
9
9
|
class UpdateFile < Commands::Core
|
10
|
-
desc
|
10
|
+
desc "Update provided file using a canonical source in another repository"
|
11
11
|
|
12
|
-
argument(:repo, required: true, desc:
|
13
|
-
argument(:file, required: true, desc:
|
14
|
-
option(:branch, required: false, desc:
|
12
|
+
argument(:repo, required: true, desc: "Source repository")
|
13
|
+
argument(:file, required: true, desc: "File path ie owner/repo:path/to/file")
|
14
|
+
option(:branch, required: false, desc: "Branch name", default: "master")
|
15
15
|
|
16
16
|
def call(repo:, file:, branch:)
|
17
17
|
url = "https://raw.githubusercontent.com/#{repo}/#{branch}/shared/#{file}"
|
@@ -1,30 +1,30 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "json"
|
4
4
|
|
5
|
-
require
|
6
|
-
require
|
5
|
+
require "ossy/cli/commands/core"
|
6
|
+
require "ossy/import"
|
7
7
|
|
8
8
|
module Ossy
|
9
9
|
module CLI
|
10
10
|
module Github
|
11
11
|
class Workflow < Commands::Core
|
12
|
-
include Import[
|
12
|
+
include Import["github.workflow"]
|
13
13
|
|
14
|
-
desc
|
14
|
+
desc "Start a GitHub workflow"
|
15
15
|
|
16
|
-
argument :repo, required: true, desc:
|
17
|
-
argument :name, required: true, desc:
|
16
|
+
argument :repo, required: true, desc: "The name of the repository on GitHub"
|
17
|
+
argument :name, required: true, desc: "The name of the workflow"
|
18
18
|
|
19
|
-
option :payload, required: false, desc:
|
19
|
+
option :payload, required: false, desc: "Optional client payload"
|
20
20
|
|
21
21
|
def call(repo:, name:, payload: "{}")
|
22
22
|
puts "Requesting: #{repo} => #{name}"
|
23
23
|
|
24
24
|
result = workflow.(repo, name, JSON.load(payload))
|
25
25
|
|
26
|
-
if result.
|
27
|
-
puts
|
26
|
+
if result.status.eql?(204)
|
27
|
+
puts "Success!"
|
28
28
|
else
|
29
29
|
puts "Failure! #{result.inspect}"
|
30
30
|
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ossy/cli/commands/core"
|
4
|
+
require "ossy/import"
|
5
|
+
require "ossy/release"
|
6
|
+
|
7
|
+
require "yaml"
|
8
|
+
require "tilt"
|
9
|
+
require "ostruct"
|
10
|
+
|
11
|
+
module Ossy
|
12
|
+
module CLI
|
13
|
+
module Releases
|
14
|
+
class Context < OpenStruct
|
15
|
+
def self.new(data)
|
16
|
+
super(releases: data.map(&Release))
|
17
|
+
end
|
18
|
+
|
19
|
+
def latest_release
|
20
|
+
releases.first
|
21
|
+
end
|
22
|
+
|
23
|
+
def previous_release
|
24
|
+
releases[1]
|
25
|
+
end
|
26
|
+
|
27
|
+
def update(hash)
|
28
|
+
hash.each { |k, v| self[k.to_sym] = v }
|
29
|
+
self
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class Generate < Commands::Core
|
34
|
+
desc "Generates a release markdown file from a changelog.yml file"
|
35
|
+
|
36
|
+
argument :config_path, required: true, desc: "The path to the changelog config"
|
37
|
+
argument :output_path, required: true, desc: "The path to the output md file"
|
38
|
+
argument :template_path, required: true, desc: "The path to the changelog ERB template"
|
39
|
+
|
40
|
+
option :data_path, required: false, desc: "Optional path to additional data yaml file"
|
41
|
+
|
42
|
+
def call(config_path:, output_path:, template_path:, data_path: nil)
|
43
|
+
puts "Generating #{output_path} from #{config_path} using #{template_path}"
|
44
|
+
|
45
|
+
ctx_data = YAML.load_file(config_path)
|
46
|
+
template = Tilt.new(template_path)
|
47
|
+
|
48
|
+
context = Context.new(ctx_data)
|
49
|
+
|
50
|
+
if data_path
|
51
|
+
key = File.basename(data_path).gsub(".yml", "")
|
52
|
+
data = YAML.load_file(data_path)
|
53
|
+
|
54
|
+
context.update(key => OpenStruct.new(data))
|
55
|
+
end
|
56
|
+
|
57
|
+
output = template.render(context)
|
58
|
+
|
59
|
+
File.write(output_path, "#{output.strip}\n")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
3
|
+
require "dry/inflector"
|
4
|
+
require "ossy/cli/commands/core"
|
5
|
+
require "ossy/import"
|
6
6
|
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
7
|
+
require "tilt"
|
8
|
+
require "erb"
|
9
|
+
require "yaml"
|
10
|
+
require "ostruct"
|
11
11
|
|
12
12
|
module Ossy
|
13
13
|
module CLI
|
@@ -15,7 +15,7 @@ module Ossy
|
|
15
15
|
class Compile < Commands::Core
|
16
16
|
class Context < OpenStruct
|
17
17
|
Inflector = Dry::Inflector.new do |i|
|
18
|
-
i.acronym
|
18
|
+
i.acronym "CLI"
|
19
19
|
end
|
20
20
|
|
21
21
|
def inflector
|
@@ -23,13 +23,13 @@ module Ossy
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
include Import[
|
26
|
+
include Import["github.workflow"]
|
27
27
|
|
28
|
-
desc
|
28
|
+
desc "Compile an erb template"
|
29
29
|
|
30
|
-
argument :source_path, required: true, desc:
|
31
|
-
argument :target_path, required: true, desc:
|
32
|
-
argument :data_file, required: true, desc:
|
30
|
+
argument :source_path, required: true, desc: "The path to the template file"
|
31
|
+
argument :target_path, required: true, desc: "The path to the output file"
|
32
|
+
argument :data_file, required: true, desc: "The path to yaml data file"
|
33
33
|
|
34
34
|
def call(source_path:, target_path:, data_file:)
|
35
35
|
puts "Compiling #{source_path} => #{target_path}"
|
data/lib/ossy/container.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "dry/system/container"
|
4
|
+
require "dry/system/components"
|
5
5
|
|
6
|
-
require
|
6
|
+
require "ossy/types"
|
7
7
|
|
8
8
|
module Ossy
|
9
9
|
class Container < Dry::System::Container
|
10
|
-
use :env, inferrer: proc { ENV.fetch(
|
10
|
+
use :env, inferrer: proc { ENV.fetch("OSSY_ENV") { "development" }.to_sym }
|
11
11
|
|
12
12
|
configure do |config|
|
13
|
-
config.root = Pathname(__dir__).join(
|
13
|
+
config.root = Pathname(__dir__).join("../../")
|
14
14
|
config.name = :ossy
|
15
|
-
config.default_namespace =
|
15
|
+
config.default_namespace = "ossy"
|
16
16
|
end
|
17
17
|
|
18
|
-
load_paths!
|
18
|
+
load_paths! "lib"
|
19
19
|
|
20
20
|
boot(:settings, from: :system) do
|
21
21
|
settings do
|
data/lib/ossy/github/client.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "ossy/import"
|
4
4
|
|
5
|
-
require
|
6
|
-
require
|
5
|
+
require "faraday"
|
6
|
+
require "json"
|
7
7
|
|
8
8
|
module Ossy
|
9
9
|
module Github
|
10
10
|
class Client
|
11
11
|
include Import[:settings]
|
12
12
|
|
13
|
-
BASE_URL =
|
13
|
+
BASE_URL = "https://api.github.com"
|
14
14
|
|
15
15
|
def membership?(username, org:, team:)
|
16
16
|
path = "orgs/#{org}/teams/#{team}/memberships/#{username}"
|
@@ -20,7 +20,7 @@ module Ossy
|
|
20
20
|
|
21
21
|
json = JSON.parse(resp.body)
|
22
22
|
|
23
|
-
json[
|
23
|
+
json["state"].eql?("active")
|
24
24
|
end
|
25
25
|
|
26
26
|
def tagger(repo:, tag:)
|
@@ -29,7 +29,7 @@ module Ossy
|
|
29
29
|
|
30
30
|
return false unless resp.status.equal?(200)
|
31
31
|
|
32
|
-
sha = JSON.parse(resp.body)[
|
32
|
+
sha = JSON.parse(resp.body)["object"]["sha"]
|
33
33
|
|
34
34
|
path = "repos/#{repo}/git/tags/#{sha}"
|
35
35
|
resp = get(path)
|
@@ -38,7 +38,7 @@ module Ossy
|
|
38
38
|
|
39
39
|
json = JSON.parse(resp.body)
|
40
40
|
|
41
|
-
{ tagger: json[
|
41
|
+
{ tagger: json["tagger"], verified: json["verification"]["verified"] }
|
42
42
|
end
|
43
43
|
|
44
44
|
def member(name, org:)
|
@@ -47,11 +47,9 @@ module Ossy
|
|
47
47
|
|
48
48
|
return nil unless resp.status.equal?(200)
|
49
49
|
|
50
|
-
|
51
|
-
.map { |member| user(member[
|
52
|
-
.detect { |user| user[
|
53
|
-
|
54
|
-
user
|
50
|
+
JSON.parse(resp.body)
|
51
|
+
.map { |member| user(member["login"]) }
|
52
|
+
.detect { |user| user["name"].eql?(name) }
|
55
53
|
end
|
56
54
|
|
57
55
|
def user(login)
|
@@ -82,8 +80,8 @@ module Ossy
|
|
82
80
|
end
|
83
81
|
|
84
82
|
def headers
|
85
|
-
|
86
|
-
|
83
|
+
{ "Content-Type" => "application/json",
|
84
|
+
"Accept" => "application/vnd.github.everest-preview+json" }
|
87
85
|
end
|
88
86
|
end
|
89
87
|
end
|
data/lib/ossy/github/workflow.rb
CHANGED
data/lib/ossy/import.rb
CHANGED
data/lib/ossy/release.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "ossy/types"
|
4
|
+
require "ossy/struct"
|
5
5
|
|
6
6
|
module Ossy
|
7
7
|
class Release < Ossy::Struct
|
@@ -12,7 +12,7 @@ module Ossy
|
|
12
12
|
attribute? :added, Types::ChangeList
|
13
13
|
attribute? :changed, Types::ChangeList
|
14
14
|
|
15
|
-
def each
|
15
|
+
def each
|
16
16
|
%i[fixed added changed].each do |type|
|
17
17
|
yield(type, self[type]) unless self[type].empty?
|
18
18
|
end
|
data/lib/ossy/struct.rb
CHANGED
data/lib/ossy/types.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "dry/types"
|
4
4
|
|
5
5
|
module Ossy
|
6
6
|
module Types
|
7
7
|
include Dry.Types()
|
8
8
|
|
9
|
-
Version = Types::String.constrained(eql:
|
10
|
-
Types::String.constrained(format:
|
9
|
+
Version = Types::String.constrained(eql: "unreleased") |
|
10
|
+
Types::String.constrained(format: /\d+\.\d+\.\d+/)
|
11
11
|
|
12
12
|
Summary = Types::String.constrained(filled: true).optional
|
13
13
|
|
data/lib/ossy/version.rb
CHANGED
metadata
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ossy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: dry-
|
14
|
+
name: dry-cli
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.5'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.1
|
22
|
+
version: 0.5.1
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0.
|
29
|
+
version: '0.5'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.1
|
32
|
+
version: 0.5.1
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name: dry-
|
34
|
+
name: dry-inflector
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0.
|
39
|
+
version: '0.1'
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.
|
42
|
+
version: 0.1.2
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '0.
|
49
|
+
version: '0.1'
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: 0.
|
52
|
+
version: 0.1.2
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
|
-
name: dry-
|
54
|
+
name: dry-struct
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
57
|
- - "~>"
|
@@ -65,33 +65,33 @@ dependencies:
|
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: '1.2'
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
|
-
name: dry-
|
68
|
+
name: dry-system
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
71
|
- - "~>"
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version: '
|
73
|
+
version: '0.14'
|
74
74
|
type: :runtime
|
75
75
|
prerelease: false
|
76
76
|
version_requirements: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
78
78
|
- - "~>"
|
79
79
|
- !ruby/object:Gem::Version
|
80
|
-
version: '
|
80
|
+
version: '0.14'
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
|
-
name: dry-
|
82
|
+
name: dry-types
|
83
83
|
requirement: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
85
|
- - "~>"
|
86
86
|
- !ruby/object:Gem::Version
|
87
|
-
version: '
|
87
|
+
version: '1.2'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
90
|
version_requirements: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
92
|
- - "~>"
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
version: '
|
94
|
+
version: '1.2'
|
95
95
|
- !ruby/object:Gem::Dependency
|
96
96
|
name: faraday
|
97
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,16 +166,16 @@ dependencies:
|
|
166
166
|
name: rubocop
|
167
167
|
requirement: !ruby/object:Gem::Requirement
|
168
168
|
requirements:
|
169
|
-
- -
|
169
|
+
- - "~>"
|
170
170
|
- !ruby/object:Gem::Version
|
171
|
-
version:
|
171
|
+
version: '1.6'
|
172
172
|
type: :development
|
173
173
|
prerelease: false
|
174
174
|
version_requirements: !ruby/object:Gem::Requirement
|
175
175
|
requirements:
|
176
|
-
- -
|
176
|
+
- - "~>"
|
177
177
|
- !ruby/object:Gem::Version
|
178
|
-
version:
|
178
|
+
version: '1.6'
|
179
179
|
description: Ossy is your ruby gem maintenance helper
|
180
180
|
email:
|
181
181
|
- piotr.solnica@gmail.com
|
@@ -199,6 +199,7 @@ files:
|
|
199
199
|
- lib/ossy/cli/github/tagger.rb
|
200
200
|
- lib/ossy/cli/github/update_file.rb
|
201
201
|
- lib/ossy/cli/github/workflow.rb
|
202
|
+
- lib/ossy/cli/releases/generate.rb
|
202
203
|
- lib/ossy/cli/templates/compile.rb
|
203
204
|
- lib/ossy/container.rb
|
204
205
|
- lib/ossy/github/client.rb
|
@@ -216,7 +217,7 @@ metadata:
|
|
216
217
|
homepage_uri: https://github.com/solnic/ossy
|
217
218
|
source_code_uri: https://github.com/solnic/ossy
|
218
219
|
changelog_uri: https://github.com/solnic/ossy
|
219
|
-
post_install_message:
|
220
|
+
post_install_message:
|
220
221
|
rdoc_options: []
|
221
222
|
require_paths:
|
222
223
|
- lib
|
@@ -231,8 +232,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
231
232
|
- !ruby/object:Gem::Version
|
232
233
|
version: '0'
|
233
234
|
requirements: []
|
234
|
-
rubygems_version: 3.
|
235
|
-
signing_key:
|
235
|
+
rubygems_version: 3.2.3
|
236
|
+
signing_key:
|
236
237
|
specification_version: 4
|
237
238
|
summary: Ossy is your ruby gem maintenance helper
|
238
239
|
test_files: []
|