diff --git a/src/jprog.jl b/src/jprog.jl
index ba6486d..d00e12c 100755
--- a/src/jprog.jl
+++ b/src/jprog.jl
@@ -1,20 +1,51 @@
#!/usr/bin/julia
+###############################################################################
+##
+##
+## Copyright (C) 2017 Justin Moore
+##
+## This program is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program. If not, see .
+##
+##############################################################################
+DEBUG = false # enable for verbose messages
function check_dir(directory)
if ispath(directory)
- print("The directory: ", directory, " :already exists\n")
+ if DEBUG == true print("The directory: ", directory, " already exists\n") end
return true
else
- print("The directory: ", directory, " :does not exist\n")
+ if DEBUG == true print("The directory: ", directory, " does not exist\n") end
return false
end
end
+function check_file(filePath)
+ if isfile(filePath)
+ if DEBUG == true print("File: ", filePath, " exists\n") end
+ return true
+
+ else
+ if DEBUG == false print("File: ", filePath, " does not exist\n") end
+ return false
+ end
+end
+
function create_default_structure(projectDir)
subDirs = ["src", "lib"]
@@ -26,34 +57,43 @@ function create_default_structure(projectDir)
projectName = rsearchindex(projectDir, "/" )
- print(projectName, "\n")
+ if DEBUG == true print(projectName, "\n") end
projectName = projectDir[projectName+1:length(projectDir)]
touch("$projectDir/src/$projectName.jl")
touch("$projectDir/README.md")
touch("$projectDir/LICENSE")
+ git_init("$projectDir")
end
+function git_init(projectPath)
+ LibGit2.init("$projectPath", false) # Initialize git repository
+ if check_dir("$projectPath/.git") == true
+ print("Initialized git repository in $projectPath\n")
+ end
+end
function help()
- print("This will be help\n")
+ print("\n", "useage: jprog init ", "\n", "\n")
+
+ print("init Create a new project\n")
end
function main()
if (length(ARGS) == 2 && ARGS[1] == "init")
- print(length(ARGS), "\n")
+ if DEBUG == true print("ARGS Count: ", length(ARGS), "\n") end
if check_dir(ARGS[2]) == true
- print("Dir exists")
+ if DEBUG == true print("Dir exists") end
else
create_default_structure(ARGS[2])
if check_dir(ARGS[2]) == true
- print("Directory: ", ARGS[2], " created\n")
+ print("Project: ", ARGS[2], " created\n")
else
print("The directory: ", ARGS[2], " could not be created\n")
end
@@ -63,4 +103,4 @@ function main()
end
end
-main()
\ No newline at end of file
+main()