Class: EasyAuto::CreateRepo

Inherits:
Object
  • Object
show all
Includes:
ClientWrapper, EasyUtilities, GitWrapper
Defined in:
lib/easy_auto/create_repo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from GitWrapper

#git

Methods included from ClientWrapper

#client, #username

Methods included from EasyUtilities

#ask, #hidden_input

Instance Attribute Details

#passwordObject (readonly)

Returns the value of attribute password.



11
12
13
# File 'lib/easy_auto/create_repo.rb', line 11

def password
  @password
end

#repo_nameObject

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_filesObject



39
40
41
# File 'lib/easy_auto/create_repo.rb', line 39

def add_files
  git.perform "add -A"
end

#add_remoteObject



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_nameObject



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_remoteObject



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_repoObject



62
63
64
65
# File 'lib/easy_auto/create_repo.rb', line 62

def create_repo
  puts "creating repo for username: #{}"
  client.create_repo get_repo_name
end

#first_commitObject



43
44
45
# File 'lib/easy_auto/create_repo.rb', line 43

def first_commit
  git.perform "commit -m 'first commit'"
end

#first_pushObject



51
52
53
# File 'lib/easy_auto/create_repo.rb', line 51

def first_push
  git.perform "push -u origin master"
end

#get_repo_nameObject



67
68
69
# File 'lib/easy_auto/create_repo.rb', line 67

def get_repo_name
  self.repo_name = ask_repo_name
end

#git_initObject



35
36
37
# File 'lib/easy_auto/create_repo.rb', line 35

def git_init
  git.init
end

#loginObject



21
22
23
# File 'lib/easy_auto/create_repo.rb', line 21

def 
  client.
end

#remote_exists?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/easy_auto/create_repo.rb', line 25

def remote_exists?
  !git.remote.empty?
end

#runObject



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_remoteObject



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