Class: YPInstall

Inherits:
Object
  • Object
show all
Defined in:
lib/yptools/install/yp_install.rb

Class Method Summary collapse

Class Method Details

.install(name) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/yptools/install/yp_install.rb', line 9

def self.install(name)
    cmd = name
    case cmd
    when 'mvvm'
        YPInstall.mvvm
    else
        yp_log_fail "'yptools install #{name}' 暂无,敬请期待"
    end
end

.mvvmObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/yptools/install/yp_install.rb', line 19

def self.mvvm
    templates_url = "[email protected]:HansenCCC/kMVVM.git"
    templates_path = Dir.pwd
    templates_name = "kMVVM"
    
    templates_path = templates_path + "/#{templates_name}"
    yp_log_doing "生成临时文件#{templates_path}"
    
    # 删除旧库
    yp_method_rmdir templates_path
    
    system("git clone #{templates_url}")
    FileUtils.cd 'kMVVM'
    system("sh install-template.sh")
    FileUtils.cd '..'
    
    # 删除缓存
    yp_method_rmdir templates_path
    yp_log_doing "移除临时文件#{templates_path}"
    yp_log_success "安装#{templates_url}完成,重新打开Xcode才能生效"
end