Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Feb 26, 2021. It is now read-only.
/python-vuejsPublic archive

Commita8f7f3a

Browse files
author
cstrap
committed
Vue.js wrapper via vue-cli provided by click
1 parent88a83b7 commita8f7f3a

File tree

4 files changed

+141
-0
lines changed

4 files changed

+141
-0
lines changed

‎python_vuejs/django.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# -*- coding: utf-8 -*-
2+
3+
importclick
4+
5+
6+
@click.command()
7+
defdjan(args=None):
8+
"""Console script for python_vuejs"""
9+
click.echo("Replace this message by putting your code into "
10+
"python_vuejs.cli.main")
11+
click.echo("See click documentation at http://click.pocoo.org/")

‎python_vuejs/utils.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__importabsolute_import,division,print_function,unicode_literals
3+
4+
importcontextlib
5+
importos
6+
7+
8+
@contextlib.contextmanager
9+
defcd(path):
10+
"""
11+
A context manager which changes the working directory to the given
12+
path, and then changes it back to its previous value on exit.
13+
"""
14+
prev_cwd=os.getcwd()
15+
os.chdir(path)
16+
yield
17+
os.chdir(prev_cwd)

‎python_vuejs/vuejs.py‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__importabsolute_import,division,print_function
3+
4+
importclick
5+
6+
from .utilsimportcd
7+
8+
fromsubprocessimportcheck_output
9+
10+
try:
11+
fromsubprocessimportcallasrun
12+
exceptImportError:
13+
fromsubprocessimportrun
14+
15+
16+
@click.command()
17+
defcheck_env():
18+
"""
19+
Check if node > 5 and npm > 3 are installed
20+
"""
21+
out=all([check_output(['node -v'.split()])>'v5.0.0',check_output(['npm -v'.split()])>='4.0.0'])
22+
ifout:
23+
click.echo(click.style('Found node and npm',fg='green'))
24+
else:
25+
click.echo(click.style('Missing node and npm installation',fg='red'))
26+
returnout
27+
28+
29+
@click.command()
30+
definstall_vue_cli():
31+
"""
32+
Install vue-cli
33+
"""
34+
out=check_output(['vue -V'.split()])
35+
ifout>='2.0.0.':
36+
click.echo(click.style('Found valid vue-cli',fg='green'))
37+
else:
38+
run(['npm install -g vue-cli'.split()])
39+
click.echo(click.style('Installed vue-cli globally',fg='green'))
40+
41+
42+
@click.command()
43+
@click.argument('project')
44+
defstartvueapp(project):
45+
run('vue init webpack {project}'.format(project=project).split())
46+
withcd(project):
47+
run(['npm install'.split()])
48+
49+
50+
@click.command()
51+
defvuedev():
52+
run(['npm run dev'.split()])

‎setup.py‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
fromsetuptoolsimportsetup
5+
6+
withopen('README.rst')asreadme_file:
7+
readme=readme_file.read()
8+
9+
withopen('HISTORY.rst')ashistory_file:
10+
history=history_file.read()
11+
12+
requirements= [
13+
'Click>=6.0',
14+
'colorama',
15+
]
16+
17+
test_requirements= [
18+
# TODO: put package test requirements here
19+
]
20+
21+
setup(
22+
name='python_vuejs',
23+
version='0.0.1',
24+
description="Gluing Python and Vue.js with a set of scripts",
25+
long_description=readme+'\n\n'+history,
26+
author="Christian Strappazzon",
27+
author_email='lab@strap.it',
28+
url='https://github.com/cstrap/python-vuejs',
29+
packages=[
30+
'python_vuejs',
31+
],
32+
package_dir={'python_vuejs':
33+
'python_vuejs'},
34+
entry_points={
35+
'console_scripts': [
36+
'checkenv=python_vuejs.vuejs:check_env',
37+
'vuecli=python_vuejs.vuejs:install_vue_cli',
38+
'startvueapp=python_vuejs.vuejs:startvueapp',
39+
'startvueapp=python_vuejs.vuejs:vuedev',
40+
]
41+
},
42+
include_package_data=True,
43+
install_requires=requirements,
44+
license="MIT license",
45+
zip_safe=False,
46+
keywords='python_vuejs',
47+
classifiers=[
48+
'Development Status :: 2 - Pre-Alpha',
49+
'Intended Audience :: Developers',
50+
'License :: OSI Approved :: MIT License',
51+
'Natural Language :: English',
52+
"Programming Language :: Python :: 2",
53+
'Programming Language :: Python :: 2.7',
54+
'Programming Language :: Python :: 3',
55+
'Programming Language :: Python :: 3.3',
56+
'Programming Language :: Python :: 3.4',
57+
'Programming Language :: Python :: 3.5',
58+
],
59+
test_suite='tests',
60+
tests_require=test_requirements
61+
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp