Преглед изворни кода

Merge branch 'develop'

tags/v0.3
Ben Kurtovic пре 9 година
родитељ
комит
2fea39f929
4 измењених фајлова са 34 додато и 7 уклоњено
  1. +6
    -0
      README.md
  2. +1
    -1
      gitup/__init__.py
  3. +26
    -5
      gitup/config.py
  4. +1
    -1
      setup.py

+ 6
- 0
README.md Прегледај датотеку

@@ -10,6 +10,12 @@ version of git and at least Python 2.7 installed.

# Installation

With [Homebrew](http://brew.sh/):

brew install pr0d1r2/contrib/gitup && brew link gitup

## From source

First:

git clone git://github.com/earwig/git-repo-updater.git


+ 1
- 1
gitup/__init__.py Прегледај датотеку

@@ -10,5 +10,5 @@ gitup: the git repository updater
__author__ = "Ben Kurtovic"
__copyright__ = "Copyright (C) 2011-2014 Ben Kurtovic"
__license__ = "MIT License"
__version__ = "0.2.3"
__version__ = "0.2.4"
__email__ = "ben.kurtovic@gmail.com"

+ 26
- 5
gitup/config.py Прегледај датотеку

@@ -13,24 +13,45 @@ from colorama import Fore, Style
__all__ = ["get_bookmarks", "add_bookmarks", "delete_bookmarks",
"list_bookmarks"]

CONFIG_FILENAME = os.path.join(os.path.expanduser("~"), ".gitup")

YELLOW = Fore.YELLOW + Style.BRIGHT
RED = Fore.RED + Style.BRIGHT

INDENT1 = " " * 3

def _ensure_dirs(path):
"""Ensure the directories within the given pathname exist."""
dirname = os.path.dirname(path)
if not os.path.exists(dirname): # Race condition, meh...
os.makedirs(dirname)

def _get_config_path():
"""Return the path to the configuration file."""
xdg_cfg = os.environ.get("XDG_CONFIG_HOME") or os.path.join("~", ".config")
return os.path.join(os.path.expanduser(xdg_cfg), "gitup", "config.ini")

def _migrate_old_config_path():
"""Migrate the old config location (~/.gitup) to the new one."""
old_path = os.path.expanduser(os.path.join("~", ".gitup"))
if os.path.exists(old_path):
new_path = _get_config_path()
_ensure_dirs(new_path)
os.rename(old_path, new_path)

def _load_config_file():
"""Read the config file and return a SafeConfigParser() object."""
_migrate_old_config_path()
config = configparser.SafeConfigParser()
# Don't lowercase option names, because we are storing paths there:
config.optionxform = str
config.read(CONFIG_FILENAME)
config.read(_get_config_path())
return config

def _save_config_file(config):
"""Save config changes to the config file specified by CONFIG_FILENAME."""
with open(CONFIG_FILENAME, "wb") as config_file:
"""Save config changes to the config file returned by _get_config_path."""
_migrate_old_config_path()
cfg_path = _get_config_path()
_ensure_dirs(cfg_path)
with open(cfg_path, "wb") as config_file:
config.write(config_file)

def get_bookmarks():


+ 1
- 1
setup.py Прегледај датотеку

@@ -19,7 +19,7 @@ setup(
name = "gitup",
packages = find_packages(),
entry_points = {"console_scripts": ["gitup = gitup.script:run"]},
install_requires = ["GitPython >= 0.3.6", "colorama >= 0.3.3"],
install_requires = ["GitPython >= 1.0.1", "colorama >= 0.3.3"],
version = __version__,
author = "Ben Kurtovic",
author_email = "ben.kurtovic@gmail.com",


Loading…
Откажи
Сачувај