Class: EasyAuto::CreateRepo
- Inherits:
-
Object
- Object
- EasyAuto::CreateRepo
- Includes:
- ClientWrapper, EasyUtilities, GitWrapper
- Defined in:
- lib/easy_auto/create_repo.rb
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#repo_name ⇒ Object
Returns the value of attribute repo_name.
Instance Method Summary collapse
- #add_files ⇒ Object
- #add_remote ⇒ Object
- #ask_repo_name ⇒ Object
- #create_remote ⇒ Object
- #create_repo ⇒ Object
- #first_commit ⇒ Object
- #first_push ⇒ Object
- #get_repo_name ⇒ Object
- #git_init ⇒ Object
- #login ⇒ Object
- #remote_exists? ⇒ Boolean
- #run ⇒ Object
- #set_remote ⇒ Object
Methods included from GitWrapper
Methods included from ClientWrapper
Methods included from EasyUtilities
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
11 12 13 |
# File 'lib/easy_auto/create_repo.rb', line 11 def password @password end |
#repo_name ⇒ Object
Returns the value of attribute repo_name.
10 11 12 |
# File 'lib/easy_auto/create_repo.rb', line 10 def repo_name @repo_name end |
Instance Method Details
#add_files ⇒ Object
39 40 41 |
# File 'lib/easy_auto/create_repo.rb', line 39 def add_files git.perform "add -A" end |
#add_remote ⇒ Object
47 48 49 |
# File 'lib/easy_auto/create_repo.rb', line 47 def add_remote git.perform "remote add origin [email protected]:#{username}/#{repo_name}.git" end |
#ask_repo_name ⇒ Object
71 72 73 |
# File 'lib/easy_auto/create_repo.rb', line 71 def ask_repo_name ask 'what would you like to name the remote repo?' end |
#create_remote ⇒ Object
29 30 31 32 33 |
# File 'lib/easy_auto/create_repo.rb', line 29 def create_remote git_init create_repo set_remote end |
#create_repo ⇒ Object
62 63 64 65 |
# File 'lib/easy_auto/create_repo.rb', line 62 def create_repo puts "creating repo for username: #{login}" client.create_repo get_repo_name end |
#first_commit ⇒ Object
43 44 45 |
# File 'lib/easy_auto/create_repo.rb', line 43 def first_commit git.perform "commit -m 'first commit'" end |
#first_push ⇒ Object
51 52 53 |
# File 'lib/easy_auto/create_repo.rb', line 51 def first_push git.perform "push -u origin master" end |
#get_repo_name ⇒ Object
67 68 69 |
# File 'lib/easy_auto/create_repo.rb', line 67 def get_repo_name self.repo_name = ask_repo_name end |
#git_init ⇒ Object
35 36 37 |
# File 'lib/easy_auto/create_repo.rb', line 35 def git_init git.init end |
#login ⇒ Object
21 22 23 |
# File 'lib/easy_auto/create_repo.rb', line 21 def login client.login end |
#remote_exists? ⇒ Boolean
25 26 27 |
# File 'lib/easy_auto/create_repo.rb', line 25 def remote_exists? !git.remote.empty? end |
#run ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/easy_auto/create_repo.rb', line 13 def run if remote_exists? puts "remote already exists!", "aborting!" else create_remote end end |
#set_remote ⇒ Object
55 56 57 58 59 60 |
# File 'lib/easy_auto/create_repo.rb', line 55 def set_remote add_files first_commit add_remote first_push end |