Skip to content

Commit

Permalink
Merge pull request #8 from roedesh/develop
Browse files Browse the repository at this point in the history
Version 0.5.0
  • Loading branch information
roedesh authored Jun 22, 2018
2 parents 82df186 + 174cc86 commit 3f73ccd
Show file tree
Hide file tree
Showing 17 changed files with 123 additions and 72 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ project
│ .editorconfig
│ .gitignore
│ CMakeLists.txt // Only if you use CLion
icon.jpg
Makefile
Makefile
icon.jpg
│ README.md
└───data
Expand All @@ -67,9 +67,9 @@ project
│ .editorconfig
│ .gitignore
│ CMakeLists.txt // Only if you use CLion
│ icon.jpg
│ main.c // Your main application file
│ Makefile
│ icon.jpg
│ README.md
```
Expand All @@ -81,7 +81,6 @@ Run `nxstart brewjs`. It will ask for a project name and author name. The follow
project
│ .editorconfig
│ .gitignore
│ HOW-TO-RUN.txt // Explains how to run a BrewJS app on the Switch
│ index.js // Your main application file
│ README.md
Expand Down Expand Up @@ -115,15 +114,15 @@ nxstart -n "My new project" -a "John Doe" libnx --no-clion
## Badge for nx-start projects
If you created a new project using this tool and you want to show some love, there is a fancy badge you can add to your README file.

[![created_with nxstart](https://img.shields.io/badge/created_with-nxstart-blue.svg)](https://github.com/roedesh/nxstart)
[![created_with nxstart](https://img.shields.io/badge/generated_by-nxstart-blue.svg)](https://github.com/roedesh/nxstart)

### Markdown
```markdown
[![created_with nxstart](https://img.shields.io/badge/created_with-nxstart-blue.svg)](https://github.com/roedesh/nxstart)
[![created_with nxstart](https://img.shields.io/badge/generated_by-nxstart-blue.svg)](https://github.com/roedesh/nxstart)
```

### reStructuredText
```
.. image:: https://img.shields.io/badge/created_with-nxstart-blue.svg
.. image:: https://img.shields.io/badge/generated_by-nxstart-blue.svg
:target: https://github.com/roedesh/nxstart
```
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ Run ``nxstart brewjs``. It will ask for a project name, author name. The followi
project
│ .editorconfig
│ .gitignore
│ HOW-TO-RUN.txt // Explains how to run a BrewJS app on the Switch.
│ index.js // Your main application file
│ README.md
Expand Down Expand Up @@ -128,3 +127,4 @@ Or if you don't use CLion:
.. code-block:: bash
$ nxstart -n "My new project" -a "John Doe" libnx --no-clion
8 changes: 4 additions & 4 deletions nxstart/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def libnx(name, author, clion, cwd):
check_and_create_directory(folder_path)

filebuilder.libnx.create_libnx_project(folder_path, name, author)
filebuilder.generic.create_readme_file(folder_path, name)
filebuilder.generic.modify_readme_file(folder_path, name, author)

if clion:
filebuilder.generic.modify_cmake_lists_file(folder_path, folder_name)
Expand All @@ -45,7 +45,7 @@ def libt(name, author, clion, cwd):
check_and_create_directory(folder_path)

filebuilder.libt.create_libt_project(folder_path, name, author)
filebuilder.generic.create_readme_file(folder_path, name)
filebuilder.generic.modify_readme_file(folder_path, name, author)

if clion:
filebuilder.generic.modify_cmake_lists_file(folder_path, folder_name)
Expand All @@ -67,7 +67,7 @@ def brewjs(name, author, cwd):
check_and_create_directory(folder_path)

filebuilder.brewjs.create_brewjs_project(folder_path, name, author)
filebuilder.generic.create_readme_file(folder_path, name)
filebuilder.generic.modify_readme_file(folder_path, name, author)

click.echo("Successfully created the BrewJS project!")

Expand All @@ -84,6 +84,6 @@ def pynx(name, author, cwd):
check_and_create_directory(folder_path)

filebuilder.pynx.create_pynx_project(folder_path, name, author)
filebuilder.generic.create_readme_file(folder_path, name)
filebuilder.generic.modify_readme_file(folder_path, name, author)

click.echo("Successfully created the PyNX project!")
11 changes: 4 additions & 7 deletions nxstart/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@

"""Defines the app context and commands."""

import click
import os

import py
import pytest
import sys
import click

from nxstart import app

Expand Down Expand Up @@ -52,14 +49,14 @@ def libnx(ctx, clion):
@cli.command('libt', short_help='create a new libtransistor project (C)')
@click.option('--clion/--no-clion', default=False, prompt='Are you using CLion?', help='include CMakeLists.txt')
@pass_context
def libnx(ctx, clion):
def libt(ctx, clion):
"""
Command for generating a libnx project.
Command for generating a libtransistor project.
:param ctx: Context
:param clion: Using CLion
"""
app.libnx(ctx.name, ctx.author, clion, ctx.cwd)
app.libt(ctx.name, ctx.author, clion, ctx.cwd)


@cli.command('brewjs', short_help='create a new BrewJS project (Javascript)')
Expand Down
2 changes: 1 addition & 1 deletion nxstart/filebuilder/brewjs.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ def create_brewjs_project(folder_path, name, author):
'APP_NAME_PLACEHOLDER': name,
'DATE_PLACEHOLDER': datetime.datetime.now().strftime("%Y-%m-%d")
}
replace_in_file(main_js_file, main_js_replacements)
replace_in_file(main_js_file, main_js_replacements)
17 changes: 8 additions & 9 deletions nxstart/filebuilder/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,19 @@
from nxstart.utils.files import get_full_path, replace_in_file


def create_readme_file(folder_path, name):
def modify_readme_file(folder_path, name, author):
"""
Copies the README.md file from the templates folder to folder_path,
and will use name as the title of the document.
Simple helper for modifying README.md files.
:param folder_path: Path to copy the file to
:param name: Project name to use as the title
:param folder_path: Path where the README.md file is
:param name: Project name
:param author: Project author
"""
template_readme_file = get_full_path(os.path.join('templates', 'README.md'))
shutil.copy2(template_readme_file, folder_path)

new_readme_file = os.path.join(folder_path, 'README.md')
new_readme_file_replacements = {
'APP_NAME_PLACEHOLDER': name
'APP_NAME_PLACEHOLDER': name,
'APP_AUTHOR_PLACEHOLDER': author

}
replace_in_file(new_readme_file, new_readme_file_replacements)

Expand Down
2 changes: 1 addition & 1 deletion nxstart/filebuilder/libt.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ def create_libt_project(folder_path, name, author):
'APP_NAME_PLACEHOLDER': name,
'APP_AUTHOR_PLACEHOLDER': author
}
replace_in_file(makefile, makefile_replacements)
replace_in_file(makefile, makefile_replacements)
1 change: 0 additions & 1 deletion nxstart/filebuilder/pynx.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,3 @@ def create_pynx_project(folder_path, name, author):
'DATE_PLACEHOLDER': datetime.datetime.now().strftime("%Y-%m-%d")
}
replace_in_file(main_cpp_file, main_cpp_replacements)

34 changes: 0 additions & 34 deletions nxstart/templates/README.md

This file was deleted.

4 changes: 0 additions & 4 deletions nxstart/templates/brewjs/HOW-TO-RUN.txt

This file was deleted.

23 changes: 23 additions & 0 deletions nxstart/templates/brewjs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# APP_NAME_PLACEHOLDER

My new awesome homebrew application for the Nintendo Switch, created with [BrewJS](https://github.com/BrewJS).

[![generated_by nxstart](https://img.shields.io/badge/generated_by-nxstart-blue.svg)](https://github.com/roedesh/nxstart)

## Features

...

## Getting Started

Download the [latest release of BrewJS](https://github.com/BrewJS/Switch/archive/master.zip)
and copy the `switch` folder to your SD card. Now you can run BrewJS games!

### Running the app

Copy this folder to `sdmc:/switch/Brew.js/`.
Now you can run this app on your Switch via BrewJS.

## Author

APP_AUTHOR_PLACEHOLDER
23 changes: 23 additions & 0 deletions nxstart/templates/libnx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# APP_NAME_PLACEHOLDER

My new awesome homebrew application for the Nintendo Switch, created with [libnx](https://github.com/switchbrew/libnx).

[![generated_by nxstart](https://img.shields.io/badge/generated_by-nxstart-blue.svg)](https://github.com/roedesh/nxstart)

## Features

...

## Getting Started

Make sure you have [DevKitA64](https://devkitpro.org/) installed. Installations can be found on their website.
For Unix-like platforms, it is recommended to use [Pacman](https://github.com/devkitPro/pacman) for installing the
required tools.

### Running the app

Run `make` inside this folder. Put the `.nro` file you just created on your SD card and launch it.

## Author

APP_AUTHOR_PLACEHOLDER
24 changes: 24 additions & 0 deletions nxstart/templates/libt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# APP_NAME_PLACEHOLDER

My new awesome homebrew application for the Nintendo Switch, created with
[libtransistor](https://github.com/reswitched/libtransistor).

[![generated_by nxstart](https://img.shields.io/badge/generated_by-nxstart-blue.svg)](https://github.com/roedesh/nxstart)

## Features

...

## Getting Started

Download the [latest release of libtransistor](https://github.com/reswitched/libtransistor/releases/latest)
and extract it. The recommended place to extract these archives is into `/opt/libtransistor/`. Next, set the
`LIBTRANSISTOR_HOME` environment variable to wherever you extracted the archive.

### Running the app

Run `make` inside this folder. Put the `.nro` file you just created on your SD card and launch it.

## Author

APP_AUTHOR_PLACEHOLDER
22 changes: 22 additions & 0 deletions nxstart/templates/pynx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# APP_NAME_PLACEHOLDER

My new awesome homebrew application for the Nintendo Switch, created with [PyNX](https://github.com/nx-python/PyNX).

[![generated_by nxstart](https://img.shields.io/badge/generated_by-nxstart-blue.svg)](https://github.com/roedesh/nxstart)

## Features

...

## Getting Started

Download the [latest release of PyNX](https://github.com/nx-python/PyNX/releases)
and copy the `switch` folder to your SD card. PyNX will appear on your homebrew menu.

### Running the app

Place your `main.py` next to `PyNX.nro`, and it will be executed as soon as you launch PyNX from the Homebrew Menu.

## Author

APP_AUTHOR_PLACEHOLDER
4 changes: 2 additions & 2 deletions nxstart/tests/test_cli_libt.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ def test_libt_with_clion():
with runner.isolated_filesystem():
result = runner.invoke(cli, ['-n', 'Test project', '-a', 'Ruud Schroën', 'libt', '--clion'])
assert not result.exception
assert result.output.endswith('Successfully created the libnx project!\n')
assert result.output.endswith('Successfully created the libtransistor project!\n')


def test_libt_without_clion():
runner = CliRunner()
with runner.isolated_filesystem():
result = runner.invoke(cli, ['-n', 'Test project', '-a', 'Ruud Schroën', 'libt', '--no-clion'])
assert not result.exception
assert result.output.endswith('Successfully created the libnx project!\n')
assert result.output.endswith('Successfully created the libtransistor project!\n')
3 changes: 3 additions & 0 deletions nxstart/utils/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ def check_and_create_directory(folder_path):
raise click.Abort()

os.makedirs(folder_path)



2 changes: 1 addition & 1 deletion nxstart/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.4.0'
__version__ = '0.5.0'

0 comments on commit 3f73ccd

Please sign in to comment.