lib/vagrant-mutate/box_loader.rb in vagrant-mutate-0.2.2 vs lib/vagrant-mutate/box_loader.rb in vagrant-mutate-0.2.3

- old
+ new

@@ -26,11 +26,11 @@ end def load(box_arg) if box_arg =~ /:\/\// box = load_from_url(box_arg) - elsif box_arg =~ /\.box$/ + elsif File.file?(box_arg) box = load_from_file(box_arg) else box = load_from_boxes_path(box_arg) end @@ -171,15 +171,19 @@ return 'virtualbox' end end def parse_identifier(identifier) - if identifier =~ /^([\w-]+)#{File::SEPARATOR}([\w-]+)$/ - @logger.info "Parsed provider name as #{$1} and box name as #{$2}" - return $1, $2 - else + split_id = identifier.split('/') + case split_id.length + when 2 + @logger.info "Parsed provider name as #{split_id[0]} and box name as #{split_id[1]}" + return split_id[0], split_id[1] + when 1 @logger.info "Parsed provider name as not given and box name as #{identifier}" return nil, identifier + else + raise Errors::ParseIdentifierFailed, :identifier => identifier end end def verify_input_dir(provider_name, name) input_dir = File.join( @env.boxes_path, name, provider_name)