perfect_world 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data.tar.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -34,7 +34,7 @@ in the package repo of your linux distribution. Check out the
34
34
  [GPGTools](https://www.gpgtools.org/installer/index.html) project, if you
35
35
  are on a Mac.
36
36
 
37
- In addition you need at least Ruby 1.9.3.
37
+ In addition you need at least Ruby 1.9.
38
38
 
39
39
  ## pwm
40
40
 
@@ -76,35 +76,35 @@ Or clone the repo.
76
76
  Let's create some passwords.
77
77
 
78
78
  $ pwm --generate github
79
- 9&sq'8Gz.Bpb8#%M.T-Xyi#&.sDcTYFE.=qFyEbld Z[wA'By75y?NA?qUy}U>xd github
79
+ 9&sq'8Gz.Bpb8#%M.T-Xyi#&.sDcTYFE.=qFyEbld-Z[wA'By75y?NA?qUy}U>xd
80
80
  $ pwm --generate google
81
- 8UN:'I1^M)H\kj'U{4l!.tK3\v9V+}L4$XNal \rzE@c\["&u#@#TRINt5"Jj[6A google
81
+ 8UN:'I1^M)H\kj'U{4l!.tK3\v9V+}L4$XNal-\rzE@c\["&u#@#TRINt5"Jj[6A
82
82
 
83
83
  And retrieve them.
84
84
 
85
85
  $ pwm --list
86
- 9&sq'8Gz.Bpb8#%M.T-Xyi#&.sDcTYFE.=qFyEbld Z[wA'By75y?NA?qUy}U>xd github
87
- 8UN:'I1^M)H\kj'U{4l!.tK3\v9V+}L4$XNal \rzE@c\["&u#@#TRINt5"Jj[6A google
86
+ 9&sq'8Gz.Bpb8#%M.T-Xyi#&.sDcTYFE.=qFyEbld-Z[wA'By75y?NA?qUy}U>xd github
87
+ 8UN:'I1^M)H\kj'U{4l!.tK3\v9V+}L4$XNal-\rzE@c\["&u#@#TRINt5"Jj[6A google
88
88
 
89
89
  Or just one.
90
90
 
91
91
  $ pwm --get github
92
- 9&sq'8Gz.Bpb8#%M.T-Xyi#&.sDcTYFE.=qFyEbld Z[wA'By75y?NA?qUy}U>xd github
92
+ 9&sq'8Gz.Bpb8#%M.T-Xyi#&.sDcTYFE.=qFyEbld-Z[wA'By75y?NA?qUy}U>xd
93
93
 
94
94
  Directly to the clipboard.
95
95
 
96
96
  $ pwm --clipboard --get google
97
- Copied the password for 'google' to your clipboard.
97
+ Copied your google password to the clipboard.
98
98
 
99
99
  Override an existing password.
100
100
 
101
101
  $ pwm --force --generate google
102
- gi>VlHK<=m2D+}8X4P\( yB6(<Jk'/9^ JAwCjK|!j-$exDe83g8[CD.n^%cYxO7 google
102
+ gi>VlHK<=m2D+}8X4P\(-yB6(<Jk'/9^-JAwCjK|!j-$exDe83g8[CD.n^%cYxO7
103
103
 
104
104
  And delete one.
105
105
 
106
106
  $ pwm --delete google
107
- Deleted the password for 'google'.
107
+ Deleted your google password.
108
108
 
109
109
  ## Config file
110
110
 
data/bin/pwm CHANGED
@@ -2,11 +2,9 @@
2
2
 
3
3
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
4
4
 
5
+ require 'yaml'
5
6
  require 'optparse'
6
7
 
7
- require 'psych'
8
- require 'psych/syntax_error'
9
-
10
8
  require 'perfect_world/cli'
11
9
  require 'perfect_world/error'
12
10
  require 'perfect_world/version'
@@ -21,7 +19,7 @@ end
21
19
  options = {}
22
20
 
23
21
  parser = OptionParser.new do |parser|
24
- parser.banner = "Usage: #{$0} [options]"
22
+ parser.banner = "Usage: #{ARGV.options.program_name} [options]"
25
23
 
26
24
  parser.separator ''
27
25
  parser.separator 'Options:'
@@ -79,7 +77,7 @@ parser = OptionParser.new do |parser|
79
77
  end
80
78
 
81
79
  parser.on('--version', 'Prints the version and exits.') do
82
- puts 'pwm ' << PerfectWorld::VERSION; exit
80
+ puts "#{ARGV.options.program_name} #{PerfectWorld::VERSION}"; exit
83
81
  end
84
82
 
85
83
  parser.separator ''
@@ -96,8 +94,8 @@ end
96
94
  config_file = File.expand_path(options.fetch(:config, '~/.pwmrc'))
97
95
 
98
96
  begin
99
- config = File.exist?(config_file) ? Psych.load_file(config_file) : {}
100
- rescue SystemCallError, Psych::Exception, Psych::SyntaxError => e
97
+ config = File.exist?(config_file) ? YAML.load_file(config_file) : {}
98
+ rescue => e
101
99
  die "Couldn't load config file: #{e.message}"
102
100
  end
103
101
 
@@ -45,7 +45,7 @@ module PerfectWorld
45
45
  # Deletes a password.
46
46
  def delete(db, id)
47
47
  if db.delete(id)
48
- puts "Deleted the password for '#{id}'."
48
+ puts "Deleted your #{id} password."
49
49
  else
50
50
  password_not_found(id)
51
51
  end
@@ -74,7 +74,7 @@ module PerfectWorld
74
74
 
75
75
  # Lists all passwords.
76
76
  def list(db, _ = nil)
77
- db.each { |id, password| print_password(id, password) }
77
+ db.each { |id, password| puts "#{password} #{id}" }
78
78
  end
79
79
 
80
80
  # Prints the current key owner.
@@ -84,24 +84,19 @@ module PerfectWorld
84
84
 
85
85
  # Raises an error with a proper message.
86
86
  def password_not_found(id)
87
- raise Error, "Couldn't find the password for '#{id}'."
87
+ raise Error, "Couldn't find your #{id} password."
88
88
  end
89
89
 
90
90
  # Prints a password or copies it to the clipboard.
91
91
  def print_or_copy_to_clipboard(id, password)
92
92
  if @config.fetch('clipboard')
93
93
  Clipboard << password
94
- puts "Copied the password for '#{id}' to your clipboard."
94
+ puts "Copied your #{id} password to the clipboard."
95
95
  else
96
- print_password(id, password)
96
+ puts password
97
97
  end
98
98
  end
99
99
 
100
- # Prints a password.
101
- def print_password(id, password)
102
- puts "#{password} #{id}"
103
- end
104
-
105
100
  # Prints a config entry.
106
101
  def print_config(key)
107
102
  puts @config[key]
@@ -55,7 +55,7 @@ module PerfectWorld
55
55
  if ! @passwords.key?(id)
56
56
  generate!(id, len)
57
57
  else
58
- raise Error, "Password for '#{id}' is already in the database."
58
+ raise Error, "Your #{id} password is already in the database."
59
59
  end
60
60
  end
61
61
 
@@ -6,7 +6,7 @@ module PerfectWorld
6
6
  # Should be raised, when gpg key could not be found.
7
7
  class KeyNotFound < Error
8
8
  def initialize(owner)
9
- super("Couldn't find key for '#{owner}'.")
9
+ super("Couldn't find GPG key for '#{owner}'.")
10
10
  end
11
11
  end
12
12
 
@@ -16,7 +16,7 @@ module PerfectWorld
16
16
  s = String.new
17
17
 
18
18
  while s.length < len
19
- s << SecureRandom.random_bytes(len * 3).gsub(/[^[:print:]]/, '')
19
+ s << SecureRandom.random_bytes(len * 3.3).gsub(/[^[:graph:]]/, '')
20
20
  end
21
21
 
22
22
  s[0..(len - 1)]
@@ -1,5 +1,4 @@
1
- require 'psych'
2
- require 'psych/syntax_error'
1
+ require 'yaml'
3
2
  require 'gpgme'
4
3
  require 'perfect_world/error'
5
4
 
@@ -58,14 +57,14 @@ module PerfectWorld
58
57
  end
59
58
 
60
59
  def serialize(data)
61
- Psych.dump(data)
62
- rescue Psych::Exception => e
60
+ YAML.dump(data)
61
+ rescue => e
63
62
  raise Error, e.message
64
63
  end
65
64
 
66
65
  def deserialize(data)
67
- Psych.load(data)
68
- rescue Psych::Exception, Psych::SyntaxError => e
66
+ YAML.load(data)
67
+ rescue => e
69
68
  raise Error, e.message
70
69
  end
71
70
 
@@ -1,3 +1,3 @@
1
1
  module PerfectWorld
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perfect_world
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -54,6 +54,38 @@ dependencies:
54
54
  - - ~>
55
55
  - !ruby/object:Gem::Version
56
56
  version: 2.0.1
57
+ - !ruby/object:Gem::Dependency
58
+ name: rake
59
+ requirement: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ type: :development
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ - !ruby/object:Gem::Dependency
74
+ name: rspec
75
+ requirement: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ~>
79
+ - !ruby/object:Gem::Version
80
+ version: 2.12.0
81
+ type: :development
82
+ prerelease: false
83
+ version_requirements: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ~>
87
+ - !ruby/object:Gem::Version
88
+ version: 2.12.0
57
89
  description: An attempt to build a simple but secure password manager.
58
90
  email:
59
91
  - ushi@porkbox.net
@@ -84,7 +116,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
84
116
  requirements:
85
117
  - - ! '>='
86
118
  - !ruby/object:Gem::Version
87
- version: 1.9.3
119
+ version: 1.9.2
88
120
  required_rubygems_version: !ruby/object:Gem::Requirement
89
121
  none: false
90
122
  requirements:
metadata.gz.sig CHANGED
Binary file