class Onboard::Project
Attributes
answer[R]
codebase[R]
core[R]
options[R]
path[R]
projects[R]
size[R]
Public Class Methods
new(info, projects, options)
click to toggle source
# File lib/onboard/project.rb, line 17 def initialize(info, projects, options) @answer = info[2] @codebase = info[0] @core = info[1] @options = options @path = "#{codebase}/#{options['destination']}" @projects = projects @size = projects.length end
Public Instance Methods
build_vc(x = '')
click to toggle source
# File lib/onboard/project.rb, line 90 def build_vc(x = '') repo = {} repo['codebase'] = codebase repo['path'] = @vc_path repo['project'] = x repo end
clean(arg)
click to toggle source
# File lib/onboard/project.rb, line 98 def clean(arg) FileUtils.rm_r arg if File.directory?(arg) end
continue?(project, version, latest)
click to toggle source
# File lib/onboard/project.rb, line 27 def continue?(project, version, latest) return true if version.nil? clean("#{path}/#{project}") repo = build_vc(project) check = Validate.new(project, version, core, answer) if check.latest?(latest) || check.hacked?(path, repo) return false else return true end end
delegate(project, version, changes, count)
click to toggle source
# File lib/onboard/project.rb, line 71 def delegate(project, version, changes, count) latest, _md5 = Release.new(project, core).choose if continue?(project, version, latest) deploy(project, latest) return update(project, changes, count) else reset(project) end end
deploy(project, version)
click to toggle source
# File lib/onboard/project.rb, line 45 def deploy(project, version) clean("#{path}/#{project}") link = Download.new.build_link(project, version) Download.new.fetch(link) # TODO: retry download after failed download verification Extract.new(Download.new.path(link), link, path).x if Validate.new(project, version, core, answer).verify(link) end
dl()
click to toggle source
# File lib/onboard/project.rb, line 81 def dl changes = false count = size projects.each do |x, y| count -= 1 changes = delegate(x, y, changes, count) end end
push(changes)
click to toggle source
# File lib/onboard/project.rb, line 53 def push(changes) return false unless changes repo = build_vc RepoBridge.new(repo).push end
reset(project)
click to toggle source
# File lib/onboard/project.rb, line 39 def reset(project) clean("#{path}/#{project}") repo = build_vc(project) RepoBridge.new(repo).co end
update(project, changes, count)
click to toggle source
# File lib/onboard/project.rb, line 59 def update(project, changes, count) if options['vc'] repo = build_vc(project) update = RepoBridge.new(repo).up changes = changes ? changes : update push(changes) if count == 0 return changes else say("#{project} added to codebase but changes are not yet under version control.", :yellow) end end