Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warns rather than fail if external project isn't linked #556

Merged
merged 1 commit into from
Oct 5, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions dev/dvm/lib/dvm/project/project.rb
Original file line number Diff line number Diff line change
@@ -1,27 +1,36 @@
require "mixlib/shellout"
require "highline/import"

module DVM
class Project
attr_reader :name, :project, :config, :service, :project_dir, :path, :external, :omnibus_project
include DVM::Tools

# TODO check required fields in config
def initialize(project_name, config)
@project = config['projects'][project_name]
@external = @project['external'] || false
# We're not doing auto-checkout for now - so tell them they need to find a mising thing
@omnibus_project = @project['omnibus-project'] || "opscode"
@name = project.has_key?('name') ? project['name'] : project_name

if external
@path = project['path'] || "external-deps/#{name}"
else
@path = project['path'] || "src/#{name}"
end

@project_dir = "/host/#{path}"
if (external and !File.exists?(@project_dir))
raise DVM::DVMArgumentError, "Please check out or symlink #{name} into chef-server/external-deps on your host before attempting to load it."
end
warn_if_not_linked
@config = config
@service = @project['service']
end

def warn_if_not_linked
if (external and !File.exists?(project_dir))
say(HighLine.color("Please check out or symlink #{name} into chef-server/external-deps on your host before attempting to load it.", :yellow))
end
end

def start(args, detach)
raise DVM::DVMArgumentError, "Start not supported for #{name}"
end
Expand All @@ -47,12 +56,14 @@ def deps
def load(build)
do_load(build)
end

def do_load(build)
end

def unload
do_unload
end

def do_unload
raise "You should implement this now."
end
Expand Down Expand Up @@ -112,6 +123,5 @@ def update(args)
def console
raise DVM::DVMArgumentError, "This project does not support a console."
end

end
end