kojo 0.4.0 → 0.4.1

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: 6fe6f0b9571a1cdd9a808cccaac4dcf5049647d1bc3190702ca45b811421ed61
4
- data.tar.gz: 7fde526ad1d6efd84a8571c87ef419da1b7f672f06d55982efe68dc487399a29
3
+ metadata.gz: fa6bcd67142ce2bbde7f22e49d2884dd258046db5a786c4591ca9657cb697ab9
4
+ data.tar.gz: a72337674e2a3d8892f63f3705d87cf91723f93ade219ce87f5a8d1331ece91a
5
5
  SHA512:
6
- metadata.gz: e8fc1e607b10197997602db589b6e3ca4f692b7a17118b276fe2e2e5bfe7ee471b6217b3dcaf12f3a5cac85df2d9b50bbc8d2e77a2ccef542e5009a3952546d2
7
- data.tar.gz: 2ea4b1943f5a6169881bcf4a68071718016041e0aa0a2e0d5a9673ead2eb5653dfa94f77533b320791d2c7fb8338b2cccfa3905b523b2d2a129c829d8ef4732e
6
+ metadata.gz: 6e302b53329de878ca3a177f98a8e43d0f12b8b9be88093c2638515c0e514b6e60512a4e217a0896fbc29edaf15fc2f3bd45a05d992efa7e2dbc43f8d46c5475
7
+ data.tar.gz: ec8504461e7bb58bbd1782dcaa1113fc2fb49729463794995e10b7d67e36e2c475946acc0a34e5663726954c592a340a81a8bbb047f80465b4829d4b9db6baae
@@ -33,7 +33,7 @@ module Kojo::Commands
33
33
  argfile = args['--args']
34
34
 
35
35
  if argfile
36
- fileopts = YAML.properly_load_file(argfile).symbolize_keys
36
+ fileopts = YAML.load_file(argfile).symbolize_keys
37
37
  @opts = fileopts.merge opts
38
38
  end
39
39
 
@@ -33,7 +33,7 @@ module Kojo
33
33
  argfile = args['--args']
34
34
 
35
35
  if argfile
36
- fileopts = YAML.properly_load_file(argfile).symbolize_keys
36
+ fileopts = YAML.load_file(argfile).symbolize_keys
37
37
  @opts = fileopts.merge @opts
38
38
  end
39
39
 
@@ -33,7 +33,7 @@ module Kojo
33
33
  argfile = args['--args']
34
34
 
35
35
  if argfile
36
- fileopts = YAML.properly_load_file(argfile).symbolize_keys
36
+ fileopts = YAML.load_file(argfile).symbolize_keys
37
37
  @opts = fileopts.merge opts
38
38
  end
39
39
 
@@ -35,7 +35,7 @@ module Kojo
35
35
  private
36
36
 
37
37
  def tojson(path)
38
- JSON.pretty_generate YAML.properly_load_file(path)
38
+ JSON.pretty_generate YAML.load_file(path)
39
39
  end
40
40
 
41
41
  # Glob patterns are usually handled by the shell, but in case
data/lib/kojo/config.rb CHANGED
@@ -59,7 +59,7 @@ module Kojo
59
59
  end
60
60
 
61
61
  def config
62
- @config ||= YAML.properly_load_file config_file
62
+ @config ||= YAML.load_file config_file
63
63
  end
64
64
  end
65
65
 
@@ -1,10 +1,9 @@
1
1
  require 'yaml'
2
2
 
3
3
  module YAML
4
+ # Make YAML.load behave the same in all Ruby versions
4
5
  # ref: https://bugs.ruby-lang.org/issues/17866
5
- def self.properly_load_file(path)
6
- YAML.load_file path, aliases: true
7
- rescue ArgumentError
8
- YAML.load_file path
6
+ class << self
7
+ alias_method :load, :unsafe_load if YAML.respond_to? :unsafe_load
9
8
  end
10
9
  end
@@ -32,7 +32,7 @@ module Kojo
32
32
  def read_file(file)
33
33
  raise Kojo::NotFoundError, "File not found: #{file}" unless File.exist? file
34
34
 
35
- config = YAML.properly_load_file file
35
+ config = YAML.load_file file
36
36
  content = File.read(file)[/^---\s*$\n(.*)/m, 1]
37
37
 
38
38
  [config, content]
data/lib/kojo/template.rb CHANGED
@@ -64,7 +64,7 @@ module Kojo
64
64
  end
65
65
 
66
66
  def indent(text, spaces)
67
- text.lines.collect { |line| "#{' ' * spaces}#{line}" }.join
67
+ text.lines.collect { |line| "#{' ' * spaces}#{line}" }.join.gsub(/^\s*$/, '')
68
68
  end
69
69
 
70
70
  end
data/lib/kojo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kojo
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
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.4.0
4
+ version: 0.4.1
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: 2022-02-24 00:00:00.000000000 Z
11
+ date: 2022-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mister_bin
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  requirements: []
133
- rubygems_version: 3.2.15
133
+ rubygems_version: 3.3.3
134
134
  signing_key:
135
135
  specification_version: 4
136
136
  summary: Configuration Ninja