mkpassword 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ae27d5e22631a72a4ead9357f420418dfdd9e173e52f6ff04086586eb044fe56
4
+ data.tar.gz: 5009835f386f53598863b4f522d6f771a8a0686176c1bf5abccede7a53fb99e9
5
+ SHA512:
6
+ metadata.gz: 48d5f8433fd03224e935e27e711b3de6cbf7342b042681481176b28536a7566bb024f632da429f898575cc3d2809c4e1f61729cb54447a5ed1b88555c92636e2
7
+ data.tar.gz: 34fae129daa1403fe62466b8a5523af088b6fbcdb50a785223ea5d836052b2f0bd981fbd6d509563ab219e8b448dcbe08c4df0a5e67d6cb775213e1cd4141575
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.5.1
5
+ before_install: gem install bundler -v 1.16.1
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in mkpassword.gemspec
6
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 s3fxn
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,43 @@
1
+ # mkpassword
2
+
3
+ mkpassword - simple password generator
4
+
5
+ ## Installation
6
+
7
+ $ gem install mkpassword
8
+ (you may need to run as root or through sudo.)
9
+
10
+ ## Usage
11
+
12
+ ```
13
+ mkpassword [options]
14
+ -l length (default:12)
15
+ -s number of special characters (default:0)
16
+ -c count (default:1)
17
+
18
+
19
+ $ mkpassword
20
+ sBda9KLtmW2V
21
+
22
+ $ mkpassword -l 15
23
+ HoRwLab9CDbdq8S
24
+
25
+ $ mkpassword -l 15 -s 2
26
+ H{enlJVxuqeR#3j
27
+
28
+ $ mkpassword -l 15 -s 2 -c 5
29
+ 0r]VWku;LL7ieqU
30
+ bY$DMXm5Zp!jXIF
31
+ hZfM3M98M+@kZIC
32
+ xlgHo|&loKCFGXN
33
+ UsJgZSR1^K0W;kM
34
+
35
+ ```
36
+
37
+ ## Contributing
38
+
39
+ Bug reports and pull requests are welcome on GitHub at https://github.com/s3fxn/mkpassword.
40
+
41
+ ## License
42
+
43
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "mkpassword"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+ require 'securerandom'
5
+
6
+ params = ARGV.getopts("l:s:c:","help")
7
+
8
+ if params['help']
9
+ puts "
10
+ Usage: #{$0} [options]
11
+ -l length (default:12)
12
+ -s number of special characters (default:0)
13
+ -c count (default:1)
14
+
15
+ "
16
+ exit
17
+ end
18
+
19
+ l = params['l']&.to_i || 12
20
+ s = params['s']&.to_i || 0
21
+ c = params['c']&.to_i || 1
22
+
23
+ special_src = [*'!'..'~'] - [*'a'..'z'] - [*'A'..'Z'] - [*'0'..'9']
24
+
25
+ if (l - s) < 1 or l < 1 or c < 1
26
+ puts 'Error'
27
+ exit 1
28
+ end
29
+
30
+ c.times {
31
+ alphanumerics = SecureRandom.alphanumeric(l - s).split(//)
32
+ specialchars = s.times.map { special_src[SecureRandom.random_number(special_src.size)] }
33
+ results = (alphanumerics + specialchars).shuffle.join
34
+ puts results
35
+ }
@@ -0,0 +1,5 @@
1
+ require "mkpassword/version"
2
+
3
+ module Mkpassword
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,3 @@
1
+ module Mkpassword
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,26 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "mkpassword/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "mkpassword"
8
+ spec.version = Mkpassword::VERSION
9
+ spec.authors = ["s3fxn"]
10
+ spec.email = ["sssfxn@gmail.com"]
11
+
12
+ spec.summary = %q{mkpassword - simple password generator}
13
+ spec.homepage = "https://github.com/s3fxn/mkpassword"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.16"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "rspec", "~> 3.0"
26
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mkpassword
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - s3fxn
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-10-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description:
56
+ email:
57
+ - sssfxn@gmail.com
58
+ executables:
59
+ - mkpassword
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - ".rspec"
65
+ - ".travis.yml"
66
+ - Gemfile
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - bin/console
71
+ - bin/setup
72
+ - exe/mkpassword
73
+ - lib/mkpassword.rb
74
+ - lib/mkpassword/version.rb
75
+ - mkpassword.gemspec
76
+ homepage: https://github.com/s3fxn/mkpassword
77
+ licenses:
78
+ - MIT
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.7.6
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: mkpassword - simple password generator
100
+ test_files: []