Skip to content

Commit

Permalink
1.1 (#26)
Browse files Browse the repository at this point in the history
* Fixed a bug when running in Python 2.x

* Fixed a bug that occurred when no tags were present

* Removed Django and dependencies from internal requirements.txt

Please make sure to have all your dependencies, including Django, in your project’s requirements.txt instead

* Fixed a bug where debug mode would halt execution

* Fixed an issue where the image would be built multiple times during deploy

* Cleaned up line breaks

* Moved support files to their own directory

* Added Initialize command

* Added code to deal with existing files in Py3 and Py2

* Added hint to edit deploy.ini

* Fixed a bug with Python2.7 compatbility

* Improved handling of config files

* Changed build process to show failed builds.

* Changed build process to show failed builds.

* Added initialize command that creates a new jonah project

* Fixed a Python3 compatibility issue

* Fixed another Python3 issue

* Added a dash of documentaiton to system_initialization.sh

* Renamed deploy.py to jonah.py

Things are getting serious and professional over here :D~

* Moved .dockerignore to the correct directory

* Created a preliminary python package

* Switched README to reStructured Text for better PyPI compatibility

* Adding supervisord conf file, which I forgot

* Progress re Docs

* Readme contd: Moving an existing project

* Readme contd: Configuration and Testing

* Readme contd: Commands

* Readme contd: Added some subheadings

* New GIF

Pronounced with a hard G

* Last preparations before pull request

- Renamed confusingly named “initialization” shell scripts
- Improved Readme layout
- bumped version number

* Added proper sidebar for the Django DDP project name issue into the README

* Added intro section to readme

* Added intro section to readme

* Fixed conflict in README

* Bumping Version Number to 1.0.

Oh yeah!

* Bumping Version number to 1.0.1.dev1

* Added a check wether docker is installed before initializing.

This fixes #15

* Hotfix for a supervisord bug

The file supervisord.conf contained a line that referenced the wrong file path for spinup.sh. This hotfix fixes that. Fixes #18.

* Updated initialize method to print out more accurate error messages

#20

* Added alias "init" for "initialize" command

fixed #21

* Improved Help output

fixed #11

* Bumped Version Number to 1.0.3

* Bumbed version number to 1.1b1

* Deduplicated help code, moved help its own method

This fixes #23

* Added “version” command, and moved the version number to version.py

This fixes #22

* Changed “backspace” to a static method

This ekes out about 0.0000001% of performance, and also removes a warning in PyCharm.

* Improved wording for “direct_deploy” doc string

* Updated Version Number to 1.1
  • Loading branch information
winsmith authored Jun 1, 2017
1 parent e28fb5f commit 7e44254
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 33 deletions.
10 changes: 3 additions & 7 deletions jonah/bin/jonah
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
#!/usr/bin/env python
import sys
import jonah
from jonah import Deployer

if __name__ == '__main__':
d = jonah.Deployer()
d = Deployer()

if len(sys.argv) > 1 and sys.argv[1] in dir(d):
if len(sys.argv) > 2 and sys.argv[2] == 'debug':
d.debug_mode = True
getattr(d, sys.argv[1])()
else:
print("USAGE:")
print("\t%s <COMMAND>, where command is one of the following:\n" % sys.argv[0])

for arg in dir(d):
print("\t" + arg.ljust(10) + "\t" + getattr(d, arg).__doc__)
print(d.help(sys.argv))
exit(0)
62 changes: 38 additions & 24 deletions jonah/jonah.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
import shlex
import shutil
import textwrap
import version

# requests might now be available. Don't run the "deploy" command in this case
# requests might not be available. Don't run the "deploy" command in this case
try:
import requests
except ImportError:
Expand Down Expand Up @@ -45,8 +46,32 @@ def __init__(self, config_file_path=os.path.join(os.getcwd(), 'jonah.ini')):

@staticmethod
def __dir__(**kwargs):
return ['initialize', 'init', 'build', 'clean_build', 'develop', 'compilemessages', 'stop', 'reload', 'shell', 'tag',
'test', 'stage', 'deploy', 'direct_deploy', 'cleanup']
return ['initialize', 'init', 'build', 'clean_build', 'develop', 'compilemessages', 'stop', 'reload', 'shell',
'tag', 'test', 'stage', 'deploy', 'direct_deploy', 'cleanup', 'version']

def help(self, argv=('jonah',)):
"""Output the help screen"""
output = "Jonah {} -- ".format(version.__version__)

output += "USAGE:\n"
output += " {} <COMMAND>, where <COMMMAND> is one of the following:\n".format(argv[0])

commands = {"General": ['init', 'build', 'clean_build', 'cleanup', 'version'],
"Development": ['develop', 'reload', 'shell', 'stop', 'test', 'compilemessages'],
"Deployment": ['stage', 'deploy', 'tag', 'direct_deploy']}

for group_name in commands.keys():
output += "\n {}:\n".format(group_name)
for command_name in commands[group_name]:
command_help = textwrap.wrap(getattr(self, command_name).__doc__, 56)
output += " - {}\t{}\n".format(command_name.ljust(12), command_help[0])
if len(command_help) > 1:
for additional_line in command_help[1:]:
output += (" " * 20) + "\t" + additional_line + "\n"

return output

# Helper Methods ###################################################################################################

def run(self, cmd, cwd=None, exceptions_should_bubble_up=False, spew=False):
"""Run a shell command"""
Expand All @@ -55,8 +80,8 @@ def run(self, cmd, cwd=None, exceptions_should_bubble_up=False, spew=False):

if spew:
# return live output for the function to handle instead of one blob
return subprocess.Popen(shlex.split(cmd), cwd=self.working_dir if cwd is None else cwd, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
return subprocess.Popen(shlex.split(cmd), cwd=self.working_dir if cwd is None else cwd,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

try:
return subprocess.check_output(shlex.split(cmd), cwd=self.working_dir if cwd is None else cwd,
Expand Down Expand Up @@ -91,7 +116,8 @@ def full_name(self, environment):
# environment should be 'develop', 'staging', or 'production'
return self.get_configuration('DOCKER_IMAGE_NAME', environment)

def backspace(self, string_to_escape):
@staticmethod
def backspace(string_to_escape):
if string_to_escape is None:
return
for char in string_to_escape:
Expand All @@ -100,6 +126,10 @@ def backspace(self, string_to_escape):

# User Actions #####################################################################################################

def version(self):
"""Print out the version number and exit"""
self.printout(version.__version__)

def check_docker(self):
"""Check that the Docker executable is available on the user's system."""
try:
Expand Down Expand Up @@ -327,7 +357,7 @@ def stage(self):
self.deploy(environment=staging)

def direct_deploy(self, environment=production):
"""Deploy as tag "master" on production server, without warning and without asking for confirmation. Danger Zone. """
"""Deploy as tag "master" on production server, without warning or asking for confirmation. Danger Zone. """
self.build()
self.tag(environment, tag=environment)
self.push(environment)
Expand Down Expand Up @@ -376,21 +406,5 @@ def cleanup(self):
d.debug_mode = True
getattr(d, sys.argv[1])()
else:
print("USAGE:")
print(" {} <COMMAND>, where <COMMMAND> is one of the following:".format(sys.argv[0]))

commands = {}
commands["General"] = ['init', 'build', 'clean_build', 'cleanup']
commands["Development"] = ['develop', 'reload', 'shell', 'stop', 'test', 'compilemessages']
commands["Deployment"] = ['stage', 'deploy', 'tag', 'direct_deploy']

for groupname in commands.keys():
print("\n {}:".format(groupname))
for command_name in commands[groupname]:
command_help = textwrap.wrap(getattr(d, command_name).__doc__, 56)
print(" - {}\t{}".format(command_name.ljust(12), command_help[0]))
if len(command_help) > 1:
for additional_line in command_help[1:]:
print((" " * 20) + "\t" + additional_line)

print(d.help(sys.argv))
exit(0)
1 change: 1 addition & 0 deletions jonah/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '1.1'
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# To use a consistent encoding
from codecs import open
from os import path
from jonah.version import __version__

here = path.abspath(path.dirname(__file__))

Expand All @@ -22,7 +23,7 @@
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version='1.0.3',
version=__version__,

description='A way to pack your Django Development, Deployment and Testing into Docker',
long_description=long_description,
Expand All @@ -43,7 +44,7 @@
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 4 - Beta',
'Development Status :: 5 - Production/Stable',

# Indicate who your project is intended for
'Intended Audience :: Developers',
Expand Down

0 comments on commit 7e44254

Please sign in to comment.