RubyConfBD 2013 decouple, bundle and share with ruby gems

1,192 views

Published on

This presentation is about explaining what is decoupling

RubyConfBD 2013 decouple, bundle and share with ruby gems

  1. 1. Decouple, Bundle and Share with Ruby Gems Nhm Tanveer Hossain Khan (Hasan)
  2. 2. Things on the table• What is decoupling ?• What is Gem ?• Create RubyConf2013_Hello Gem.• Publish on RubyGems Repository.• And share with fellow ruby developers
  3. 3. About me!• Working with Ruby for last 6 years.• Currently working with “Genweb2 Ltd.” as “Systems Architect”• Passionate about Ruby, Java, Nodejs, Creative idea and FOOD!• Built http://www.khadok.com• My Github profile - https://github.com/we4tech
  4. 4. Decoupling!
  5. 5. What is decoupling Coupling?
  6. 6. What is decoupling ?
  7. 7. Direct benefits!
  8. 8. Benefits (contd.)• Creates reusable code• Modularizes structure• Responds to polymorphic behavior• Possible to integrate with other projects
  9. 9. Trade-offs• Requires common sense• Requires expertise on understanding “What’s enough?”• It should be derived from a real project.• Requires tune up and adjustment based on real requirements.
  10. 10. Ruby Gems!
  11. 11. What is Ruby Gems ?
  12. 12. Or This!
  13. 13. Real Ruby Stone!Collected from wikipedia - http://en.wikipedia.org/wiki/File:Ruby_-_Winza,_Tanzania.jpg
  14. 14. Ruby Gem/Gemstone!Collected from wikipedia - http://en.wikipedia.org/wiki/File:Cardinal_gems.png
  15. 15. Finally a complete Necklace!
  16. 16. Ruby Gems Repository Publish Gem "mysql" Ruby Dev Over the Internet Publish GemRubyGems Repository "user_auth" Ruby Dev Publish Gem "factory_girl" Ruby Dev
  17. 17. A complete ruby application
  18. 18. Create RubyConf2013_hello gem!
  19. 19. $ gem install bundle$ bundle gem rubyconfbd2013_hello
  20. 20. Generated files
  21. 21. Code it!# File: lib/rubyconfbd2013_hello.rbrequire "rubyconfbd2013_hello/version"module Rubyconfbd2013Hello def rubyconfbd_year 2013 end def rubyconfbd_location Bangladesh endendObject.send(:extend, Rubyconfbd2013Hello)Object.send(:include, Rubyconfbd2013Hello)
  22. 22. Add Gem information# File: rubyconfbd2013_hello.gemspec# Other codes …… gem.authors = ["nhm tanveer hossain khan"] gem.email = ["hasan83bd@gmail.com"] gem.description = %q{A very basic gem demonstration for RubyConfBD 2013} gem.summary = %q{A very basic gem demonstration for RubyConfBD 2013} gem.homepage = "https://github.com/we4tech/rubyconfbd2013_hello"
  23. 23. $ rake release
  24. 24. Result!
  25. 25. Usages!• $ gem install rubyconfbd2013_hello• $ irb• require “rubyconfbd2013_hello”• Object.rubyconfbd_year• => 2013• Object.rubyconfbd_location• => „Bangladesh”
  26. 26. You can check it yourself!• Rubygems link - https://rubygems.org/gems/rubyconfbd2013_ hello• Github link - https://github.com/we4tech/rubyconfbd2013 _hello
  27. 27. That’s It! ( Question.any? ) 

×