{"id":15958194,"url":"https://github.com/tbrowder/classfactory","last_synced_at":"2025-04-04T09:40:50.711Z","repository":{"id":147368117,"uuid":"282895481","full_name":"tbrowder/ClassFactory","owner":"tbrowder","description":"Provides tools to create a data collection with classes to manipulate the persistent data.","archived":false,"fork":false,"pushed_at":"2021-07-31T14:50:07.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T06:06:50.439Z","etag":null,"topics":["class","data","persistent","raku"],"latest_commit_sha":null,"homepage":"","language":"Raku","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"artistic-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tbrowder.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-27T12:43:52.000Z","updated_at":"2021-07-31T14:50:10.000Z","dependencies_parsed_at":"2023-07-12T16:46:18.081Z","dependency_job_id":null,"html_url":"https://github.com/tbrowder/ClassFactory","commit_stats":{"total_commits":8,"total_committers":2,"mean_commits":4.0,"dds":0.125,"last_synced_commit":"842add2c23f2d3a98536a2c546132c4a5a0f4b8e"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tbrowder%2FClassFactory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tbrowder%2FClassFactory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tbrowder%2FClassFactory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tbrowder%2FClassFactory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tbrowder","download_url":"https://codeload.github.com/tbrowder/ClassFactory/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247157046,"owners_count":20893202,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["class","data","persistent","raku"],"created_at":"2024-10-07T14:02:03.741Z","updated_at":"2025-04-04T09:40:50.679Z","avatar_url":"https://github.com/tbrowder.png","language":"Raku","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.com/tbrowder/ClassFactory.svg?branch=master)](https://travis-ci.com/tbrowder/ClassFactory)\n\nClassFactory\n============\n\nThis module provides tools to create a data collection with classes to describe and use the persistent data. \n\nSYNOPSIS\n--------\n\n    $ mkdir somedir\n    $ cd somedir\n\n    # Initialize the factory with your desired name:\n    $ cfact --initialize PROJ\n\nThe module is designed to use static data to describe such things as configuration and specifications for book and other document formats but it could also be used for collections of data for scientific research. Classes have only built-in scalar attributes so they act something like a struct with methods in C++.\n\nThe initialization step shown above results in a directory and file structure like this:\n\n    .git           \n    .gitignore     # \u003c== contains: 'data/.json'\n    .project       # \u003c== contains: 'factory = PROJ'\n    classes/\n        .keep\n    data/\n        .keep\n    examples/\n        README\n        a.class\n        b.data\n    lib/\n        .keep\n\nIf git is not available a warning will be issued and the init process aborted. If no version control is wanted or a different vcs will be used pass the '-novcs' option along with '-init'.\n\nThis factory currently uses its own list format data files but could easily be extended to create classes to use other data formats such as CSV or Excel XMLS files.\n\nWe start with a description of a class in a simple text format with each data line consisting of one or two words:\n\n    # comments are ok\n    class: classname\n    id Str    # This attribute is required and will be added to all\n              # classes automatically if it is missing.\n    attr1     # default type is Str\n    attr2 Num # valid entries: Str, Int, UInt, Num\n    attrN\n\nThe same file can contain multiple class definitions with the new class definition starting with the 'class:' keyword and ending with the end of file or the start of a new class.\n\nThe data file for an instance of classname looks almost the same:\n\n    # comments are ok\n    classdata: classname\n    id sometext     # Two words only. The combination of classname\n                    # and id must be unique within the factory.\n                    # If the user does not provide a value, one\n                    # will be provided automatically.\n    attr1 some text # Str type\n    attr2 1.2       # one value, a Num\n    attr3 -3        # one value, an Int\n    attr4 4         # one value, an UInt\n\nThe data files may also contain multiple classdata definitions.\n\nThe file names used for class definitions have no relation to the generated products, but an extension of '.class' is used by the module to indicate the file contains one or more class definitions. Likewise, '.data' is the extension used for class instance data files. Ultimately, all instance files will be converted into JSON format and named 'class.id.json'.\n\nThe next step is creating the data for the factory. When one or more data files are created you can then start using the factory but first you must run\n\n    cfact -build\n\nwhich creates the 'lib/PROJ.rakumod' file with class definitions and converts existing data files into JSON format which are saved in a hidden directory 'data/.json'. From then on any changes to source files of classes or data will be ignored. At any time you can rerun the '-build' step to refresh all files which includes deleting and recreating the existing 'data/.json' directory and 'lib/PROJ.rakumod' file.\n\nUsing the data factory\n----------------------\n\nTo use the data we create a simple access script to show all data in the collection:\n\n    cf-show-factory\n\nThat program should use the PROJ module and read all the data files under the 'data/.json' directory.\n\nYou can get a local copy of that file by running:\n\n    cfact -download\n\nWork flow for using the factory\n-------------------------------\n\nA using program will prepare for data use by instantiating the collection:\n\n    use ClassFactory;\n    instantiate;\n\nThen all objects in directory 'data/.json' will be accessible through the exported hash:\n\n    %data{$class}{$id};\n\nIn addition, class names are available through the exported hash:\n\n    %classes;\n\nPlanned features\n----------------\n\n  * Create the factory from data in a CSV file\n\n  * Create the factory from data in an Excel XMLS file\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftbrowder%2Fclassfactory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftbrowder%2Fclassfactory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftbrowder%2Fclassfactory/lists"}