Changeset - f9c8fec48185
[Not reviewed]
default
1 3 1
Thomas De Schampheleire - 7 years ago 2018-11-18 20:02:17
thomas.de_schampheleire@nokia.com
cli: convert 'gearbox make-rcext' in 'kallithea-cli extensions-create'

Note: 'extensions' instead of 'rcextensions' as first step to get away from
the 'rc' prefix.
4 files changed with 14 insertions and 21 deletions:
0 comments (0 inline, 0 general)
docs/usage/customization.rst
Show inline comments
 
@@ -55,7 +55,7 @@ overwrite an entire function, change a g
 

	
 
To generate a skeleton extensions package, run::
 

	
 
    gearbox make-rcext -c my.ini
 
    kallithea-cli extensions-create -c my.ini
 

	
 
This will create an ``rcextensions`` package next to the specified ``ini`` file.
 
See the ``__init__.py`` file inside the generated ``rcextensions`` package
kallithea/bin/kallithea_cli.py
Show inline comments
 
@@ -18,6 +18,7 @@ from kallithea.bin.kallithea_cli_base im
 
# import commands (they will add themselves to the 'cli' object)
 
import kallithea.bin.kallithea_cli_config
 
import kallithea.bin.kallithea_cli_db
 
import kallithea.bin.kallithea_cli_extensions
 
import kallithea.bin.kallithea_cli_iis
 
import kallithea.bin.kallithea_cli_ishell
 
import kallithea.bin.kallithea_cli_repo
kallithea/bin/kallithea_cli_extensions.py
Show inline comments
 
file renamed from kallithea/lib/paster_commands/make_rcextensions.py to kallithea/bin/kallithea_cli_extensions.py
 
@@ -12,38 +12,31 @@
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
"""
 
kallithea.lib.paster_commands.make_rcextensions
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
make-rcext gearbox command for Kallithea
 

	
 
This file was forked by the Kallithea project in July 2014.
 
This file was forked by the Kallithea project in July 2014 and later moved.
 
Original author and date, and relevant copyright and licensing information is below:
 
:created_on: Mar 6, 2012
 
:author: marcink
 
:copyright: (c) 2013 RhodeCode GmbH, and others.
 
:license: GPLv3, see LICENSE.md for more details.
 
"""
 

	
 
import click
 
import kallithea.bin.kallithea_cli_base as cli_base
 

	
 
import os
 
import pkg_resources
 

	
 
from kallithea.lib.paster_commands.common import ask_ok, BasePasterCommand
 

	
 
import kallithea
 
from kallithea.lib.paster_commands.common import ask_ok
 

	
 
class Command(BasePasterCommand):
 
    """Kallithea: Write template file for extending Kallithea in Python
 
@cli_base.register_command(config_file=True)
 
def extensions_create():
 
    """Write template file for extending Kallithea in Python.
 

	
 
    A rcextensions directory with a __init__.py file will be created next to
 
    An rcextensions directory with a __init__.py file will be created next to
 
    the ini file. Local customizations in that file will survive upgrades.
 
    The file contains instructions on how it can be customized.
 
    """
 

	
 
    requires_db_session = False
 

	
 
    def take_action(self, args):
 
        here = self.config['here']
 
    here = kallithea.CONFIG['here']
 
        content = pkg_resources.resource_string(
 
            'kallithea', os.path.join('config', 'rcextensions', '__init__.py')
 
        )
 
@@ -52,7 +45,7 @@ class Command(BasePasterCommand):
 
            msg = ('Extension file %s already exists, do you want '
 
                   'to overwrite it ? [y/n]') % ext_file
 
            if not ask_ok(msg):
 
                print 'Nothing done, exiting...'
 
            click.echo('Nothing done, exiting...')
 
                return
 

	
 
        dirname = os.path.dirname(ext_file)
 
@@ -60,4 +53,4 @@ class Command(BasePasterCommand):
 
            os.makedirs(dirname)
 
        with open(ext_file, 'wb') as f:
 
            f.write(content)
 
            print 'Wrote new extensions file to %s' % ext_file
 
        click.echo('Wrote new extensions file to %s' % ext_file)
setup.py
Show inline comments
 
@@ -161,7 +161,6 @@ setuptools.setup(
 
    [gearbox.commands]
 
    celeryd=kallithea.lib.paster_commands.celeryd:Command
 
    make-index=kallithea.lib.paster_commands.make_index:Command
 
    make-rcext=kallithea.lib.paster_commands.make_rcextensions:Command
 
    upgrade-db=kallithea.lib.dbmigrate:UpgradeDb
 
    """,
 
)
0 comments (0 inline, 0 general)