-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from michaeljoseph/rm-sh-add-fabric
-sh + fabric everywhere
- Loading branch information
Showing
11 changed files
with
38 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
CHANGELOG = 'CHANGELOG.md' | ||
REQUIREMENTS = 'requirements.txt' | ||
arguments = {} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,16 @@ | ||
import logging | ||
|
||
from fabric.api import local | ||
|
||
from changes import config | ||
from changes.compat import check_output, CalledProcessError | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
def handle_dry_run(fn, *args): | ||
def dry_run(command): | ||
if not config.arguments.get('--dry-run', True): | ||
return fn(*args) | ||
else: | ||
log.debug('dry run of %s %s, skipping' % (fn, args)) | ||
return True | ||
|
||
|
||
def execute(command, dry_run=True): | ||
if not dry_run: | ||
try: | ||
return check_output(command.split(' ')).split('\n') | ||
except CalledProcessError as e: | ||
log.error('return code: %s, output: %s', e.returncode, e.output) | ||
return False | ||
return local(command, capture=False) | ||
else: | ||
log.debug('dry run of %s, skipping' % command) | ||
return True | ||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,17 @@ | ||
import logging | ||
|
||
import sh | ||
|
||
from changes import config, shell | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
def commit_version_change(): | ||
module_name, dry_run, new_version = config.common_arguments() | ||
|
||
shell.handle_dry_run( | ||
sh.git.commit, | ||
('-m', new_version, '%s/__init__.py' % module_name, config.CHANGELOG) | ||
) | ||
|
||
shell.handle_dry_run(sh.git.push, ()) | ||
module_name, _, new_version = config.common_arguments() | ||
shell.dry_run('git commit -m "%s" %s/__init__.py %s' % (new_version, module_name, config.CHANGELOG)) | ||
shell.dry_run('git push') | ||
|
||
|
||
def tag(): | ||
_, dry_run, new_version = config.common_arguments() | ||
|
||
shell.handle_dry_run( | ||
sh.git.tag, | ||
('-a', new_version, '-m', '"%s"' % new_version) | ||
) | ||
|
||
shell.handle_dry_run(sh.git.push, ('--tags')) | ||
shell.dry_run('git tag -a %s -m "%s"' % (new_version, new_version)) | ||
shell.dry_run('git push --tags') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters