GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - numb4/hack-codegen: Library to programatically generate Hack code and write it to signed files

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

25 Commits
25 Commits

Folders and files

NameName
Last commit message
Last commit date
examples/dorm
examples/dorm
 
 
lib
lib
 
 
src
src
 
 
test
test
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.hhconfig
.hhconfig
 
 
.travis.yml
.travis.yml
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
PATENTS
PATENTS
 
 
README.md
README.md
 
 
composer.json
composer.json
 
 

Repository files navigation

Hack Codegen Build Status

Hack Codegen is a library for easily generating Hack code and writing it into signed files that prevent undesired modifications. The idea behind writing code that writes code is to raise the level of abstraction and reduce coupling. You can use your own way of describing a problem and generate the corresponding code. E.g. see examples/dorm. In this example, we use a schema to describe the structure of the data, and we use Hack Codegen to write the matching code.

Examples

The DORM example shows how to use the different aspects of the code generation in a simplified real-life example. The included tests also exemplify the usage of the different components.

Requirements

Hack Codegen requires:

  • HHVM
  • Composer

Installing Hack Codegen

To install this package via composer, just add the package to require and start using it.

{
    "require": {
        "facebook/hack-codegen": "*"
    }
}

Usage

Include the autoload file generated by composer and you are ready to start using it. For example:

<?hh
require 'vendor/autoload.php';

echo codegen_file('HelloWorld.php')
  ->addClass(
    codegen_class('HelloWorld')
      ->addMethod(
        codegen_method('sayHi')
          ->setBody('echo "hello world\n";')
      )
  )->save();

Configuration

You can configure some options such as the maximum line width, spacing and headers by editing the file src/HackCodegenConfig.php

License

Hack Codegen is BSD-licensed. We also provide an additional patent grant.

About

Library to programatically generate Hack code and write it to signed files

Resources

Readme
License

Contributing

Contributing
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.