class DYAutomate::Command::CodeSnippet
Attributes
xcode_snippsets_path[RW]
当前路径
Public Class Methods
new(argv)
click to toggle source
Calls superclass method
DYAutomate::Command::new
# File lib/DYAutomate/Command/codeSnippet.rb, line 19 def initialize(argv) super @xcode_snippsets_path = File.join(Dir.home,"/Library/Developer/Xcode/UserData/CodeSnippets") end
Public Instance Methods
clone_templates()
click to toggle source
# File lib/DYAutomate/Command/codeSnippet.rb, line 41 def clone_templates tempPath = File.join(Dir.home,'Documents','.iOSCodeSnippet') unless Dir.exist?(tempPath) system("mkdir #{tempPath}") end system ("git clone #{@config.codeSnippsets_git_url} --depth 1 #{tempPath}") Dir.chdir("#{tempPath}/CodeSnippets") Dir.glob("*") do |path| FileUtils.cp(path, @xcode_snippsets_path) end `rm -rf #{tempPath}` puts "安装完成..." end
run()
click to toggle source
# File lib/DYAutomate/Command/codeSnippet.rb, line 37 def run clone_templates end
validate!()
click to toggle source
Calls superclass method
# File lib/DYAutomate/Command/codeSnippet.rb, line 24 def validate! super unless Dir.exist?(@xcode_snippsets_path) help! " error -- >!!! Not found Xcode CodeSnippets at the #{@xcode_snippsets_path}" end unless @config.detailObj.codeSnippsets_git_url help! " error -- >!!! Not found the value of codeSnippsets_git_url" end end