Class: Gct::Command::Setup

Inherits:
Gct::Command show all
Defined in:
lib/gct/command/setup.rb

Instance Method Summary collapse

Methods inherited from Gct::Command

#auto_add_tag, #check_branch_can_be_update, #config_gitlab, #current_branch, #file_contents, #get_project, #gitlab_error, options, run

Constructor Details

#initialize(argv) ⇒ Setup

Returns a new instance of Setup.



10
11
12
# File 'lib/gct/command/setup.rb', line 10

def initialize(argv)
  super
end

Instance Method Details

#create_backup_folderObject



22
23
24
25
26
27
28
# File 'lib/gct/command/setup.rb', line 22

def create_backup_folder
  backup_path = Generator::GctFile.backup_folder_path
  if !File.exist?(backup_path) 
    system "mkdir #{backup_path}", exception: true
    puts "#{backup_path} 创建成功!".green
  end
end

#create_config_fileObject



46
47
48
49
50
51
52
# File 'lib/gct/command/setup.rb', line 46

def create_config_file
  config_path = Generator::GctFile.config_file_path
  if !File.exist?(config_path) 
    system "touch #{config_path}", exception: true
    puts "#{config_path} 创建成功!".green
  end
end

#create_root_folderObject



30
31
32
33
34
35
36
# File 'lib/gct/command/setup.rb', line 30

def create_root_folder
  gct_path = Generator::GctFile.root_folder_path
  if !File.exist?(gct_path) 
    system "mkdir #{gct_path}", exception: true
    puts "#{gct_path} 创建成功!".green
  end
end

#create_temp_folderObject



38
39
40
41
42
43
44
# File 'lib/gct/command/setup.rb', line 38

def create_temp_folder
  temp_path = Generator::GctFile.temp_folder_path
  if !File.exist?(temp_path) 
    system "mkdir #{temp_path}", exception: true
    puts "#{temp_path} 创建成功!".green
  end
end

#runObject



14
15
16
17
18
19
20
# File 'lib/gct/command/setup.rb', line 14

def run
  create_root_folder
  create_temp_folder
  create_config_file
  create_backup_folder
  puts "setup success!".green
end