huami 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +1 -1
  2. data/bin/huami +44 -4
  3. data/huami.gemspec +2 -2
  4. metadata +52 -29
data/README.md CHANGED
@@ -13,5 +13,5 @@ INSTALL
13
13
  USAGE
14
14
  ------
15
15
 
16
- $ huami [KEY]
16
+ $ huami -h
17
17
 
data/bin/huami CHANGED
@@ -1,14 +1,54 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'huami'
4
+ require 'optparse'
5
+ require 'highline/import'
6
+
7
+ options = {}
8
+
9
+ optparse = OptionParser.new do |opts|
10
+ opts.banner = "Usage: huami [options] key"
11
+ options[:copy] = false
12
+ opts.on('-c', '--copy', 'Copy password to the clipboard instead of output.') do
13
+ options[:copy] = true
14
+ end
15
+ opts.on('-h', '--help', 'Display this screen.') do
16
+ puts opts
17
+ exit 1
18
+ end
19
+ end
20
+
21
+ optparse.parse!
4
22
 
5
23
  if ARGV.length != 1
6
- puts "Usage:"
7
- puts "huami.rb KEY"
8
- exit(1)
24
+ puts optparse.help
25
+ exit 1
9
26
  end
10
27
 
11
28
  key = ARGV[0]
12
29
  password = ask("Enter password: ") { |q| q.echo = false }
13
30
 
14
- puts Huami.huami(key, password)
31
+ hash_password = Huami.huami(key, password)
32
+
33
+ if options[:copy]
34
+ if system('which xclip > /dev/null 2>&1')
35
+ copy_cmd = 'xclip -selection clipboard'
36
+ # I don't get a mac, so I'm not sure is this right!
37
+ elsif system('which pbcopy > /dev/null 2>&1')
38
+ copy_cmd = 'pbcopy'
39
+ end
40
+
41
+ if copy_cmd.nil?
42
+ puts 'Can not find pbcopy or xclip command.'
43
+ exit 1
44
+ end
45
+ # Don't know why backticks do not work...
46
+ IO.popen("echo #{hash_password} | #{copy_cmd}")
47
+ puts 'The password has been copyed to you clipboard.'
48
+ elsif
49
+ puts hash_password
50
+ end
51
+
52
+ exit 0
53
+
54
+
data/huami.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'huami'
3
- s.version = '0.0.3'
4
- s.date = '2012-02-26'
3
+ s.version = '0.0.4'
4
+ s.date = '2012-03-15'
5
5
  s.summary = 'Huami'
6
6
  s.description = 'Manage your password in rememberable way.'
7
7
  s.executables << 'huami'
metadata CHANGED
@@ -1,34 +1,46 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: huami
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 4
10
+ version: 0.0.4
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Wei Zhu
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-02-26 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2012-03-15 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
15
22
  name: highline
16
- requirement: &13441100 !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
17
25
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
22
33
  type: :runtime
23
- prerelease: false
24
- version_requirements: *13441100
34
+ version_requirements: *id001
25
35
  description: Manage your password in rememberable way.
26
36
  email: yesmeck@gmail.com
27
- executables:
37
+ executables:
28
38
  - huami
29
39
  extensions: []
40
+
30
41
  extra_rdoc_files: []
31
- files:
42
+
43
+ files:
32
44
  - .gitignore
33
45
  - README.md
34
46
  - Rakefile
@@ -36,28 +48,39 @@ files:
36
48
  - huami.gemspec
37
49
  - lib/huami.rb
38
50
  - test/test_huami.rb
51
+ has_rdoc: true
39
52
  homepage: https://rubygems.org/gems/huami
40
53
  licenses: []
54
+
41
55
  post_install_message:
42
56
  rdoc_options: []
43
- require_paths:
57
+
58
+ require_paths:
44
59
  - lib
45
- required_ruby_version: !ruby/object:Gem::Requirement
60
+ required_ruby_version: !ruby/object:Gem::Requirement
46
61
  none: false
47
- requirements:
48
- - - ! '>='
49
- - !ruby/object:Gem::Version
50
- version: '0'
51
- required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ hash: 3
66
+ segments:
67
+ - 0
68
+ version: "0"
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
70
  none: false
53
- requirements:
54
- - - ! '>='
55
- - !ruby/object:Gem::Version
56
- version: '0'
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 3
75
+ segments:
76
+ - 0
77
+ version: "0"
57
78
  requirements: []
79
+
58
80
  rubyforge_project:
59
- rubygems_version: 1.8.16
81
+ rubygems_version: 1.3.7
60
82
  signing_key:
61
83
  specification_version: 3
62
84
  summary: Huami
63
85
  test_files: []
86
+