Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Fixed location of OAuth link. Removed instance member github_username from CLI #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions lib/learn_config/cli.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
module LearnConfig
class CLI
attr_reader :github_username
attr_accessor :token

def initialize(github_username)
@github_username = github_username
end

def ask_for_oauth_token(short_text: false, retries_remaining: 5)
if !short_text
puts <<-LONG
To connect with the Learn web application, you will need to configure
the Learn gem with an OAuth token. You can find yours at the bottom of your profile
page at: https://learn.co/#{github_username ? github_username : 'your-github-username'}.
page at: https://base.flatironschool.com/account/manage.

LONG

Expand Down
3 changes: 1 addition & 2 deletions lib/learn_config/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,7 @@ def setup_learn_config_machine
login, password = netrc.read

if (!login || !password) || !LearnWeb::Client.new(token: password, silent_output: true).valid_token?
github_username, _uid = netrc.read(machine: 'flatiron-push')
oauth_token = LearnConfig::CLI.new(github_username).ask_for_oauth_token
oauth_token = LearnConfig::CLI.new.ask_for_oauth_token
netrc.write(new_login: 'learn', new_password: oauth_token)
end
end
Expand Down