0

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?

Ricardo Acras
  • 35,784
  • 16
  • 71
  • 112

2 Answers2

3

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.

Atastor
  • 741
  • 3
  • 11
  • +1 It worked fine. Is there a way to make it not necessary to restart the rails app every time I change something in the gem? – Ricardo Acras Sep 19 '12 at 20:31
  • You tell me ... I guess it should be possible by switching stuff in environments, but as my apps usually are quite small I never bothered to check this out :-) – Atastor Sep 19 '12 at 20:34
1

You could always symlink your gem code to lib/ and then include that in your autoreload paths (application.rb IIRC).

arturaz
  • 767
  • 6
  • 18
  • here are some more details on this idea: http://stackoverflow.com/questions/6191635/how-to-reload-a-gem-on-every-request-in-development-mode – coderuby Nov 10 '16 at 09:42