cryplot icon indicating copy to clipboard operation
cryplot copied to clipboard

Palettes Enum is empty

Open stellarpower opened this issue 1 year ago • 4 comments

Doing a shards install, I presume the downloading of palettes not completed successfully - upon build of the sample programs, I get:

Dependencies are satisfied
Building: sample1
Error target sample1 failed to compile:
Showing last frame. Use --error-trace for full trace.

In lib/cryplot/src/plot/palettes.cr:9:3

 9 | enum Palette
     ^
Error: enum Palette must have at least one member

Looking at the generated file:

  # Gnuplot color palettes adapted from https://github.com/Gnuplotting/gnuplot-palettes
  enum Palette
    def to_s(io : IO) : Nil
      io << self.to_s.downcase
    end

    def data
      Cryplot.palettes[self]
    end
  end

  class_getter palettes : Hash(Palette, String) { get_palettes }

  private def self.get_palettes
    pals = Hash(Palette, String).new

    pals
  end

Presume something with the download of the palettes repo hasn't worked or has changed since initial version(?).

I'm on Crystal 1.5.0-dev [792027789] (2022-05-25)

Cheers!

stellarpower avatar Aug 20 '22 15:08 stellarpower

Update: looks like the script needs git here: system("git submodule update --init") - gen_palettes.cr:5

As I downloaded using shards install, the folder is a checkout, not a repo itself. Quick workaround would be to check if this command fails, and spit out an error, but longer-term probably a different method of downloading would be better.

stellarpower avatar Aug 20 '22 15:08 stellarpower

Thanks @stellarpower . Seems some functionality has been changed in latest version of lang. I've changed post install to invoke shell script to perform the work. Have tested it on Mac and assumes same should work on *nix based systems as well.

naqvis avatar Sep 09 '22 01:09 naqvis

Hi I'm seeing this with Crystal 1.2.0 (2022-01-01) on linux (nixos) with a shards install.

Any idea how to fix?

nuxeh avatar Jan 11 '24 22:01 nuxeh

Any idea how to fix?

try to run install.sh and see if it succeeds. if no, then restrict your shard.yml to use version 0.1.0 of this shard

naqvis avatar Jan 12 '24 09:01 naqvis