merrow 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 083ad9adefba5cabb590be7dbf1923af07e6373f
4
- data.tar.gz: be58c8c3595968607334418bb72fba283d472fda
3
+ metadata.gz: d26239b80810e27abca70b395d51238ef555904d
4
+ data.tar.gz: 4dffdbb14e42a8695d0db9e382354845d9afe7c9
5
5
  SHA512:
6
- metadata.gz: 65b442de0dcf7fc990702dc45ef3d5fb025582d4c621e75ed593587c9b9fcf1af6151f93f685af8f7f4f1959ad2070cc8aca8ce854217df4a495cd3d88e5e44d
7
- data.tar.gz: 88d9181c093a885d97ddd84e5534e06361aadc7c9bbc5aae1ac6d6be2d89ba8c7c55f04a725cf807bb40cdf9438d1ad7532dd7088f09cc3afc4b4d153e0b057e
6
+ metadata.gz: 0a5b96f37d347cec213b8915d4fdc5a89cc0e28635ce5a5f669fa5d4cf659b7e4dcd84556cfe50acdff453052fc181701e64eb1a5d4cab898bff34b9d2062c40
7
+ data.tar.gz: f3a9f89eeb36091a9acaa92fbd930ae5050ec3d485a7e992cb009f2eb74f713af38eaad3cfcc49a6b4fa8e513e9ec129a921c72ce0c37a45222bbbb9dac08a29
data/Changelog.md ADDED
@@ -0,0 +1,6 @@
1
+ # 0.0.3
2
+ Hopefully support Two-factor
3
+ Don't show password in the terminal
4
+
5
+ # 0.0.2
6
+ Better UI when no file is there
@@ -1,6 +1,7 @@
1
1
  #This class manages the configuration in the .merrow.yml file
2
2
  require 'yaml'
3
3
  require 'octokit'
4
+ require 'io/console'
4
5
 
5
6
  class Configuration
6
7
  FILENAME= '.merrow.yml'
@@ -14,7 +15,7 @@ class Configuration
14
15
  end
15
16
 
16
17
  def repos
17
- data["repos"]
18
+ data["repos"] || []
18
19
  end
19
20
 
20
21
 
@@ -26,8 +27,8 @@ class Configuration
26
27
  puts "The username and password will not be stored anywhere"
27
28
  puts "What is your username for Github?"
28
29
  username = gets.chomp
29
- puts "What is your password for Github?"
30
- password = gets.chomp
30
+ puts "What is your password for Github? (your input is hidden)"
31
+ password = STDIN.noecho(&:gets).chomp
31
32
  token_name = "Token used by Merrow"
32
33
  client = Octokit::Client.new login: username, password: password
33
34
  auth = client.create_authorization(scopes: ["repo", "public_repo", "user"], note: token_name)
@@ -36,6 +37,14 @@ class Configuration
36
37
  rescue Octokit::Unauthorized => e
37
38
  puts "Authourization failed, user or password wrong?"
38
39
  exit(-1)
40
+ rescue Octokit::OneTimePasswordRequired => e
41
+ puts "Your account requires Two-factor authentication."
42
+ puts "Provide your two-factor token, you will need this only once (input hidden):"
43
+ token = STDIN.noecho(&:gets).chomp
44
+ auth = client.create_authorization(scopes: ["repo", "public_repo", "user"],
45
+ headers: { "X-GitHub-OTP" => token},
46
+ note: token_name)
47
+ auth[:token]
39
48
  end
40
49
 
41
50
  def save(data)
@@ -57,7 +66,7 @@ class Configuration
57
66
  puts "(format is user/repo like rails/rails or JordiPolo/merrow):"
58
67
  repo = gets.chomp
59
68
  if repo.match(/.*\/.*/)
60
- File.open(config_file,'w+'){|file| file.write( {repo: [*repo]}.to_yaml)}
69
+ File.open(config_file,'w+'){|file| file.write( {repos: [*repo]}.to_yaml)}
61
70
  config_file
62
71
  else
63
72
  puts "Repo format not valid, run the tool again, you need to provide username/reponame like JordiPolo/merrow"
@@ -1,3 +1,3 @@
1
1
  module Merrow
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/merrow.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["mumismo@gmail.com"]
11
11
  spec.summary = %q{Small tool to look at all you pending PR in Github.}
12
12
  spec.description = %q{Small tool to look at all you pending PR in Github }
13
- spec.homepage = ""
13
+ spec.homepage = "https://github.com/JordiPolo/merrow"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merrow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordi Polo
@@ -75,6 +75,7 @@ extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
77
  - ".gitignore"
78
+ - Changelog.md
78
79
  - Gemfile
79
80
  - LICENSE.txt
80
81
  - README.md
@@ -84,7 +85,7 @@ files:
84
85
  - lib/merrow/configuration.rb
85
86
  - lib/merrow/version.rb
86
87
  - merrow.gemspec
87
- homepage: ''
88
+ homepage: https://github.com/JordiPolo/merrow
88
89
  licenses:
89
90
  - MIT
90
91
  metadata: {}