dmp 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/dmp/cli.rb ADDED
@@ -0,0 +1,54 @@
1
+ require 'thor'
2
+ require 'dmp'
3
+ require 'colorize'
4
+ require 'clipboard'
5
+
6
+ module Dmp
7
+ # Command line interface for DMP
8
+ class CLI < Thor
9
+ default_task :gen_pass
10
+ desc 'gen [length]', 'Generate a passphrase of the desired length.'
11
+ method_option :clipboard,
12
+ aliases: '-c',
13
+ type: :boolean,
14
+ desc: 'Copy passphrase to clipboard.'
15
+ def gen_pass(pass_length = 7)
16
+ # Generate colored passphrase
17
+ passphrase = Dmp.gen_passphrase(pass_length.to_i)
18
+
19
+ # if flag clipboard is 'true' then copy passphrase to clipboard
20
+ if options[:clipboard]
21
+ Clipboard.copy(passphrase.join(' '))
22
+ end
23
+
24
+ # colors array will be used to pick a randomized sample
25
+ # removing black cause it looks ugly in terminals
26
+ colors = String.colors
27
+ colors.delete(:black)
28
+
29
+ passphrase.map! do |phrase|
30
+ rand_color = colors.sample
31
+ phrase.colorize(rand_color)
32
+ end
33
+ print '[*] Passphrase: '.bold + passphrase.join(' ')
34
+ end
35
+
36
+ desc 'about', 'Displays version number and information'
37
+ def about
38
+ # Displays banner, version number and author
39
+ banner = '''
40
+ ____ __ __ ____
41
+ | _ \ | \/ | | _ \
42
+ | | | | | |\/| | | |_) |
43
+ | |_| | | | | | | __/
44
+ |____/ |_| |_| |_|
45
+ '''.bold.red
46
+ puts banner
47
+ puts ' version: '.bold + '0.1.0'.white
48
+ puts ' author: '.bold + '@__franccesco'.green
49
+ puts ' homepage: '.bold + 'https://github.com/franccesco/dmp'.green
50
+ puts ' learn more: '.bold + 'https://codingdose.info'.green
51
+ puts # extra line, somehow I like them.
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,3 @@
1
+ module Dmp
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,160 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dmp
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Franccesco Orozco
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-09-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: colorize
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
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: clipboard
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.16'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.16'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: minitest
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '5.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '5.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: minitest-reporters
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.3'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.3'
111
+ description: Generates a passphrase using EFF's long wordlist.
112
+ email:
113
+ - franccesco@codingdose.info
114
+ executables:
115
+ - dmp
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - ".gitignore"
120
+ - ".rubocop.yml"
121
+ - ".travis.yml"
122
+ - CODE_OF_CONDUCT.md
123
+ - Gemfile
124
+ - Gemfile.lock
125
+ - LICENSE.txt
126
+ - README.md
127
+ - Rakefile
128
+ - bin/console
129
+ - bin/setup
130
+ - dmp.gemspec
131
+ - exe/dmp
132
+ - lib/dmp.rb
133
+ - lib/dmp/assets/eff_long_wordlist.txt
134
+ - lib/dmp/cli.rb
135
+ - lib/dmp/version.rb
136
+ homepage: https://github.com/franccesco/dmp
137
+ licenses:
138
+ - MIT
139
+ metadata: {}
140
+ post_install_message:
141
+ rdoc_options: []
142
+ require_paths:
143
+ - lib
144
+ required_ruby_version: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ required_rubygems_version: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ requirements: []
155
+ rubyforge_project:
156
+ rubygems_version: 2.7.7
157
+ signing_key:
158
+ specification_version: 4
159
+ summary: Generate a secure passphrase.
160
+ test_files: []