k_util 0.0.26 → 0.0.29

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: fea6ad816bc7b0e7d628f3726b0ba6d3f731e185405c982ff74a082e7dbaacfd
4
- data.tar.gz: a89a98739a7ef4a2fee5ff1a7ceabeba1ff55e63238382969e99443d235e5b23
3
+ metadata.gz: d9ec8fb313e3972467b61761e295e19d5d51cd0f9588b8c905b7c5f1ed764dfe
4
+ data.tar.gz: aaecd737aaaca075c1226b5a49a16f72cc95c3478a04ad93fefd3990def1c8af
5
5
  SHA512:
6
- metadata.gz: d9b54e54f72d4555cc9ea62710780857f3a8c5007e9fc15599ad1ce54e509595e0517c4d6e1cb01e991457222b6d0f715541248c1d92bd31e057a7f1c25225f8
7
- data.tar.gz: 793c00959b89a70933b72d4266dfddea2b1911d7e06f3e3fba4b4011495240e12bc90d73520aa99d7c40edb8fa4feb6996ae55969fa0e43e607e8a144800c6de
6
+ metadata.gz: 00b1b9528aa4bfc8cca63dcefe68a943e2f5fcd4ee413d7f05e28630e4dbb411d969f07fd579e30491ed2d4b1a384f09acef81c00d50882320be4c658be2f033
7
+ data.tar.gz: cd878a71496b9e2f7b5ff415bfb31b931affd0b44870ab0d7b9690cf465caee99a020c14e0158510a32e8431274b409acb56d58d631c91e7616b58ef4e3e8b3e
data/.rubocop.yml CHANGED
@@ -38,7 +38,7 @@ Metrics/MethodLength:
38
38
  Layout/LineLength:
39
39
  Max: 200
40
40
  # Ignores annotate output
41
- IgnoredPatterns: ['\A# \*\*']
41
+ AllowedPatterns: ['\A# \*\*']
42
42
  IgnoreCopDirectives: true
43
43
 
44
44
  Lint/UnusedMethodArgument:
@@ -80,3 +80,7 @@ Style/AccessorGrouping:
80
80
  Layout/SpaceBeforeComma:
81
81
  Enabled: false
82
82
  # My Preferences - End
83
+
84
+ Style/OpenStructUse:
85
+ Exclude:
86
+ - "**/*"
data/Gemfile CHANGED
@@ -16,7 +16,7 @@ group :development, :test do
16
16
  gem 'guard-bundler'
17
17
  gem 'guard-rspec'
18
18
  gem 'guard-rubocop'
19
- gem 'rake', '~> 12.0'
19
+ gem 'rake'
20
20
  gem 'rake-compiler', require: false
21
21
  gem 'rspec', '~> 3.0'
22
22
  gem 'rubocop'
data/hooks/update-version CHANGED
@@ -30,4 +30,4 @@ end
30
30
  output.push('')
31
31
 
32
32
  printf "%-25<label>s : %<version>s\n", label: 'GEM VERSION', version: version
33
- File.open('lib/k_util/version.rb', 'w+') { |f| f.write(output.join("\n")) }
33
+ File.write('lib/k_util/version.rb', output.join("\n"))
data/k_util.gemspec CHANGED
@@ -22,9 +22,10 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  # spec.metadata['allowed_push_host'] = "Set to 'http://mygemserver.com'"
24
24
 
25
- spec.metadata['homepage_uri'] = spec.homepage
26
- spec.metadata['source_code_uri'] = 'https://github.com/klueless-io/k_util'
27
- spec.metadata['changelog_uri'] = 'https://github.com/klueless-io/k_util/commits/master'
25
+ spec.metadata['homepage_uri'] = spec.homepage
26
+ spec.metadata['source_code_uri'] = 'https://github.com/klueless-io/k_util'
27
+ spec.metadata['changelog_uri'] = 'https://github.com/klueless-io/k_util/commits/master'
28
+ spec.metadata['rubygems_mfa_required'] = 'true'
28
29
 
29
30
  # Specify which files should be added to the gem when it is released.
30
31
  # The `git ls-files -z` loads the RubyGem files that have been added into git.
@@ -6,14 +6,18 @@ module KUtil
6
6
  module Data
7
7
  # Helper methods attached to the namespace for working with Data
8
8
  module InstanceVariablesToH
9
- def to_h
9
+ def to_h(symbolize_keys: false)
10
10
  hash = {}
11
11
  instance_variables.each do |var|
12
12
  value = instance_variable_get(var)
13
13
 
14
+ # TODO: Add deep support for symbolize_keys
14
15
  value = KUtil.data.to_hash(value) if KUtil.data.hash_convertible?(value)
15
16
 
16
- hash[var.to_s.delete('@')] = value
17
+ key = var.to_s.delete('@')
18
+ key = key.to_sym if symbolize_keys
19
+
20
+ hash[key] = value
17
21
  end
18
22
  hash
19
23
  end
@@ -7,8 +7,9 @@ module KUtil
7
7
  def capture2(cmd, **opts)
8
8
  output, status = Open3.capture2(cmd, **opts)
9
9
 
10
- unless success?
11
- binding.pry
10
+ unless status.success?
11
+ puts "failed to run command: #{cmd}"
12
+ # bxxxinding.pry
12
13
  end
13
14
 
14
15
  raise Open3Error unless status.success?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KUtil
4
- VERSION = '0.0.26'
4
+ VERSION = '0.0.29'
5
5
  end
data/lib/k_util.rb CHANGED
@@ -5,7 +5,6 @@ require 'open3'
5
5
  require 'k_util/version'
6
6
  require 'k_util/console_helper'
7
7
  require 'k_util/data/instance_variables_to_h'
8
- require 'k_util/data/instance_variables_to_symbolized_hash'
9
8
  require 'k_util/data_helper'
10
9
  require 'k_util/file_helper'
11
10
  require 'k_util/open3_helper'
@@ -28,7 +27,7 @@ module KUtil
28
27
  KUtil.open3 = KUtil::Open3Helper.new
29
28
  end
30
29
 
31
- if ENV['KLUE_DEBUG']&.to_s&.downcase == 'true'
30
+ if ENV.fetch('KLUE_DEBUG', 'false').downcase == 'true'
32
31
  namespace = 'KUtil::Version'
33
32
  file_path = $LOADED_FEATURES.find { |f| f.include?('k_util/version') }
34
33
  version = KUtil::VERSION.ljust(9)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: k_util
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.26
4
+ version: 0.0.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-17 00:00:00.000000000 Z
11
+ date: 2022-07-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: " KUtil provides simple utility methods, such as file helpers, data
14
14
  object helpers and more.\n"
@@ -41,7 +41,6 @@ files:
41
41
  - lib/k_util.rb
42
42
  - lib/k_util/console_helper.rb
43
43
  - lib/k_util/data/instance_variables_to_h.rb
44
- - lib/k_util/data/instance_variables_to_symbolized_hash.rb
45
44
  - lib/k_util/data_helper.rb
46
45
  - lib/k_util/file_helper.rb
47
46
  - lib/k_util/open3_helper.rb
@@ -53,6 +52,7 @@ metadata:
53
52
  homepage_uri: http://appydave.com/gems/k-util
54
53
  source_code_uri: https://github.com/klueless-io/k_util
55
54
  changelog_uri: https://github.com/klueless-io/k_util/commits/master
55
+ rubygems_mfa_required: 'true'
56
56
  post_install_message:
57
57
  rdoc_options: []
58
58
  require_paths:
@@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  requirements: []
71
- rubygems_version: 3.2.33
71
+ rubygems_version: 3.1.6
72
72
  signing_key:
73
73
  specification_version: 4
74
74
  summary: KUtil provides simple utility methods
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Provide data object helper functions
4
- # include KUtil::Data::InstanceVariablesToH
5
- module KUtil
6
- module Data
7
- # Helper methods attached to the namespace for working with Data
8
- module InstanceVariablesToSymbolizedHash
9
- def to_h
10
- hash = {}
11
- instance_variables.each do |var|
12
- value = instance_variable_get(var)
13
-
14
- value = KUtil.data.to_hash(value) if KUtil.data.hash_convertible?(value)
15
-
16
- hash[var.to_s.delete('@').to_sym] = value
17
- end
18
- hash
19
- end
20
- end
21
- end
22
- end