ruby on rails - Rake build is operating in an incorrect context -
i have gem exists collect several engines ease of implementation, provide few utility methods of included engines. 1 such utility method rake task release new versions of of collected engines.
my problem that, when run code should execute in context of 1 of collected engines (git commands, file system manipulation, etc.) works, except rake build
command. reason, command somehow running in context of umbrella gem, , picking version number gemfile.lock.
using code example:
dir.chdir( path_to_collected_engine ) # below lie of failed build attempts, of failed in same way... #p sh( 'bundle' , 'exec' , 'rake' , 'build' ) #p sh( 'bundle exec rake build' ) #p `bundle exec rake build` #thr = thread.new { # p `bundle exec rake build` #} #thr.join #load file.join(dir.pwd, 'rakefile') #rake::task['build'].invoke #p `gem build #{ path_to_collected_engine_gemspec_file }` end
when run standard ruby file, desired output of collected_engine_a 3.12.9 built pkg/collected_engine_a-3.12.9.gem
, when running rake task in umbrella gem, puzzling output of collected_engine_a 3.12.9 built pkg/collected_engine_a-3.12.2.gem
. seems version being derived gemfile.lock of umbrella gem (if adjust version there, affects output).
i've tried both , without bundle exec
preface, same result.
can think of way pick correct context, or stuck moving these out of rakefile, , standard script (renaming output file poor option not considered)?
bundle exec
has specific behavior when launched in subshell. can see following note in bundle exec
:
make sure if bundler invoked in subshell, uses same gemfile (by setting bundle_gemfile)
so in case, do:
bundle exec rake build bundle_gemfile=#{path_to_collected_engine}/gemfile
Comments
Post a Comment