--The library for the Ruby language provided in a fixed format is called "gem". --For example, "gem" includes the following. --Rails (Web framework) --Sinatra (Web framework) --omniauth (authentication function) --unicorn (application server) --Rspec (test framework) ...etc --Corresponds to CPAN in Perl, pear in php, etc.
--A package management system dedicated to gems, similar to yum and apt. --The following site discloses and provides information on gems. https://rubygems.org/
--Gem can be manually installed individually as follows. - gem install "sinatra" - gem install "unicorn" - gem install "omniauth" ――However, when using various gems (libraries) in combination, there may be a compatibility problem such as "gemA ver1 and gemB ver2 work well, but the latest versions do not work well." There is. --In addition, when developing with multiple people and multiple environments, it is necessary to match the name and version of the library used in each environment. ――In such a case, Bundler will install and manage each gem while maintaining compatibility between gems. --Write the gem you want to install in a file called Gemfile, and install using bundler based on it. --Basically, it is recommended to install gems other than bundler via bundler.
--Installing Bundler --Bundler is also one of the gems. Let's download manually - gem install bundler --Check that the version is displayed after installation. - bundler -v
--Recommendation of Rubygems | For beginners who are not familiar with Ruby http://qiita.com/sumyapp/items/5ec58bf3567e557c24d7 --Bundler overview http://qiita.com/hisonl/items/162f70e612e8e96dba50 --What is Bundler? http://shokai.org/blog/archives/7262
Gem command and Bundler basics -BlueTechNote
$ gem install
$ gem update
$ gem uninstall
bundler --Install Bundler --Write the Gem to install in the Gemfile --Install with the bundle install command --Upgrade the Gem with the bundle update command
-Install Bundler
(m ・_・ Bp) 17:50 ~/Desktop/vsnote2.0/ruby % gem install bundler
Fetching bundler-2.1.4.gem
Successfully installed bundler-2.1.4
Parsing documentation for bundler-2.1.4
Installing ri documentation for bundler-2.1.4
Done installing documentation for bundler after 2 seconds
1 gem installed
-Write the Gem to install in the Gemfile
(m ・_・ Bp) 17:51 ~/Desktop/vsnote2.0/ruby % bundle init
Writing new Gemfile to /Users/uekiyoshihiro/Desktop/vsnote2.0/ruby/Gemfile
-Install with the bundle install command
(m ・_・ Bp) 17:53 ~/Desktop/vsnote2.0/ruby % bundle install
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Using bundler 2.1.4
Fetching coderay 1.1.2
Installing coderay 1.1.2
Fetching method_source 1.0.0
Installing method_source 1.0.0
Fetching pry 0.13.1
Installing pry 0.13.1
Bundle complete! 1 Gemfile dependency, 4 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
-Upgrade Gem with the bundle update command
(m ・_・ Bp) 17:58 ~/Desktop/vsnote2.0/ruby % bundle update
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Using bundler 2.1.4
Using coderay 1.1.2
Using method_source 1.0.0
Using pry 0.13.1
Bundle updated!
$ bundle init #Generate Gemfile
$ bundle install #Install the gem package written in the Gemfile
$ bundle exec #Run the command using the gem package installed with Bundler
$ bundle list #View a list of installed gem packages
$ bundle update #Update installed gem package version
Recommended Posts