knife-github 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/knife-github.gemspec CHANGED
@@ -19,6 +19,6 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
  s.license = 'Apache 2.0'
21
21
  s.add_dependency "mixlib-versioning", ">= 1.0.0"
22
- s.add_dependency "ruby-termios", ">= 0.9.6"
22
+ s.add_dependency "highline", ">= 1.6.19"
23
23
  s.add_dependency "chef", ">= 10.0.0"
24
24
  end
@@ -38,7 +38,7 @@ module KnifeGithubTokenCreate
38
38
  #
39
39
 
40
40
  deps do
41
- require 'knife-github/password'
41
+ require 'highline'
42
42
  require 'chef/knife/github_base'
43
43
  include Chef::Knife::GithubBase
44
44
  require 'chef/mixin/shell_out'
@@ -129,7 +129,7 @@ module KnifeGithubTokenCreate
129
129
  Chef::Log.debug("Validating token information for user: #{username}.")
130
130
 
131
131
  params[:username] = username
132
- params[:password] = Github::Password.get( "Please enter github password for #{username} :" )
132
+ params[:password] = HighLine.new.ask("Please enter github password for #{username} :") { |q| q.echo = "x" }
133
133
  params[:action] = "GET"
134
134
 
135
135
  token_key = nil
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Github
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-github
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-02-25 00:00:00.000000000 Z
13
+ date: 2014-03-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: mixlib-versioning
@@ -29,13 +29,13 @@ dependencies:
29
29
  - !ruby/object:Gem::Version
30
30
  version: 1.0.0
31
31
  - !ruby/object:Gem::Dependency
32
- name: ruby-termios
32
+ name: highline
33
33
  requirement: !ruby/object:Gem::Requirement
34
34
  none: false
35
35
  requirements:
36
36
  - - ! '>='
37
37
  - !ruby/object:Gem::Version
38
- version: 0.9.6
38
+ version: 1.6.19
39
39
  type: :runtime
40
40
  prerelease: false
41
41
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  requirements:
44
44
  - - ! '>='
45
45
  - !ruby/object:Gem::Version
46
- version: 0.9.6
46
+ version: 1.6.19
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: chef
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -118,7 +118,6 @@ files:
118
118
  - lib/chef/knife/github_token_create.rb
119
119
  - lib/knife-github/config.rb
120
120
  - lib/knife-github/connection.rb
121
- - lib/knife-github/password.rb
122
121
  - lib/knife-github/repo.rb
123
122
  - lib/knife-github/version.rb
124
123
  homepage: https://github.com/schubergphilis/knife-github
@@ -1,85 +0,0 @@
1
- require 'termios'
2
-
3
- module Github
4
- class Password < String
5
-
6
- # Turn local terminal echo on or off. This method is used for securing the
7
- # display, so that a soon to be entered password will not be echoed to the
8
- # screen. It is also used for restoring the display afterwards.
9
- #
10
- # If _masked_ is +true+, the keyboard is put into unbuffered mode, allowing
11
- # the retrieval of characters one at a time. _masked_ has no effect when
12
- # _on_ is +false+. You are unlikely to need this method in the course of
13
- # normal operations.
14
- #
15
- def Password.echo(on=true, masked=false)
16
- term = Termios::getattr( $stdin )
17
-
18
- if on
19
- term.c_lflag |= ( Termios::ECHO | Termios::ICANON )
20
- else # off
21
- term.c_lflag &= ~Termios::ECHO
22
- term.c_lflag &= ~Termios::ICANON if masked
23
- end
24
-
25
- Termios::setattr( $stdin, Termios::TCSANOW, term )
26
- end
27
-
28
-
29
- # Get a password from _STDIN_, using buffered line input and displaying
30
- # _message_ as the prompt. No output will appear while the password is being
31
- # typed. Hitting <b>[Enter]</b> completes password entry. If _STDIN_ is not
32
- # connected to a tty, no prompt will be displayed.
33
- #
34
- def Password.get(message="Password: ")
35
- begin
36
- if $stdin.tty?
37
- Password.echo false
38
- print message if message
39
- end
40
-
41
- pw = Password.new( $stdin.gets || "" )
42
- pw.chomp!
43
-
44
- ensure
45
- if $stdin.tty?
46
- Password.echo true
47
- print "\n"
48
- end
49
- end
50
- end
51
-
52
-
53
- # Get a password from _STDIN_ in unbuffered mode, i.e. one key at a time.
54
- # _message_ will be displayed as the prompt and each key press with echo
55
- # _mask_ to the terminal. There is no need to hit <b>[Enter]</b> at the end.
56
- #
57
- def Password.getc(message="Password: ", mask='*')
58
- # Save current buffering mode
59
- buffering = $stdout.sync
60
-
61
- # Turn off buffering
62
- $stdout.sync = true
63
-
64
- begin
65
- Password.echo(false, true)
66
- print message if message
67
- pw = ""
68
-
69
- while ( char = $stdin.getc ) != 10 # break after [Enter]
70
- putc mask
71
- pw << char
72
- end
73
-
74
- ensure
75
- Password.echo true
76
- print "\n"
77
- end
78
-
79
- # Restore original buffering mode
80
- $stdout.sync = buffering
81
-
82
- Password.new( pw )
83
- end
84
- end
85
- end