Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Wulin Kungfu - Fight for Ruby Enterprise problems

Jimmy Huang
November 18, 2012

Wulin Kungfu - Fight for Ruby Enterprise problems

My topic on RubyConfChina2012, introduces wulin_master gem which is used for building enterprise application with ruby.

Jimmy Huang

November 18, 2012
Tweet

More Decks by Jimmy Huang

Other Decks in Programming

Transcript

  1. Wulin Kungfu
    Fight for Ruby Enterprise problems

    View full-size slide

  2. Background
    !   FIFA World Cup 2010 in South Africa
    !   BSS software managing the Broadcasting of the event
    !   TV and Radio orders
    !   Broadcasting instructions
    !   Temporal booking
    !   Spatial booking
    !   Finance

    View full-size slide

  3. Problems
    ! Extjs (everything is JavaScript)
    !   Code duplication
    !   Controllers setup for the JSON
    !   JavaScript setup of the grid and screens
    !   Heavy UI - Instability

    View full-size slide

  4. We hope …
    !   Lighter
    !   Easier
    !   DSL
    !   Faster productivity

    View full-size slide

  5. Birth of WulinMaster

    View full-size slide

  6. WulinMaster
    !   A Ruby on Rails based framework
    !   For resolving enterprise problems
    !   Developer friendly
    !   Extensible

    View full-size slide

  7. !   Application Interface

    View full-size slide

  8. Tools and technologies
    !   Based on:
    !   Ruby on Rails ( >= 3.1 )
    ! SlickGrid ( https://github.com/mleibman/SlickGrid )
    ! jQuery plugins (jQuery UI, BBQ …)
    !   The Wulin plugins are Rails Engines.
    !   Use JSON as communication format.

    View full-size slide

  9. Architecture
    Your Application
    Ruby on Rails
    WulinMaster
    WulinGrid
    WulinScreen
    SlickGrid
    WulinPanel
    jQuery Plugins
    WulinScreenController
    WulinOAuth
    WulinAudit
    WulinPermit
    WulinExcel
    Other
    Wulin
    Plugins
    GridAction GridBehavior
    GridRelation
    GridColumn
    WulinHomeController
    GridStates

    View full-size slide

  10. Create Your Guild

    View full-size slide

  11. Wulin generator




    rails g wulin_master:install

    create app/controllers/homepage_controller.rb (menu configuration)
    create config/initializers/wulin_master.rb
    route root :to => 'homepage#index’

    View full-size slide

  12. Build the menu
    # app/controllers/homepage_controller.rb

    View full-size slide

  13. Wulin Grid
    !   Fundamental component
    !   Remote data
    !   Auto cell types
    !   Association columns

    View full-size slide

  14. Wulin Screen
    !   Fundamental container
    !   One/more grids/panels
    !   Specific configurations for grids in it

    View full-size slide

  15. Model View
    Controller
    Browser
    Rails MVC
    Model
    Screen
    Controller
    Browser
    Wulin MVC
    both change
    Auto generated
    grid grid

    View full-size slide

  16. Build a screen and a grid
    rails g wulin_master:screen_and_grid blogger

    name:string age:integer country:reference





    create db/migrate/20121115075159_create_bloggers.rb
    create app/controllers/bloggers_controller.rb
    create app/screens/blogger_screen.rb
    create app/grids/blogger_grid.rb
    create app/models/blogger.rb
    create app/views/bloggers
    route resources :bloggers

    View full-size slide

  17. # app/grids/blogger_grid.rb
    # app/screens/blogger_screen.rb

    View full-size slide

  18. Your first house!

    View full-size slide

  19. Furnish it
    !   Grid Action
    !   Grid Behavior
    !   Grid Relation

    View full-size slide

  20. Grid Action
    !   A toolbar button
    !   Active – respond to a user event
    !   Implemented in JavaScript
    !   Default actions are: Add, Edit, Delete
    !   Plugins might provide default actions such as Export
    Excel, Audit, etc.

    View full-size slide

  21. Grid Behavior
    !   Passive Triggered by grid event
    !   Implemented by JavaScript
    !   Default behaviors

    View full-size slide

  22. # app/assets/javascripts/actions/show_info.js

    View full-size slide

  23. # app/assets/javascripts/behaviors/say_hello.js

    View full-size slide

  24. Grid Relation
    !   One screen, multiple grids
    !   Interaction between grids
    !   Default relations

    View full-size slide

  25. # app/screens/bloggers_posts_screen.rb

    View full-size slide

  26. Crafting your own weapon
    !   Rails Engine
    !   Write your own components
    !   Define your own actions / behaviors
    !   Equip it

    View full-size slide

  27. Open source
    ! http://github.com/ekohe/wulin_demo
    ! http://github/com/ekohe/wulin_master
    !   http://wulin_demo.ekohe.com

    View full-size slide

  28. Jimmy Huang ([email protected])
    黄腾
    @pake007

    View full-size slide