passwordsafe 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,3 +1,5 @@
1
1
  pkg/*
2
2
  *.gem
3
3
  .bundle
4
+ safefile
5
+
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm ruby-1.9.2-p0@pws
data/Gemfile.lock CHANGED
@@ -2,11 +2,29 @@ PATH
2
2
  remote: .
3
3
  specs:
4
4
  passwordsafe (0.0.1)
5
+ highline
6
+ thor
5
7
 
6
8
  GEM
7
9
  remote: http://rubygems.org/
8
10
  specs:
11
+ aruba (0.2.7)
12
+ background_process
13
+ cucumber (~> 0.10.0)
14
+ background_process (1.2)
15
+ builder (3.0.0)
16
+ cucumber (0.10.0)
17
+ builder (>= 2.1.2)
18
+ diff-lcs (~> 1.1.2)
19
+ gherkin (~> 2.3.2)
20
+ json (~> 1.4.6)
21
+ term-ansicolor (~> 1.0.5)
9
22
  diff-lcs (1.1.2)
23
+ gherkin (2.3.2)
24
+ json (~> 1.4.6)
25
+ term-ansicolor (~> 1.0.5)
26
+ highline (1.6.1)
27
+ json (1.4.6)
10
28
  rspec (2.3.0)
11
29
  rspec-core (~> 2.3.0)
12
30
  rspec-expectations (~> 2.3.0)
@@ -15,10 +33,17 @@ GEM
15
33
  rspec-expectations (2.3.0)
16
34
  diff-lcs (~> 1.1.2)
17
35
  rspec-mocks (2.3.0)
36
+ term-ansicolor (1.0.5)
37
+ thor (0.14.3)
18
38
 
19
39
  PLATFORMS
20
40
  ruby
21
41
 
22
42
  DEPENDENCIES
43
+ aruba
44
+ bundler
45
+ cucumber
46
+ highline
23
47
  passwordsafe!
24
48
  rspec
49
+ thor
data/README.md CHANGED
@@ -1,5 +1,14 @@
1
- == Password Safe
1
+ ==Password Safe
2
2
  A command line application that can store and retrieve passwords from an encrypted file.
3
3
 
4
4
  Based on 'Tutorial: Build your own password safe with Ruby!' at http://rbjl.net/41-tutorial-build-your-own-password-safe-with-ruby
5
5
 
6
+ Basic implementation
7
+ password add name password
8
+
9
+ Not Implemented yet
10
+ password get name
11
+ password list
12
+ password remove name
13
+ password help
14
+
data/bin/password ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'passwordsafe/cli'
4
+
5
+ PasswordSafe::CLI.start
6
+
@@ -0,0 +1,18 @@
1
+ Feature: Add
2
+ In order to store my passwords
3
+ As a user
4
+ I want to be able to add my passwords to the passwordsafe
5
+
6
+
7
+ Scenario: Add a new password
8
+ When I run "password add name pa$$word" interactively
9
+ And I type "masterpa$$"
10
+ Then the output should contain "password name added to safe"
11
+
12
+ Scenario: Add a password with a name that exists
13
+ Given A safe exists with masterpassword "masterpa$$" and a "name" key
14
+ When I run "password add name pa$$word" interactively
15
+ And I type "masterpa$$"
16
+ Then the output should contain "Key already exists in keyring"
17
+ And the output should not contain "password name added to safe"
18
+
@@ -0,0 +1,11 @@
1
+ require 'passwordsafe/safe'
2
+ require 'passwordsafe/keyring'
3
+ require 'passwordsafe/cli'
4
+
5
+ Given /^A safe exists with masterpassword "([^"]*)" and a "([^"]*)" key$/ do |masterpass, key_name|
6
+ in_current_dir do
7
+ safe = PasswordSafe::Safe.new(PasswordSafe::CLI::DEFAULTSAFE, masterpass)
8
+ PasswordSafe::Keyring.new(safe).add key_name, "dummypass"
9
+ end
10
+ end
11
+
@@ -0,0 +1,7 @@
1
+ require "bundler/setup"
2
+ require 'aruba/cucumber'
3
+
4
+ After do |s|
5
+ remove_file(PasswordSafe::CLI::DEFAULTSAFE)
6
+ end
7
+
@@ -0,0 +1,29 @@
1
+ require 'thor'
2
+ require 'passwordsafe/safe'
3
+ require 'passwordsafe/keyring'
4
+
5
+ module PasswordSafe
6
+ class CLI < Thor
7
+ DEFAULTSAFE = 'safefile'
8
+
9
+ desc "add NAME PASSWORD", "Add a new PASSWORD to the keyring with name NAME"
10
+ def add name, password
11
+ safe = make_safe
12
+ begin
13
+ PasswordSafe::Keyring.new(safe).add name, password
14
+ rescue PasswordSafe::Keyring::KeyExistsException => msg
15
+ puts "#{msg}"
16
+ else
17
+ puts "password #{name} added to safe"
18
+ end
19
+ end
20
+
21
+ no_tasks do
22
+ def make_safe filename = DEFAULTSAFE
23
+ masterpass = ask("Enter your master password: ") { |q| q.echo = "x" }
24
+ PasswordSafe::Safe.new(filename, masterpass)
25
+ end
26
+ end
27
+ end
28
+ end
29
+
@@ -2,6 +2,7 @@ require 'passwordsafe/safe'
2
2
 
3
3
  module PasswordSafe
4
4
  class Keyring
5
+ class KeyExistsException < StandardError; end
5
6
 
6
7
  def initialize safe = nil
7
8
  @safe = safe
@@ -1,3 +1,4 @@
1
1
  module Passwordsafe
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
4
+
data/passwordsafe.gemspec CHANGED
@@ -19,6 +19,12 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
+ s.add_development_dependency('bundler')
22
23
  s.add_development_dependency('rspec')
24
+ s.add_development_dependency('cucumber')
25
+ s.add_development_dependency('aruba')
26
+
27
+ s.add_dependency "thor"
28
+ s.add_dependency "highline"
23
29
  end
24
30
 
data/spec/cli_spec.rb ADDED
File without changes
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - thecatwasnot
@@ -18,7 +18,7 @@ date: 2010-12-22 00:00:00 -06:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- name: rspec
21
+ name: bundler
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
24
  none: false
@@ -30,11 +30,76 @@ dependencies:
30
30
  version: "0"
31
31
  type: :development
32
32
  version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: rspec
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ version: "0"
44
+ type: :development
45
+ version_requirements: *id002
46
+ - !ruby/object:Gem::Dependency
47
+ name: cucumber
48
+ prerelease: false
49
+ requirement: &id003 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ segments:
55
+ - 0
56
+ version: "0"
57
+ type: :development
58
+ version_requirements: *id003
59
+ - !ruby/object:Gem::Dependency
60
+ name: aruba
61
+ prerelease: false
62
+ requirement: &id004 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ segments:
68
+ - 0
69
+ version: "0"
70
+ type: :development
71
+ version_requirements: *id004
72
+ - !ruby/object:Gem::Dependency
73
+ name: thor
74
+ prerelease: false
75
+ requirement: &id005 !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ segments:
81
+ - 0
82
+ version: "0"
83
+ type: :runtime
84
+ version_requirements: *id005
85
+ - !ruby/object:Gem::Dependency
86
+ name: highline
87
+ prerelease: false
88
+ requirement: &id006 !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ segments:
94
+ - 0
95
+ version: "0"
96
+ type: :runtime
97
+ version_requirements: *id006
33
98
  description: Small command line app for storing passwords
34
99
  email:
35
100
  - thecatwasnot@gmail.com
36
- executables: []
37
-
101
+ executables:
102
+ - password
38
103
  extensions: []
39
104
 
40
105
  extra_rdoc_files: []
@@ -42,17 +107,23 @@ extra_rdoc_files: []
42
107
  files:
43
108
  - .gitignore
44
109
  - .rspec
110
+ - .rvmrc
45
111
  - Gemfile
46
112
  - Gemfile.lock
47
113
  - README.md
48
114
  - Rakefile
115
+ - bin/password
116
+ - features/add.feature
117
+ - features/step_definitions/safe_steps.rb
118
+ - features/support/env.rb
49
119
  - lib/passwordsafe.rb
120
+ - lib/passwordsafe/cli.rb
50
121
  - lib/passwordsafe/encryptor.rb
51
122
  - lib/passwordsafe/keyring.rb
52
123
  - lib/passwordsafe/safe.rb
53
124
  - lib/passwordsafe/version.rb
54
125
  - passwordsafe.gemspec
55
- - safefile
126
+ - spec/cli_spec.rb
56
127
  - spec/encryptor_spec.rb
57
128
  - spec/keyring_spec.rb
58
129
  - spec/safe_spec.rb
data/safefile DELETED
@@ -1 +0,0 @@
1
- �������U�vZ�H�