Class: Authentication

Inherits:
Object
  • Object
show all
Defined in:
lib/dyntool.rb

Overview

Getting authentication creds from users

Instance Method Summary collapse

Instance Method Details

#AuthUserObject

Getting creds from user to authenticate upon dyn



52
53
54
55
56
57
58
59
# File 'lib/dyntool.rb', line 52

def AuthUser()
	@creds = []
	@username = ask("Enter your username:  ") { |q| q.echo = true }
	@password = ask("Enter your password:  ") { |q| q.echo = "*" }
	@creds << @username
	@creds << @password
	return(@creds)
end

#SvnChkObject

check if dyn.yaml configuration is same as commited in svn



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/dyntool.rb', line 61

def SvnChk()
	@svn_chk=`svn stat dyn.yml`
	if @svn_chk != ""
		puts "Your dyn.yaml is not identical to the dyn.yml in the svn, or does not exist."
		@q1 = ask("Do you want to see the diffrences? (yes|no)? ") { |q| q.echo = true }
		case @q1 
			when "yes" then
				@diff_output = `svn diff dyn.yml`
				puts @diff_output
				@q2 = ask("Do you want to use the local or svn version? (local|svn)? ") { |q| q.echo = true }
				if @q2 == "local"
					@commit_output = `svn ci dyn.yml -m"Updating dyn.yml file to svn"`
					puts "Checking in and moving forward"
					puts @commit_output
				elsif @q2 == "svn"
					@revert_output = `svn revert dyn.yml; svn up`
					puts "Reverting to svn version and moving forward"
					puts @revert_output
				end
			when "no"
				puts "Please make sure that you local and svn copies are identical"
				exit 2
		end
	end
end