librelist archives

« back to archive

is it possible to automate make with the bundle install command?

is it possible to automate make with the bundle install command?

From:
Shu Yan Chan
Date:
2012-10-14 @ 20:48
Hello,  I have managed to successfully build some Ruby gem that use Rice
following the instructions in


http://librelist.com/browser//rice/2012/6/27/ruby-gem-that-uses-rice/#9579b2be35e04c5b1c0727c1a34b8020

However, the gem is actually only for internal use by Rails servers and we
want to streamline the deployment process so that ideally, after fetching
all the source code (including the ruby gem that use Rice for some C++
code), we can setup the Rails server by simply running the "bundle install"
command.

Currently, there are two way for us to setup the gem for the Rails servers,
both involve more than just "bundle install" command.

a)  after all the source code are fetched to the target machine, run the
"gem build GemName.gemspec" command at the gem source code directory, and
then run "gem install GemName-ver.gem" and then finally "bundle install" at
the Rails server root


or

b) the source code for the ruby gem is already in the vendor/gems
directory, and in the Gemfile for the Rails server, the path to the gem
source code is also specified as well as the exact version number:
gem 'GemName', '0.0.1', :path => "vendor/gems"
then cd into the gem directory and run
ruby extconf.rb
make
and finally "bundle install"


in b), if I omit "ruby extconf.rb" and "make", "bundle install" would
actually still succeed, it is just that when it comes to the time the Rails
server actually need to use the gem, it fails because the .so file hasn't
been build.  Is there a way such that in method b), I can let the bundler
know that this Rice gem requires the running of  "ruby extconf.rb" and
"make"? (in method a, the "gem install" does automatically run  "ruby
extconf.rb" and "make" as part of the process)

Thanks.

Shu Yan

Re: [rice] is it possible to automate make with the bundle install command?

From:
Jason Roelofs
Date:
2012-10-15 @ 18:27
On Oct 14, 2012, at 4:48 PM, Shu Yan Chan <shu@supermono-studios.com> wrote:

> Hello,  I have managed to successfully build some Ruby gem that use Rice
following the instructions in
> 
> 
http://librelist.com/browser//rice/2012/6/27/ruby-gem-that-uses-rice/#9579b2be35e04c5b1c0727c1a34b8020
> 
> However, the gem is actually only for internal use by Rails servers and 
we want to streamline the deployment process so that ideally, after 
fetching all the source code (including the ruby gem that use Rice for 
some C++ code), we can setup the Rails server by simply running the 
"bundle install" command.
> 
> Currently, there are two way for us to setup the gem for the Rails 
servers, both involve more than just "bundle install" command.
> 
> a)  after all the source code are fetched to the target machine, run the
"gem build GemName.gemspec" command at the gem source code directory, and 
then run "gem install GemName-ver.gem" and then finally "bundle install" 
at the Rails server root
> 
> 
> or
> 
> b) the source code for the ruby gem is already in the vendor/gems 
directory, and in the Gemfile for the Rails server, the path to the gem 
source code is also specified as well as the exact version number:
> gem 'GemName', '0.0.1', :path => "vendor/gems" 
> then cd into the gem directory and run
> ruby extconf.rb
> make
> and finally "bundle install"  
> 
> 
> in b), if I omit "ruby extconf.rb" and "make", "bundle install" would 
actually still succeed, it is just that when it comes to the time the 
Rails server actually need to use the gem, it fails because the .so file 
hasn't been build.  Is there a way such that in method b), I can let the 
bundler know that this Rice gem requires the running of  "ruby extconf.rb"
and "make"? (in method a, the "gem install" does automatically run  "ruby 
extconf.rb" and "make" as part of the process)  
> 
> Thanks.
> 
> Shu Yan

Hmm, if a plain `gem install yourgem.gemspec` does everything correctly 
then it should work fine under bundler. Have you run bundler in --verbose 
mode to see if it's actually building your gem, particularly from a clean 
slate?

I'm wondering if bundler does something different when it comes to locally
stored gem source like that. I'll take a look to see if I can find 
anything along that path.

Jason

Re: [rice] is it possible to automate make with the bundle install command?

From:
Shu Yan Chan
Date:
2012-10-15 @ 20:08
Thanks for your reply, here is a bit more info.

using bundle install --verbose
the relevant output are:
...
Query List: []
Using rake (0.9.2.2) from /usr/local/rvm/gems/ruby-1.8.7-p370@global
/specifications/rake-0.9.2.2.gemspec
Using rice (1.4.3) from /usr/local/rvm/gems/ruby-1.8.7-p370@rails3.2.1
/specifications/rice-1.4.3.gemspec
Using MyGem (0.2.0) from source at vendor/gems/MyGem from
/home/user/myRailsApp/vendor/gems/MyGem/MyGem.gemspec
...

and "extconf.rb" and "make" are not being executed  (no Makefile and .so
files produced).

Thanks.

Shu yan

On 15 October 2012 19:27, Jason Roelofs <jameskilton@gmail.com> wrote:

> On Oct 14, 2012, at 4:48 PM, Shu Yan Chan <shu@supermono-studios.com>
> wrote:
>
> Hello,  I have managed to successfully build some Ruby gem that use Rice
> following the instructions in
>
>
> 
http://librelist.com/browser//rice/2012/6/27/ruby-gem-that-uses-rice/#9579b2be35e04c5b1c0727c1a34b8020
>
> However, the gem is actually only for internal use by Rails servers and we
> want to streamline the deployment process so that ideally, after fetching
> all the source code (including the ruby gem that use Rice for some C++
> code), we can setup the Rails server by simply running the "bundle install"
> command.
>
> Currently, there are two way for us to setup the gem for the Rails
> servers, both involve more than just "bundle install" command.
>
> a)  after all the source code are fetched to the target machine, run the
> "gem build GemName.gemspec" command at the gem source code directory, and
> then run "gem install GemName-ver.gem" and then finally "bundle install" at
> the Rails server root
>
>
> or
>
> b) the source code for the ruby gem is already in the vendor/gems
> directory, and in the Gemfile for the Rails server, the path to the gem
> source code is also specified as well as the exact version number:
> gem 'GemName', '0.0.1', :path => "vendor/gems"
> then cd into the gem directory and run
> ruby extconf.rb
> make
> and finally "bundle install"
>
>
> in b), if I omit "ruby extconf.rb" and "make", "bundle install" would
> actually still succeed, it is just that when it comes to the time the Rails
> server actually need to use the gem, it fails because the .so file hasn't
> been build.  Is there a way such that in method b), I can let the bundler
> know that this Rice gem requires the running of  "ruby extconf.rb" and
> "make"? (in method a, the "gem install" does automatically run  "ruby
> extconf.rb" and "make" as part of the process)
>
> Thanks.
>
> Shu Yan
>
>
> Hmm, if a plain `gem install yourgem.gemspec` does everything correctly
> then it should work fine under bundler. Have you run bundler in --verbose
> mode to see if it's actually building your gem, particularly from a clean
> slate?
>
> I'm wondering if bundler does something different when it comes to locally
> stored gem source like that. I'll take a look to see if I can find anything
> along that path.
>
> Jason
>