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 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 Slide

  3. View Slide

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

    View Slide

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

    View Slide

  6. Birth of WulinMaster

    View Slide

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

    View Slide

  8. !   Application Interface

    View Slide

  9. 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 Slide

  10. 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 Slide

  11. Create Your Guild

    View Slide

  12. 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 Slide

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

    View Slide

  14. View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  18. 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 Slide

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

    View Slide

  20. View Slide

  21. Your first house!

    View Slide

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

    View Slide

  23. 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 Slide

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

    View Slide

  25. View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  29. # app/screens/bloggers_posts_screen.rb

    View Slide

  30. View Slide

  31. Level up!

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide