rake_secrets 0.1.0.pre.2 → 0.1.0.pre.3

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: c940578d417b5a01690bd7556fe71200d528d94faa0cbf233d255661ee59bd01
4
- data.tar.gz: 791cb4520aeafaba912447e0640d649577d0c44fb376fc2ea8e81d500a276560
3
+ metadata.gz: 74d4dd4e8fc036cfe4489f8998c46d8841b298cdd0b50583c7233e8fdd5d8aed
4
+ data.tar.gz: b1e2cba8af58326856a87aaaa0cc60d494b4892e52b8be21850b17ba1030156e
5
5
  SHA512:
6
- metadata.gz: cb00673e88937702be516a5be5ba28cbd9249eb15952b1f3a9cc72a0de07f800d7599fdff5a844e261ae158bc5efdb26ae7a8b1a603e15c80d7631852cd5d391
7
- data.tar.gz: '09ef78c7cb5b84ba01e75a8077acd74f4ce8d59c620f4cd3b06cfa2824095bb5e6c72120927d0b45993e6668f46ae60fe373df0648265879da4c2d29ed396b68'
6
+ metadata.gz: da7bd3843a0d2bf0515e6c92f00427d97d3d589f7971c406e8b6ee94e5cd73ca8036a73c856525724a6cc8b416e225eb2cd368af540ba42a99f4123887d5463b
7
+ data.tar.gz: '080cfd5e18baeee7134bcd6285483b4bfdf0790656842fc28f391e3ec11a34a9ff1f8daf5042bde61077122798008c9cfc0535e5cc65ac0182ab3e04ec73fa12'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rake_secrets (0.1.0.pre.2)
4
+ rake_secrets (0.1.0.pre.3)
5
5
  colored2 (~> 3.1)
6
6
  rake_factory (= 0.32.0.pre.2)
7
7
 
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './character_set'
4
+
5
+ module RakeSecrets
6
+ module Types
7
+ class Alphabetic
8
+ LOWERCASE_CHARACTERS = ('a'..'z').to_a
9
+ UPPERCASE_CHARACTERS = ('A'..'Z').to_a
10
+
11
+ def initialize(opts = {})
12
+ @delegate = CharacterSet.new(
13
+ character_set(opts[:case]),
14
+ length: opts[:length] || 32
15
+ )
16
+ end
17
+
18
+ def generate
19
+ @delegate.generate
20
+ end
21
+
22
+ private
23
+
24
+ def character_set(case_type)
25
+ characters = []
26
+ characters += UPPERCASE_CHARACTERS if %i[upper both].include?(case_type)
27
+ characters += LOWERCASE_CHARACTERS unless case_type == :upper
28
+ characters
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './character_set'
4
+
5
+ module RakeSecrets
6
+ module Types
7
+ class Numeric
8
+ NUMBER_CHARACTERS = ('0'..'9').to_a
9
+
10
+ def initialize(opts = {})
11
+ @delegate = CharacterSet.new(
12
+ NUMBER_CHARACTERS,
13
+ length: opts[:length] || 32
14
+ )
15
+ end
16
+
17
+ def generate
18
+ @delegate.generate
19
+ end
20
+ end
21
+ end
22
+ end
@@ -2,7 +2,9 @@
2
2
 
3
3
  require_relative 'types/constant'
4
4
  require_relative 'types/character_set'
5
+ require_relative 'types/alphabetic'
5
6
  require_relative 'types/alphanumeric'
7
+ require_relative 'types/numeric'
6
8
 
7
9
  module RakeSecrets
8
10
  module Types
@@ -15,9 +17,17 @@ module RakeSecrets
15
17
  CharacterSet.new(set, opts)
16
18
  end
17
19
 
20
+ def alphabetic(opts = {})
21
+ Alphabetic.new(opts)
22
+ end
23
+
18
24
  def alphanumeric(opts = {})
19
25
  Alphanumeric.new(opts)
20
26
  end
27
+
28
+ def numeric(opts = {})
29
+ Numeric.new(opts)
30
+ end
21
31
  end
22
32
  end
23
33
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RakeSecrets
4
- VERSION = '0.1.0.pre.2'
4
+ VERSION = '0.1.0.pre.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake_secrets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre.2
4
+ version: 0.1.0.pre.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - InfraBlocks Maintainers
@@ -65,9 +65,11 @@ files:
65
65
  - lib/rake_secrets/transformers/erb_template.rb
66
66
  - lib/rake_secrets/transformers/identity.rb
67
67
  - lib/rake_secrets/types.rb
68
+ - lib/rake_secrets/types/alphabetic.rb
68
69
  - lib/rake_secrets/types/alphanumeric.rb
69
70
  - lib/rake_secrets/types/character_set.rb
70
71
  - lib/rake_secrets/types/constant.rb
72
+ - lib/rake_secrets/types/numeric.rb
71
73
  - lib/rake_secrets/version.rb
72
74
  - rake_secrets.gemspec
73
75
  homepage: https://github.com/infrablocks/rake_secrets