ossy 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 +4 -4
- data/lib/ossy/cli/commands.rb +6 -0
- data/lib/ossy/cli/releases/generate.rb +54 -0
- data/lib/ossy/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 888c62267952b5f24a66741016179765c541c7fe9f28576ed892484b48e4ce52
|
4
|
+
data.tar.gz: '01885a2a26f4b3c8e02be23419c9165ade07ed4aeedd2c047c537d4793cd61f9'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a62e32830553990689776251581d2c9bdc91e3f3b40dee67b2c1f0fccfe114774ae9ad67552f92b6a10222a1484455c26251fc781d4bb5fa2478fd5264ee538c
|
7
|
+
data.tar.gz: 900e60b374b75b8ea0e957b60938fb9c6a3571136b111cef7731e4b113a950565ad33908279e5bacd11c33b9fdc99cca757e3ae6819cd094c4522bd3fd1af321
|
data/lib/ossy/cli/commands.rb
CHANGED
@@ -16,6 +16,8 @@ module Ossy
|
|
16
16
|
require "ossy/cli/changelogs/generate"
|
17
17
|
require "ossy/cli/changelogs/update"
|
18
18
|
|
19
|
+
require "ossy/cli/releases/generate"
|
20
|
+
|
19
21
|
require "ossy/cli/configs/merge"
|
20
22
|
|
21
23
|
require "ossy/cli/templates/compile"
|
@@ -37,6 +39,10 @@ module Ossy
|
|
37
39
|
changelogs.register "update", Changelogs::Update, aliases: %w[u]
|
38
40
|
end
|
39
41
|
|
42
|
+
register "releases", aliases: %w[r] do |releases|
|
43
|
+
releases.register "generate", Releases::Generate, aliases: %w[g]
|
44
|
+
end
|
45
|
+
|
40
46
|
register "configs", aliases: %w[c] do |configs|
|
41
47
|
configs.register "merge", Configs::Merge, aliases: %w[m]
|
42
48
|
end
|
@@ -0,0 +1,54 @@
|
|
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).first])
|
17
|
+
end
|
18
|
+
|
19
|
+
def update(hash)
|
20
|
+
hash.each { |k, v| self[k.to_sym] = v }
|
21
|
+
self
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class Generate < Commands::Core
|
26
|
+
desc "Generates a release markdown file from a changelog.yml file"
|
27
|
+
|
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
|
+
|
32
|
+
def call(config_path:, output_path:, template_path:, data_path: nil)
|
33
|
+
puts "Generating #{output_path} from #{config_path} using #{template_path}"
|
34
|
+
|
35
|
+
ctx_data = YAML.load_file(config_path)
|
36
|
+
template = Tilt.new(template_path)
|
37
|
+
|
38
|
+
context = Context.new(ctx_data)
|
39
|
+
|
40
|
+
if data_path
|
41
|
+
key = File.basename(data_path).gsub(".yml", "")
|
42
|
+
data = YAML.load_file(data_path)
|
43
|
+
|
44
|
+
context.update(key => OpenStruct.new(data))
|
45
|
+
end
|
46
|
+
|
47
|
+
output = template.render(context)
|
48
|
+
|
49
|
+
File.write(output_path, "#{output.strip}\n")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/lib/ossy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ossy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-cli
|
@@ -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
|