Package org.qdl_lang.install
Class Installer
- java.lang.Object
-
- org.qdl_lang.install.Installer
-
public class Installer extends Object
Really simple installer. This basically just copies stuff that has been set up in the create_installer.sh script, so chances are excellent if you need to change the installer, you should be looking there.
This gets copied to your jar and will just copy everything in the jar to a given directory (including sub directories). So make the tree you want, jar it up with this class and run it.Caveat for changing this class
This is a completely standalone class -- no dependencies but plain Old Java -- because otherwise you have to manage dependencies (might involve writing your own class loader!) for this installer program which can get very hard. The idea is that this is a lean, single class. Even inheritance doesn't work.Created by Jeff Gaynor
on 3/30/20 at 7:23 AM
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringALL_FLAGprotected static StringDEBUG_FLAGprotected static StringDIR_ARGprotected static StringHELP_FLAGprotected static StringHELP_OPTIONprotected static StringINSTALL_OPTIONprotected static StringLIST_OPTIONprotected static StringNANO_FLAGStringoperationKeyprotected static StringQDL_FLAGprotected static StringREMOVE_OPTIONstatic StringSHEBANGprotected static StringUPDATE_OPTIONprotected static StringUPGRADE_FLAGprotected static StringUPGRADE_OPTIONprotected static StringVIM_FLAG
-
Constructor Summary
Constructors Constructor Description Installer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FilecheckRootDir(File rootDir, boolean upgrade)Prompts for the right directory, if missing, and then it will check if various directories exist.protected booleancheckUpgradeDir(File dir)For upgrades.protected voidcp(String resourceName, File target)gets the resourceName as a stream and copies it to the physical target file.protected voiddoInstall()protected voiddoListFiles()protected voiddoRemove()protected voiddoUpgrade()protected BufferedReadergetBufferedReader()protected HashMap<String,String>getFileList()StringgetOperation()FilegetRootDir()protected FilegetUserHome()booleanhasRootDir()protected voidinstallNano(File rootDir)This will install nano support in the user's home directoryprotected voidinstallQDL(File rootDir)protected voidinstallVim(File rootDir)install vim supportBooleanis(String key)booleanisAll()booleanisDebugOn()booleanisInstall()booleanisList()booleanisNano()booleanisQDL()booleanisRemove()booleanisShowHelp()protected List<String>isToList(InputStream inputStream)booleanisUpgrade()booleanisVim()static voidmain(String[] args)protected voidnukeDir(File dir)Remove the contents of the directory.Stringreadline(String prompt)protected voidrunnit2(String[] args)protected voidsay(String x)voidsetDebugOn(boolean debugOn)protected voidsetupMap(String[] args)protected voidtrace(String message)protected voiduninstallNano()protected voiduninstallQDL(File rootDir)protected voiduninstallVim()protected voidupgradeNano()protected voidupgradeQDL(File rootDir)Overwrites (but does not delete) files and will make more complex paths.protected voidupgradeVim()
-
-
-
Field Detail
-
UPGRADE_FLAG
protected static final String UPGRADE_FLAG
- See Also:
- Constant Field Values
-
UPGRADE_OPTION
protected static final String UPGRADE_OPTION
- See Also:
- Constant Field Values
-
UPDATE_OPTION
protected static final String UPDATE_OPTION
- See Also:
- Constant Field Values
-
HELP_FLAG
protected static final String HELP_FLAG
- See Also:
- Constant Field Values
-
HELP_OPTION
protected static final String HELP_OPTION
- See Also:
- Constant Field Values
-
DIR_ARG
protected static final String DIR_ARG
- See Also:
- Constant Field Values
-
DEBUG_FLAG
protected static final String DEBUG_FLAG
- See Also:
- Constant Field Values
-
INSTALL_OPTION
protected static final String INSTALL_OPTION
- See Also:
- Constant Field Values
-
LIST_OPTION
protected static final String LIST_OPTION
- See Also:
- Constant Field Values
-
REMOVE_OPTION
protected static final String REMOVE_OPTION
- See Also:
- Constant Field Values
-
VIM_FLAG
protected static final String VIM_FLAG
- See Also:
- Constant Field Values
-
NANO_FLAG
protected static final String NANO_FLAG
- See Also:
- Constant Field Values
-
QDL_FLAG
protected static final String QDL_FLAG
- See Also:
- Constant Field Values
-
ALL_FLAG
protected static final String ALL_FLAG
- See Also:
- Constant Field Values
-
SHEBANG
public static String SHEBANG
-
operationKey
public String operationKey
-
-
Method Detail
-
trace
protected void trace(String message)
-
isDebugOn
public boolean isDebugOn()
-
setDebugOn
public void setDebugOn(boolean debugOn)
-
main
public static void main(String[] args)
-
doRemove
protected void doRemove() throws IOException- Throws:
IOException
-
uninstallQDL
protected void uninstallQDL(File rootDir)
-
upgradeNano
protected void upgradeNano() throws IOException- Throws:
IOException
-
installNano
protected void installNano(File rootDir) throws IOException
This will install nano support in the user's home directory- Throws:
IOException
-
uninstallNano
protected void uninstallNano() throws IOException- Throws:
IOException
-
upgradeVim
protected void upgradeVim() throws IOException- Throws:
IOException
-
uninstallVim
protected void uninstallVim() throws IOException- Throws:
IOException
-
installVim
protected void installVim(File rootDir) throws IOException
install vim support- Throws:
IOException
-
getUserHome
protected File getUserHome()
-
checkUpgradeDir
protected boolean checkUpgradeDir(File dir)
For upgrades. If the diretory does not exist, create it. Return false if the directory does not exist.- Parameters:
dir-- Returns:
-
nukeDir
protected void nukeDir(File dir)
Remove the contents of the directory. At the end of this, the directory is empty. It does not delete the directory, however- Parameters:
dir-
-
isToList
protected List<String> isToList(InputStream inputStream) throws IOException
- Throws:
IOException
-
upgradeQDL
protected void upgradeQDL(File rootDir) throws Exception
Overwrites (but does not delete) files and will make more complex paths. This allows for upgrading much older QDL installs that might have different or missing (e.g. vim support) directories.- Throws:
Exception
-
cp
protected void cp(String resourceName, File target) throws IOException
gets the resourceName as a stream and copies it to the physical target file.- Parameters:
resourceName-target-- Throws:
IOException
-
checkRootDir
protected File checkRootDir(File rootDir, boolean upgrade) throws Exception
Prompts for the right directory, if missing, and then it will check if various directories exist. If this returns false, then the install cannot proceed, because, e.g., they request an upgrade but no base install exists.- Returns:
- Throws:
Exception
-
getBufferedReader
protected BufferedReader getBufferedReader()
-
say
protected void say(String x)
-
setupMap
protected void setupMap(String[] args)
-
getRootDir
public File getRootDir()
-
isInstall
public boolean isInstall()
-
isRemove
public boolean isRemove()
-
isUpgrade
public boolean isUpgrade()
-
isShowHelp
public boolean isShowHelp()
-
isList
public boolean isList()
-
hasRootDir
public boolean hasRootDir()
-
getOperation
public String getOperation()
-
isAll
public boolean isAll()
-
isNano
public boolean isNano()
-
isVim
public boolean isVim()
-
isQDL
public boolean isQDL()
-
-