Class: DYAutomate::Command::CodeGenerate
Instance Attribute Summary collapse
#config, #env_str, #repo_name
Instance Method Summary
collapse
#pp
Constructor Details
Returns a new instance of CodeGenerate.
20
21
22
23
|
# File 'lib/DYAutomate/Command/codeGenerate.rb', line 20
def initialize(argv)
@path = Dir.pwd
super
end
|
Instance Attribute Details
#path ⇒ Object
18
19
20
|
# File 'lib/DYAutomate/Command/codeGenerate.rb', line 18
def path
@path
end
|
Instance Method Details
#clone_templates ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
|
# 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 ⇒ Object
33
34
35
36
37
38
39
40
41
|
# 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! ⇒ Object
25
26
27
28
29
30
31
|
# 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
|