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
94
95
|
# 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
end
puts ""
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 = {}
prj['codebase'] = codebase
prj['path'] = "#{codebase}/#{path}"
prj['projects'] = projects
prj['core'] = core
Project.new(prj).dl
if options[:vc] == true
branch = options[:branch].nil? ? '' : options[:branch]
repo = {}
repo['branch'] = branch
repo['codebase'] = codebase
repo['projects'] = projects
repo['path'] = path
Repo.new(repo).update
else
projects.each do |x, y|
say("#{x} added to codebase but changes are not yet tracked in version control.", :yellow)
end
end
else
say("All projects already in codebase.", :yellow)
end
end
|