EugenMayer/docker-sync

`expand_ignore_strings`: undefined method `append` for Array

zedtux opened this issue · 3 comments

Error

Updating docker-sync from version 0.7.2 to 1.0.4 makes the docker-sync-stack start command to fail with the following error :

       note:  You can also run docker-sync in the background with docker-sync start
          ok  Starting native_osx for sync one-sync
/Users/zedtux/.rvm/gems/ruby-2.4.5/gems/docker-sync-1.0.4/lib/docker-sync/sync_strategy/native_osx.rb:205:in `expand_ignore_strings': undefined method `append' for #<Array:0x00007fb665859260> (NoMethodError)
  from /Users/zedtux/.rvm/gems/ruby-2.4.5/gems/docker-sync-1.0.4/lib/docker-sync/sync_strategy/native_osx.rb:52:in `start_container'
  from /Users/zedtux/.rvm/gems/ruby-2.4.5/gems/docker-sync-1.0.4/lib/docker-sync/sync_strategy/native_osx.rb:112:in `run'
  from /Users/zedtux/.rvm/gems/ruby-2.4.5/gems/docker-sync-1.0.4/lib/docker-sync/sync_process.rb:85:in `run'
  from /Users/zedtux/.rvm/gems/ruby-2.4.5/gems/docker-sync-1.0.4/lib/docker-sync/sync_manager.rb:111:in `block in run'
  from /Users/zedtux/.rvm/gems/ruby-2.4.5/gems/docker-sync-1.0.4/lib/docker-sync/sync_manager.rb:110:in `each'
  from /Users/zedtux/.rvm/gems/ruby-2.4.5/gems/docker-sync-1.0.4/lib/docker-sync/sync_manager.rb:110:in `run'
  from /Users/zedtux/.rvm/gems/ruby-2.4.5/gems/docker-sync-1.0.4/tasks/stack/stack.thor:45:in `start'
  from /Users/zedtux/.rvm/gems/ruby-2.4.5/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
  from /Users/zedtux/.rvm/gems/ruby-2.4.5/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
  from /Users/zedtux/.rvm/gems/ruby-2.4.5/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
  from /Users/zedtux/.rvm/gems/ruby-2.4.5/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
  from /Users/zedtux/.rvm/gems/ruby-2.4.5/gems/docker-sync-1.0.4/bin/docker-sync-stack:15:in `<top (required)>'
  from /Users/zedtux/.rvm/gems/ruby-2.4.5/bin/docker-sync-stack:23:in `load'
  from /Users/zedtux/.rvm/gems/ruby-2.4.5/bin/docker-sync-stack:23:in `<main>'
  from /Users/zedtux/.rvm/gems/ruby-2.4.5/bin/ruby_executable_hooks:24:in `eval'
  from /Users/zedtux/.rvm/gems/ruby-2.4.5/bin/ruby_executable_hooks:24:in `<main>'

Downgrading docker-sync gem to version 1.0.3 workaround this issue.

Docker Driver

d4m

Sync strategy

native_osx

your docker-sync.yml

version: "2"

options:
  # default: docker-compose.yml if you like, you can set a custom location (path) of your compose file like ~/app/compose.yml
  # HINT: you can also use this as an array to define several compose files to include. Order is important!
  compose-file-path: 'docker-compose.yml'

  # optional, default: docker-compose-dev.yml if you like, you can set a custom location (path) of your compose file. Do not set it, if you do not want to use it at all

  # if its there, it gets used, if you name it explicitly, it HAS to exist
  # HINT: you can also use this as an array to define several compose files to include. Order is important!
  compose-dev-file-path: 'docker-compose-dev.yml'

  # optional, activate this if you need to debug something, default is false
  # IMPORTANT: do not run stable with this, it creates a memory leak, turn off verbose when you are done testing
  verbose: false

  # optional, default auto, can be docker-sync, thor or auto and defines how the sync will be invoked on the cli. Mostly depending if your are using docker-sync solo, scaffolded or in development ( thor )
  cli_mode: 'auto'
  # optional, maximum number of attempts for unison waiting for the success exit status. The default is 5 attempts (1-second sleep for each attempt). Only used in unison.
  max_attempt: 5

  # optional, default: pwd, root directory to be used when transforming sync src into absolute path, accepted values: pwd (current working directory), config_path (the directory where docker-sync.yml is found)
  project_root: 'pwd'

syncs:
  one-sync:
    # os aware sync strategy, default to unison under osx, and native docker volume under linux
    sync_strategy: 'native_osx'

    # which folder to watch / sync from - you can use tilde, it will get expanded.
    # the contents of this directory will be synchronized to the Docker volume with the name of this sync entry ('app-sync' here)
    src: '.'

    # optional, a list of excludes. These patterns will not be synced
    sync_excludes: ['.git', 'log', 'node_modules', 'public/packs', 'tmp']

    # use this to change the exclude syntax.
    # Path: you match the exact path ( nesting problem )
    # Name: If a file or a folder does match this string ( solves nesting problem )
    # Regex: Define a regular expression
    # none: You can define a type for each sync exclude, so sync_excludes: ['Name .git', 'Path Gemlock']
    #
    # for more see http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html#pathspec
    sync_excludes_type: 'Name'

    # this does not user groupmap but rather configures the server to map
    # optional: usually if you map users you want to set the user id of your application container here
    sync_userid: '1000'

    # optional, a list of regular expressions to exclude from the fswatch - see fswatch docs for details
    watch_excludes: ['.*/.git', '.*/log', '.*/node_modules', '.*/public/packs', '.*/tmp']

    # optional: use this to switch to fswatch verbose mode
    watch_args: '-v'

OS

macOS 10.15.7

The problem is append is not present in ruby 2.4 - it was introduced in ruby 2.5 (https://ruby-doc.org/core-2.4.0/Array.html / https://ruby-doc.org/core-2.5.0/Array.html ).

I think that was happening unintended, but i'am not really planning to downgrade the implementation - ruby 2.4 is EOL.
I would rather release 1.0.5 and upper the minimum ruby to 2.5 in this case.

I can see you are using RVM, so just install 2.5+ and you should be good to go already.

Cool, I will upgrade my Ruby, it's a very old version anyway.

Having an error about my Ruby version would have help, so yeah, please update the minimum Ruby version 👍

released 1.0.5 to fix this