I have a Ruby on Rails app, our development environment is set on macOS. I need a connection to the svn server that I use for storing files and so on.
The core problem I am facing is, despite I succeed all of the steps from the docs I can not import svn_wc gem in my controller.rb
Terminal output when I run rails serve is similar to this one
LoadError (cannot load such file -- svn/core)
I have this line in my Gemfile
gem 'svn_wc'
And had installed MacPorts for downloading Ruby bindings with the following command
sudo port install subversion-rubybindings
The gem seems buggy and does not declare dependencies correctly. It requires svn/core, which is not present in the gem source code.
The gemspec does not declare any dependency either.
However, if you read the README, you'll see that you need SVN SWIG ruby binding (whatever that is) but also ruby 1.8.
Your best bet would be to find another gem, or even use something like git-svn and interact with it like git
Related
I am new to Ruby, Rails and gem management. One thing what I have noticed is that whenever I run bundle install (even within the project directory) it seems to install gems which affects other gem based Rails projects too.
For instance, assume that after running bundle install within one gem based Rail project (which installs a bunch of gems from the gemfile) I run into gem incompatibility issues. Now, these issues will manifest in all the other gem based projects too and will present themselves everytime I attempt to rackup
My questions are:
1) Is there a way to localize this damage (gem version incompatibility) to the current project and not have other projects affected?
2) Is there a good way to obtain a compatible set of gems or is the only way to look at the gem dependencies on a gem-by-gem basis (look at the tree) and figure out the compatible ones? I seem to be wasting a lot of time on this and if I fix one something else seems to break.
Please let me know what I'm missing here or point me to resources.
Thanks
It sounds like you're missing use of bundle exec
Description
This command executes the command, making all gems specified in the Gemfile(5) available to require in Ruby programs.
Essentially, if you would normally have run something like rspec spec/my_spec.rb, and you want to use the gems specified in the Gemfile(5) and installed via bundle install(1), you should run bundle exec rspec spec/my_spec.rb.
bundle install will install gems to $GEM_HOME which is shared by any apps using the same ruby and can result in multiple versions of the same gem being installed (this is expected and normal). If you don't then also use bundle exec to load only the gem versions specified in your Gemfile you can get incompatibility errors or unexpected behavior as ruby doesn't know which version of a particular gem to require.
RVM, rbenv, and other ruby version managers are useful tools for both isolating gems per project (which isn't really necessary when also using bundler) and for allowing multiple ruby versions to be installed on the same machine (which is not handled by bundler and can be very useful when developing multiple apps with different ruby version requirements).
My understanding is that the gemfile in a Rails app only provides references to the actual code of these gems on your local computer. So when you're running your app locally, it's pulling the gem code from your local computer. What happens when you deploy though? The server runs your rails code, but does it also hold all the references in your gem file and automatically download them as well?
Yep. If you deploy on Heroku, you can see bundler doing its work and pulling down the gems.
As per the Bundler docs, you can use bundle show --paths to see exactly where your gems are being loaded from.
Additionally, if you aren't using bundler, you can use the command gem environment to see gem paths on the system.
See this existing answer for more info: How can I find where gem files are installed?
on a Windows 7 environment,
i installed ruby 2.2 and and the ruby development kit and want to install a gem now, which throws this error:
error: unknown type name 'BOOL'
for the command
gem install av_capture -v '1.0.1'
on multiple .h files. The av_capture gem is part of a 'bundle install' i want to do for another gem.
I also get one
fatal error: AVFoundation/AVFoundation.h: No such file or directory
So i doubt that av_capture gem can be installed at all (?)
Google tells me to use g++ instead of gcc to fix the bool type error, i dont think that i can adjust this for the ruby devkit though.
The DevKit itself seems to work fine, the example json part of the devkit wiki installation site works.
Just looked up this gem, as it says everywhere on their site:
Wraps up AVCapture and exposes it to Ruby. This gem only works on OS X.
So I doubt you're going to get this to work. AVFoundation is an IOS Specific thing.
I want to make a gem from rails source code and install the gem.
After clone the master repository of rails, I tried as follow.
$>gem build rails.gemspec
$>gem install rails-4.2.0.alpha.gem
It did not work. I also tried $>rake install which did not work either.
Looking forward your help!
There is a script in the root directory which builds from source and installs the gems. It's called install.rb. You can use it by running the following:
ruby install.rb 4.2.0.alpha
Note: At the time of writing this the arel gem needs to be built from source and installed separately before running the install script above. This is because the version constraints in rails are requiring a version of arel which has not yet been released onto rubygems.org.
I just created this standard skeleton of a gem.
In it I'm extending Ruby with C. Using this tutorial, I produced a very basic gem that performs a simple hello_world method.
But I'm not sure how to incorporate this into an app at this point.
Does anyone know what steps I need to take in order to install this gem in my existing Rails app? Then, once it is installed (I imagine with Bundler), how would one access the method of hello_world from within the Ruby environment?
I noticed your repository is missing the .gemspec file. Gemspecs define a "gem" and allow it to be installed and published using Rubygems. This guide to creating a gem, on rubygems.org, explains what a .gemspec file is and how to create it.
Once you have a gemspec file in your repo, you can publish it to rubygems (so it can be installed on any computer), or use it directly from your filesystem. To include a gem from a local directory in a gemfile, the include line looks like this:
gem 'aes_gem', path: '/path/to/aes_gem'
Or if you just want to install it using gem install:
gem install /path/to/aes_gem.0.0.0.gem
You can use bundler to install local gems and use them.
This can be achieved by
gem "foo", :path => "/path/to/foo"
in your case
gem 'aes_gem', path: '/path/to/aes_gem'
Once you complete your gem, you can push into github or rubygems and specify the path accordingly