Module: Locomotive::Wagon::NetrcConcern
- Included in:
- AuthenticateCommand, PushCommand
- Defined in:
- lib/locomotive/wagon/commands/concerns/netrc_concern.rb
Instance Method Summary collapse
- #read_credentials_from_netrc(host) ⇒ Object
- #write_credentials_to_netrc(host, email, api_key) ⇒ Object
Instance Method Details
#read_credentials_from_netrc(host) ⇒ Object
13 14 15 16 17 |
# File 'lib/locomotive/wagon/commands/concerns/netrc_concern.rb', line 13 def read_credentials_from_netrc(host) if entry = Netrc.read[host] { email: entry.login, api_key: entry.password } end end |
#write_credentials_to_netrc(host, email, api_key) ⇒ Object
7 8 9 10 11 |
# File 'lib/locomotive/wagon/commands/concerns/netrc_concern.rb', line 7 def write_credentials_to_netrc(host, email, api_key) netrc = Netrc.read netrc[host] = email, api_key netrc.save end |