Skip to content

Commit

Permalink
i #314 Fixed exec script configs
Browse files Browse the repository at this point in the history
Signed-off-by: Dao McGill <[email protected]>
  • Loading branch information
daomcgill committed Dec 9, 2024
1 parent be0bb10 commit 1fcfe14
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 125 deletions.
17 changes: 8 additions & 9 deletions exec/annotate.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,40 @@ require(gt,quietly=TRUE)
doc <- "
USAGE:
annotate.R annotate help
annotate.R annotate <tools.yml> <maven.yml> <srcml_filepath>
annotate.R annotate <tools.yml> <project_conf.yml>
annotate.R (-h | --help)
annotate.R --version
DESCRIPTION:
Provides a function to interact with Kaiaulu's Syntax Extractor,
to generate an annotated XML file. Please see
Kaiaulu's README.md for instructions on how to create <tool.yml>
and <maven.yml>.
and <project_conf.yml>.
OPTIONS:
-h --help Show this screen.
--version Show version.
"

arguments <- docopt::docopt(doc, version = 'Kaiaulu 0.0.0.9600')
arguments <- docopt::docopt(doc, version = 'Kaiaulu 0.0.0.9700')
if(arguments[["annotate"]] & arguments[["help"]]){
cli_alert_info("Annotates source code using srcML.")
}else if(arguments[["annotate"]]){

tools_path <- arguments[["<tools.yml>"]]
conf_path <- arguments[["<maven.yml>"]]
srcml_filepath <- arguments[["<srcml_filepath>"]]
conf_path <- arguments[["<project_conf.yml>"]]

tool_conf <- parse_config(tools_path)
maven_conf <- parse_config(conf_path)
project_conf <- parse_config(conf_path)

srcml_path <- get_tool_project("srcml", tool_conf)
src_folder <- get_src_folder(maven_conf)
srcml_output_path <- get_srcml_filepath(maven_conf)
src_folder <- get_src_folder(project_conf)
srcml_filepath <- get_srcml_filepath(project_conf)

srcml_path <- path.expand(srcml_path)
src_folder <- path.expand(src_folder)
srcml_output_path <- path.expand(srcml_output_path)
srcml_filepath <- path.expand(srcml_filepath)

annotated_file <- annotate_src_text(
srcml_path = srcml_path,
Expand Down
106 changes: 0 additions & 106 deletions exec/mailinglist.R

This file was deleted.

14 changes: 4 additions & 10 deletions exec/src_content_parser.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ source('../../kaiaulu/R/src.R')

doc <- "
USAGE:
src_content_parser.R query <tools.yml> <project_conf.yml> <srcml_filepath> <output_dir> [--namespace | --file-docs | --class-docs | --variables | --packages | --functions | --imports | --class-names]
src_content_parser.R query <tools.yml> <project_conf.yml> <output_dir> [--namespace | --file-docs | --class-docs | --variables | --packages | --functions | --imports | --class-names]
DESCRIPTION:
Uses srcML to parse a source code folder, as specified on the project configuration file, to parse selected content and generate structured tables (e.g., classes, functions, variables) as CSV files. Each query option produces a table with a specific structure. See OPTIONS for details.
Expand All @@ -29,21 +29,15 @@ OPTIONS:
--class-names Returns a 2-column table (filepath, classname) where each row is defined by a class name.
"

arguments <- docopt::docopt(doc, version = 'Kaiaulu 0.0.0.9600')
arguments <- docopt::docopt(doc, version = 'Kaiaulu 0.0.0.9700')

tools_conf <- parse_config(arguments[["<tools.yml>"]])
project_conf <- parse_config(arguments[["<project_conf.yml>"]])

srcml_path <- get_tool_project("srcml", tools_conf)
src_folder <- get_src_folder(project_conf)
srcml_filepath <- arguments[["<srcml_filepath>"]]
output_dir <- arguments[["<output_dir>"]]

# Set output folder path
output_folder <- output_dir
if (!dir.exists(output_folder)) {
dir.create(output_folder, recursive = TRUE)
}
srcml_filepath <- get_srcml_filepath(project_conf)
output_folder <- arguments[["<output_dir>"]]

# Determine which query to run and save output
if (arguments[["--namespace"]]) {
Expand Down

0 comments on commit 1fcfe14

Please sign in to comment.