carpentries / lesson-example

Example lesson using The Carpentries lesson template.
https://carpentries.github.io/lesson-example/
Other
64 stars 173 forks source link

Setup: WEBrick dependency missing? #327

Closed jd-foster closed 3 years ago

jd-foster commented 3 years ago

System: macOS 10.13 (High Sierra) Ruby: 3.00 (via Homebrew: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin17]) Jekyll: 3.9.0 (also applies to latest version 4.2.0)

I am getting an error after make serve following the instructions in Setup in sections "macOS" then "For Everyone". The full log is attached below. I've isolated the issue to the make command bundle exec jekyll serve, where there is a require "webrick" line

/usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve/servlet.rb:3:in `<top (required)>'

My basic fix is to add the line gem 'webrick' into the Gemfile in the root of the lesson repository.

This might have a connection to a recent Jekyll pull request that was merged into master on 11 Jan 2021 https://github.com/jekyll/jekyll/pull/8524

Configuration file: /Users/username/Documents/GitHub/julia-data-workflow/_config.yml Source: /Users/username/Documents/GitHub/julia-data-workflow Destination: /Users/username/Documents/GitHub/julia-data-workflow/_site Incremental build: disabled. Enable with --incremental Generating... Remote Theme: Using theme carpentries/carpentries-theme done in 1.898 seconds. Auto-regeneration: enabled for '/Users/username/Documents/GitHub/julia-data-workflow' bundler: failed to load command: jekyll (/usr/local/lib/ruby/gems/3.0.0/bin/jekyll) /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve/servlet.rb:3:in require': cannot load such file -- webrick (LoadError) from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve/servlet.rb:3:in<top (required)>' from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:184:in require_relative' from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:184:insetup' from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:102:in process' from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:93:inblock in start' from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:93:in each' from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:93:instart' from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:75:in block (2 levels) in init_with_program' from /usr/local/lib/ruby/gems/3.0.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:inblock in execute' from /usr/local/lib/ruby/gems/3.0.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in each' from /usr/local/lib/ruby/gems/3.0.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:inexecute' from /usr/local/lib/ruby/gems/3.0.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in go' from /usr/local/lib/ruby/gems/3.0.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:inprogram' from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/exe/jekyll:15:in <top (required)>' from /usr/local/lib/ruby/gems/3.0.0/bin/jekyll:23:inload' from /usr/local/lib/ruby/gems/3.0.0/bin/jekyll:23:in <top (required)>' from /Users/username/.local/share/gem/ruby/3.0.0/gems/bundler-2.2.15/lib/bundler/cli/exec.rb:63:inload' from /Users/username/.local/share/gem/ruby/3.0.0/gems/bundler-2.2.15/lib/bundler/cli/exec.rb:63:in kernel_load' from /Users/username/.local/share/gem/ruby/3.0.0/gems/bundler-2.2.15/lib/bundler/cli/exec.rb:28:inrun' from /Users/username/.local/share/gem/ruby/3.0.0/gems/bundler-2.2.15/lib/bundler/cli.rb:494:in exec' from /Users/username/.local/share/gem/ruby/3.0.0/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor/command.rb:27:inrun' from /Users/username/.local/share/gem/ruby/3.0.0/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in invoke_command' from /Users/username/.local/share/gem/ruby/3.0.0/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor.rb:392:indispatch' from /Users/username/.local/share/gem/ruby/3.0.0/gems/bundler-2.2.15/lib/bundler/cli.rb:30:in dispatch' from /Users/username/.local/share/gem/ruby/3.0.0/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor/base.rb:485:instart' from /Users/username/.local/share/gem/ruby/3.0.0/gems/bundler-2.2.15/lib/bundler/cli.rb:24:in start' from /Users/username/.local/share/gem/ruby/3.0.0/gems/bundler-2.2.15/exe/bundle:49:inblock in <top (required)>' from /Users/username/.local/share/gem/ruby/3.0.0/gems/bundler-2.2.15/lib/bundler/friendly_errors.rb:130:in with_friendly_errors' from /Users/username/.local/share/gem/ruby/3.0.0/gems/bundler-2.2.15/exe/bundle:37:in<top (required)>' from /usr/local/opt/ruby/bin/bundle:23:in load' from /usr/local/opt/ruby/bin/bundle:23:in

' make: *** [serve] Error 1

maxim-belkin commented 3 years ago

We addressed this in https://github.com/carpentries/styles/pull/555. Syncing your lesson with the styles repository should fix the problem.

jd-foster commented 3 years ago

Thanks Maxim. What's the best approach to this? So once I've run git remote add template https://github.com/carpentries/styles.git what's the best way of merging the styles repository? I guess I'm asking what the git command(s) should be. Is there a way to accept all incoming changes at once? Thanks for any help.

Edit: this was the best I could come up with git merge template/gh-pages --allow-unrelated-histories --strategy-option=theirs --squash

zkamvar commented 3 years ago

Hi @jd-foster,

This is definitely one of the biggest pain points for the template. In the January maintainers meeting, we discussed tricks to use for working with the template and pull requests. I've added the recommendations to a flight rules document in the maintainers resources repository.

Your solution works and I like the use of --strategy-option=theirs, but I would caution against using the --squash flag because this forces the history of your lesson to diverge significantly from the template (the shared history of the build scripts is the method we use to update the styles).

That being said, the new template we are working on (still in pre-alpha, but nearly ready for alpha testing) will have auto-updating styles that will avoid problems like these.

maxim-belkin commented 3 years ago

carpentries/styles is an upstream repo for The Carpentries' lessons so their histories aren't (or, at least, shouldn't be) unrelated. The way I sync up lessons with the carpentries/styles repo is:

# once per repo
git remote add template https://github.com/carpentries/styles.git
git config --local remote.template.tagOpt --no-tags

git fetch template
git merge -m "Merge branch gh-pages of carpentries/styles" template/gh-pages
# fix conflicts, if any ~> git add ~> git merge --continue

Once this is done, I manually sync up files from bin/boilerplate with the ones in the root folder. Examples:

I don't use any flags to automate the merging process because (1) I never remember what Git considers 'theirs' and 'ours' and (2) sometimes changes in the lesson's gh-pages branch are the ones I want to keep.

maxim-belkin commented 3 years ago

@jd-foster, I'm closing this issue, but please feel free to open a new one if you have any questions about the syncing process.