zachallett / test_reload_gem Goto Github PK
View Code? Open in Web Editor NEWSource code for blog post about adding reload! support to gem development
License: MIT License
Source code for blog post about adding reload! support to gem development
License: MIT License
I know this is 3 years old and has no activity, but I found your blog post today, and it's pretty useful. There's a mistake though. When you require the gem name:
require 'test_gem'
that is requiring the version of that gem that is installed. You would need to run gem build *.gemspec
and gem install *.gem
to install the version of your gem with the changes you just made during development. This isn't very useful, as most people don't build and install their gem for every little change. Instead, change that line to this:
require_relative 'lib/test_gem'
and as long as you are using Ruby's gem file structure conventions, it will load the actual files you are working with. This was you can save your files, and run reload!
from pry without ever exiting. Here's the relevant sections from my Rakefile
for reference (gem name is brewer
):
task :console do
require 'pry'
require_relative 'lib/brewer'
def reload!
files = $LOADED_FEATURES.select { |feat| feat =~ /\/brewer\// }
files.each { |file| load file }
end
ARGV.clear
Pry.start
end
Other than that, this is cool, and I know I'm going to use it. Thanks.
Edit: This needs to be run from the root of your gem during development, but that's usually where people work anyway.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.