nanoc: bundle / cri/option_parser / foreman interaction error

bundle exec foreman start used to correctly run nanoc view without complaint; now nanoc errors with a cri/option_parser error. Running the two individual commands in foreman’s Procfile works fine:

Procfile:

watch: bundle exec guard
nanoc_view: bundle exec nanoc view

% bundle exec guard

14:03:59 - INFO - Compilation succeeded.
14:03:59 - INFO - LiveReload is waiting for a browser to connect.
14:03:59 - INFO - Guard is now watching at 'jm3.net'
[1] guard(main)>

% bundle exec nanoc view

View the site at http://127.0.0.1:3000/
[2017-11-10 14:04:20] INFO  WEBrick 1.3.1
[2017-11-10 14:04:20] INFO  ruby 2.4.0 (2016-12-24) [x86_64-darwin16]
[2017-11-10 14:04:20] INFO  WEBrick::HTTPServer#start: pid=11520 port=3000

but

% bundle exec foreman start

which runs the same two commands, now bombs with a cri/option_parse error:

watch.1      | started with pid 11581
nanoc_view.1 | started with pid 11582
nanoc_view.1 |
nanoc_view.1 | Captain! We’ve been hit!
nanoc_view.1 |
nanoc_view.1 | LoadError: cannot load such file -- cri/option_parser
nanoc_view.1 |
nanoc_view.1 |   0. ~/vendor/bundle/ruby/2.4.0/gems/cri-2.10.1/lib/cri/command.rb:369:in `require'
nanoc_view.1 |   1. ~/vendor/bundle/ruby/2.4.0/gems/cri-2.10.1/lib/cri/command.rb:369:in `partition'
nanoc_view.1 |   2. ~/vendor/bundle/ruby/2.4.0/gems/cri-2.10.1/lib/cri/command.rb:265:in `run'
nanoc_view.1 |   3. ~/vendor/bundle/ruby/2.4.0/gems/nanoc-4.8.11/lib/nanoc/cli.rb:63:in `block in run'
nanoc_view.1 |   4. ~/vendor/bundle/ruby/2.4.0/gems/nanoc-4.8.11/lib/nanoc/cli/error_handler.rb:66:in `handle_while'
nanoc_view.1 |   5. ~/vendor/bundle/ruby/2.4.0/gems/nanoc-4.8.11/lib/nanoc/cli/error_handler.rb:24:in `handle_while'
nanoc_view.1 |   6. ~/vendor/bundle/ruby/2.4.0/gems/nanoc-4.8.11/lib/nanoc/cli.rb:61:in `run'
nanoc_view.1 |   7. ~/vendor/bundle/ruby/2.4.0/gems/nanoc-4.8.11/bin/nanoc:18:in `<top (required)>'
nanoc_view.1 |   8. ~/vendor/bundle/ruby/2.4.0/bin/nanoc:22:in `load'
nanoc_view.1 |   9. ~/vendor/bundle/ruby/2.4.0/bin/nanoc:22:in `<top (required)>'
nanoc_view.1 |   ... 17 lines omitted (see crash.log for details)
nanoc_view.1 |
nanoc_view.1 | A detailed crash log has been written to ./crash.log.
nanoc_view.1 | exited with code 1
system       | sending SIGTERM to all processes
Error: wrong argument type Nanoc::CLI::CleaningStream (expected File)

Ruby version 2.4.0, Gemfile:

source 'https://rubygems.org'
ruby '2.4.0'

group :development do
  gem 'adsf'             # for nanoc view
  gem 'foreman'          # process-manager to start guard + rackup
  gem 'guard-livereload' # enable guard to reload browser when files change
  gem 'guard-nanoc'      # watch files, i guess? no idea, rtfm
  gem 'guard-rack'       # enable guard to HUP webserver when low-level stuff changes
  gem 'rack'             # HTTP-layer middleware manager
  gem 'rack-livereload'  # inject livereload code into the page in development
  gem 'dotenv'           # save / load environment variables - used for AWS keys
  gem 'rake'
  gem 'pry'
  gem 'nanoc'

  gem 'sass'             # css shit
  gem 'uglifier'         # js post-processing

  gem 'builder'          # required for XML sitemaps
  gem 'haml'             # simple templates
  gem 'slim'             # experimenting with alternate template engine
end

crash.log

Crashlog created at 2017-11-10 14:07:05 -0800

===== MESSAGE:

LoadError: cannot load such file -- cri/option_parser

===== STACK TRACE:

0. ~/vendor/bundle/ruby/2.4.0/gems/cri-2.10.1/lib/cri/command.rb:369:in `require'
1. ~/vendor/bundle/ruby/2.4.0/gems/cri-2.10.1/lib/cri/command.rb:369:in `partition'
2. ~/vendor/bundle/ruby/2.4.0/gems/cri-2.10.1/lib/cri/command.rb:265:in `run'
3. ~/vendor/bundle/ruby/2.4.0/gems/nanoc-4.8.11/lib/nanoc/cli.rb:63:in `block in run'
4. ~/vendor/bundle/ruby/2.4.0/gems/nanoc-4.8.11/lib/nanoc/cli/error_handler.rb:66:in `handle_while'
5. ~/vendor/bundle/ruby/2.4.0/gems/nanoc-4.8.11/lib/nanoc/cli/error_handler.rb:24:in `handle_while'
6. ~/vendor/bundle/ruby/2.4.0/gems/nanoc-4.8.11/lib/nanoc/cli.rb:61:in `run'
7. ~/vendor/bundle/ruby/2.4.0/gems/nanoc-4.8.11/bin/nanoc:18:in `<top (required)>'
8. ~/vendor/bundle/ruby/2.4.0/bin/nanoc:22:in `load'
9. ~/vendor/bundle/ruby/2.4.0/bin/nanoc:22:in `<top (required)>'
10. ~/.rvm/gems/ruby-2.4.0/gems/bundler-1.16.0.pre.3/lib/bundler/cli/exec.rb:75:in `load'
11. ~/.rvm/gems/ruby-2.4.0/gems/bundler-1.16.0.pre.3/lib/bundler/cli/exec.rb:75:in `kernel_load'
12. ~/.rvm/gems/ruby-2.4.0/gems/bundler-1.16.0.pre.3/lib/bundler/cli/exec.rb:28:in `run'
13. ~/.rvm/gems/ruby-2.4.0/gems/bundler-1.16.0.pre.3/lib/bundler/cli.rb:424:in `exec'
14. ~/.rvm/gems/ruby-2.4.0/gems/bundler-1.16.0.pre.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
15. ~/.rvm/gems/ruby-2.4.0/gems/bundler-1.16.0.pre.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
16. ~/.rvm/gems/ruby-2.4.0/gems/bundler-1.16.0.pre.3/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
17. ~/.rvm/gems/ruby-2.4.0/gems/bundler-1.16.0.pre.3/lib/bundler/cli.rb:27:in `dispatch'
18. ~/.rvm/gems/ruby-2.4.0/gems/bundler-1.16.0.pre.3/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
19. ~/.rvm/gems/ruby-2.4.0/gems/bundler-1.16.0.pre.3/lib/bundler/cli.rb:18:in `start'
20. ~/.rvm/gems/ruby-2.4.0/gems/bundler-1.16.0.pre.3/exe/bundle:30:in `block in <top (required)>'
21. ~/.rvm/gems/ruby-2.4.0/gems/bundler-1.16.0.pre.3/lib/bundler/friendly_errors.rb:122:in `with_friendly_errors'
22. ~/.rvm/gems/ruby-2.4.0/gems/bundler-1.16.0.pre.3/exe/bundle:22:in `<top (required)>'
23. /usr/local/bin/bundle:22:in `load'
24. /usr/local/bin/bundle:22:in `<main>'
25. ~/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'

===== VERSION INFORMATION:

Nanoc 4.8.11 © 2007-2017 Denis Defreyne.
Running ruby 2.4.0 (2016-12-24) on x86_64-darwin16 with RubyGems 2.6.8.

===== SYSTEM INFORMATION:

Darwin mac 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64

===== INSTALLED GEMS:

bundler 1.16.0.pre.3

===== LOAD PATHS:

0. ~/.rvm/gems/ruby-2.4.0/gems/bundler-1.16.0.pre.3/lib
1. ~/vendor/bundle/ruby/2.4.0/gems/ref-2.0.0/lib
2. ~/.rvm/gems/ruby-2.4.0/gems/bundler-1.16.0.pre.3/lib/gems/bundler-1.16.0.pre.3/lib
3. ~/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0
4. ~/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/x86_64-darwin16
5. ~/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby
6. ~/.rvm/rubies/ruby-2.4.0/lib/ruby/vendor_ruby/2.4.0
7. ~/.rvm/rubies/ruby-2.4.0/lib/ruby/vendor_ruby/2.4.0/x86_64-darwin16
8. ~/.rvm/rubies/ruby-2.4.0/lib/ruby/vendor_ruby
9. ~/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0
10. ~/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin16

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 24 (16 by maintainers)

Most upvoted comments

Glad to hear!

By the way, I’m working on making the live-recompilation part of Nanoc more integrated (easier to set up and use, as well as faster). If you don’t mind living on the edge, you can:

  1. Update the Gemfile to use nanoc from master:

    gem 'nanoc', github: 'nanoc/nanoc'
    
  2. Add more dependencies to Gemfile:

    gem 'listen'
    gem 'eventmachine'
    gem 'em-websocket'
    
  3. Run bundle

  4. Set NANOC_FEATURES to all in the environment, to enable experimental features.

  5. Update your Procfile to say

    watch: bundle exec nanoc compile --watch
    view: bundle exec nanoc view --reload
    

This will be quite similar to your setup with Guard. Some things will still change before this feature is properly released:

  • Notifications (through macOS’ system notifications or notify-send on Linux)
  • No need to mention extra dependencies in the Gemfile
  • Single live command
  • Lots of testing
  • Windows support