hanamimastery-cli 0.2.2 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.tool-versions +1 -1
- data/Gemfile.lock +2 -1
- data/lib/hanamimastery/cli/commands/to_notion.rb +24 -0
- data/lib/hanamimastery/cli/commands/to_pro.rb +1 -1
- data/lib/hanamimastery/cli/transformations/to_notion.rb +22 -0
- data/lib/hanamimastery/cli/version.rb +1 -1
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f62c2b5c42bf610773dfe4649f63c32f617e795601bc61e8bd8e59f4ee40d65
|
4
|
+
data.tar.gz: acd9c90a37342f82e28b943b7412b71a874f4e6a44d6bdcbe7e3020cf014e77a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0117306eac74029b0e600cac92f51fa0ba95c7211a47fe3d35408f410366f2e767dc53db7a632713ce72dca4e3bfe475de20287a570bce564fa68321dcefd6b5
|
7
|
+
data.tar.gz: a9e120aad764838a437cc606de45ae3dcb4778fad9b9fedecf3f17170416e15085a79f7f755caa7d506b5d4716d74b36027a9ad7cac9e389c556499c2b9888f6
|
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby 3.2.
|
1
|
+
ruby 3.2.2
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hanamimastery-cli (0.
|
4
|
+
hanamimastery-cli (0.3.1)
|
5
5
|
commonmarker (~> 1.0.0.pre6)
|
6
6
|
dry-cli (<= 1.0)
|
7
7
|
dry-configurable (~> 1.0)
|
@@ -80,6 +80,7 @@ GEM
|
|
80
80
|
|
81
81
|
PLATFORMS
|
82
82
|
x86_64-darwin-20
|
83
|
+
x86_64-darwin-23
|
83
84
|
|
84
85
|
DEPENDENCIES
|
85
86
|
hanamimastery-cli!
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Hanamimastery
|
4
|
+
module CLI
|
5
|
+
module Commands
|
6
|
+
class ToNotion < Dry::CLI::Command
|
7
|
+
desc 'Renders HTML out of Markdown'
|
8
|
+
argument :episode, type: :integer, required: :true, desc: "Episode's ID to render"
|
9
|
+
option :save, aliases: ['-s'], type: :boolean, default: false, desc: 'Save to file?'
|
10
|
+
|
11
|
+
include Deps[
|
12
|
+
repository: 'repositories.episodes',
|
13
|
+
transformation: 'transformations.to_pro'
|
14
|
+
]
|
15
|
+
|
16
|
+
def call(episode:, save:, **)
|
17
|
+
content = repository.fetch(episode).content
|
18
|
+
processed = transformation.call(content)
|
19
|
+
save ? File.write("#{episode}-episode.html", processed) : puts(processed)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -16,7 +16,7 @@ module Hanamimastery
|
|
16
16
|
def call(episode:, save:, **)
|
17
17
|
content = repository.fetch(episode).content
|
18
18
|
processed = transformation.call(content)
|
19
|
-
|
19
|
+
repository.replace(episode, processed)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'commonmarker'
|
4
|
+
|
5
|
+
module Hanamimastery
|
6
|
+
module CLI
|
7
|
+
module Transformations
|
8
|
+
class ToPRO
|
9
|
+
# TODO: Make it Configurable
|
10
|
+
HOST = "https://hanamimastery.com"
|
11
|
+
|
12
|
+
# Transforms Markdown input to output compatible with Notion
|
13
|
+
#
|
14
|
+
def call(id, content)
|
15
|
+
image_patern = /\!(\[\[)(.+)(\]\])/
|
16
|
+
result
|
17
|
+
.gsub(image_pattern, "![#{'\2'.humanize.tr('-', ''))}](#{HOST}/images/episodes/#{id})")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hanamimastery-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Wilgosz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-cli
|
@@ -83,7 +83,7 @@ dependencies:
|
|
83
83
|
description: A set of command line utility scripts helping with producing Hanami Mastery
|
84
84
|
content.
|
85
85
|
email:
|
86
|
-
- sebastian@
|
86
|
+
- sebastian@hanamimastery.com
|
87
87
|
executables:
|
88
88
|
- hanamimastery
|
89
89
|
extensions: []
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- lib/hanamimastery-cli.rb
|
104
104
|
- lib/hanamimastery/cli.rb
|
105
105
|
- lib/hanamimastery/cli/commands.rb
|
106
|
+
- lib/hanamimastery/cli/commands/to_notion.rb
|
106
107
|
- lib/hanamimastery/cli/commands/to_pro.rb
|
107
108
|
- lib/hanamimastery/cli/commands/touch.rb
|
108
109
|
- lib/hanamimastery/cli/commands/unshot.rb
|
@@ -110,6 +111,7 @@ files:
|
|
110
111
|
- lib/hanamimastery/cli/deps.rb
|
111
112
|
- lib/hanamimastery/cli/errors.rb
|
112
113
|
- lib/hanamimastery/cli/repositories/episodes.rb
|
114
|
+
- lib/hanamimastery/cli/transformations/to_notion.rb
|
113
115
|
- lib/hanamimastery/cli/transformations/to_pro.rb
|
114
116
|
- lib/hanamimastery/cli/transformations/touch.rb
|
115
117
|
- lib/hanamimastery/cli/transformations/unshot.rb
|
@@ -123,6 +125,7 @@ metadata:
|
|
123
125
|
homepage_uri: https://github.com/hanamimastery/cli
|
124
126
|
source_code_uri: https://github.com/hanamimastery/cli
|
125
127
|
changelog_uri: https://github.com/hanamimastery/cli/tree/main/CHANGELOG.md
|
128
|
+
bug_tracker_uri: https://github.com/hanamimastery/cli/issues
|
126
129
|
post_install_message:
|
127
130
|
rdoc_options: []
|
128
131
|
require_paths:
|
@@ -131,15 +134,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
131
134
|
requirements:
|
132
135
|
- - ">="
|
133
136
|
- !ruby/object:Gem::Version
|
134
|
-
version:
|
137
|
+
version: 3.0.0
|
135
138
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
139
|
requirements:
|
137
140
|
- - ">="
|
138
141
|
- !ruby/object:Gem::Version
|
139
142
|
version: '0'
|
140
143
|
requirements: []
|
141
|
-
rubygems_version: 3.4.
|
144
|
+
rubygems_version: 3.4.22
|
142
145
|
signing_key:
|
143
146
|
specification_version: 4
|
144
|
-
summary: Command line
|
147
|
+
summary: Command line tools for Hanami Mastery content creation
|
145
148
|
test_files: []
|