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

Chanko Hacking Guide

r7kamura
April 28, 2014

Chanko Hacking Guide

r7kamura

April 28, 2014
Tweet

More Decks by r7kamura

Other Decks in Programming

Transcript

  1. README.md Chanko ! Chanko provides a simple framework for rapidly

    and safely prototyping new features in your production Rails app, and exposing these prototypes to specified segments of your user base. ! With Chanko, you can release many features concurrently and manage target users independently. When any errors are raised from chanko's features, it will be automatically hidden and fallback to its normal behavior.
  2. Bundler.require Loads all Gems listed in Gemfile. Open your config/application.rb

    to see the real example. ! # example Bundler.require(:default, Rails.env)
  3. require "action_controller" require "action_view" require "active_record" require "active_support/all" require "rails"

    require "chanko/active_if" require "chanko/config" require "chanko/controller" require "chanko/exception_handler" require "chanko/function" require "chanko/helper" require "chanko/invoker" require "chanko/loader" require "chanko/logger" require "chanko/railtie" require "chanko/unit" require "chanko/unit_proxy" require "chanko/unit_proxy_provider" lib/chanko.rb external internal
  4. Rails::Railtie Railtie is the core of the Rails framework and

    provides several hooks to extend Rails and/or modify the initialization process. ! class MyRailtie < Rails::Railtie initializer "my_initializer_name" do # some initialization behavior end end
  5. Rails Init Process 1. `rails s` 2. bin/rails 3. rails/commands/server

    … or using unicorn 4. config.ru 5. config/application.rb 6. Bundler.require 7. My::Application.initialize! 8. initializers.tsort_each… 9. run My::Application
  6. .invoke(:x, :y) 1. find a module named “X” 2. find

    a function named “y” from “X” 3. stack local variables 4. call “y” 5. unstack local variables 6. call fallback block if any error occurred lib/chanko/invoker.rb
  7. AS::Dependencies 1. Register auto load path 2. Find module if

    const_missing occurred 3. Clear loaded modules if any file changed