cmdlet 0.0.4 → 0.0.5

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: bfdaac05f95db1014dc0a28dca06d7af071a40b46ccf79398ae7e15cef3d73ab
4
- data.tar.gz: f90974598208b711a674c2a9dacd850dcea8be72f79d8cf2bddd11425c98a706
3
+ metadata.gz: ae44ce26b73b2f24d493ad916c12328b2814e5e670cf8828079e4e7e32cc9f4a
4
+ data.tar.gz: a9efa32929e26af9cdda7d207834d025039c049dd365ae79abacd1d7da33c5b0
5
5
  SHA512:
6
- metadata.gz: 04b7ea36c7db18bb2becc84ea1fda21856a906d39d3b0a3c390a159fce77e40dcdb752da1c810ce14cb7b5205bee8ebfe884ac467d724081e16f6adc468078d1
7
- data.tar.gz: bc84349086aeb4be3d8c5a9f3e595e84f39596af58592cbc4be16ed2f6856d4c342a1c9ab6b8ab3f4d9f52683665aed7f2fc9cf2a1f7ed7d386dd128898a8a42
6
+ metadata.gz: c79358c0e425a5dbe5f5441c69afc489eb86034c52122c14a217a2fa0eeb3b19249c578bc002118852a635c1404db62f905f1245813f66edf91db39909d6a18b
7
+ data.tar.gz: 795edc645cc8747e9551ac5f8027b738c4d579ca6943b20ec82072d383172e3af7e39e1f6f4788205d80abeb8ba2749c23e1b553b56bef92c6fe04cece21d726
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.0.4](https://github.com/klueless-io/cmdlet/compare/v0.0.3...v0.0.4) (2022-07-08)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add basic configuration ([d8ecbb1](https://github.com/klueless-io/cmdlet/commit/d8ecbb17f61600de3b3f5d8987cc132d6e5ba0b2))
7
+
1
8
  ## [0.0.3](https://github.com/klueless-io/cmdlet/compare/v0.0.2...v0.0.3) (2022-07-08)
2
9
 
3
10
 
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/string'
4
+
5
+ module Cmdlet
6
+ # String tokenizer will clean up a string so that all sorts of formatted strings can be
7
+ # represented in a consistent fashion
8
+ class StringTokenizer
9
+ # Tokenize string
10
+ # rubocop:disable Metrics/ParameterLists
11
+ def parse(value,
12
+ preserve_case: false,
13
+ compress_prefix_numerals: true,
14
+ compress_suffix_numerals: true,
15
+ separator: '-',
16
+ forced_separator: false)
17
+ return '' if value.nil?
18
+
19
+ # Insert space before any lowercaseUppercase
20
+ value = value.gsub(/(?<=[a-z])(?=[A-Z])/, ' ')
21
+
22
+ # make sure that any numbers followed by space and then some text has the white space removed
23
+ value = value.gsub(/^(\d*)(\s*)/, '\1') if compress_prefix_numerals
24
+
25
+ # Technique1: make sure that trailing space followed by number is compressed
26
+ # NOTE: named groups don't seem to work with \1, \2 etc.
27
+ # ex = /(?<space>[\s]*)(?<number>[\d]*)$/
28
+ # value =value.sub(ex) { |_| Regexp.last_match[:number] }
29
+
30
+ # Technique2: make sure that trailing space followed by number is compressed
31
+ value = value.gsub(/(\s*)(\d*)$/, '\2') if compress_suffix_numerals
32
+
33
+ value = value.parameterize(preserve_case: preserve_case, separator: separator) # (separator: ' ')
34
+
35
+ value = value.gsub(/[-_]/, separator) if forced_separator
36
+
37
+ value
38
+ end
39
+ # rubocop:enable Metrics/ParameterLists
40
+ end
41
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cmdlet
4
- VERSION = '0.0.4'
4
+ VERSION = '0.0.5'
5
5
  end
data/lib/cmdlet.rb CHANGED
@@ -4,6 +4,7 @@
4
4
  require 'k_config'
5
5
  require_relative 'cmdlet/version'
6
6
  require_relative 'cmdlet/configuration'
7
+ require_relative 'cmdlet/string_tokenizer'
7
8
 
8
9
  module Cmdlet
9
10
  # raise Cmdlet::Error, 'Sample message'
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "cmdlet",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "cmdlet",
9
- "version": "0.0.4",
9
+ "version": "0.0.5",
10
10
  "devDependencies": {
11
11
  "@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
12
12
  "@semantic-release/changelog": "^6.0.1",
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cmdlet",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "Cmdlet provides a set of functions (wrapped in the command pattern) that perform simple actions",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cmdlet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
@@ -10,6 +10,20 @@ bindir: exe
10
10
  cert_chain: []
11
11
  date: 2022-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '6'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '6'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: k_config
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -55,6 +69,7 @@ files:
55
69
  - bin/setup
56
70
  - lib/cmdlet.rb
57
71
  - lib/cmdlet/configuration.rb
72
+ - lib/cmdlet/string_tokenizer.rb
58
73
  - lib/cmdlet/version.rb
59
74
  - package-lock.json
60
75
  - package.json