Module: MPS::Constants
- Defined in:
- lib/mps/constants.rb
Constant Summary collapse
- MPS_EXT =
mps file extention
"mps"- HOME_DIR =
user home directory
Dir.home
- MPS_DIR =
default mps directory where all mps related files will be stored, including mps storage directory, config, log files etc.
File.join(HOME_DIR, ".mps")
- MPS_CONFIG_FILE =
mps config default file path
File.join(HOME_DIR, ".mps_config.yaml")
- MPS_STORAGE_DIR =
default mps storage directory, usually where the mps files will be stored. but should configurable to any path through config.
File.join(MPS_DIR, "mps")
- MPS_FILE_NAME_REGEXP =
mps file name structure
Regexp.new("^(?<date-stamp>(?<year>\\d{4})(?<month>\\d{2})(?<day>\\d{2})(?<dot-epoch>\\.(?<epoch>\\d{10,}))?)\\.#{MPS_EXT}$")
- MPS_FILE_NAME_CLIPPER =
clip the mps filename except the extention, usually datestamp
->(file_basename){ m = MPS_FILE_NAME_REGEXP.match(file_basename) m ? m[1] : "0" }
- MPS_FILE_NAME_DATE_CLIPPER =
clip datestamp with hash accessibility from the mps filename
->(file_basename){ MPS_FILE_NAME_REGEXP=~file_basename { year: $~[2], month: $~[3], day: $~[4] } }
- MPS_NEW_FILE_NAME_GEN =
get new file name
->(date){ "#{date.strftime('%Y%m%d')}.#{Time.now.to_i}.#{MPS_EXT}" }
- MPS_LOG_FILE =
default mps log path
File.join(MPS_DIR, "mps.log")
- DEFAULT_CONF_HASH =
default conf hash
{ mps_dir: MPS_DIR, storage_dir: MPS_STORAGE_DIR, log_file: MPS_LOG_FILE, git_remote: "origin", git_branch: "master" }
- AT_REGEXP_LA =
at or @[]{} signature regexps — brackets are optional: @task{ } and @task[]{ } both valid
/(?=@[a-zA-Z0-9_]+(?:\[[\s\S]*?\])?\s*\{)/- AT_REGEXP =
/@(?<element_sign>[a-zA-Z0-9_]+)(?:\[(?<args>[^\]]*)\])?\s*\{/- END_CURLY_REGEXP_LA =
end curly bracket regexp — excludes } surrounded by single-quotes
/(?=(?<!')\}(?!'))/- END_CURLY_REGEXP =
/(?<!')\}(?!')/