shh 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,10 @@
1
- require 'shh'
1
+ require 'splat'
2
2
 
3
3
  module Shh
4
4
  class EntryMenu
5
5
  def initialize prompt, hash, read_only=false
6
6
  @prompt, @hash, @read_only = prompt, hash, read_only
7
- @clipboard = Shh.clipboard
8
- @launcher = Shh.launcher
7
+ @splat = Splat.new
9
8
  refresh
10
9
  end
11
10
 
@@ -43,17 +42,12 @@ module Shh
43
42
  end
44
43
 
45
44
  private
46
-
47
- def can_copy? key
48
- @clipboard and @hash[key]
49
- end
50
-
51
45
  def can_edit?
52
46
  !@read_only
53
47
  end
54
48
 
55
49
  def can_launch? key
56
- @launcher and @hash[key] =~ /^http/
50
+ @splat.supported? and @hash[key] =~ /^http/
57
51
  end
58
52
 
59
53
  def view key
@@ -61,7 +55,7 @@ private
61
55
  end
62
56
 
63
57
  def copy key
64
- @clipboard.content = @hash[key] if can_copy?(key)
58
+ @splat.clipboard = @hash[key]
65
59
  end
66
60
 
67
61
  def set key
@@ -86,7 +80,7 @@ private
86
80
  end
87
81
 
88
82
  def launch key
89
- @launcher.launch @hash[key] if can_launch?(key)
83
+ @splat.launch @hash[key] if can_launch?(key)
90
84
  end
91
85
 
92
86
  def refresh
@@ -96,7 +90,7 @@ private
96
90
  commands << "set #{key}" if can_edit?
97
91
  commands << "delete #{key}" if can_edit?
98
92
  commands << "view #{key}"
99
- commands << "copy #{key}" if can_copy?(key)
93
+ commands << "copy #{key}" if @splat.supported?
100
94
  commands << "launch #{key}" if can_launch?(key)
101
95
  end
102
96
  Readline.completion_proc = lambda do |text|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Ryall
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-30 00:00:00 +11:00
12
+ date: 2010-01-31 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -52,6 +52,16 @@ dependencies:
52
52
  - !ruby/object:Gem::Version
53
53
  version: 1.6.3
54
54
  version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: splat
57
+ type: :runtime
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ~>
62
+ - !ruby/object:Gem::Version
63
+ version: 0.0.1
64
+ version:
55
65
  description: |
56
66
  A command line utility that manages accounts and passwords as individual encypted files
57
67
 
@@ -65,15 +75,10 @@ extra_rdoc_files: []
65
75
  files:
66
76
  - lib/shh/cli.rb
67
77
  - lib/shh/crypt.rb
68
- - lib/shh/darwin10_clipboard.rb
69
- - lib/shh/darwin10_launcher.rb
70
78
  - lib/shh/entries_menu.rb
71
79
  - lib/shh/entry_menu.rb
72
80
  - lib/shh/prompt.rb
73
81
  - lib/shh/repository.rb
74
- - lib/shh/win32_clipboard.rb
75
- - lib/shh/win32_launcher.rb
76
- - lib/shh.rb
77
82
  - bin/shh
78
83
  - README.rdoc
79
84
  - MIT-LICENSE
@@ -1,5 +0,0 @@
1
- class Darwin10Clipboard
2
- def content= text
3
- `echo "#{text}" | pbcopy`
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- class Darwin10Launcher
2
- def launch text
3
- `open #{text}`
4
- end
5
- end
@@ -1,7 +0,0 @@
1
- require 'win32/clipboard'
2
-
3
- class Win32Clipboard
4
- def content= text
5
- Win32::Clipboard.set_data(text)
6
- end
7
- end
@@ -1,5 +0,0 @@
1
- class Win32Launcher
2
- def launch text
3
- `start #{text}`
4
- end
5
- end
data/lib/shh.rb DELETED
@@ -1,25 +0,0 @@
1
- module Shh
2
- def self.clipboard
3
- if RUBY_PLATFORM =~ /mswin32/
4
- require 'shh/win32_clipboard'
5
- return Win32Clipboard.new
6
- end
7
- if RUBY_PLATFORM =~ /darwin10/
8
- require 'shh/darwin10_clipboard'
9
- return Darwin10Clipboard.new
10
- end
11
- nil
12
- end
13
-
14
- def self.launcher
15
- if RUBY_PLATFORM =~ /mswin32/
16
- require 'shh/win32_launcher'
17
- return Win32Launcher.new
18
- end
19
- if RUBY_PLATFORM =~ /darwin10/
20
- require 'shh/darwin10_launcher'
21
- return Darwin10Launcher.new
22
- end
23
- nil
24
- end
25
- end