简体   繁体   中英

Environment to develop gem while develop rails app

I am developing a Rails app that uses a gem that I am also developing.

Every change that I make in the gem I have to: build, uninstall previously installed gem, install built gem, restart rails app.

You can imagine that it easily becomes a nightmare to make even litle changes in the gem.

I´ve tried to manually load all files that are configured to be loaded by the gem (at Gemspec) but it always seem to be some problem in the loading process, not finding libraries or not loading in the proper order.

Is there a way to set my environment to better develop my gem with my app?

You can just add a file reference to your local filesystem in your Gemfile, like

gem 'new_gem', :path => '~/RubyPlayground/DevGems/new_gem/'

That way you just need a new bundle install after modifying your new gem.

Update

Reading your description again you might not be using rails 32. My suggestion is of course based on bundler at least.

您总是可以将gem代码符号链接到lib /,然后将其包含在自动重载路径(application.rb IIRC)中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM