Revision 110:125520c3dc05 repoint.sml
| repoint.sml | ||
|---|---|---|
| 38 | 38 |
authorization. |
| 39 | 39 |
*) |
| 40 | 40 |
|
| 41 |
val repoint_version = "0.9.98"
|
|
| 41 |
val repoint_version = "1.1"
|
|
| 42 | 42 |
|
| 43 | 43 |
|
| 44 | 44 |
datatype vcs = |
| ... | ... | |
| 136 | 136 |
structure RepointFilenames = struct |
| 137 | 137 |
val project_file = "repoint-project.json" |
| 138 | 138 |
val project_lock_file = "repoint-lock.json" |
| 139 |
val project_completion_file = ".repoint.point" |
|
| 139 | 140 |
val user_config_file = ".repoint.json" |
| 140 | 141 |
val archive_dir = ".repoint-archive" |
| 141 | 142 |
end |
| ... | ... | |
| 215 | 216 |
val nonempty_dir_exists : string -> bool |
| 216 | 217 |
val project_spec_path : string -> string |
| 217 | 218 |
val project_lock_path : string -> string |
| 219 |
val project_completion_path : string -> string |
|
| 218 | 220 |
val verbose : unit -> bool |
| 219 | 221 |
end = struct |
| 220 | 222 |
|
| ... | ... | |
| 272 | 274 |
fun project_lock_path rootpath = |
| 273 | 275 |
project_file_path rootpath (RepointFilenames.project_lock_file) |
| 274 | 276 |
|
| 277 |
fun project_completion_path rootpath = |
|
| 278 |
project_file_path rootpath (RepointFilenames.project_completion_file) |
|
| 279 |
|
|
| 275 | 280 |
fun trim str = |
| 276 | 281 |
hd (String.fields (fn x => x = #"\n" orelse x = #"\r") str) |
| 277 | 282 |
|
| ... | ... | |
| 2420 | 2425 |
in |
| 2421 | 2426 |
JsonBits.save_json_to lock_file lock_json |
| 2422 | 2427 |
end |
| 2423 |
|
|
| 2428 |
|
|
| 2429 |
fun checkpoint_completion_file rootpath = |
|
| 2430 |
let val completion_file = FileBits.project_completion_path rootpath |
|
| 2431 |
val stream = TextIO.openOut completion_file |
|
| 2432 |
in |
|
| 2433 |
TextIO.closeOut stream |
|
| 2434 |
end |
|
| 2435 |
|
|
| 2424 | 2436 |
fun pad_to n str = |
| 2425 | 2437 |
if n <= String.size str then str |
| 2426 | 2438 |
else pad_to n (str ^ " ") |
| ... | ... | |
| 2586 | 2598 |
val _ = if List.exists (fn (_, OK _) => true | _ => false) outcomes |
| 2587 | 2599 |
then lock_project project |
| 2588 | 2600 |
else OS.Process.success |
| 2601 |
val return_code = return_code_for outcomes |
|
| 2589 | 2602 |
in |
| 2590 |
return_code_for outcomes |
|
| 2603 |
if OS.Process.isSuccess return_code |
|
| 2604 |
then checkpoint_completion_file (#rootpath context) |
|
| 2605 |
else (); |
|
| 2606 |
return_code |
|
| 2591 | 2607 |
end |
| 2592 | 2608 |
|
| 2593 | 2609 |
fun load_local_project pintype = |
| ... | ... | |
| 2625 | 2641 |
fun usage () = |
| 2626 | 2642 |
(print "\nRepoint "; |
| 2627 | 2643 |
version (); |
| 2628 |
print ("\nA simple manager for third-party source code dependencies.\n\n"
|
|
| 2644 |
print ("\n A simple manager for third-party source code dependencies.\n"
|
|
| 2645 |
^ " http://all-day-breakfast.com/repoint/\n\n" |
|
| 2629 | 2646 |
^ "Usage:\n\n" |
| 2630 |
^ " repoint <command>\n\n" |
|
| 2647 |
^ " repoint <command> [<options>]\n\n"
|
|
| 2631 | 2648 |
^ "where <command> is one of:\n\n" |
| 2632 | 2649 |
^ " status print quick report on local status only, without using network\n" |
| 2633 | 2650 |
^ " review check configured libraries against their providers, and report\n" |
| 2634 | 2651 |
^ " install update configured libraries according to project specs and lock file\n" |
| 2635 | 2652 |
^ " update update configured libraries and lock file according to project specs\n" |
| 2636 |
^ " lock update lock file to match local library status\n" |
|
| 2637 |
^ " archive pack up project and all libraries into an archive file\n" |
|
| 2638 |
^ " (invoke as 'repoint archive target-file.tar.gz')\n" |
|
| 2639 |
^ " version print the Repoint version number and exit\n\n"); |
|
| 2653 |
^ " lock rewrite lock file to match local library status\n" |
|
| 2654 |
^ " archive pack up project and all libraries into an archive file:\n" |
|
| 2655 |
^ " invoke as 'repoint archive targetfile.tar.gz --exclude unwanted.txt'\n" |
|
| 2656 |
^ " version print the Repoint version number and exit\n\n" |
|
| 2657 |
^ "and <options> may include:\n\n" |
|
| 2658 |
^ " --directory <dir>\n" |
|
| 2659 |
^ " change to directory <dir> before doing anything; in particular,\n" |
|
| 2660 |
^ " expect to find project spec file in that directory\n\n"); |
|
| 2640 | 2661 |
OS.Process.failure) |
| 2641 | 2662 |
|
| 2642 | 2663 |
fun archive target args = |
| ... | ... | |
| 2647 | 2668 |
with_local_project USE_LOCKFILE (Archive.archive (target, xs)) |
| 2648 | 2669 |
| _ => usage () |
| 2649 | 2670 |
|
| 2671 |
fun handleSystemArgs args = |
|
| 2672 |
let fun handleSystemArgs' leftover args = |
|
| 2673 |
case args of |
|
| 2674 |
"--directory"::dir::rest => |
|
| 2675 |
(OS.FileSys.chDir dir; |
|
| 2676 |
handleSystemArgs' leftover rest) |
|
| 2677 |
| arg::rest => |
|
| 2678 |
handleSystemArgs' (leftover @ [arg]) rest |
|
| 2679 |
| [] => leftover |
|
| 2680 |
in |
|
| 2681 |
OK (handleSystemArgs' [] args) |
|
| 2682 |
handle e => ERROR (exnMessage e) |
|
| 2683 |
end |
|
| 2684 |
|
|
| 2650 | 2685 |
fun repoint args = |
| 2651 |
let val return_code = |
|
| 2686 |
case handleSystemArgs args of |
|
| 2687 |
ERROR e => (print ("Error: " ^ e ^ "\n");
|
|
| 2688 |
OS.Process.exit OS.Process.failure) |
|
| 2689 |
| OK args => |
|
| 2690 |
let val return_code = |
|
| 2652 | 2691 |
case args of |
| 2653 | 2692 |
["review"] => review () |
| 2654 | 2693 |
| ["status"] => status () |
| ... | ... | |
| 2660 | 2699 |
| arg::_ => (print ("Error: unknown argument \"" ^ arg ^ "\"\n");
|
| 2661 | 2700 |
usage ()) |
| 2662 | 2701 |
| _ => usage () |
| 2663 |
in |
|
| 2664 |
OS.Process.exit return_code; |
|
| 2665 |
() |
|
| 2666 |
end |
|
| 2702 |
in |
|
| 2703 |
OS.Process.exit return_code |
|
| 2704 |
end |
|
| 2667 | 2705 |
|
| 2668 | 2706 |
fun main () = |
| 2669 | 2707 |
repoint (CommandLine.arguments ()) |
Also available in: Unified diff