kojo 0.3.1 → 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/README.md +23 -0
- data/lib/kojo/commands/command_base.rb +1 -3
- data/lib/kojo/extensions/file.rb +6 -0
- data/lib/kojo/version.rb +1 -1
- data/lib/kojo.rb +1 -0
- 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: 58d07f01002779c56f713af67a1717936ca02d2d845c2cf3156c598f0977dbc6
|
4
|
+
data.tar.gz: 6f36bb1868a7663470a0f20c1d874cc2fc75424b63cad2f4ad93cb45fc03948b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 298d26612f5f151b46c93301195e5ed3e23ea1554f471ce229f501c3d332108964ef9e295041c0458afc879ace070bb458e61da2639c4e21762ce91c76da3e27
|
7
|
+
data.tar.gz: f9bb7831a3865f87ed2a87df8cd209e408bdb0c38ccac56080eb366aed7e9577fc82161ea698473d3bbdf58949ac52c51f11edcc3b22d7f9d4071f8f78e9efda
|
data/README.md
CHANGED
@@ -31,6 +31,7 @@ Table of Contents
|
|
31
31
|
- [Conditions and Loops with ERB](#conditions-and-loops-with-erb)
|
32
32
|
- [Interactive Mode](#interactive-mode)
|
33
33
|
- [Using from Ruby Code](#using-from-ruby-code)
|
34
|
+
- [Contributing / Support](#contributing--support)
|
34
35
|
|
35
36
|
---
|
36
37
|
|
@@ -248,6 +249,28 @@ params = { version: '0.1.1' }
|
|
248
249
|
result = template.render params do |path, content|
|
249
250
|
# code to handle results here
|
250
251
|
end
|
252
|
+
```
|
253
|
+
|
254
|
+
In addition, Kojo extends Ruby's `File` class with the `File.deep_write`
|
255
|
+
method, which lets you write the file and create the directory structure as
|
256
|
+
needed. You may use it in your code like this:
|
257
|
+
|
258
|
+
```ruby
|
259
|
+
# Config
|
260
|
+
config = Kojo::Config.new 'examples/config-from-file/config.yml'
|
261
|
+
config.import_base = "examples/config-from-file/imports"
|
251
262
|
|
263
|
+
config.generate do |path, content|
|
264
|
+
File.deep_write path, content
|
265
|
+
end
|
252
266
|
```
|
253
267
|
|
268
|
+
Contributing / Support
|
269
|
+
--------------------------------------------------
|
270
|
+
|
271
|
+
If you experience any issue, have a question or a suggestion, or if you wish
|
272
|
+
to contribute, feel free to [open an issue][issues].
|
273
|
+
|
274
|
+
---
|
275
|
+
|
276
|
+
[issues]: https://github.com/DannyBen/kojo/issues
|
@@ -5,9 +5,7 @@ module Kojo
|
|
5
5
|
class CommandBase < MisterBin::Command
|
6
6
|
def save(file, output)
|
7
7
|
outpath = "#{outdir}/#{file}"
|
8
|
-
|
9
|
-
FileUtils.mkdir_p dir unless Dir.exist? dir
|
10
|
-
File.write outpath, output
|
8
|
+
File.deep_write outpath, output
|
11
9
|
say "Saved #{outpath}"
|
12
10
|
end
|
13
11
|
end
|
data/lib/kojo/version.rb
CHANGED
data/lib/kojo.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kojo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mister_bin
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- lib/kojo/commands/single.rb
|
73
73
|
- lib/kojo/config.rb
|
74
74
|
- lib/kojo/exceptions.rb
|
75
|
+
- lib/kojo/extensions/file.rb
|
75
76
|
- lib/kojo/front_matter_template.rb
|
76
77
|
- lib/kojo/refinements/array.rb
|
77
78
|
- lib/kojo/refinements/hash.rb
|