57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
# File 'lib/asproject.rb', line 57
def execute(args=nil)
begin
@should_create_project = true
@created_files = []
if(args.nil?)
@execution_dir = Dir.pwd
else
@execution_dir = args.execution_dir
@project_name = args.project_name
end
@path_finder = PathFinder.new(@execution_dir)
parse_args(args)
@resolver = AsProjectResolver.new(self)
if(@arguments.copy_to_home)
copy_templates_to_user_home
end
out '---------------------------'
begin
project = @path_finder.current_project
@should_create_project = false
msg = ">> Working in existing project #{project_name} at: " + project
rescue
if(@arguments.project_name == '')
finish
exit
end
msg = ">> Creating a new project at: #{@execution_dir}#{File::SEPARATOR}#{@project_name}"
end
out msg
if(@arguments.project_name == '')
@execution_dir = File.expand_path(@path_finder.current_project)
@path_finder.execution_dir = @execution_dir
@arguments.execution_dir = @execution_dir
else
create_project
end
if(@arguments.copy_to_project)
copy_templates_to_project
end
copy_templates(@arguments.selected_templates)
finish
rescue ProjectError => e
out e.message
exit
end
end
|