At least run your
tests first!
...You wrote
tests, right?
Slide 69
Slide 69 text
SHIP IT!
Slide 70
Slide 70 text
% gem push hola-0.0.0.gem
Enter your RubyGems.org credentials.
Don't have an account yet?
Create one at http://rubygems.org/sign_up
Email: nick@quaran.to
Password:
Signed in.
Pushing gem to RubyGems.org...
Successfully registered gem: hola (0.0.0)
% cat bin/hola
#!/usr/bin/env ruby
require 'hola'
puts Hola.hi(ARGV[0])
“Probably derived from “shell bang” under the influence
of American slang “the whole shebang” (everything, the
works)” http://www.retrologic.com/jargon/S/shebang.html
(shə-băng')
Slide 80
Slide 80 text
% cat bin/hola
#!/usr/bin/env ruby
require 'hola'
puts Hola.hi(ARGV[0])
(shə-băng')
“Probably derived from “shell bang” under the influence
of American slang “the whole shebang” (everything, the
works)” http://www.retrologic.com/jargon/S/shebang.html
% cat Rakefile
require 'rake/testtask'
Rake::TestTask.new do |t|
t.libs << 'test'
end
desc "Run tests"
task :default => :test
Slide 93
Slide 93 text
% cat test/test_hola.rb
require 'test/unit'
require 'hola'
class HolaTest < Test::Unit::TestCase
def test_default_hello
assert_equal "Hello world!", Hola.hi
end
def test_custom_hello
assert_equal "Hello Boston!", Hola.hi("Boston")
end
end
Slide 94
Slide 94 text
% rake test
(in /Users/qrush/Dev/ruby/hola)
Loaded suite
Started
..
Finished in 0.000736 seconds.
2 tests, 2 assertions, 0
failures,
0 errors, 0 skips
Test run options: --seed 15331
Slide 95
Slide 95 text
FIRST GEM
EXECUTABLE
TESTING
DOCS
Slide 96
Slide 96 text
Meh.
Slide 97
Slide 97 text
push gem
webhook
tweet on
@rubygems
Slide 98
Slide 98 text
push gem
webhook
tweet on
@rubygems
ON
EVERY
PUSH
Slide 99
Slide 99 text
push gem
webhook
tweet on
@rubygems
ON
EVERY
PUSH
~200+
TIMES
DAILY
Slide 100
Slide 100 text
Say hi, your
gem will!
Slide 101
Slide 101 text
guides inline
Slide 102
Slide 102 text
guides inline
nokogiri
yard
Slide 103
Slide 103 text
guides inline
nokogiri
yard
rails
datamapper
Slide 104
Slide 104 text
# The main Hola driver
class Hola
# Say hi to the world!
#
# Example:
# >> Hola.hi("Buffalo")
# => Hello Buffalo!
#
# Arguments:
# message: (String)
def self.hi(message = "world")
puts "Hello #{message}!"
end
end
Slide 105
Slide 105 text
Learn how to
document your
code:
http://yardoc.org
Slide 106
Slide 106 text
10TIPS
AWESOME
FOR MAKING
YOUR GEM
Slide 107
Slide 107 text
Write a
README.
1.
Slide 108
Slide 108 text
WHAT
SHOULD
GO
IN
A
README
WHAT IT IS
INSTALL
INSTRUCTIONS
HOW TO
USE IT
Slide 109
Slide 109 text
Use a
LICENSE
2.
Slide 110
Slide 110 text
Code with no LICENSE
is COPYRIGHTED.
Slide 111
Slide 111 text
Pick a license BEFORE
pushing your gem.
Slide 112
Slide 112 text
Name your
gem
properly.
3.
Slide 113
Slide 113 text
DO NOT CALL IT:
[rR].*
rials
cheezburger
kitty
dicks
Gem::Specification.new do |s|
s.name = "hola"
s.version = "2.0.0"
s.add_runtime_dependency(
"thor", [">= 0.14.5"])
s.add_development_dependency(
"rspec", ["= 2.2.0"])
Only this one works for me!
EXACT
Slide 141
Slide 141 text
Gem::Specification.new do |s|
s.name = "hola"
s.version = "2.0.0"
s.add_runtime_dependency(
"thor", [">= 0.14.5"])
s.add_development_dependency(
"rspec", ["= 2.2.0"])
It will always work!
OPTIMISTIC
Slide 142
Slide 142 text
Avoid >=
Slide 143
Slide 143 text
Gem::Specification.new do |s|
s.name = "hola"
s.version = "2.0.0"
s.add_runtime_dependency(
"thor", [">= 0.14.5", "< 1.0.0"])
s.add_development_dependency(
"rspec", ["= 2.2.0"])
Lock to a range instead
PESSIMISTIC
Slide 144
Slide 144 text
Gem::Specification.new do |s|
s.name = "hola"
s.version = "2.0.0"
s.add_runtime_dependency(
"thor", ["~> 0.14"])
s.add_development_dependency(
"rspec", ["= 2.2.0"])
Use the twiddle-wakka!
PESSIMISTIC
Slide 145
Slide 145 text
Cut
prereleases
9.
Slide 146
Slide 146 text
% head -4 hola.gemspec
Gem::Specification.new do |s|
s.name = 'hola'
s.version = '1.0.0.pre'
Slide 147
Slide 147 text
% head -4 hola.gemspec
Gem::Specification.new do |s|
s.name = 'hola'
s.version = '1.0.0.pre'
ANY LETTER(S)