SlideShare a Scribd company logo
1 of 28
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!
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 Decouple, Bundle and Share with Ruby Gems

Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Hiroshi SHIBATA
 
The Future of Dependency Management for Ruby
The Future of Dependency Management for RubyThe Future of Dependency Management for Ruby
The Future of Dependency Management for RubyHiroshi SHIBATA
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Hiroshi SHIBATA
 
The story of language development
The story of language developmentThe story of language development
The story of language developmentHiroshi SHIBATA
 
The Future of Bundled Bundler
The Future of Bundled BundlerThe Future of Bundled Bundler
The Future of Bundled BundlerHiroshi SHIBATA
 
from(0).to('rubygems.org')
from(0).to('rubygems.org')from(0).to('rubygems.org')
from(0).to('rubygems.org')michele franzin
 
The Future of library dependency manageement of Ruby
The Future of library dependency manageement of RubyThe Future of library dependency manageement of Ruby
The Future of library dependency manageement of RubyHiroshi SHIBATA
 
The Enterprise Strikes Back
The Enterprise Strikes BackThe Enterprise Strikes Back
The Enterprise Strikes BackBurke Libbey
 
Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developergicappa
 
Introducing ruby on rails
Introducing ruby on railsIntroducing ruby on rails
Introducing ruby on railsPriceen
 
Crate - ruby based standalone executables
Crate - ruby based standalone executablesCrate - ruby based standalone executables
Crate - ruby based standalone executablesJeremy Hinegardner
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Railsousli07
 
JRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRubyJRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRubyelliando dias
 
RubyMotion Introduction
RubyMotion IntroductionRubyMotion Introduction
RubyMotion IntroductionLori Olson
 

Similar to Decouple, Bundle and Share with Ruby Gems (20)

Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0
 
The Future of Dependency Management for Ruby
The Future of Dependency Management for RubyThe Future of Dependency Management for Ruby
The Future of Dependency Management for Ruby
 
Gems on Ruby
Gems on RubyGems on Ruby
Gems on Ruby
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0
 
The story of language development
The story of language developmentThe story of language development
The story of language development
 
Setup ruby
Setup rubySetup ruby
Setup ruby
 
The Future of Bundled Bundler
The Future of Bundled BundlerThe Future of Bundled Bundler
The Future of Bundled Bundler
 
Week6
Week6Week6
Week6
 
from(0).to('rubygems.org')
from(0).to('rubygems.org')from(0).to('rubygems.org')
from(0).to('rubygems.org')
 
The Future of library dependency manageement of Ruby
The Future of library dependency manageement of RubyThe Future of library dependency manageement of Ruby
The Future of library dependency manageement of Ruby
 
The Enterprise Strikes Back
The Enterprise Strikes BackThe Enterprise Strikes Back
The Enterprise Strikes Back
 
Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developer
 
Introducing ruby on rails
Introducing ruby on railsIntroducing ruby on rails
Introducing ruby on rails
 
Crate - ruby based standalone executables
Crate - ruby based standalone executablesCrate - ruby based standalone executables
Crate - ruby based standalone executables
 
RubyGems 3 & 4
RubyGems 3 & 4RubyGems 3 & 4
RubyGems 3 & 4
 
Initiation à Ruby on Rails
Initiation à Ruby on RailsInitiation à Ruby on Rails
Initiation à Ruby on Rails
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
JRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRubyJRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRuby
 
Rubygems And You
Rubygems And YouRubygems And You
Rubygems And You
 
RubyMotion Introduction
RubyMotion IntroductionRubyMotion Introduction
RubyMotion Introduction
 

More from nhm taveer hossain khan

More from nhm taveer hossain khan (13)

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

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 = ["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"
  • 25.
  • 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? ) 