SlideShare a Scribd company logo
Decouple, Bundle and Share with
          Ruby Gems
   Nhm Tanveer Hossain Khan (Hasan)
Things on the table
•   What is decoupling ?
•   What is Gem ?
•   Create RubyConf2013_Hello Gem.
•   Publish on RubyGems Repository.
•   And share with fellow ruby developers
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
Decoupling!
What is decoupling Coupling?
What is decoupling ?
Direct benefits!
Benefits (contd.)
•   Creates reusable code
•   Modularizes structure
•   Responds to polymorphic behavior
•   Possible to integrate with other projects
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.
Ruby Gems!
What is Ruby Gems ?
Or This!
Real Ruby Stone!
Collected from wikipedia - http://en.wikipedia.org/wiki/File:Ruby_-_Winza,_Tanzania.jpg
Ruby Gem/Gemstone!
Collected from wikipedia - http://en.wikipedia.org/wiki/File:Cardinal_gems.png
Finally a complete Necklace!
Ruby Gems Repository

                                          Publish Gem
                                           "mysql"


                                                           Ruby Dev




                      Over the Internet   Publish Gem
RubyGems Repository                       "user_auth"


                                                           Ruby Dev




                                           Publish Gem
                                          "factory_girl"


                                                           Ruby Dev
A complete ruby application
Create RubyConf2013_hello
          gem!
$ gem install bundle
$ bundle gem rubyconfbd2013_hello
Generated files
Code it!
# File: lib/rubyconfbd2013_hello.rb
require "rubyconfbd2013_hello/version"

module Rubyconfbd2013Hello
  def rubyconfbd_year
    2013
  end

  def rubyconfbd_location
    'Bangladesh'
  end
end

Object.send(:extend, Rubyconfbd2013Hello)
Object.send(:include, Rubyconfbd2013Hello)
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"
$ rake release
Result!
RubyConfBD 2013   decouple, bundle and share with ruby gems
Usages!
• $ gem install
  rubyconfbd2013_hello
• $ irb
• require “rubyconfbd2013_hello”
• Object.rubyconfbd_year
• => 2013
• Object.rubyconfbd_location
• => „Bangladesh”
You can check it yourself!
• Rubygems link -
  https://rubygems.org/gems/rubyconfbd2013_
  hello
• Github link -
  https://github.com/we4tech/rubyconfbd2013
  _hello
That’s It! ( Question.any? )

             

More Related Content

Similar to RubyConfBD 2013 decouple, bundle and share with ruby gems (20)

PPTX
11 Ruby Gems
Deepak Hagadur Bheemaraju
 
ODP
Build-a-Gem Workshop
Brian Kaney
 
ODP
Build-a-Gem Workshop
Brian Kaney
 
KEY
Week6
reneedv
 
KEY
from(0).to('rubygems.org')
michele franzin
 
PDF
Gems on Ruby
Hiroshi SHIBATA
 
PDF
Writing a Ruby Gem for beginners
ConFoo
 
PPTX
Creating Ruby Gems
Flatiron School
 
DOCX
Install Guide
Santosh Kiran Beyagudem
 
PDF
RubyGems 3 & 4
Hiroshi SHIBATA
 
PDF
Gemification for Ruby 2.5/3.0
Hiroshi SHIBATA
 
PDF
Frozen Rails Slides
carllerche
 
PPTX
Chennai.rb feb 2016
Vijay Raghavan Aravamudhan
 
PDF
The Future of library dependency manageement of Ruby
Hiroshi SHIBATA
 
PDF
The Future of library dependency management of Ruby
Hiroshi SHIBATA
 
PDF
Ruby Presentation - Article
Christopher Giroir
 
KEY
An introduction to Rails 3
Blazing Cloud
 
PDF
How to make a Ruby Gem - Austin on Rails, January 2014
Clare Glinka
 
PDF
Gems on Ruby
Hiroshi SHIBATA
 
PDF
The Future of Dependency Management for Ruby
Hiroshi SHIBATA
 
Build-a-Gem Workshop
Brian Kaney
 
Build-a-Gem Workshop
Brian Kaney
 
Week6
reneedv
 
from(0).to('rubygems.org')
michele franzin
 
Gems on Ruby
Hiroshi SHIBATA
 
Writing a Ruby Gem for beginners
ConFoo
 
Creating Ruby Gems
Flatiron School
 
RubyGems 3 & 4
Hiroshi SHIBATA
 
Gemification for Ruby 2.5/3.0
Hiroshi SHIBATA
 
Frozen Rails Slides
carllerche
 
Chennai.rb feb 2016
Vijay Raghavan Aravamudhan
 
The Future of library dependency manageement of Ruby
Hiroshi SHIBATA
 
The Future of library dependency management of Ruby
Hiroshi SHIBATA
 
Ruby Presentation - Article
Christopher Giroir
 
An introduction to Rails 3
Blazing Cloud
 
How to make a Ruby Gem - Austin on Rails, January 2014
Clare Glinka
 
Gems on Ruby
Hiroshi SHIBATA
 
The Future of Dependency Management for Ruby
Hiroshi SHIBATA
 

More from nhm taveer hossain khan (13)

PDF
Introduction to Machine Learning
nhm taveer hossain khan
 
PPTX
Continuous feature-development
nhm taveer hossain khan
 
PDF
Agile Scrum Kanban (BASIS SoftExpo 2011)
nhm taveer hossain khan
 
PDF
phpXperts seminar 2010 CodeMan! with noSQL!
nhm taveer hossain khan
 
PDF
Hi code man! ain't you crazy enough ?
nhm taveer hossain khan
 
PDF
Let s imagine you have contributed to build the better bangladesh
nhm taveer hossain khan
 
PDF
Ain't you crazy enough ?
nhm taveer hossain khan
 
PDF
Agile Project Management Basis Software Exposition 2010
nhm taveer hossain khan
 
PPT
Ruby on Rails small application demo
nhm taveer hossain khan
 
PDF
Developing Quality Web Application
nhm taveer hossain khan
 
PDF
Better code in JavaScript
nhm taveer hossain khan
 
PDF
TekS Short Git Overview
nhm taveer hossain khan
 
ZIP
Whats Preventing Me To Write Nearly Accurate Code.Key
nhm taveer hossain khan
 
Introduction to Machine Learning
nhm taveer hossain khan
 
Continuous feature-development
nhm taveer hossain khan
 
Agile Scrum Kanban (BASIS SoftExpo 2011)
nhm taveer hossain khan
 
phpXperts seminar 2010 CodeMan! with noSQL!
nhm taveer hossain khan
 
Hi code man! ain't you crazy enough ?
nhm taveer hossain khan
 
Let s imagine you have contributed to build the better bangladesh
nhm taveer hossain khan
 
Ain't you crazy enough ?
nhm taveer hossain khan
 
Agile Project Management Basis Software Exposition 2010
nhm taveer hossain khan
 
Ruby on Rails small application demo
nhm taveer hossain khan
 
Developing Quality Web Application
nhm taveer hossain khan
 
Better code in JavaScript
nhm taveer hossain khan
 
TekS Short Git Overview
nhm taveer hossain khan
 
Whats Preventing Me To Write Nearly Accurate Code.Key
nhm taveer hossain khan
 
Ad

RubyConfBD 2013 decouple, bundle and share with ruby gems

  • 1. Decouple, Bundle and Share with Ruby Gems Nhm Tanveer Hossain Khan (Hasan)
  • 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. 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
  • 5. What is decoupling Coupling?
  • 8. Benefits (contd.) • Creates reusable code • Modularizes structure • Responds to polymorphic behavior • Possible to integrate with other projects
  • 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.
  • 11. What is Ruby Gems ?
  • 13. Real Ruby Stone! Collected from wikipedia - http://en.wikipedia.org/wiki/File:Ruby_-_Winza,_Tanzania.jpg
  • 14. Ruby Gem/Gemstone! Collected from wikipedia - http://en.wikipedia.org/wiki/File:Cardinal_gems.png
  • 15. Finally a complete Necklace!
  • 16. Ruby Gems Repository Publish Gem "mysql" Ruby Dev Over the Internet Publish Gem RubyGems Repository "user_auth" Ruby Dev Publish Gem "factory_girl" Ruby Dev
  • 17. A complete ruby application
  • 19. $ gem install bundle $ bundle gem rubyconfbd2013_hello
  • 21. Code it! # File: lib/rubyconfbd2013_hello.rb require "rubyconfbd2013_hello/version" module Rubyconfbd2013Hello def rubyconfbd_year 2013 end def rubyconfbd_location 'Bangladesh' end end Object.send(:extend, Rubyconfbd2013Hello) Object.send(:include, Rubyconfbd2013Hello)
  • 22. Add Gem information # File: rubyconfbd2013_hello.gemspec # Other codes …… gem.authors = ["nhm tanveer hossain khan"] gem.email = ["[email protected]"] 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"
  • 26. Usages! • $ gem install rubyconfbd2013_hello • $ irb • require “rubyconfbd2013_hello” • Object.rubyconfbd_year • => 2013 • Object.rubyconfbd_location • => „Bangladesh”
  • 27. You can check it yourself! • Rubygems link - https://rubygems.org/gems/rubyconfbd2013_ hello • Github link - https://github.com/we4tech/rubyconfbd2013 _hello
  • 28. That’s It! ( Question.any? ) 