class DYAutomate::Command::CodeGenerate

Attributes

path[RW]

当前路径

Public Class Methods

new(argv) click to toggle source
Calls superclass method DYAutomate::Command::new
# File lib/DYAutomate/Command/codeGenerate.rb, line 20
def initialize(argv)
  @path = Dir.pwd
  super
end

Public Instance Methods

clone_templates() click to toggle source
# File lib/DYAutomate/Command/codeGenerate.rb, line 43
def clone_templates
  url = @config.templates_git_url
  path = @config.templates_cache_path
  system("rm -rf #{path}")
  unless Dir.exist?(path)
    Dir.mkdir(path,0777)
  end
  UI.puts("Cloning `#{url}` into `#{path}`.")
  system("git clone #{url} --depth 1 #{path}")

end
run() click to toggle source
# File lib/DYAutomate/Command/codeGenerate.rb, line 33
def run
    clone_templates
    exulateFile = File.join(@config.templates_cache_path,"ACMain.rb")
    if File.exist?(exulateFile)
      system("ruby #{exulateFile} #{Dir.pwd}")
    else
      UI.puts "cant find templates start file <ACMain.rb>."
    end
end
validate!() click to toggle source
Calls superclass method
# File lib/DYAutomate/Command/codeGenerate.rb, line 25
def validate!
  super
  unless @config.templates_git_url
      help! "
      error -- >!!! Not found <templates_git_url> in the #{DYAutomateConfig.configFilePath}"
  end
end