kojo 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 74de16b71f9f82631f4c62aa2f8a295b1c575ec72115d010d7188a7fbd412114
4
- data.tar.gz: fd97420ac441b2872c9c48b9326057e441fac811efba27e4763852655c6a479d
3
+ metadata.gz: b135236a60c6021df034236a28118c5184ce87dc6a029eabf154be2afb282baa
4
+ data.tar.gz: 9cb63fdc1dc1134c5e59ebe25f1c90b755c5df86fb48763f55a985b689c166b4
5
5
  SHA512:
6
- metadata.gz: de8d9c02d15b26336b345a585130077ae17052e0876bd2ae5abdc5048d7f7eb18f10808ef8d99d96a0083cccac67a52497d66ee05ab120f1a15c834712accb3d
7
- data.tar.gz: 982cbeb243666fe90116dc179634d19d9075889b8a9cc65053dc75a8646892522423340e9fad2794c200899336cc23ddd56855ca51a2c6428ab2a82eef9a41c8
6
+ metadata.gz: 7eb027521703e1e3856b31c8fe18c749ccd0ef9ac05abbd3cb1aa812827fc9ee56e330418664d347cc89422da34e6387f1f2913f56e39584b78e625c533e89e9
7
+ data.tar.gz: 93f80e96e9c4272844d7fba22626d7565c871b18841f6bf4080a5cdf52b476577e8c3f6ab7c04d0c8e9fb933f43c70f1b45753f5011f5294008a609a5493b094
@@ -12,15 +12,19 @@ module Kojo
12
12
  @import_base = dir
13
13
  end
14
14
 
15
- def render(args={}, &block)
15
+ def render(args = {}, &block)
16
16
  files.each do |file|
17
17
  handle file, args, &block
18
18
  end
19
19
  end
20
20
 
21
+ def size
22
+ files.size
23
+ end
24
+
21
25
  private
22
26
 
23
- def handle(file, args={})
27
+ def handle(file, args = {})
24
28
  template = Template.new file
25
29
  template.import_base = import_base
26
30
 
data/lib/kojo/config.rb CHANGED
@@ -14,7 +14,7 @@ module Kojo
14
14
  @import_base = nil
15
15
  end
16
16
 
17
- def generate(opts={}, &block)
17
+ def generate(opts = {}, &block)
18
18
  if directory_mode?
19
19
  generate_from_dir opts, &block
20
20
  else
@@ -1,3 +1,5 @@
1
+ require 'fileutils'
2
+
1
3
  class File
2
4
  def self.deep_write(path, content)
3
5
  FileUtils.mkdir_p File.dirname(path)
@@ -12,7 +12,7 @@ module Kojo
12
12
  @file = file
13
13
  end
14
14
 
15
- def render(additional_args=nil)
15
+ def render(additional_args = nil)
16
16
  additional_args ||= {}
17
17
  config, @template = read_file file
18
18
 
@@ -24,7 +24,7 @@ module Kojo
24
24
 
25
25
  private
26
26
 
27
- def handle(args={})
27
+ def handle(args = {})
28
28
  content = template
29
29
  content = content.eval_erb args, file
30
30
  content = content.eval_vars args, file
@@ -5,7 +5,7 @@ module Kojo
5
5
  refine Array do
6
6
  # Convert an array of +["key=value", "key=value"]+ pairs to a hash
7
7
  def args_to_hash
8
- collect { |a| k, v = a.split '=' }
8
+ collect { |a| a.split '=' }
9
9
  .to_h
10
10
  .symbolize_keys
11
11
  .typecast_values
@@ -1,6 +1,5 @@
1
1
  require 'erb'
2
2
  require 'ostruct'
3
- require 'kojo/refinements/hash'
4
3
 
5
4
  module Kojo
6
5
  module Refinements
data/lib/kojo/template.rb CHANGED
@@ -16,7 +16,7 @@ module Kojo
16
16
  @import_base = dir
17
17
  end
18
18
 
19
- def render(args={})
19
+ def render(args = {})
20
20
  @args = args
21
21
  evaluate file
22
22
  end
data/lib/kojo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kojo
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
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.3
4
+ version: 0.3.4
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-05 00:00:00.000000000 Z
11
+ date: 2020-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mister_bin