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

Build more gems

Build more gems

An impassioned plea to the BathRuby conference to build more gems so that we can look better than Node.js/npm in the numbers game.

We wrote a gem live and you can see it here: https://rubygems.org/gems/is_even

Phil Nash

March 11, 2016
Tweet

More Decks by Phil Nash

Other Decks in Programming

Transcript

  1. NPM

  2. r e q u i r e ( " i

    s - e v e n " ) ;
  3. r e q u i r e ( " i

    s - o d d " ) ; r e q u i r e ( " i s - n u m b e r " ) ;
  4. Generate a gem $ b u n d l e

    g e m i s _ e v e n
  5. Write the code # l i b / i s

    _ e v e n . r b r e q u i r e " i s _ e v e n / v e r s i o n " m o d u l e I s E v e n d e f s e l f . w e l l _ i s _ i t ? ( n u m b e r ) n u m b e r . e v e n ? e n d e n d 0 1 . 0 2 . 0 3 . 0 4 . 0 5 . 0 6 . 0 7 . 0 8 .
  6. Update the gemspec s p e c . s u

    m m a r y = " T e l l s y o u i f a n u m b e r i s e v e n " s p e c . d e s c r i p t i o n = " T e l l s y o u i f a n u m b e r i s e v e n " s p e c . h o m e p a g e = " h t t p : / / p h i l n a . s h " 0 1 . 0 2 . 0 3 .
  7. Update the gemspec 2 We're pushing to Rubygems, so remove

    the a l l o w e d _ p u s h _ h o s t metadata i f s p e c . r e s p o n d _ t o ? ( : m e t a d a t a ) s p e c . m e t a d a t a [ ' a l l o w e d _ p u s h _ h o s t ' ] = " T O D O : S e t t o ' h t t p : / / m y e l s e r a i s e " R u b y G e m s 2 . 0 o r n e w e r i s r e q u i r e d t o p r o t e c t a g a i n s t p e n d 0 1 . 0 2 . 0 3 . 0 4 . 0 5 .
  8. Release the gem $ g e m b u i

    l d i s _ e v e n . g e m s p e c $ g e m p u s h i s _ e v e n - 0 . 1 . 0 . g e m
  9. But seriously • Building my first gem helped me learn

    Ruby • Extracting gems from apps reduced repetition
  10. But seriously • Building my first gem helped me learn

    Ruby • Extracting gems from apps reduced repetition • Creating new gems helped developers use Twilio
  11. Disclaimer I'm not really advocating for the creation of loads

    of crap gems. Make useful gems, make gems you'd want to use, write tests. No Node.js developers were hurt in the making of this presentation. No Node.js modules were hurt in the making of this presentation. Well, maybe some Node.js modules' feelings were hurt, but they will recover. Ruby is awesome. You are all awesome.