Skip to main content

Simple and dumb Python script that packages up Java files into a basic NetBeans project for ICS4U.

Project description

netbeansifier

PyPI MIT License Python 3

Simple and dumb Python script that packages up Java files into a basic NetBeans project for ICS4U.

Usage: netbeansify <input directory> [options]

Available Options:
    --help                  Display this help message.
    --out <dir>             Specify the output directory; if --zip is set, this is optional.
    --sourcepath <dir>      Specify the input directory (overrides the one already specified).
    --name <project_name>   Specify the project name (default: input directory name).
    --mainclass <class>     Specify the main class, including the package (default: project name).
    --sourcever <ver>       Specify the source code's compatible Java version (default: 11).
    --targetver <ver>       Specify the target's compatible Java version (default: 11).
    --jvmargs <args>        Specify additional args to pass to the JVM during execution.
    --javacargs <args>      Specify additional args to pass to javac during compilation.
    --precommand <cmd>      Specify a command to run before generating the files; the command is
                                executed in the source directory. Multiple commands can be
                                used by chaining with &&.
    --postcommand <cmd>     Specify a command to run after generating the files; the command is
                                executed in the destination directory. Multiple commands can be
                                used by chaining with &&.
    --template <dir>        Specify the template file directory (default: "template/" in the Python
                                file's directory).
    --zip                   Create a NetBeans project zip named ProjectName.zip in the current
                                directory; if this is set, --out is optional.
    --nologo                Do not include netbeanz.png in the output.
    --verbose               Print more output.

netbeansifier also supports gitignore-style ignore files.
Files named .nbignore contain patterns for files/directories that are excluded during copying.
The file itself is also ignored.

You can also make a netbeansifierfile. Each line will be treated as a command-line option.
Note: Because of the --precommand and --postcommand options, running an untrusted netbeansifierfile
could result in malicious commands being executed!

Installation

netbeansifier can be installed through pip with pip install netbeansifier. Alternatively, clone this repository and run python3 setup.py install (py setup.py install on Windows).

Usage

Once installed, the program can be invoked through python3 -m netbeansifier (py -m netbeansifier on Windows), or directly using netbeansify.

Basic Usage

For the bare minimum, you need to specify an input directory and an output directory:

netbeansify project_directory --out output_directory

This will generate a NetBeans project in output_directory, with all your files in project_directory in the project.

Often, you might also want to specify a project name and main class (entry point):

netbeansify project_directory --out output_directory --name MyProject --mainclass MyEntryPointClass

Finally, passing the --zip option will generate a project zip, which you can directly submit:

netbeansify project_directory --name MyProject --mainclass MyEntryPointClass --zip

When --zip is used, you can omit the output directory to only generate a zip (the output will use a temporary directory and deleted after generation). Alternatively, if both --out and --zip are specified, both the zip and the normal project directory will be generated.

Advanced Usage

You can use the --precommand and --postcommand options to specify a command to execute before and after the files are generated. This can be used for purposes such as removing old archives before generation, or moving files around.

For example, suppose we want to remove the project zip before generating. Suppose we also have an input.txt, which we wish to place in the project root (by default, it will be placed in the src folder with all the Java sources). We can use the following command:

netbeansify project_directory --precommand "rm -f ProjectName.zip" --postcommand "mv src/input.txt ./"

Please note that the pre-command is executed in the input directory, while the post-command is executed in the output directory.

For more arguments, see the help message at the beginning.

.nbignore

By default, netbeansifier will copy over all the files and directories in your input directory (excluding .nbignores and netbeansifierfiles). To ignore certain files, netbeansifier supports ignore files with gitignore syntax. Files and directories matching the patterns in a .nbignore file will not be copied.

For example, the following .nbignore file ignores a Git repository and build output:

.git/
bin/

netbeansifierfile

To avoid typing in all the arguments every time you run the command, you can set up a netbeansifierfile for your project. When you run netbeansify in a directory, it will look for a file named netbeansifierfile in the current directory to use. Each line in the file is a command-line argument. The these arguments come before the arguments you specify manually on the command-line, so you can override them manually by specifying an argument again if desired.

Example netbeansifierfile:

# This is a comment (only works at the beginning of the line)
# Each line is a new command-line option
--name ProjectName
--mainclass MyMainClass
--sourcepath .
# Example pre-command to clean up old archives and make fresh Javadocs
# Pre-commands are executed in the source directory
--precommand rm -rf ProjectName.zip doc/ && javadoc -d doc *.java
# Example post-command to move the doc folder and other files into the correct location
# Post-commands are executed in the destination directory (project root)
--postcommand mv src/doc src/input1.txt src/input2.txt .
# Generate a zip
--zip

With such a setup, you can simply run netbeansify without giving it any arguments, since it will read them from the netbeansifierfile.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

netbeansifier-1.0.1.tar.gz (196.4 kB view details)

Uploaded Source

Built Distribution

netbeansifier-1.0.1-py3-none-any.whl (195.5 kB view details)

Uploaded Python 3

File details

Details for the file netbeansifier-1.0.1.tar.gz.

File metadata

  • Download URL: netbeansifier-1.0.1.tar.gz
  • Upload date:
  • Size: 196.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5

File hashes

Hashes for netbeansifier-1.0.1.tar.gz
Algorithm Hash digest
SHA256 388239b3d826d776b56f8597403400f0a926483360f5546bfe1b4010ff013062
MD5 f4d3ad549fdabef2545f663c28c73462
BLAKE2b-256 144768770efdb7c8c86e4e40ec25700cb12a34087a6b27cc789e4ede1a9c78de

See more details on using hashes here.

File details

Details for the file netbeansifier-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: netbeansifier-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 195.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5

File hashes

Hashes for netbeansifier-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7abc442af44a606afac48c136dada55da2a1c96df48c7d72ffb8dc704cb99993
MD5 ac4d32e02a9eebd8188b8ff12a9bbbce
BLAKE2b-256 f3f212be2a2dab6013010e9c659b168754c2d26931b8a5794fef42529d7dc5f4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page