Bundle install from an external gemfile and managing local configs in multiple applications

34 views
Skip to first unread message

Qns

unread,
Apr 28, 2017, 11:49:23 PM4/28/17
to ruby-bundler
I am using ant tasks to install gems from a gemfile,gemfile.lock that sit outside the working directory
    <exec dir="${working.dir}" executable="bundle">
        <arg line="install --gemfile=${external.dir}/Gemfile --path ${working.dir}" />
    </exec>
This installs the gems correctly in the desired location but the bundle config '.bundle/config' is created in ${external.dir}. I need everything related to the bundle installed self contained in the working dir. I could have different working directories (eg : jenkins jobs) and i need gems to be installed in all these workspaces from the common external file to run some tasks. To fix this I was executing

    <exec dir="${working.dir}" executable="bundle">
        <arg line="—local config path ${working.dir}" />
    </exec>
To successfully execute a ruby script using 'bundle exec rspec' , i had to add a few more local configs

        <exec dir="${working.dir}" executable="bundle">
            <arg line="config --local binstubs ${working.dir} " />           
        </exec>
        <exec dir="${working.dir}" executable="bundle">
            <arg line="config --local bin ${working.dir} " />           
        </exec>
        <exec dir="${working.dir}" executable="bundle">
            <arg line="config --local gemfile ${external.dir}/Gemfile " />           
        </exec>

This helped me successfully execute a ruby script using bundle exec, however I can see that everytime 'bundle install' is run on different jenkins jobs , the .bundle/config in ${external.dir} and I don't know how this would affect my jobs.Local config is being generated for all of them. Is there a better way to achieve what I need ? Please help.
Reply all
Reply to author
Forward
0 new messages