Class: Utils
- Inherits:
-
Object
- Object
- Utils
- Defined in:
- lib/dyntool.rb
Overview
Getting authentication creds from users
Instance Method Summary collapse
-
#AuthUser ⇒ Object
Getting creds from user to authenticate upon dyn.
-
#SvnChk(uid) ⇒ Object
check if dyn.yaml configuration is same as commited in svn.
Instance Method Details
#AuthUser ⇒ Object
Getting creds from user to authenticate upon dyn
65 66 67 68 69 70 71 72 |
# File 'lib/dyntool.rb', line 65 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 |
#SvnChk(uid) ⇒ Object
check if dyn.yaml configuration is same as commited in svn
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/dyntool.rb', line 74 def SvnChk(uid) @rep_uid = `svn info | grep "Repository UUID" | awk '{ print $3 }' 2>/dev/null` if @rep_uid.chomp != "#{uid}" abort("You are not in a directory that checkout to authorized SVN") end @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 |