scrum_yo 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTQ0MDM2ZDJmNTYyOTU4NjY0YjgwYmM2ODJiZWE5MWIzY2U4MWNjMg==
4
+ NDc5MTc4MjVhOTg0MTVlYTczMmFmNTM3YmYyOThhN2FkOGY0MDNiZA==
5
5
  data.tar.gz: !binary |-
6
- YWMzZWEzOGI3M2JiNGRiNWY5Yjc3NzBiZTQ1MTY2NjYyMjMxZTk2ZQ==
6
+ NGNjNzgzY2I5YzQ0YjFkMmJkMDEwYTJiOGVlZWQ5NjI4ZTI4MWMzZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NzNhZTViMmVlYzMxYmRlNDkxODgyNTNjNDU2YzAwMjhiMmM0OGE2N2NmYTYz
10
- NzA2YTIxYTRjNGU4Njk3MGZlZWJjM2ZjZWM2OTE0NDI3MGEyNmEzNjUyZGQy
11
- OGI5MDg5YzliYjZkYmM1YzE1NzIxYTc5MWJhNzg5NzhmYTMyZDA=
9
+ N2FlNGU4NjQxZjkwMWYyYzg0MDgwNjJkYmQ0NzU1ZWZhYjQ3ZDZiMDI4Nzgw
10
+ MWU0NDBkMDk4M2FjYTQwNzFiMmU5ZGM4ZmQ1ZjBjYzY5NzA1MjJiNmVkZDZj
11
+ M2QxNzE4ZjFhNDRhZDY3YzNkZThlMzNjNjVlZTUyOTk2MzRmNmM=
12
12
  data.tar.gz: !binary |-
13
- ZWYwMDdhZTk3YTgyYTMyMDAxZjk4OGQ4ZmVkZmM3MmNkMDRkZWFjZDM1ZGZi
14
- ODYzOTU2MDVkYzc4MTM4ZmYzYjk0ZWNiMDIxOGI3YjEyZjA3ZGVjMzdlNTRh
15
- YWUxNGUyYTVmMmQ1ZTA2ZTUzMGVmODdmYjViYzZmMTA4MGE3NDU=
13
+ YTQ5ZTA5NWQxZWQyYTA5M2M5YTM2M2YwNjRmNGQ1NDA5NDI0OWYzNTY4ODA5
14
+ ZTFmMzljM2ZhYmJmYWNiMjJiZmU3NWIzNWQ4ZmEyMGVjYWIwZGEwZWYxM2I3
15
+ MWE2ZTM4ZTU3ZTFmMzQ1ZTAwNTVjZTY5YjI5NDk5NmNkY2M0OTk=
data/README.md CHANGED
@@ -1,24 +1,32 @@
1
- # ScrumYo
1
+ ![scrum yo](https://raw.githubusercontent.com/mscoutermarsh/scrum_yo/master/scrum_art.png)
2
2
 
3
- TODO: Write a gem description
3
+ Be awesome at your daily stand up. Get a summary of your most recent GitHub commits & pull requests right in your console.
4
+
5
+ ScrumYo uses the GitHub API to grab your recent commits/pull requests.
6
+
7
+ ### Screenshot
8
+ ![example of scrumyo](https://raw.githubusercontent.com/mscoutermarsh/scrum_yo/master/scrumyo_example.png)
4
9
 
5
10
  ## Installation
6
11
 
7
- Add this line to your application's Gemfile:
12
+ $ gem install scrum_yo
13
+
14
+ If using RVM, install it to your global gemset:
8
15
 
9
- gem 'scrum_yo'
16
+ $ rvm @global do gem install scrum_yo
10
17
 
11
- And then execute:
12
18
 
13
- $ bundle
19
+ ## Usage
14
20
 
15
- Or install it yourself as:
21
+ There is only one command! To see your recent activity:
16
22
 
17
- $ gem install scrum_yo
23
+ $ scrumyo
18
24
 
19
- ## Usage
25
+ You'll have to login to your GitHub account on first use.
26
+
27
+ ## Authentication
20
28
 
21
- TODO: Write usage instructions here
29
+ You'll be asked to login to GitHub your first time using ScrumYo. This creates an OAuth token to be used for subsequent logins. Oauth token is saved to your ```~/.netrc``` file.
22
30
 
23
31
  ## Contributing
24
32
 
@@ -11,6 +11,9 @@ require 'string_hacks'
11
11
  module ScrumYo
12
12
  class CLI
13
13
  def self.start(*args)
14
+ puts "ScrumYo!".rainbow
15
+ ScrumYo::User.authenticate
16
+
14
17
  puts "Happy #{DateTime.current.strftime('%A')}!\n"
15
18
  puts "Grabbing your recent GitHub Activity...\n".rainbow
16
19
  ScrumYo::Output.new.print
@@ -1,3 +1,6 @@
1
+ require 'highline/import'
2
+ require 'netrc'
3
+
1
4
  module ScrumYo
2
5
  class User
3
6
  attr_reader :github_client, :username, :emails
@@ -13,5 +16,44 @@ module ScrumYo
13
16
  Time.zone = DateTime.now.utc_offset / 60 / 60
14
17
  Time.zone.name
15
18
  end
19
+
20
+ def self.authenticate(logged_in = false)
21
+ netrc = Netrc.read
22
+
23
+ if netrc['api.github.com'] && Octokit::Client.new(netrc: true).login
24
+ return true
25
+ end
26
+
27
+ puts "Authentication failed".red if logged_in
28
+
29
+ get_credentials
30
+ end
31
+
32
+ def self.get_credentials
33
+ puts "Please login with your Github account.".yellow
34
+ username = ask("Github Username:")
35
+ password = ask('Password (typing hidden):') { |q| q.echo = false }
36
+
37
+ client = Octokit::Client.new(login: username, password: password)
38
+
39
+
40
+ if agree('Do you use Two Factor Auth? (y/n)')
41
+ two_factor = ask('Enter your 2FA token:')
42
+ oauth = client.create_authorization(scopes: ['user','repo'], note: 'ScrumYo gem!', headers: { "X-GitHub-OTP" => two_factor })
43
+ else
44
+ oauth = client.create_authorization(scopes: ['user','repo'], note: 'ScrumYo gem!')
45
+ end
46
+
47
+ save_to_netrc(username, oauth.token)
48
+ self.authenticate(true)
49
+ end
50
+
51
+ def self.save_to_netrc(user, token)
52
+ netrc = Netrc.read
53
+ netrc.new_item_prefix = "# This entry was added by the ScrumYo gem\n"
54
+ netrc['api.github.com'] = user, token
55
+ netrc.save
56
+ end
57
+
16
58
  end
17
59
  end
@@ -1,3 +1,3 @@
1
1
  module ScrumYo
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
Binary file
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_dependency 'netrc', '~> 0.7.7'
23
23
  spec.add_dependency 'activesupport', '~> 4.1.0'
24
24
  spec.add_dependency 'colorize'
25
+ spec.add_dependency 'highline'
25
26
 
26
27
  spec.add_development_dependency "bundler", "~> 1.5"
27
28
  spec.add_development_dependency "pry"
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrum_yo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Coutermarsh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-26 00:00:00.000000000 Z
11
+ date: 2014-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ! '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: highline
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: bundler
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -158,7 +172,9 @@ files:
158
172
  - lib/scrum_yo/user.rb
159
173
  - lib/scrum_yo/version.rb
160
174
  - lib/string_hacks.rb
175
+ - scrum_art.png
161
176
  - scrum_yo.gemspec
177
+ - scrumyo_example.png
162
178
  - spec/spec_helper.rb
163
179
  homepage: ''
164
180
  licenses: