Coder Social home page Coder Social logo

joomgen-3.0's Introduction

JoomGen

JoomGen is a code generator created by JetWorks to take out the pain of Joomla! component development. It takes a small set of from YAML or UML files and generates a complete Joomla! component ready to install and use.

The component's code follows the PEAR coding conventions and many Joomla! best practices.

Usage (YAML)

component.yaml

This file will contain general data about your component. In this file you will see something like this:

  name: Jobline
  identifier: Jobline
  component: com_jobline
  version: 1.0.0
  author:
      name: JetWorks
      email: [email protected]
      url: http://jetworks.com.br
  copyright: 2010 JetWorks. All rights reserved.
  license: GNU General Public License
  description: Component description
  default_language: en-GB
  database:
      engine: MyISAM
      default_charset: utf8

Most of these are self-explanatory. The fields you need to change in every project are:

  • name: the project's name, like "My Project"
  • identifier: a class name based on the project name, like "MyProject"
  • component: the component's name, like "com_myproject"
  • version
  • author

models.yaml

This file will contain data about the models / tables used in your component. The syntax is the following:

  model_name:
      field_name: type
  
  another_model_name:
      not_required_field:
          type: type
          required: false
      field_with_description:
          type: type
          description: This is my field

  sql_table_without_model_name:
      sql_only: true

Some rules about the MVC component generation:

  • All tables get an integer primary key named "id" automatically;
  • If "sql_only" is true then just the SQL table will be generated (without the MVC part); this is useful when two models have a "Many To Many" relationship table, for example;
  • If a model has "published: bool", publication / unpublication logic is added to the admin interface;
  • Models names should be in plural form.

An example models.yaml file:

  posts:
      title: string
      content: rich_text
      created_on: datetime
  
  tags:
      name: string
  
  posts_tags:
      post_id: int
      tag_id: int
      sql_only: true

frontend.yaml

This file will contain data about the frontend views for each model used in your component. The syntax is the following:

  model_name:
      details: field names separated by space
      new: field names separated by space
      list: field names separated by space
  
  another_model_name:
      details: field names separated by space
      new: field names separated by space
      list: field names separated by space

These field names are the fields from your models that you want to display in your views. You only need to add entries for the models you want to use in the frontend.

An example frontend.yaml file:

  posts:
      details: title content created_on
      new: title content
      list: title content created_on

Field types / SQL respectives

  • string: VARCHAR(255)
  • text: TEXT
  • int: INT(11)
  • datetime: DATETIME
  • date: DATE
  • time: TIME
  • double: DOUBLE
  • decimal: DECIMAL
  • rich_text: TEXT
  • bool: INT(1)

Field attributes

  • type: don't have a default value
  • required: defaults to "true"
  • description: defaults to a capitalized version of the field name. "contact_name" became "Contact Name"

Generating the component

For generate the component you just need to type the line above on the command line:

~$ php [path_to_joomgen]/bin/joomgen.php

And your component's package will be available on the root folder of Joomgen

joomgen-3.0's People

Contributors

spillere avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.