micrate icon indicating copy to clipboard operation
micrate copied to clipboard

shards install missing micrate dependencies

Open jackashton opened this issue 4 years ago • 0 comments

If you include micrate in a shard.yml and run shards install it does not include mysql (and sqlite3) which are dependencies for micrate. This is the error you get when you try build a project with micrate as a dependency.

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

In lib/micrate/src/micrate-bin.cr:3:1

 3 | require "mysql"
     ^
Error: can't find file 'mysql'

If you're trying to require a shard:
- Did you remember to run `shards install`?
- Did you make sure you're running the compiler in the same directory as your shard.yml?

my project shard.yml

name: example
version: 0.1.0

crystal: 0.36.1

license: MIT

targets:
  micrate:
    main: lib/micrate/src/micrate-bin.cr

dependencies:
  pg:
    github: will/crystal-pg

  granite:
    github: Gembot-ai/granite
    branch: master

  cuid:
    github: rodrigopinto/cuid

  dotenv:
    github: drum445/dotenv

  micrate:
    github: amberframework/micrate

output of shards install

$ shards install
Resolving dependencies
Fetching https://github.com/will/crystal-pg.git
Fetching https://github.com/gembot-ai/granite.git
Fetching https://github.com/rodrigopinto/cuid.git
Fetching https://github.com/drum445/dotenv.git
Fetching https://github.com/amberframework/micrate.git
Fetching https://github.com/crystal-lang/crystal-db.git
Installing db (0.10.1)
Installing pg (0.24.0)
Installing granite (0.22.0 at 4b14cc0)
Installing cuid (1.0.0 at b773f57)
Installing dotenv (0.3.0)
Installing micrate (0.12.0)
Writing shard.lock

Moving mysql and sqlite from dependencies to dev dependencies seems to be the cause as adding these to my shard.yml and doing shards install fixes this issue. https://github.com/amberframework/micrate/commit/6d88fb4fe2fc657d4908e20be06c885be27ccab2#diff-cbaa8062ee0fcfb5af8adfd98f69af4766b9ad5bb5e79158abe8da34f6fd7de0

jackashton avatar Sep 28 '21 22:09 jackashton