Skip to content

Commit 67d6f6f

Browse files
committed
Removed unnecessary README files from brewjs and libnx templates
1 parent 9b22db3 commit 67d6f6f

File tree

21 files changed

+180
-145
lines changed

21 files changed

+180
-145
lines changed

nxstart/cli.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,27 @@ def __init__(self):
2626

2727

2828
@click.group()
29-
@click.option('--name', '-n', default=None, help='The name of your project')
30-
@click.option('--author', '-a', default=None, help='The full name of the author')
29+
@click.option("--name", "-n", default=None, help="The name of your project")
30+
@click.option("--author", "-a", default=None, help="The full name of the author")
3131
@pass_context
3232
def cli(ctx, name, author):
3333
click.echo(TITLE_TEXT)
3434
click.echo(VERSION_STRING)
3535
if not name:
36-
name = click.prompt('Please enter the name of your project', type=str)
36+
name = click.prompt("Please enter the name of your project", type=str)
3737
if not author:
38-
author = click.prompt('Please enter your name', type=str)
38+
author = click.prompt("Please enter your name", type=str)
3939
ctx.name = name
4040
ctx.author = author
4141

4242

43-
@cli.command('libnx', short_help='create a new libnx project (C++)')
44-
@click.option('--clion/--no-clion', default=False, prompt='Are you using CLion?', help='include CMakeLists.txt')
43+
@cli.command("libnx", short_help="create a new libnx project (C++)")
44+
@click.option(
45+
"--clion/--no-clion",
46+
default=False,
47+
prompt="Are you using CLion?",
48+
help="include CMakeLists.txt",
49+
)
4550
@pass_context
4651
def libnx(ctx, clion):
4752
"""
@@ -53,8 +58,13 @@ def libnx(ctx, clion):
5358
app.libnx(ctx.name, ctx.author, clion, ctx.cwd)
5459

5560

56-
@cli.command('libt', short_help='create a new libtransistor project (C)')
57-
@click.option('--clion/--no-clion', default=False, prompt='Are you using CLion?', help='include CMakeLists.txt')
61+
@cli.command("libt", short_help="create a new libtransistor project (C)")
62+
@click.option(
63+
"--clion/--no-clion",
64+
default=False,
65+
prompt="Are you using CLion?",
66+
help="include CMakeLists.txt",
67+
)
5868
@pass_context
5969
def libt(ctx, clion):
6070
"""
@@ -66,7 +76,7 @@ def libt(ctx, clion):
6676
app.libt(ctx.name, ctx.author, clion, ctx.cwd)
6777

6878

69-
@cli.command('brewjs', short_help='create a new BrewJS project (Javascript)')
79+
@cli.command("brewjs", short_help="create a new BrewJS project (Javascript)")
7080
@pass_context
7181
def brewjs(ctx):
7282
"""
@@ -77,7 +87,7 @@ def brewjs(ctx):
7787
app.brewjs(ctx.name, ctx.author, ctx.cwd)
7888

7989

80-
@cli.command('pynx', short_help='create a new PyNX project (Python)')
90+
@cli.command("pynx", short_help="create a new PyNX project (Python)")
8191
@pass_context
8292
def pynx(ctx):
8393
"""

nxstart/filebuilder/brewjs.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import os
77
from distutils.dir_util import copy_tree
88

9-
from nxstart.utils.files import get_full_path, replace_in_file
9+
from nxstart.utils.files import (check_and_create_directory, get_full_path,
10+
replace_in_file)
1011

1112

1213
def create_brewjs_project(folder_path, name, author):
@@ -18,21 +19,23 @@ def create_brewjs_project(folder_path, name, author):
1819
:param name: Name of the project
1920
:param author: Name of the author
2021
"""
21-
template_folder = get_full_path(os.path.join('templates', 'brewjs'))
22+
template_folder = get_full_path(os.path.join("templates", "brewjs"))
2223
copy_tree(template_folder, folder_path)
2324

24-
main_js_file = os.path.join(folder_path, 'Source.js')
25+
main_js_file = os.path.join(folder_path, "Source.js")
2526
main_js_replacements = {
26-
'APP_AUTHOR_PLACEHOLDER': author,
27-
'APP_NAME_PLACEHOLDER': name,
28-
'DATE_PLACEHOLDER': datetime.datetime.now().strftime("%Y-%m-%d")
27+
"APP_AUTHOR_PLACEHOLDER": author,
28+
"APP_NAME_PLACEHOLDER": name,
29+
"DATE_PLACEHOLDER": datetime.datetime.now().strftime("%Y-%m-%d"),
2930
}
3031
replace_in_file(main_js_file, main_js_replacements)
3132

32-
package_json_file = os.path.join(folder_path, 'package.json')
33+
package_json_file = os.path.join(folder_path, "package.json")
3334
package_json_replacements = {
34-
'APP_AUTHOR_PLACEHOLDER': author,
35-
'APP_NAME_PLACEHOLDER': name,
36-
'DATE_PLACEHOLDER': datetime.datetime.now().strftime("%Y-%m-%d")
35+
"APP_AUTHOR_PLACEHOLDER": author,
36+
"APP_NAME_PLACEHOLDER": name,
37+
"DATE_PLACEHOLDER": datetime.datetime.now().strftime("%Y-%m-%d"),
3738
}
3839
replace_in_file(package_json_file, package_json_replacements)
40+
41+
check_and_create_directory(os.path.join(folder_path, "assets"))

nxstart/filebuilder/generic.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
"""Includes generic functions such as copying the README.md file."""
44

5+
import glob
56
import os
67

78
from nxstart.utils.files import replace_in_file
@@ -15,11 +16,10 @@ def modify_readme_file(folder_path, name, author):
1516
:param name: Project name
1617
:param author: Project author
1718
"""
18-
new_readme_file = os.path.join(folder_path, 'README.md')
19+
new_readme_file = os.path.join(folder_path, "README.md")
1920
new_readme_file_replacements = {
20-
'APP_NAME_PLACEHOLDER': name,
21-
'APP_AUTHOR_PLACEHOLDER': author
22-
21+
"APP_NAME_PLACEHOLDER": name,
22+
"APP_AUTHOR_PLACEHOLDER": author,
2323
}
2424
replace_in_file(new_readme_file, new_readme_file_replacements)
2525

@@ -30,7 +30,7 @@ def remove_cmake_lists_file(folder_path):
3030
3131
:param folder_path: Path to created folder
3232
"""
33-
cmake_lists_file = os.path.join(folder_path, 'CMakeLists.txt')
33+
cmake_lists_file = os.path.join(folder_path, "CMakeLists.txt")
3434
os.remove(cmake_lists_file)
3535

3636

@@ -41,8 +41,6 @@ def modify_cmake_lists_file(folder_path, folder_name):
4141
:param folder_path: Path to created folder
4242
:param folder_name: Project folder name
4343
"""
44-
cmake_lists_file = os.path.join(folder_path, 'CMakeLists.txt')
45-
cmake_lists_file_replacements = {
46-
'FOLDER_NAME_PLACEHOLDER': folder_name
47-
}
44+
cmake_lists_file = os.path.join(folder_path, "CMakeLists.txt")
45+
cmake_lists_file_replacements = {"FOLDER_NAME_PLACEHOLDER": folder_name}
4846
replace_in_file(cmake_lists_file, cmake_lists_file_replacements)

nxstart/filebuilder/libnx.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import os
77
from distutils.dir_util import copy_tree
88

9-
from nxstart.utils.files import get_full_path, replace_in_file
9+
from nxstart.utils.files import (check_and_create_directory, get_full_path,
10+
replace_in_file)
1011

1112

1213
def create_libnx_project(folder_path, name, author):
@@ -18,20 +19,23 @@ def create_libnx_project(folder_path, name, author):
1819
:param name: Name of the project
1920
:param author: Name of the author
2021
"""
21-
template_folder = get_full_path(os.path.join('templates', 'libnx'))
22+
template_folder = get_full_path(os.path.join("templates", "libnx"))
2223
copy_tree(template_folder, folder_path)
2324

24-
main_cpp_file = os.path.join(folder_path, 'source', 'main.cpp')
25+
main_cpp_file = os.path.join(folder_path, "source", "main.cpp")
2526
main_cpp_replacements = {
26-
'APP_AUTHOR_PLACEHOLDER': author,
27-
'APP_NAME_PLACEHOLDER': name,
28-
'DATE_PLACEHOLDER': datetime.datetime.now().strftime("%Y-%m-%d")
27+
"APP_AUTHOR_PLACEHOLDER": author,
28+
"APP_NAME_PLACEHOLDER": name,
29+
"DATE_PLACEHOLDER": datetime.datetime.now().strftime("%Y-%m-%d"),
2930
}
3031
replace_in_file(main_cpp_file, main_cpp_replacements)
3132

32-
makefile = os.path.join(folder_path, 'Makefile')
33+
makefile = os.path.join(folder_path, "Makefile")
3334
makefile_replacements = {
34-
'APP_NAME_PLACEHOLDER': name,
35-
'APP_AUTHOR_PLACEHOLDER': author
35+
"APP_NAME_PLACEHOLDER": name,
36+
"APP_AUTHOR_PLACEHOLDER": author,
3637
}
3738
replace_in_file(makefile, makefile_replacements)
39+
40+
check_and_create_directory(os.path.join(folder_path, "data"))
41+
check_and_create_directory(os.path.join(folder_path, "includes"))

nxstart/filebuilder/libt.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@ def create_libt_project(folder_path, name, author):
1818
:param name: Name of the project
1919
:param author: Name of the author
2020
"""
21-
template_folder = get_full_path(os.path.join('templates', 'libt'))
21+
template_folder = get_full_path(os.path.join("templates", "libt"))
2222
copy_tree(template_folder, folder_path)
2323

24-
main_c_file = os.path.join(folder_path, 'main.c')
24+
main_c_file = os.path.join(folder_path, "main.c")
2525
main_c_replacements = {
26-
'APP_AUTHOR_PLACEHOLDER': author,
27-
'APP_NAME_PLACEHOLDER': name,
28-
'DATE_PLACEHOLDER': datetime.datetime.now().strftime("%Y-%m-%d")
26+
"APP_AUTHOR_PLACEHOLDER": author,
27+
"APP_NAME_PLACEHOLDER": name,
28+
"DATE_PLACEHOLDER": datetime.datetime.now().strftime("%Y-%m-%d"),
2929
}
3030
replace_in_file(main_c_file, main_c_replacements)
3131

32-
makefile = os.path.join(folder_path, 'Makefile')
32+
makefile = os.path.join(folder_path, "Makefile")
3333
makefile_replacements = {
34-
'APP_NAME_PLACEHOLDER': name,
35-
'APP_AUTHOR_PLACEHOLDER': author
34+
"APP_NAME_PLACEHOLDER": name,
35+
"APP_AUTHOR_PLACEHOLDER": author,
3636
}
3737
replace_in_file(makefile, makefile_replacements)

nxstart/filebuilder/pynx.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ def create_pynx_project(folder_path, name, author):
1818
:param name: Name of the project
1919
:param author: Name of the author
2020
"""
21-
template_folder = get_full_path(os.path.join('templates', 'pynx'))
21+
template_folder = get_full_path(os.path.join("templates", "pynx"))
2222
copy_tree(template_folder, folder_path)
2323

24-
main_cpp_file = os.path.join(folder_path, 'main.py')
24+
main_cpp_file = os.path.join(folder_path, "main.py")
2525
main_cpp_replacements = {
26-
'APP_AUTHOR_PLACEHOLDER': author,
27-
'APP_NAME_PLACEHOLDER': name,
28-
'DATE_PLACEHOLDER': datetime.datetime.now().strftime("%Y-%m-%d")
26+
"APP_AUTHOR_PLACEHOLDER": author,
27+
"APP_NAME_PLACEHOLDER": name,
28+
"DATE_PLACEHOLDER": datetime.datetime.now().strftime("%Y-%m-%d"),
2929
}
3030
replace_in_file(main_cpp_file, main_cpp_replacements)

nxstart/templates/brewjs/assets/README.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

nxstart/templates/libnx/data/README.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

nxstart/templates/libnx/include/README.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

nxstart/templates/pynx/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ def main():
1414
"""
1515
The main loop
1616
"""
17-
print('Hello world!')
17+
print("Hello world!")
1818

1919

20-
if __name__ == '__main__':
20+
if __name__ == "__main__":
2121
main()

0 commit comments

Comments
 (0)