Gemspec error due to 'spec.version = Additionals::VERSION'
If I run a Ruby file in another Redmine plugin, I get the following error in Additionals;
ruby plugins/redmine_xapian/extra/xapian_indexer.rb
[!] There was an error parsing `Gemfile`:
[!] There was an error parsing `Gemfile`:
[!] There was an error while loading `additionals.gemspec`: uninitialized constant Additionals::VERSION. Bundler cannot continue.
# from /opt/redmine/plugins/additionals/additionals.gemspec:9
# -------------------------------------------
# spec.name = 'additionals'
> spec.version = Additionals::VERSION
# spec.authors = ['AlphaNodes']
# -------------------------------------------
. Bundler cannot continue.
# from /opt/redmine/plugins/additionals/Gemfile:4
# -------------------------------------------
# # Specify your gem's dependencies in additionals.gemspec
> gemspec
#
# -------------------------------------------
. Bundler cannot continue.
# from /opt/redmine/Gemfile:108
# -------------------------------------------
# Dir.glob File.expand_path("../plugins/*/{Gemfile,PluginGemfile}", __FILE__) do |file|
> eval_gemfile file
# end
# -------------------------------------------
A workaround is to modify lib/additionals/version.rb as follows:
# frozen_string_literal: true
module Additionals
-- VERSION = '3.0.3-master' unless defined? VERSION
++ VERSION = '3.0.3-master'
end
Me too having this problem. Many thanks for your workaround! Probably additionals plugin could be made more stable...
Hi @picman,
do you get this error with latest additionals, yet? I never had this problems you described with other plugins.
With the master branch:
$ ruby plugins/redmine_xapian/extra/xapian_indexer.rb
[!] There was an error parsing `Gemfile`:
[!] There was an error parsing `Gemfile`:
[!] There was an error while loading `additionals.gemspec`: uninitialized constant Additionals::PluginVersion::VERSION. Bundler cannot continue.
The reason is unclear for me, but, can't you simple remove the check unless defined? VERSION. Why is it there?
Because this plugin can be installed as Gem. I did not find a solution for this without initializing VERSION constant twice. That is the reason. If I find a solution for that, I can remove this check.