36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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
|
# File 'lib/onboard/cli.rb', line 36
def projects(codebase)
core = "#{options[:core]}.x"
projects = {}
if options[:modules].nil? == false
options[:modules].each { |x| projects[x] = '' }
elsif options[:themes].nil? == false
options[:themes].each { |x| projects[x] = '' }
end
path = "#{options[:path]}"
found = Finder.new(projects, codebase).locate
if found.empty? == false
say("Projects exist at the following locations:", :yellow)
found.each do |x, y|
puts " " + x
projects[File.basename(x)] = y[0]
end
puts ""
if options[:delete] == 'delete'
say("Ready to delete existing projects:", :yellow)
Confirm.new("Proceed?", true).yes?
found.each do |x, y|
Project.new.clean(x)
projects[File.basename(x)] = ''
end
end
end
if options[:force] != 'force'
if found.empty? == false
found.each do |x, y|
projects.delete(File.basename(x))
end
end
end
if projects.empty? == false
say("Ready to add the following projects:", :green)
projects.each do |x, y|
puts " " + "#{codebase}/#{path}/#{x}"
end
puts ""
if options[:no].nil? && options[:yes].nil?
Confirm.new("Proceed?").yes?
elsif options[:no] == 'no'
say("Script was exited.")
exit
end
prj = {}
branch = options[:branch].nil? ? '' : options[:branch]
prj['branch'] = branch
prj['codebase'] = codebase
prj['core'] = core
prj['path'] = path
prj['projects'] = projects
prj['vc'] = options[:vc]
Project.new(prj).dl
else
say("All projects already in codebase.", :yellow)
end
end
|