Sha256: f64ff8c22cf3794e45e8af3de735288da6c7db85fe99b47d71cbfadec5ce77da

Contents?: true

Size: 1.29 KB

Versions: 13

Compression:

Stored size: 1.29 KB

Contents

ASSETS.cli.config do |cnf|
  cnf.people do |input, session, options|
    people = Eco::API::Organization::People.new([])
    if SCR.get_arg("-get-people")
      options.deep_merge!(people: {
        get: {from: :remote, type: :full}
      })
      people = session.do.file_people
    elsif SCR.get_arg("-people-from-backup")
      file = SCR.get_arg("-people-from-backup", with_param: true)
      options.deep_merge!(people: {
        get: {from: :local, type: :backup}
      })
      people = JSON.parse(File.read(file))
      people = Eco::API::Organization::People.new(people)
    elsif SCR.get_arg("-get-partial")
      unless input && input.is_a?(Enumerable)
        raise "To use -get-partial (partial updates), you need to use -entries-from"
      end
      options.deep_merge!(people: {
        get: {from: :remote, type: :partial}
      })

      people = session.do.search(input, options: options)
    else
      options.deep_merge!(people: {
        get: {from: :local, type: :full}
      })
      people = session.do.load_people(modifier: [:newest, :save])
      if people.empty?
        options.deep_merge!(people: {
          get: {from: :remote, type: :full}
        })
        people = session.do.file_people if people.empty?
      end
    end
    people
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
eco-helpers-1.0.11 lib/eco/cli/config/default/people.rb
eco-helpers-1.0.10 lib/eco/cli/config/default/people.rb
eco-helpers-1.0.9 lib/eco/cli/config/default/people.rb
eco-helpers-1.0.8 lib/eco/cli/config/default/people.rb
eco-helpers-1.0.7 lib/eco/cli/config/default/people.rb
eco-helpers-1.0.6 lib/eco/cli/config/default/people.rb
eco-helpers-1.0.5 lib/eco/cli/config/default/people.rb
eco-helpers-1.0.4 lib/eco/cli/config/default/people.rb
eco-helpers-1.0.3 lib/eco/cli/config/default/people.rb
eco-helpers-0.9.5 lib/eco/cli/config/default/people.rb
eco-helpers-1.0.2 lib/eco/cli/config/default/people.rb
eco-helpers-0.9.4 lib/eco/cli/config/default/people.rb
eco-helpers-0.9.3 lib/eco/cli/config/default/people.rb