ConFoo Vancouver 2017
@sophiedeziel
About anywhere!
Are you solving common problems?
Have some cool scripts?
Small number of variations Gemspec, licence, readme, etc
# Make dir and git init commands
> cd ..
> bundle gem has_prerequisite
> cd has_prerequisite
> git commit -Am "init the gem"
> cd ..
> rails plugin new has_prerequisite --skip-test --dummy-path=spec/dummy
> cd has_prerequisite
> git add -p
> git commit -m "init the rails specific setup of the gem"
I decided to keep the dependency on Active Support but not Devise.
So I have to implement similar methods
Failures:
1) HasPrerequisite redirection it redirects to the path when the prerequisite is not met
Failure/Error: store_location_for(:user, request.fullpath)
NoMethodError:
undefined method `store_location_for' for #<#<Class:0x007f9d98a359e8>:0x007f9d9b931238>
# ./lib/has_prerequisite.rb:36:in `perform_checks'
# ./spec/has_prerequisite_spec.rb:43:in `block (2 levels) in <top (required)>'
# ./spec/has_prerequisite_spec.rb:55:in `block (3 levels) in <top (required)>'
module HasPrerequisite
class Railtie > ::Rails::Railtie
initializer "has_prerequisite.configure_view_controller" do |app|
ActiveSupport.on_load :action_controller do
include HasPrerequisite
end
end
end
end
gem 'has_prerequisite', path: '~/dev/has_prerequisite'
> bundle install
=> It will use your gem
> rspec
Note: If you changed the interface, you'll have to change the usage and maybe some tests
I recommend following Semantic Versioning
MAJOR . MINOR . PATCH
When to publish 1.0.0 ?
Tip: you can always use the labels (1.0.0.beta, 1.0.0.rc.1, 1.0.0.pre, 1.0.0.racecar-1)
choosealicense.com
contributor-covenant.org
Run your own with `gem server`
Gemfurry
Note: configure .gemspec to avoid accidental pushes to Rubygems.org
→ bundle exec rake release
has_prerequisite 1.0.0.alpha built to pkg/has_prerequisite-1.0.0.alpha.gem.
Tagged v1.0.0.alpha.
Pushed git commits and tags.
Pushed has_prerequisite 1.0.0.alpha to rubygems.org.
@sophiedeziel
Official guide:
guides.rubygems.org/publishing/
Moving code to lib folder:
justinweiss.com/articles/a-guide-to-extracting-your-first-ruby-gem/
PR for open-source: