I'll summarize the bundler and bundler commands for myself. ・ Bundle install ・ Bundle update
-Bunler is a tool that manages ** gem **. -The bundler itself is also a type of ** gem **. -Use ** Gemfile ** and ** Gemfile.lock ** to manage gems.
・ A gem is a library. -A collection of useful functions. -By installing gem, various functions without writing code from scratch ・ There are many types of gems. (User registration function, authentication function, etc.)
The Gemfile describes the gems used in the app. You can install the listed gems by typing the command. When installing, it is possible to specify the version of the gem, otherwise it will be installed with the latest version.
Gemfile
gem 'bootstrap-sass', '3.4.1'
The gem actually installed is listed. It also shows gems that have dependencies on gems installed with the Gemfile.
Gemfile.lock
bootsnap (1.5.1)
msgpack (~> 1.0)
bootstrap-sass (3.4.1)
autoprefixer-rails (>= 5.2.1)
sassc (>= 2.0.0)
builder (3.2.4)
Enter the following command in the terminal.
------ % gem install bundler
Check the bundler version with the following command and Also check if bundler is installed.
------ % bundle -v
Bundler version 1.17.2
bundle install Install the gem described in the Gemfile. Search the Gemfile for gems that are not in Gemfile.lock, and install the gems you find. After executing the command, the installed gems will be displayed below.
------ % bundle install
The dependency tzinfo-data (>= 0) will be unused by any of the platforms
Bundler is installing for. Bundler is installing for ruby but the dependency is
only for x86-mingw32, x86-mswin32,x64-mingw32, java. To add those platforms to
the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32
java`.
Using rake 13.0.1
Using concurrent-ruby 1.1.7
Using i18n 1.8.5
Using minitest 5.14.2
Using thread_safe 0.3.6
...
...
...
Bundle complete! 20 Gemfile dependencies, 78 gems now installed.
Gems in the group production were not installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
bundle update Ignore the contents written in Gemfile.lock and install all the gems written in Gemfile. The behavior after execution is the same as bundle install.
------ % bundle update
The dependency tzinfo-data (>= 0) will be unused by any of the platforms
Bundler is installing for. Bundler is installing for ruby but the dependency is
only for x86-mingw32, x86-mswin32,x64-mingw32, java. To add those platforms to
the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32
java`.
Using rake 13.0.1
Using concurrent-ruby 1.1.7
Using i18n 1.8.5
Using minitest 5.14.2
Using thread_safe 0.3.6
...
...
...
Bundle updated!
Gems in the group production were not installed.
Basically, it seems better to use "bundle install". It is good to use "bundle update" when an error occurs due to a dependency. If you use "bundle update" in the production environment, the configuration of the gem will change from the development environment and test environment, and unexpected problems may occur, so be careful.
Recommended Posts