Bundler

De WikiOpenTruc
Aller à : navigation, rechercher

m.c. : bundler , jekyll ,

Bundler provides a consistent environment for Ruby projects by tracking and installing the exact gems and versions that are needed.

Bundler is an exit from dependency hell, and ensures that the gems you need are present in development, staging, and production. Starting work on a project is as simple as bundle install.


Install

  • Il faut être superutilisateur (... contrairement à la page officielle)
# gem install bundler
Fetching: bundler-1.16.2.gem (100%)
Successfully installed bundler-1.16.2
Parsing documentation for bundler-1.16.2
Installing ri documentation for bundler-1.16.2
Done installing documentation for bundler after 7 seconds
1 gem installed


Utilisation de bundle

  • il faut être positionné dans un répertoire qui contient des gemfiles. Les gemfiles contiennent les instructions sur quoi faire.
  • ne pas utiliser en su (il refuse de toutes façons)
  • l'user qui installe doit être dans le groupe sudo
$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Using public_suffix 2.0.5
Using addressable 2.5.1
Using bundler 1.16.2
Using colorator 1.1.0
Fetching eventmachine 1.2.5


Your user account isn't allowed to install to the system RubyGems.
  You can cancel this installation and run:

      bundle install --path vendor/bundle

  to install the gems into ./vendor/bundle/, or you can enter your password
  and install the bundled gems to RubyGems using sudo.

  Password: 
usera n'apparaît pas dans le fichier sudoers. Cet événement sera signalé.
Bundler::SudoNotPermittedError: Bundler requires sudo access to install at the moment. Try installing again, granting Bundler sudo access when prompted, or installing into a different
path.
An error occurred while installing eventmachine (1.2.5), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '1.2.5' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  jekyll-livereload was resolved to 0.2.2, which depends on
    em-websocket was resolved to 0.5.1, which depends on
      eventmachine


$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Using public_suffix 2.0.5
Using addressable 2.5.1
Using bundler 1.16.2
Using colorator 1.1.0
Fetching eventmachine 1.2.5


Your user account isn't allowed to install to the system RubyGems.
  You can cancel this installation and run:

      bundle install --path vendor/bundle

  to install the gems into ./vendor/bundle/, or you can enter your password
  and install the bundled gems to RubyGems using sudo.

  Password: 
Installing eventmachine 1.2.5 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /tmp/bundler20180706-2315-1sw7642eventmachine-1.2.5/gems/eventmachine-1.2.5/ext
/usr/bin/ruby2.3 -r ./siteconf20180706-2315-1eu95ea.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /tmp/bundler20180706-2315-1sw7642eventmachine-1.2.5/gems/eventmachine-1.2.5 for inspection.
Results logged to /tmp/bundler20180706-2315-1sw7642eventmachine-1.2.5/extensions/x86_64-linux/2.3.0/eventmachine-1.2.5/gem_make.out

An error occurred while installing eventmachine (1.2.5), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '1.2.5' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  jekyll-livereload was resolved to 0.2.2, which depends on
    em-websocket was resolved to 0.5.1, which depends on
      eventmachine

effectivement, il n'y a carrément pas de répertoire /usr/lib/ruby/include ... mébon, ça ne semble pas être ça le problème.

$ sudo gem install eventmachine -v '1.2.5' --source 'https://rubygems.org/'
Building native extensions.  This could take a while...
ERROR:  Error installing eventmachine:
	ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.3.0/gems/eventmachine-1.2.5/ext
/usr/bin/ruby2.3 -r ./siteconf20180706-2452-16ftry6.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.3.0/gems/eventmachine-1.2.5 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/eventmachine-1.2.5/gem_make.out

J'installe ruby-dev et ça commence à aller un peu mieux.

usera@DO790B:~/github/bisq-website$ sudo gem install eventmachine -v '1.2.5' --source 'https://rubygems.org/'
Building native extensions.  This could take a while...
Successfully installed eventmachine-1.2.5
Parsing documentation for eventmachine-1.2.5
Installing ri documentation for eventmachine-1.2.5
Done installing documentation for eventmachine after 7 seconds
1 gem installed

et bundle install fonctionne enfin !

$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Using public_suffix 2.0.5
Using addressable 2.5.1
Using bundler 1.16.2
Using colorator 1.1.0
Fetching eventmachine 1.2.5
Installing eventmachine 1.2.5 with native extensions
Fetching http_parser.rb 0.6.0
Installing http_parser.rb 0.6.0 with native extensions
Fetching em-websocket 0.5.1
Installing em-websocket 0.5.1
Fetching ffi 1.9.18
Installing ffi 1.9.18 with native extensions
Fetching forwardable-extended 2.6.0
Installing forwardable-extended 2.6.0
Fetching rb-fsevent 0.10.2
Installing rb-fsevent 0.10.2
Fetching rb-inotify 0.9.10
Installing rb-inotify 0.9.10
Fetching sass-listen 4.0.0
Installing sass-listen 4.0.0
Fetching sass 3.5.1
Installing sass 3.5.1
Fetching jekyll-sass-converter 1.5.0
Installing jekyll-sass-converter 1.5.0
Fetching listen 3.0.8
Installing listen 3.0.8
Fetching jekyll-watch 1.5.0
Installing jekyll-watch 1.5.0
Fetching kramdown 1.14.0
Installing kramdown 1.14.0
Fetching liquid 4.0.0
Installing liquid 4.0.0
Fetching mercenary 0.3.6
Installing mercenary 0.3.6
Fetching pathutil 0.14.0
Installing pathutil 0.14.0
Fetching rouge 1.11.1
Installing rouge 1.11.1
Fetching safe_yaml 1.0.4
Installing safe_yaml 1.0.4
Fetching jekyll 3.5.1
Installing jekyll 3.5.1
Fetching jekyll-feed 0.9.2
Installing jekyll-feed 0.9.2
Fetching jekyll-livereload 0.2.2
Installing jekyll-livereload 0.2.2
Fetching jekyll-redirect-from 0.12.1
Installing jekyll-redirect-from 0.12.1
Fetching jekyll-sitemap 1.1.1
Installing jekyll-sitemap 1.1.1
Bundle complete! 5 Gemfile dependencies, 27 gems now installed.
Bundled gems are installed into `./vendor/bundle`



Liens