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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rake_secrets/types/alphabetic.rb +32 -0
- data/lib/rake_secrets/types/numeric.rb +22 -0
- data/lib/rake_secrets/types.rb +10 -0
- data/lib/rake_secrets/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74d4dd4e8fc036cfe4489f8998c46d8841b298cdd0b50583c7233e8fdd5d8aed
|
4
|
+
data.tar.gz: b1e2cba8af58326856a87aaaa0cc60d494b4892e52b8be21850b17ba1030156e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz: '
|
6
|
+
metadata.gz: da7bd3843a0d2bf0515e6c92f00427d97d3d589f7971c406e8b6ee94e5cd73ca8036a73c856525724a6cc8b416e225eb2cd368af540ba42a99f4123887d5463b
|
7
|
+
data.tar.gz: '080cfd5e18baeee7134bcd6285483b4bfdf0790656842fc28f391e3ec11a34a9ff1f8daf5042bde61077122798008c9cfc0535e5cc65ac0182ab3e04ec73fa12'
|
data/Gemfile.lock
CHANGED
@@ -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
|
data/lib/rake_secrets/types.rb
CHANGED
@@ -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
|
data/lib/rake_secrets/version.rb
CHANGED
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.
|
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
|