fog-openstack
fog-openstack copied to clipboard
Make sure bundler is installed for development
What's the problem?
Starting from a clean system, carrying out the development instructions fails due to missing bundler gem, which must be installed explicitly. Error message:
bundle install
+ bundle install
./bin/setup: line 6: bundle: command not found
How to reproduce?
$ cat > Dockerfile << EOF
> FROM ubuntu:xenial
> RUN apt-get update && \
apt-get install -y software-properties-common git && \
add-apt-repository -y ppa:brightbox/ruby-ng && \
apt-get update && \
apt-get install ruby2.3 ruby2.3-dev
> RUN git clone https://github.com/fog/fog-openstack.git
> WORKDIR fog-openstack
> ENTRYPOINT ["./bin/setup"]
> EOF
$ docker build -t apophis90/fog-test
$ docker run --rm apophis90/fog-test
bundle install
+ bundle install
./bin/setup: line 6: bundle: command not found
How to fix:
Install bundler gem right before bin/setup/ is launched, by running gem install bundler. Consequently, the Dockerfile from above would look like this:
$ cat > Dockerfile << EOF
> FROM ubuntu:xenial
> RUN apt-get update && \
apt-get install -y software-properties-common git && \
add-apt-repository -y ppa:brightbox/ruby-ng && \
apt-get update && \
apt-get install ruby2.3 ruby2.3-dev && \
gem install bundler
> RUN git clone https://github.com/fog/fog-openstack.git
> WORKDIR fog-openstack
> ENTRYPOINT ["./bin/setup"]
> EOF
$ docker build -t apophis90/fog-test
$ docker run --rm apophis90/fog-test
Note: Since the build-essential package is missing here, bin/setup/ still fails while trying the build native extensions of dependencies. I will cover that in a separate issue, since this is distro-specific.
I'd propose complementing the changes from PR #318 and add it to the development instructions in README. By that means, it's still copy-pasteable:
$ git clone https://github.com/fog/fog-openstack.git # Clone repository
$ gem install bundler # Make sure bundler is installed
$ cd fog-openstack; bin/setup # Install dependencies from project directory
$ rake spec # Run tests
$ bin/console # Run interactive prompt that allows you to experiment (optional)
$ bundle exec rake install # Install gem to your local machine (optional)
I'm happy to help here, opinions and feedback welcome.