Skip to content

Commit

Permalink
Merge pull request conan-io#3468 from Minimonium/feature/add_relative…
Browse files Browse the repository at this point in the history
…_config_install

Feature/add relative config install
  • Loading branch information
memsharded committed Sep 4, 2018
2 parents f21e106 + 56f2894 commit 6bd266d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions conans/client/conan_api.py
Expand Up @@ -495,6 +495,10 @@ def config_rm(self, item):


@api_method @api_method
def config_install(self, item, verify_ssl, config_type=None, args=None): def config_install(self, item, verify_ssl, config_type=None, args=None):
# _make_abs_path, but could be not a path at all
if item is not None and os.path.exists(item) and not os.path.isabs(item):
item = os.path.abspath(item)

from conans.client.conf.config_installer import configuration_install from conans.client.conf.config_installer import configuration_install
return configuration_install(item, self._client_cache, self._user_io.out, verify_ssl, config_type, args) return configuration_install(item, self._client_cache, self._user_io.out, verify_ssl, config_type, args)


Expand Down
17 changes: 16 additions & 1 deletion conans/test/command/config_install_test.py
Expand Up @@ -4,7 +4,7 @@
import os import os
import zipfile import zipfile
from conans.test.utils.test_files import temp_folder from conans.test.utils.test_files import temp_folder
from conans.util.files import load, save_files, save from conans.util.files import load, save_files, save, mkdir
from conans.client.remote_registry import RemoteRegistry, Remote from conans.client.remote_registry import RemoteRegistry, Remote
from mock import patch from mock import patch
from conans.client.rest.uploader_downloader import Downloader from conans.client.rest.uploader_downloader import Downloader
Expand Down Expand Up @@ -222,6 +222,21 @@ def install_repo_test(self):
self.client.run('config install "%s/.git"' % folder) self.client.run('config install "%s/.git"' % folder)
self._check("%s/.git" % folder) self._check("%s/.git" % folder)


def install_repo_relative_test(self):
relative_folder = "./config"
absolute_folder = os.path.join(self.client.current_folder, "config")
mkdir(absolute_folder)
folder = self._create_profile_folder(absolute_folder)
with tools.chdir(folder):
self.client.runner('git init .')
self.client.runner('git add .')
self.client.runner('git config user.name myname')
self.client.runner('git config user.email myname@mycompany.com')
self.client.runner('git commit -m "mymsg"')

self.client.run('config install "%s/.git"' % relative_folder)
self._check(os.path.join("%s" % folder, ".git"))

def install_custom_args_test(self): def install_custom_args_test(self):
""" should install from a git repo """ should install from a git repo
""" """
Expand Down

0 comments on commit 6bd266d

Please sign in to comment.