Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Creating a Gem
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Jeff Felchner
March 22, 2013
Technology
140
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Creating a Gem
Jeff Felchner
March 22, 2013
More Decks by Jeff Felchner
See All by Jeff Felchner
Rails Engines as an SOA Middle Ground
jfelchner
1
520
Advanced and Intermediate Git
jfelchner
1
89
Rails Templates
jfelchner
1
83
Other Decks in Technology
See All in Technology
攻撃と防御で学ぶAI時代のプロダクトセキュリティ演習
recruitengineers
PRO
6
2.1k
AI時代の強いチームの作り方
yuukiyo
25
16k
OSPN.JPバージョンアップ作業進捗のご報告 / 20260801-osc26kyoto
akkiesoft
0
410
바이브풀 라이프
arawn
0
100
TypeScript入門 2026
recruitengineers
PRO
2
490
【CEDEC2026】『GRANBLUE FANTASY: Relink - Endless Ragnarok』のバトル制作事例 ~最高のキャラゲーを目指して~
cygames
PRO
0
230
Webアクセシビリティ入門 2026
recruitengineers
PRO
2
450
Invisible to AI? Making TYPO3 Sites Quotable by AI Search Systems
wolfgangwagner
0
160
QAエンジニア起点で進める、SmartHRにおける信頼性向上について
kaomi_wombat
1
120
JavaScript 研修 (2026)
recruitengineers
PRO
1
450
【CEDEC2026】グラフィックスエンジニアのためのニューラルシェーディング入門
cygames
PRO
0
120
侵入は突然に 〜 IoTマルウェアと悪用される家庭の機器 ~ / When Intrusion Strikes: IoT Malware and the Abuse of Home Devices
nttcom
0
1.5k
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
630
Bash Introduction
62gerente
615
220k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
430
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Exploring anti-patterns in Rails
aemeredith
3
460
Speed Design
sergeychernyshev
33
2k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
470
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
780
SEO for Brand Visibility & Recognition
aleyda
0
4.7k
How to Think Like a Performance Engineer
csswizardry
28
2.7k
What does AI have to do with Human Rights?
axbom
PRO
1
2.3k
Transcript
Creating Your First Gem
What?
Does One Thing Well
Why?
Programming is hard.
Programming well is really hard.
The Problem
Naming
The First Rule
Name It Something Clever
The Second Rule
Don’t Take One Of My Names
None
615.555.1234
None
The Third Rule
Don’t Be Inappropriate
Don't name it something sexual.
Don't name it something misogynistic
Don't name it after crude words for your anatomy
F&%#
None
Why Listen To Me?
rspectacular null_and_void bangers_and_hash envision dolla_dolla_bill stipend use_the_forcible referehencible molten_core dynamo
johnny_five i_am_valid oscillator chronological greenwich get_together enwrap pinpoint chicken_soup apple_cart ruby-progressbar
Our Example
None
“Translating pig latin is fun”.to_pig_latin # => “anslating-tray ig-pay atin-lay
is-ay un-fay”
None
Creating Your Gem
Jewler
Hoe
Bundler
</disclaimer>
gem install bundler bundle gem pope_francis
create pope_francis/Gemfile create pope_francis/Rakefile create pope_francis/LICENSE.txt create pope_francis/README.md create pope_francis/.gitignore
create pope_francis/pope_francis.gemspec create pope_francis/lib/pope_francis.rb create pope_francis/lib/pope_francis/version.rb
create pope_francis/Gemfile create pope_francis/Rakefile create pope_francis/LICENSE.txt create pope_francis/README.md create pope_francis/.gitignore
create pope_francis/pope_francis.gemspec create pope_francis/lib/pope_francis.rb create pope_francis/lib/pope_francis/version.rb
Gem::Specification.new do |gem| gem.name = "pope_francis" gem.version = PopeFrancis::VERSION gem.authors
= ["Jeff Felchner"] gem.email = ["
[email protected]
"] gem.description = %q{TODO: Write a gem description} gem.summary = %q{TODO: Write a gem summary} gem.homepage = "" end
Gem::Specification.new do |gem| gem.name = "pope_francis" gem.version = PopeFrancis::VERSION gem.authors
= ["Jeff Felchner"] gem.email = ["
[email protected]
"] gem.description = %q{ig-pay atin-lay anslator-tray} gem.summary = %q{The one-stop shop for your Pig Latin needs} gem.homepage = "http://github.com/jfelchner/pope_francis" end
Releasing Your Gem
Sign Up on rubygems.org
None
Add Your Gem to Github (optional)
None
rake release
pope_francis 0.0.1 built to pkg/ pope_francis-0.0.1.gem Tagged v0.0.1 Pushed git
commits and tags Pushed pope_francis 0.0.1 to rubygems.org
None
Versioning
Use Semantic Versioning (http://semver.org)
x.y.z Major . Minor . Patch (eg 1.8.4)
Your Gem’s Version
pope_francis/lib/pope_francis/version.rb
module PopeFrancis VERSION = "0.0.1" end
arning-way! Pushing The Same Version Twice Will Fail
> gem push pkg/pope_francis-0.0.1.gem Pushing gem to https://rubygems.org... Repushing of
gem versions is not allowed. Please use `gem yank` to remove bad gem releases.
Yanking Releases
> gem install gemcutter > gem yank pope_francis -v 0.0.1
Yanking gem from RubyGems.org... Pushing gem to https://rubygems.org... Successfully yanked gem: pope_francis (0.0.1)
None
> gem install pope_francis ERROR: Could not find a valid
gem 'pope_francis' (>= 0) in any repository ERROR: Possible alternatives: francis, tolerances
README Driven Development
Waaaaaaiiiiiiiiiiiiitttttttttt a second.....
Your Public API = Your Version
Your Public API is the most important thing when developing
a gem.
None
Write the Code
Fast Forward
pope_francis/lib/pope_francis.rb
require ‘pope_francis’
require ‘pope_francis’ while english_phrase = gets do puts english_phrase.to_pig_latin end
Hacking On It
Fork the Gem
https://github.com/jfelchner/pope_francis
Rename the Gem in Your Fork
pope_francis-nash-rails
pope_francis-nash-rails-jfelchner
Using It In Another Project
gem install pope_francis-nash-rails-jfelchner
require ‘pope_francis’
require ‘pope_francis-nash-rails-jfelchner’
Exercises
Additional Options
“Translating pig latin is fun” .to_pig_latin(:hyphenate => false) # =>
“anslatingtray igpay atinlay isway unfay”
Preserve Capitalization
“Translating Pig Latin is fun”.to_pig_latin # => “Anslating-tray Ig-pay Atin-lay
is-way un-fay”
Rails App
None
Thanks! Jeff Felchner @jfelchner