pass 0.0.3 → 0.0.6

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
- SHA1:
3
- metadata.gz: 91bcbf233648df0ab6b9b4a676eb9edc2ba9878a
4
- data.tar.gz: 6ab800006ea66bbe80c5fdfa274d056de1eae4b7
2
+ SHA256:
3
+ metadata.gz: 12c7cafaf8a91ed0368e4614da00d55b6523851122a14330daf44a5fbcf7637c
4
+ data.tar.gz: 3e591a5f56b686d273aafbadf40da32e3a70a0a16f9f97e832db5a6347896a92
5
5
  SHA512:
6
- metadata.gz: 06e9e65a42cf8323eb67d8f010c72040e8a9200df6b3b6a64c7116ac1d011d4eadfc3dd6c31143659588ae2f2bea3e22c8c879c2f7b9f5f4e6c0e853502b291c
7
- data.tar.gz: 1aeb65fb37aec9c688e32e33351f7b59c38e354751e727ee0f3227c35ab266e69af7b3652a7c6d3e7ed64ec238ebd356f8ecaab2bac412d6bac1e99f4c3abd38
6
+ metadata.gz: 17be1cb82ca32d01d359d11fd14bde4b93a4f6efe956396415c12e54c06a0fbed66b2978047db3ddc8ffe3b4ea9a6710020609483d19336ac627abc531dd45fc
7
+ data.tar.gz: ee878a0713c20dfcdc3a349f2951df271503bb86174b7024d38490b9ff10393cd8be58a4c5124e4c42e32459883e8489f17542f1bab30193841fd451e5b8f774
@@ -0,0 +1,36 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: CI
9
+
10
+ on:
11
+ push:
12
+ branches: [ main ]
13
+ pull_request:
14
+ branches: [ main ]
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ test:
21
+ runs-on: ubuntu-latest
22
+ strategy:
23
+ matrix:
24
+ ruby-version: [ '2.5', '2.6', '2.7', '3.0', '3.1' ]
25
+ steps:
26
+ - uses: actions/checkout@v3
27
+ - name: Set up Ruby
28
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
29
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
30
+ # uses: ruby/setup-ruby@v1
31
+ uses: ruby/setup-ruby@2b019609e2b0f1ea1a2bc8ca11cb82ab46ada124
32
+ with:
33
+ ruby-version: ${{ matrix.ruby-version }}
34
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
35
+ - name: Run tests for ${{ matrix.ruby }}
36
+ run: bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .DS_Store
11
+ /.idea/
data/.rspec CHANGED
@@ -1 +1,2 @@
1
+ --format documentation
1
2
  --color
data/Gemfile CHANGED
@@ -1,14 +1,10 @@
1
- source "http://rubygems.org"
2
- # Add dependencies required to use your gem here.
3
- # Example:
4
- # gem "activesupport", ">= 2.3.5"
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in pass.gemspec
4
+ gemspec
5
+
6
+ ruby '>= 2.5'
5
7
 
6
- # Add dependencies to develop your gem here.
7
- # Include everything needed to run rake, tests, features, etc.
8
8
  group :development do
9
- gem "rspec", "~> 2.8.0"
10
- gem "shoulda", ">= 0"
11
- gem "yard", "~> 0.7"
12
- gem "bundler", "~> 1.9.1"
13
- gem "jeweler", "~> 1.8.3"
9
+ gem 'rubocop', '~> 1.16.0'
14
10
  end
data/LICENSE.txt CHANGED
@@ -1,20 +1,21 @@
1
+ The MIT License (MIT)
2
+
1
3
  Copyright (c) 2011 Hitoshi Kurokawa
2
4
 
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
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:
10
11
 
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
13
14
 
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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.
data/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # pass
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/pass.svg)](https://badge.fury.io/rb/pass)
4
+ ![Testing workflow](https://github.com/krhitoshi/pass/workflows/Testing%20workflow/badge.svg)
5
+
6
+ ## Description
7
+
8
+ The 'pass' command generates random passwords.
9
+
10
+ ## Installation
11
+
12
+ All you have to do is to install the gem
13
+
14
+ ```
15
+ $ gem install pass
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ You can run 'pass' to generate one random password.
21
+ Generated passwords have 20 characters and does not include ambiguous characters ``l o I O 1 " ' ` |``.
22
+ As default, a password consists of upper case letters, lower case letters, and numbers.
23
+
24
+ ```
25
+ $ pass
26
+ ```
27
+
28
+ If you need more passwords, you can specify the number of passwords.
29
+
30
+ ```
31
+ $ pass 12
32
+ ```
33
+
34
+ You can specify the password length with -l or --length option.
35
+
36
+ ```
37
+ $ pass -l 30
38
+ $ pass --length 50
39
+ ```
40
+
41
+ You can use -s or --symbols option to include symbols in passwords.
42
+
43
+ ```
44
+ $ pass -s
45
+ $ pass --symbols
46
+ ```
47
+
48
+ You can specify certain characters you don't want to put in passwords with -e or --exclude option.
49
+
50
+ ```
51
+ $ pass -e 'ABCD678'
52
+ $ pass --symbols --exclude '*[]{}/\'
53
+ ```
54
+
55
+ ## Options
56
+
57
+ ```
58
+ -c [NUMBER] (deprecated) specify password length
59
+ -l, --length [NUMBER] specify password length
60
+ -s, --symbols include symbols
61
+ -e, --exclude [CHARACTERS] exclude characters
62
+ -v, --version show version
63
+ ```
64
+
65
+ ## License
66
+
67
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -1,43 +1,6 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require 'rake'
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
11
3
 
12
- require 'jeweler'
13
- Jeweler::Tasks.new do |gem|
14
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
- gem.name = "pass"
16
- gem.homepage = "http://github.com/krhitoshi/pass"
17
- gem.license = "MIT"
18
- gem.summary = %Q{Password Generator for CUI}
19
- gem.description = %Q{gem pass - Password Generator for CUI}
20
- gem.email = "hitoshi@nextseed.jp"
21
- gem.authors = ["Hitoshi Kurokawa"]
22
- # Include your dependencies below. Runtime dependencies are required when using your gem,
23
- # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
24
- # gem.add_runtime_dependency 'jabber4r', '> 0.1'
25
- # gem.add_development_dependency 'rspec', '> 1.2.3'
26
- end
27
- Jeweler::RubygemsDotOrgTasks.new
28
-
29
- require 'rspec/core'
30
- require 'rspec/core/rake_task'
31
- RSpec::Core::RakeTask.new(:spec) do |spec|
32
- spec.pattern = FileList['spec/**/*_spec.rb']
33
- end
34
-
35
- RSpec::Core::RakeTask.new(:rcov) do |spec|
36
- spec.pattern = 'spec/**/*_spec.rb'
37
- spec.rcov = true
38
- end
4
+ RSpec::Core::RakeTask.new(:spec)
39
5
 
40
6
  task :default => :spec
41
-
42
- require 'yard'
43
- YARD::Rake::YardocTask.new
data/bin/console ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "pass"
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
+ require "pry"
10
+ Pry.start
data/bin/setup ADDED
@@ -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
data/{bin → exe}/pass RENAMED
@@ -3,6 +3,6 @@
3
3
 
4
4
  $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
5
5
  require 'rubygems'
6
- require 'pass'
6
+ require 'pass/cli'
7
7
 
8
- Pass.new.exec(ARGV)
8
+ Pass::CLI.new.exec(ARGV)
data/lib/pass/cli.rb ADDED
@@ -0,0 +1,77 @@
1
+ require 'optparse'
2
+ require 'pass'
3
+ require 'pass/version'
4
+
5
+ class Pass
6
+ class CLI
7
+ class Error < StandardError; end
8
+
9
+ def exec(argv)
10
+ options = {}
11
+ options[:length] = Pass::DEFAULT_PASSWORD_LENGTH
12
+
13
+ opts = OptionParser.new
14
+
15
+ opts.on('-c [NUMBER]', '(deprecated) specify password length') do |value|
16
+ options[:length] = option_to_i(value)
17
+ end
18
+
19
+ opts.on('-l', '--length [NUMBER]', 'specify password length') do |value|
20
+ options[:length] = option_to_i(value)
21
+ end
22
+
23
+ opts.on('-s', '--symbols', 'include symbols') do |value|
24
+ options[:symbols] = value
25
+ end
26
+
27
+ opts.on('-e', '--exclude [CHARACTERS]', 'exclude characters') do |value|
28
+ options[:exclude] = value
29
+ end
30
+
31
+ opts.on_tail('-v', '--version', 'show version') do
32
+ puts "pass #{Pass::VERSION}"
33
+ exit 0
34
+ end
35
+
36
+ opts.banner = banner
37
+
38
+ begin
39
+ res_argv = opts.parse!(argv)
40
+ num_passwords = if res_argv[0]
41
+ option_to_i(res_argv[0])
42
+ else
43
+ Pass::DEFAULT_NUM_PASSWORDS
44
+ end
45
+
46
+ pass = Pass.new(**options)
47
+
48
+ num_passwords.times do
49
+ puts pass.generate
50
+ end
51
+ rescue Pass::Error, Pass::CLI::Error, OptionParser::ParseError => e
52
+ abort "Error: #{e.message}"
53
+ end
54
+
55
+ exit 0
56
+ end
57
+
58
+ private
59
+
60
+ def option_to_i(opt)
61
+ Integer(opt)
62
+ rescue ArgumentError => _e
63
+ raise Error, "the option must be an integer: '#{opt}'"
64
+ end
65
+
66
+ def banner
67
+ <<~BANNER
68
+ Usage: pass [options] [number of passwords]
69
+
70
+ Description:
71
+ The 'pass' command generates random passwords.
72
+
73
+ Options:
74
+ BANNER
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,3 @@
1
+ class Pass
2
+ VERSION = '0.0.6'
3
+ end
data/lib/pass.rb CHANGED
@@ -1,91 +1,72 @@
1
- require 'optparse'
2
-
3
1
  class Pass
4
- MIN_NUM_CHARACTERS = 3
5
- NUM_CHARACTERS = 12
2
+ MIN_PASSWORD_LENGTH = 5
3
+ DEFAULT_NUM_PASSWORDS = 1
4
+ DEFAULT_PASSWORD_LENGTH = 20
5
+
6
+ ALPHABETIC_CHARS = ('a'..'z').to_a + ('A'..'Z').to_a
7
+ NUMERIC_CHARS = ('1'..'9').to_a
8
+ SYMBOL_CHARS = ('!'..'/').to_a + (':'..'@').to_a + ('['..'`').to_a + ('{'..'~').to_a
9
+ AMBIGUOUS_CHARS = %w[l o I O 1 " ' ` |]
6
10
 
7
11
  class Error < StandardError; end
8
12
 
9
- def initialize
10
- @list_carachters = ('a'..'z').to_a + ('A'..'Z').to_a + ('1'..'9').to_a - %w[l o I O 1]
11
- @num_iteration = 100
12
- @validation_regexps = [/\d/, /[a-z]/, /[A-Z]/]
13
+ def initialize(**options)
14
+ @options = { length: DEFAULT_PASSWORD_LENGTH }
15
+ @options.update(options)
13
16
  end
14
17
 
15
- def generate(num = NUM_CHARACTERS)
16
- if !integer?(num) || num < MIN_NUM_CHARACTERS
17
- raise Pass::Error, "Invalid Argument: number of characters should be more than #{MIN_NUM_CHARACTERS}."
18
- end
18
+ def char_list
19
+ list = ALPHABETIC_CHARS + NUMERIC_CHARS
19
20
 
20
- @num_iteration.times do
21
- pass = @list_carachters.sample(num).join
22
- return pass if valid?(pass)
23
- end
24
- raise "Not Converged: #{@num_iteration} times"
25
- end
21
+ list += SYMBOL_CHARS if @options[:symbols]
26
22
 
27
- def valid?(pass)
28
- @validation_regexps.all?{|reg| reg =~ pass}
29
- end
23
+ list -= exclude_char_list
30
24
 
31
- def multi_generate(num_password, num_character = NUM_CHARACTERS)
32
- passwords = []
33
- num_password.times do
34
- passwords << generate(num_character)
35
- end
36
- passwords
25
+ list
37
26
  end
38
27
 
39
- def Pass.generate(num = NUM_CHARACTERS)
40
- Pass.new.generate(num)
28
+ def exclude_char_list
29
+ list = AMBIGUOUS_CHARS
30
+ list += @options[:exclude].split(//).sort.uniq if @options[:exclude]
31
+ list
41
32
  end
42
33
 
43
- def exec(argv)
44
- num_characters = NUM_CHARACTERS
45
- opts = OptionParser.new
46
- opts.on('-c NUM', 'specify password length') do |value|
47
- num_characters = value
48
- end
49
- opts.on_tail('-v', '--version', 'show version') do
50
- puts "#{self.class.name} #{version}"
51
- exit 0
34
+ def generate
35
+ length = @options[:length]
36
+
37
+ if length < MIN_PASSWORD_LENGTH
38
+ raise Pass::Error,
39
+ "Invalid Argument: password length must be more than #{MIN_PASSWORD_LENGTH}."
52
40
  end
53
- opts.banner = <<END
54
- Usage: pass [options] [number of passwords]
55
-
56
- Description:
57
- Generates random passwords.
58
-
59
- Options:
60
- END
61
- begin
62
- res_argv = opts.parse!(argv)
63
- num_times = res_argv[0] || 1
64
- puts multi_generate(num_times.to_i, num_characters.to_i)
65
- rescue SystemExit
66
- rescue Exception => e
67
- $stderr.puts "Error: #{e.message}"
68
- exit 1
41
+
42
+ rest_length = length
43
+ result = ""
44
+ # append append password string until 'result' reaches the 'length'
45
+ while rest_length > char_list_size
46
+ result += generate_password_base(char_list_size)
47
+ rest_length -= char_list_size
69
48
  end
70
- exit 0
71
- end
49
+ result += generate_password_base(rest_length)
72
50
 
73
- def num_iteration
74
- @num_iteration
51
+ result
75
52
  end
76
53
 
77
- def num_iteration=(value)
78
- raise(Error, "Invalid Argument: num_iteration #{value}") if !integer?(value) || value <= 0
79
- @num_iteration = value
54
+ def self.generate(num = DEFAULT_PASSWORD_LENGTH)
55
+ new(length: num).generate
80
56
  end
81
57
 
82
- def version
83
- number = File.read(File.dirname(__FILE__) + '/../VERSION')
84
- number.chomp
58
+ private
59
+
60
+ def char_list_size
61
+ char_list.size
85
62
  end
86
63
 
87
- private
88
- def integer?(value)
89
- value.kind_of?(Integer)
64
+ # generate a password that is long less than 'char_list_size'
65
+ def generate_password_base(length)
66
+ if length > char_list_size
67
+ raise ArgumentError, "argument must be less than #{char_list_size}"
68
+ end
69
+
70
+ char_list.sample(length).join
90
71
  end
91
72
  end
data/pass.gemspec CHANGED
@@ -1,65 +1,27 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
- # stub: pass 0.0.3 ruby lib
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'pass/version'
6
5
 
7
- Gem::Specification.new do |s|
8
- s.name = "pass"
9
- s.version = "0.0.3"
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "pass"
8
+ spec.version = Pass::VERSION
9
+ spec.authors = ["Hitoshi Kurokawa"]
10
+ spec.email = ["hitoshi@nextseed.jp"]
10
11
 
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.require_paths = ["lib"]
13
- s.authors = ["Hitoshi Kurokawa"]
14
- s.date = "2015-08-22"
15
- s.description = "gem pass - Password Generator for CUI"
16
- s.email = "hitoshi@nextseed.jp"
17
- s.executables = ["pass"]
18
- s.extra_rdoc_files = [
19
- "LICENSE.txt",
20
- "README.rdoc"
21
- ]
22
- s.files = [
23
- ".document",
24
- ".rspec",
25
- "Gemfile",
26
- "LICENSE.txt",
27
- "README.rdoc",
28
- "Rakefile",
29
- "VERSION",
30
- "bin/pass",
31
- "lib/pass.rb",
32
- "pass.gemspec",
33
- "spec/pass_spec.rb",
34
- "spec/spec_helper.rb"
35
- ]
36
- s.homepage = "http://github.com/krhitoshi/pass"
37
- s.licenses = ["MIT"]
38
- s.rubygems_version = "2.4.5"
39
- s.summary = "Password Generator for CUI"
12
+ spec.summary = %q{Password Generator (CLI)}
13
+ spec.description = %q{gem pass - Password Generator (CLI)}
14
+ spec.homepage = "http://github.com/krhitoshi/pass"
15
+ spec.license = "MIT"
40
16
 
41
- if s.respond_to? :specification_version then
42
- s.specification_version = 4
43
-
44
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
- s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
46
- s.add_development_dependency(%q<shoulda>, [">= 0"])
47
- s.add_development_dependency(%q<yard>, ["~> 0.7"])
48
- s.add_development_dependency(%q<bundler>, ["~> 1.9.1"])
49
- s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
50
- else
51
- s.add_dependency(%q<rspec>, ["~> 2.8.0"])
52
- s.add_dependency(%q<shoulda>, [">= 0"])
53
- s.add_dependency(%q<yard>, ["~> 0.7"])
54
- s.add_dependency(%q<bundler>, ["~> 1.9.1"])
55
- s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
56
- end
57
- else
58
- s.add_dependency(%q<rspec>, ["~> 2.8.0"])
59
- s.add_dependency(%q<shoulda>, [">= 0"])
60
- s.add_dependency(%q<yard>, ["~> 0.7"])
61
- s.add_dependency(%q<bundler>, ["~> 1.9.1"])
62
- s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
63
19
  end
64
- end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
65
23
 
24
+ spec.add_development_dependency "rake", "~> 12.0"
25
+ spec.add_development_dependency "rspec", "~> 3.0"
26
+ spec.add_development_dependency "pry"
27
+ end
metadata CHANGED
@@ -1,111 +1,84 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hitoshi Kurokawa
8
- autorequire:
9
- bindir: bin
8
+ autorequire:
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-22 00:00:00.000000000 Z
11
+ date: 2022-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rspec
14
+ name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.8.0
19
+ version: '12.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.8.0
26
+ version: '12.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: shoulda
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: yard
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '0.7'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '0.7'
55
- - !ruby/object:Gem::Dependency
56
- name: bundler
28
+ name: rspec
57
29
  requirement: !ruby/object:Gem::Requirement
58
30
  requirements:
59
31
  - - "~>"
60
32
  - !ruby/object:Gem::Version
61
- version: 1.9.1
33
+ version: '3.0'
62
34
  type: :development
63
35
  prerelease: false
64
36
  version_requirements: !ruby/object:Gem::Requirement
65
37
  requirements:
66
38
  - - "~>"
67
39
  - !ruby/object:Gem::Version
68
- version: 1.9.1
40
+ version: '3.0'
69
41
  - !ruby/object:Gem::Dependency
70
- name: jeweler
42
+ name: pry
71
43
  requirement: !ruby/object:Gem::Requirement
72
44
  requirements:
73
- - - "~>"
45
+ - - ">="
74
46
  - !ruby/object:Gem::Version
75
- version: 1.8.3
47
+ version: '0'
76
48
  type: :development
77
49
  prerelease: false
78
50
  version_requirements: !ruby/object:Gem::Requirement
79
51
  requirements:
80
- - - "~>"
52
+ - - ">="
81
53
  - !ruby/object:Gem::Version
82
- version: 1.8.3
83
- description: gem pass - Password Generator for CUI
84
- email: hitoshi@nextseed.jp
54
+ version: '0'
55
+ description: gem pass - Password Generator (CLI)
56
+ email:
57
+ - hitoshi@nextseed.jp
85
58
  executables:
86
59
  - pass
87
60
  extensions: []
88
- extra_rdoc_files:
89
- - LICENSE.txt
90
- - README.rdoc
61
+ extra_rdoc_files: []
91
62
  files:
92
- - ".document"
63
+ - ".github/workflows/ci.yml"
64
+ - ".gitignore"
93
65
  - ".rspec"
94
66
  - Gemfile
95
67
  - LICENSE.txt
96
- - README.rdoc
68
+ - README.md
97
69
  - Rakefile
98
- - VERSION
99
- - bin/pass
70
+ - bin/console
71
+ - bin/setup
72
+ - exe/pass
100
73
  - lib/pass.rb
74
+ - lib/pass/cli.rb
75
+ - lib/pass/version.rb
101
76
  - pass.gemspec
102
- - spec/pass_spec.rb
103
- - spec/spec_helper.rb
104
77
  homepage: http://github.com/krhitoshi/pass
105
78
  licenses:
106
79
  - MIT
107
80
  metadata: {}
108
- post_install_message:
81
+ post_install_message:
109
82
  rdoc_options: []
110
83
  require_paths:
111
84
  - lib
@@ -120,9 +93,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
93
  - !ruby/object:Gem::Version
121
94
  version: '0'
122
95
  requirements: []
123
- rubyforge_project:
124
- rubygems_version: 2.4.5
125
- signing_key:
96
+ rubygems_version: 3.3.7
97
+ signing_key:
126
98
  specification_version: 4
127
- summary: Password Generator for CUI
99
+ summary: Password Generator (CLI)
128
100
  test_files: []
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
data/README.rdoc DELETED
@@ -1,44 +0,0 @@
1
- = Pass
2
-
3
- Pass is a command to generator random passwords for CUI.
4
-
5
- == Using
6
-
7
- The first step is to install the gem
8
-
9
- gem install pass
10
-
11
- You can run Pass to generate one random password. A generated password has 12 characters with more than one upper case letter, lower case letter, and numeric character.
12
-
13
- pass
14
-
15
- If you need more passwords, you can specify the number of passwords.
16
-
17
- pass 12
18
-
19
- You can specify the password length by -c option.
20
-
21
- pass -c 18
22
-
23
- == Options
24
-
25
- ```
26
- -c NUM specify password length
27
- -v, --version show version
28
- ```
29
-
30
- == Contributing to Pass
31
-
32
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
33
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
34
- * Fork the project
35
- * Start a feature/bugfix branch
36
- * Commit and push until you are happy with your contribution
37
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
38
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
39
-
40
- == Copyright
41
-
42
- Copyright (c) 2011 Hitoshi Kurokawa. See LICENSE.txt for
43
- further details.
44
-
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.0.3
data/spec/pass_spec.rb DELETED
@@ -1,180 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require "stringio"
3
-
4
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
5
-
6
- describe Pass do
7
- before do
8
- @pass = Pass.new
9
- end
10
-
11
- describe "出力される文字数" do
12
- it "文字数を指定できること" do
13
- @pass.generate(3).size.should be(3)
14
- @pass.generate(12).size.should be(12)
15
- @pass.generate(30).size.should be(30)
16
- end
17
-
18
- it "文字数を指定しない場合は12文字であること" do
19
- @pass.generate.size.should be(12)
20
- end
21
- end
22
-
23
- describe "特定文字が含まれること含まれないこと" do
24
- it "文字列に数字が1文字以上含まれること" do
25
- 10.times do
26
- (@pass.generate(3) =~ /\d/).should be_true
27
- end
28
- end
29
-
30
- it "文字列に小文字が1文字以上含まれること" do
31
- 10.times do
32
- (@pass.generate(3) =~ /[a-z]/).should be_true
33
- end
34
- end
35
-
36
- it "文字列に大文字が1文字以上含まれること" do
37
- 10.times do
38
- (@pass.generate(3) =~ /[A-Z]/).should be_true
39
- end
40
- end
41
-
42
- it "見間違えやすい文字列が含まれないこと" do
43
- exclude_characters = %w[l o I O 1]
44
- 50.times do
45
- (@pass.generate =~ /[#{exclude_characters.join}]/).should be_false
46
- end
47
- end
48
- end
49
-
50
- describe "valid?" do
51
- it "validなパスワードでtrueを返すこと" do
52
- @pass.valid?("aT2").should be_true
53
- @pass.valid?("1bR").should be_true
54
- @pass.valid?("J0e").should be_true
55
- end
56
-
57
- it "invalidなパスワードでfalseを返すこと" do
58
- @pass.valid?("012").should be_false
59
- @pass.valid?("abc").should be_false
60
- @pass.valid?("ABC").should be_false
61
- @pass.valid?("0bc").should be_false
62
- @pass.valid?("0BC").should be_false
63
- @pass.valid?("AbC").should be_false
64
- end
65
- end
66
-
67
- describe "イテレーションの回数" do
68
- it "回数値を読み込めること" do
69
- @pass.num_iteration.should be(100)
70
- end
71
-
72
- it "回数値を変更できること" do
73
- @pass.num_iteration = 10
74
- @pass.num_iteration.should be(10)
75
- end
76
-
77
- it "0以下の回数値を入力すると例外を発生" do
78
- lambda{ @pass.num_iteration = 0 }.should raise_error(Pass::Error)
79
- lambda{ @pass.num_iteration = -10 }.should raise_error(Pass::Error)
80
- end
81
- end
82
-
83
- describe "例外の発生" do
84
- describe "特定回数の生成試行数を超えると例外を発生すること" do
85
- before do
86
- @pass.num_iteration = 1
87
- end
88
-
89
- after do
90
- @pass.num_iteration = 100
91
- end
92
-
93
- it do
94
- lambda{
95
- 10.times do
96
- @pass.generate(3)
97
- end
98
- }.should raise_error
99
- end
100
- end
101
-
102
- it "2以下の文字数を指定すると例外を発生すること" do
103
- lambda{ @pass.generate(2) }.should raise_error(Pass::Error)
104
- lambda{ @pass.generate(0) }.should raise_error(Pass::Error)
105
- lambda{ @pass.generate(-10) }.should raise_error(Pass::Error)
106
- end
107
-
108
- it "不正な回数値を入力すると例外を発生すること" do
109
- lambda{ @pass.num_iteration = "abc" }.should raise_error(Pass::Error)
110
- end
111
-
112
- it "不正な文字数を入力すると例外を発生すること" do
113
- lambda{ @pass.generate("abc") }.should raise_error(Pass::Error)
114
- end
115
- end
116
-
117
- describe "複数パスワードの生成" do
118
- it "指定した個数のパスワードを配列で返すこと" do
119
- @pass.multi_generate(2).size.should be(2)
120
- end
121
- end
122
-
123
- describe "コマンド用メソッド" do
124
- before do
125
- $stdout = StringIO.new
126
- end
127
-
128
- after do
129
- $stdout = STDOUT
130
- end
131
-
132
- it "オプション無しで1個のパスワードが返ってくること" do
133
- argv = [] # オプションなし
134
- lambda{ @pass.exec(argv) }.should raise_error(SystemExit)
135
- passwords = $stdout.string.chomp.split("\n")
136
- passwords.size.should be(1)
137
- passwords.first.size.should be(12)
138
- end
139
-
140
- it "パスワード数が指定できること" do
141
- argv = [20] # 20パスワード
142
- lambda{ @pass.exec(argv) }.should raise_error(SystemExit)
143
- passwords = $stdout.string.chomp.split("\n")
144
- passwords.size.should be(20)
145
- passwords.each do |password|
146
- password.size.should be(12)
147
- end
148
- end
149
-
150
- it "-cで文字数指定ができること" do
151
- argv = %w[3 -c 16] # 16文字 3パスワード
152
- lambda{ @pass.exec(argv) }.should raise_error(SystemExit)
153
- passwords = $stdout.string.chomp.split("\n")
154
- passwords.size.should be(3)
155
- passwords.each do |password|
156
- password.size.should be(16)
157
- end
158
- end
159
-
160
- it "指定順序が変わっても-cで文字数指定ができること" do
161
- argv = %w[-c 16 3] # 16文字 3パスワード
162
- lambda{ @pass.exec(argv) }.should raise_error(SystemExit)
163
- passwords = $stdout.string.chomp.split("\n")
164
- passwords.size.should be(3)
165
- passwords.each do |password|
166
- password.size.should be(16)
167
- end
168
- end
169
-
170
- it "-vでバージョン表示をするとSystemExitすること" do
171
- argv = %w[-v]
172
- lambda{ @pass.exec(argv) }.should raise_error(SystemExit)
173
- end
174
-
175
- it "-hでヘルプ表示をするとSystemExitすること" do
176
- argv = %w[-h]
177
- lambda{ @pass.exec(argv) }.should raise_error(SystemExit)
178
- end
179
- end
180
- end
data/spec/spec_helper.rb DELETED
@@ -1,12 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
- $LOAD_PATH.unshift(File.dirname(__FILE__))
3
- require 'rspec'
4
- require 'pass'
5
-
6
- # Requires supporting files with custom matchers and macros, etc,
7
- # in ./support/ and its subdirectories.
8
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
-
10
- RSpec.configure do |config|
11
-
12
- end