ensminger
ensminger

Reputation: 711

Jekyll is outputing Gemfile, Gemfile.lock on build. How can / should I prevent this?

jekyll build is creating a Gemfile and Gemfile.lock in my _site directory.

Two questions:

  1. Should I be concerned about including those files in production?
  2. If yes, how can I prevent them from being generated?

Open to any answer, including the yet-not-obvious-to-me.

Thank you!

Here is a screenshot of my environment. You can see that Gemfile and Gemfile.lock are created within _site.

enter image description here

Upvotes: 3

Views: 718

Answers (2)

David Jacquel
David Jacquel

Reputation: 52809

In _config.yml, add :

exclude:
 - Gemfile
 - Gemfile.lock

Upvotes: 5

jan.zikan
jan.zikan

Reputation: 1316

The best practice is to have only _site directory placed on production server. If you have the whole Jekyll project placed on production server make sure that _site directory is marked as root and therefore files on the same or higher level cannot be accessed. In that case presence of Gemfile and Gemfile.lock files does not matter.

I have a Rake task that deploys the Jekyll _site directory to production server using rsync.

desc "Deploy site"
task :deploy do
  command = "jekyll build && \
    rsync -avz --delete _site/ myserver:/var/www/mysite/"
  sh command
end

This is myserver configuration in .ssh config

Host myserver
  User USERNAME
  Hostname IP_ADDRESS
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/myserver/id_rsa
  ForwardAgent yes

Upvotes: 1

Related Questions