Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
-picnit - Nit package manager
+nitpm - Nit package manager
-picnit [--help] [--verbose] <command> [<args>]
+nitpm [--help] [--verbose] <command> [<args>]
Install a package by searching for its name or directly from a Git repository URL.
Install a package by searching for its name or directly from a Git repository URL.
- picnit install hello_picnit
- picnit install https://gitlab.com/xymus/hello_picnit.git
+ nitpm install hello_nitpm
+ nitpm install https://gitlab.com/xymus/hello_nitpm.git
### list
List installed packages.
### list
List installed packages.
### upgrade
Upgrade a package.
### upgrade
Upgrade a package.
- picnit upgrade hello_picnit
+ nitpm upgrade hello_nitpm
### uninstall
Uninstall a package.
### uninstall
Uninstall a package.
- picnit uninstall hello_picnit
+ nitpm uninstall hello_nitpm
### help
Show general help message or the help for a command.
### help
Show general help message or the help for a command.
- picnit help
- picnit help install
+ nitpm help
+ nitpm help install
NITCOPT=--semi-global
OLDNITCOPT=--semi-global
NITCOPT=--semi-global
OLDNITCOPT=--semi-global
-OBJS=nitc nitpick nit nitls nitunit picnit nitx nitlight nitserial nitrestful
+OBJS=nitc nitpick nit nitls nitunit nitpm nitx nitlight nitserial nitrestful
SRCS=$(patsubst %,%.nit,$(OBJS))
BINS=$(patsubst %,../bin/%,$(OBJS))
MOREOBJS=nitdoc nitweb nitcatalog nitmetrics nitpretty nitweb
SRCS=$(patsubst %,%.nit,$(OBJS))
BINS=$(patsubst %,../bin/%,$(OBJS))
MOREOBJS=nitdoc nitweb nitcatalog nitmetrics nitpretty nitweb
import modelbuilder_base
import ini
import modelbuilder_base
import ini
redef class ToolContext
# Option --path
redef class ToolContext
# Option --path
# Setup the paths value
paths.append(toolcontext.opt_path.value)
# Setup the paths value
paths.append(toolcontext.opt_path.value)
- # Packages managed by picnit, only use when not testing with tests.sh
+ # Packages managed by nitpm, only use when not testing with tests.sh
if "NIT_TESTING_TESTS_SH".environ != "true" then
if "NIT_TESTING_TESTS_SH".environ != "true" then
- paths.add picnit_lib_dir
+ paths.add nitpm_lib_dir
end
var path_env = "NIT_PATH".environ
end
var path_env = "NIT_PATH".environ
# limitations under the License.
# Nit package manager command line interface
# limitations under the License.
# Nit package manager command line interface
import opts
import prompt
import ini
import curl
import opts
import prompt
import ini
import curl
-# Command line action, passed after `picnit`
+# Command line action, passed after `nitpm`
abstract class Command
# Short name of the command, specified in the command line
abstract class Command
# Short name of the command, specified in the command line
super Command
redef fun name do return "install"
super Command
redef fun name do return "install"
- redef fun usage do return "picnit install [package0[=version] [package1 ...]]"
+ redef fun usage do return "nitpm install [package0[=version] [package1 ...]]"
redef fun description do return "Install packages by name, Git repository address or from the local package.ini"
# Packages installed in this run (identified by the full path)
redef fun description do return "Install packages by name, Git repository address or from the local package.ini"
# Packages installed in this run (identified by the full path)
# TODO customizable server list
# TODO parse ini file in memory
# TODO customizable server list
# TODO parse ini file in memory
- var url = "https://xymus.net/picnit/{package_id}.ini"
+ var url = "https://xymus.net/nitpm/{package_id}.ini"
var ini_path = "/tmp/{package_id}.ini"
if verbose then print "Looking for a package description at '{url}'"
var ini_path = "/tmp/{package_id}.ini"
if verbose then print "Looking for a package description at '{url}'"
- var target_dir = picnit_lib_dir / name
+ var target_dir = nitpm_lib_dir / name
if version != null then target_dir += "=" + version
if installed.has(target_dir) then
# Ignore packages installed in this run
if version != null then target_dir += "=" + version
if installed.has(target_dir) then
# Ignore packages installed in this run
super Command
redef fun name do return "upgrade"
super Command
redef fun name do return "upgrade"
- redef fun usage do return "picnit upgrade <package>"
+ redef fun usage do return "nitpm upgrade <package>"
redef fun description do return "Upgrade a package"
redef fun apply(args)
redef fun description do return "Upgrade a package"
redef fun apply(args)
end
var name = args.first
end
var name = args.first
- var target_dir = picnit_lib_dir / name
+ var target_dir = nitpm_lib_dir / name
if not target_dir.file_exists or not target_dir.to_path.is_dir then
print_error "Package not found"
if not target_dir.file_exists or not target_dir.to_path.is_dir then
print_error "Package not found"
super Command
redef fun name do return "uninstall"
super Command
redef fun name do return "uninstall"
- redef fun usage do return "picnit uninstall <package>"
+ redef fun usage do return "nitpm uninstall <package>"
redef fun description do return "Uninstall a package"
redef fun apply(args)
redef fun description do return "Uninstall a package"
redef fun apply(args)
end
var name = args.first
end
var name = args.first
- var target_dir = picnit_lib_dir / name
+ var target_dir = nitpm_lib_dir / name
if not target_dir.file_exists or not target_dir.to_path.is_dir then
print_error "Package not found"
if not target_dir.file_exists or not target_dir.to_path.is_dir then
print_error "Package not found"
super Command
redef fun name do return "list"
super Command
redef fun name do return "list"
- redef fun usage do return "picnit list"
+ redef fun usage do return "nitpm list"
redef fun description do return "List installed packages"
redef fun apply(args)
do
redef fun description do return "List installed packages"
redef fun apply(args)
do
- var files = picnit_lib_dir.files
+ var files = nitpm_lib_dir.files
- var ini_path = picnit_lib_dir / file / "package.ini"
+ var ini_path = nitpm_lib_dir / file / "package.ini"
if verbose then print "- Reading ini file at {ini_path}"
var ini = new ConfigTree(ini_path)
var tags = ini["package.tags"]
if verbose then print "- Reading ini file at {ini_path}"
var ini = new ConfigTree(ini_path)
var tags = ini["package.tags"]
super Command
redef fun name do return "help"
super Command
redef fun name do return "help"
- redef fun usage do return "picnit help [command]"
+ redef fun usage do return "nitpm help [command]"
redef fun description do return "Show general help message or the help for a command"
redef fun apply(args)
redef fun description do return "Show general help message or the help for a command"
redef fun apply(args)
private var command_help = new CommandHelp(commands)
end
private var command_help = new CommandHelp(commands)
end
-redef fun picnit_lib_dir
do
if "NIT_TESTING".environ == "true" then
do
if "NIT_TESTING".environ == "true" then
- return "/tmp/picnit-test-" + "NIT_TESTING_ID".environ
+ return "/tmp/nitpm-test-" + "NIT_TESTING_ID".environ
else return super
end
# Print the general help message
private fun print_help
do
else return super
end
# Print the general help message
private fun print_help
do
- print "usage: picnit <command> [options]"
+ print "usage: nitpm <command> [options]"
print ""
print "commands:"
print ""
print "commands:"
# limitations under the License.
# Services related to the Nit package manager
# limitations under the License.
# Services related to the Nit package manager
-# Folder where are downloaded picnit packages
-fun picnit_lib_dir: String
+# Folder where are downloaded nitpm packages
+fun nitpm_lib_dir: String
do
var dir = "NITPM_PATH".environ
if not dir.is_empty then return dir
do
var dir = "NITPM_PATH".environ
if not dir.is_empty then return dir