Skip to content

ScriptStash is a C# code loader for text/script files manipulation. It loads each script file once. Keeping it stored in-memory, ready to be used for any applicative reuse over and over.

License

Notifications You must be signed in to change notification settings

Eurekode/ScriptStash.Net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ScriptStash ScriptStash Logo

Version

What is ...

ScriptStash is a C# code loader for text/script files manipulation. It loads each script file once. Keeping it stored in-memory, ready to be used for any applicative reuse over and over. Also, it can be used for token-driven scripting (e.g. place in script token for SELECT-SQL table name, changing the query target table dynamically at run-time).

How it works ...

ScriptStash loads with System.IO.File each script at its destination folder and store it in-memory while your solution application running. ScriptStash can store dictionary key-value pairs for token injection to every stored tokenized script file. So, it can return the original file loaded, or a transformed text with all needed tokens replaced with values from given dictionary.

Usage ...

Usage examples:

  • Maintain a query SQL scripts directory for a web-application with database storage.
  • Keep reusable shell scripts for 3rd party ALM tool. Load and execute them from yours C# application utility.
  • Store scripts from any scripting language (e.g. PowerShell, VBScript, JavaScript, etc.) for execution from C# app.
  • Handle installation scripts batch, to be deployed on several environments with different inner setting per environment.
  • Maintain test template scripts, with data-driven cases to be injected to each test template before execution.

Code Example ...

  string scriptsFolder = "c:\project\scripts";
  string pattern = "*.sql";
  string genSelectAllQueryName = "select_all_query.sql";
  string genTemplateTableQuery = "template_table_query.sql";
  :
  :
  Stash mySqlStash = new Stash(scriptsFolder, pattern);
  string sqlText1 = mySqlStash[genSelectAllQueryName].Text;
  :
  mySqlStash.Tokens["<table-name>"] = "USERS";
  mySqlStash.Tokens["<where-clause>"] = "WHERE USER.City='Tel-Aviv";
  string sqlText2 = mySqlStash[genTemplateTableQuery].InjectTokens();

[!] For more indepth example please chek next Gist : Stash example - SQL queries

Documentation

Check out ScriptStash documentation pages here.

License

This project is MIT licensed. For more information, see license.

About

ScriptStash is a C# code loader for text/script files manipulation. It loads each script file once. Keeping it stored in-memory, ready to be used for any applicative reuse over and over.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages