Class: CommitLive::NetrcInteractor

Inherits:
Object
  • Object
show all
Defined in:
lib/commit-live/netrc-interactor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNetrcInteractor

Returns a new instance of NetrcInteractor.



7
8
9
# File 'lib/commit-live/netrc-interactor.rb', line 7

def initialize
	ensure_proper_permissions!
end

Instance Attribute Details

#loginObject (readonly)

Returns the value of attribute login.



5
6
7
# File 'lib/commit-live/netrc-interactor.rb', line 5

def 
  @login
end

#netrcObject (readonly)

Returns the value of attribute netrc.



5
6
7
# File 'lib/commit-live/netrc-interactor.rb', line 5

def netrc
  @netrc
end

#passwordObject (readonly)

Returns the value of attribute password.



5
6
7
# File 'lib/commit-live/netrc-interactor.rb', line 5

def password
  @password
end

Instance Method Details

#delete!(machine:) ⇒ Object



21
22
23
24
25
26
# File 'lib/commit-live/netrc-interactor.rb', line 21

def delete!(machine:)
	@netrc = Netrc.read

	netrc.delete(machine)
	netrc.save
end

#read(machine: 'ga-config') ⇒ Object



11
12
13
14
# File 'lib/commit-live/netrc-interactor.rb', line 11

def read(machine: 'ga-config')
	@netrc = Netrc.read
	@login, @password = netrc[machine]
end

#write(machine: 'ga-config', new_login:, new_password:) ⇒ Object



16
17
18
19
# File 'lib/commit-live/netrc-interactor.rb', line 16

def write(machine: 'ga-config', new_login:, new_password:)
	netrc[machine] = , new_password
	netrc.save
end