Skip to content

Commit 6b95b49

Browse files
committed
Update bundle-commands.md
1 parent 8047417 commit 6b95b49

File tree

1 file changed

+56
-4
lines changed

1 file changed

+56
-4
lines changed

cheatsheets/ruby/dependencies/bundle-commands.md

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,71 @@ $ chmod +w Gemfile
3939
$ nano Gemfile
4040
```
4141

42-
### Install
42+
### Configure
4343

4444
Make sure to configure Bundle first:
4545

4646
```sh
4747
$ bundle config set --local path vendor/bundle
4848
```
4949

50-
Then install gems.
50+
### Install
51+
52+
Install gems already instead in the `Gemfile`.
53+
54+
```sh
55+
$ bundle install [OPTIONS]
56+
```
57+
58+
### Add
59+
60+
> Adds the specified gem to Gemfile (if valid) and run 'bundle install' in one step.
61+
62+
```sh
63+
$ bundle add GEM VERSION
64+
```
65+
66+
Example:
67+
68+
```sh
69+
$ bundle add jekyll-optional-front-matter
70+
```
71+
72+
Line appended to `Gemfile`:
73+
74+
```ruby
75+
gem "jekyll-optional-front-matter", "~> 0.3.2"
76+
```
77+
78+
Output:
79+
80+
```
81+
Fetching gem metadata from https://rubygems.org/..........
82+
...
83+
Using jekyll-optional-front-matter 0.3.2
84+
```
85+
86+
### Add in group
87+
88+
To put the plugin in a group:
5189
5290
```sh
53-
$ bundle add GEM VERSION # Add gem to Gemfile and run bundle install
54-
$ bundle install [OPTIONS] # Install the current environment to the system
91+
$ bundle add jekyll-optional-front-matter -g jekyll_plugins
92+
```
93+
94+
Line appended:
95+
96+
```ruby
97+
gem "jekyll-optional-front-matter", "~> 0.3.2", :group => :jekyll_plugins
98+
```
99+
100+
But you may prefer to write it yourself like this:
101+
102+
```ruby
103+
group :jekyll_plugins do
104+
gem 'jekyll-optional-front-matter', '~> 0.3.2'
105+
# Other plugins...
106+
end
55107
```
56108

57109
### Update and clean

0 commit comments

Comments
 (0)