Table of Contents
Code analyzer for the ooc programming language.
If you only want to use the release and won't bother with compiling anything yourself, this quick guide is for you.
Taken from here (active as of september 2015)
If the first one doesn't do it for you, go here (active as of september 2015)
sudo apt-get update && sudo apt-get upgrade
curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
sudo apt-get install -y nodejs
cd MAGIC_FOLDER
sudo cp magic /usr/local/bin
Done! Now head over to the usage section.
Very, very early alpha stage.
Known to work on Linux (x64), status on other platforms is unknown at this time.
First, install g++. Open up a terminal window and issue the following command, then follow the on-screen instructions.
sudo apt-get install g++
The node.js version provided by aptitude is outdated, so do not install via apt-get. Instead, download and unpack node.js into any folder, then follow the steps outlined below.
cd NODE_FOLDER
./configure
make
sudo make install
You may have to restart the terminal. Now that we've installed node.js, it's time to update npm (node package manager) and then install the Typescript compiler.
sudo npm install -g npm
sudo npm install -g typescript
Now verify that Typescript has been installed:
tsc --v
It should give you version 1.5.3 or greater.
You can install magic in two different ways:
magic's default install location is /usr/local/bin
, which requires you to run the installer as root.
cd MAGIC_FOLDER
sudo ./install
If you want to install magic to a different location, you may give the installer that location as an argument. Depending on the location, you may have to run the installer as root.
./install ~/apps/bin
The installer will build the project for you. For ease of use, make sure you have magic's location
in your $PATH
. To find out, issue the command echo $PATH
in the terminal.
magic
to a location of your choosing (we recommend /usr/local/bin
or any other standard bin directory(this may require sudo
))If you have modified magic and want to rebuild it, make sure you're in magic's root folder, then do one of the following:
tsc
. The build output is located in ./build
. To run magic, issue node ./build/magic.js TARGET_DIR
If you don't specify a target directory, your current location will be used.
magic [TARGET DIRECTORY]
magic ~/projects/my_awesome_project/source
magic ~/projects/my_awesome_project/source > violations.txt
If you want to run the analyzer on a single file, simply specify the filename. You may also specify a list of files, separated by a space.
magic ~/projects/my_awesome_project/source/math/Quaternion.ooc
If your shell supports wildcard expansion, you may also specify wildcards to process files that match a certain pattern, for example, to analyze all files that start with Matrix:
magic ~/projects/my_awesome_project/source/math/Matrix*.ooc
You may also sort the output of each file by line number, by using -s
magic -s [TARGET]
If you want to prevent magic from analyzing certain folders or files in your project directory,
create a file called .magicignore
and put it in the root folder of your project. In this file
you add everything you want to keep from magic, relative to the project root folder.
Example:
lib/somethirdpartylibrary
source/math/Transform.ooc
Here are some problems that may occur along the way, and hopefully, solutions to them.
command -v magic
. The output should point to where magic is installed, if it is empty,
then you need to add magic's location to your $PATH
.