amberframework / amber

A Crystal web framework that makes building applications fast, simple, and enjoyable. Get started with quick prototyping, less bugs, and blazing fast performance.
https://amberframework.org
MIT License
2.57k stars 205 forks source link

amber command missing after shards installs --ignore-crystal-version #1260

Closed szabgab closed 2 years ago

szabgab commented 3 years ago

Description

After installing amber on Crystal 1.0.0 I still don't have the amber command to get started.

Steps to Reproduce

I have this shard.yml file in an otherwise empty directory

name: Amber Demo
version: 0.0.1

authors:
   - Gabor Szabo <gabor@szabgab.com>

description: |
  Experimenting with Amber

dependencies:
  amber:
    github: amberframework/amber
  sqlite3:
    github: crystal-lang/crystal-sqlite3

development_dependencies:
  ameba:
    github: crystal-ameba/ameba

license: MIT

I installed the dependencies using

shards install --ignore-crystal-version

It did not report any errors and I have lib/amber and a lot of other things installed in lib. However in bib/ I only have the ameba command not amber Nor is it found anywhere in my $PATH

Versions

Ubuntu 21.04 using Crystal 1.0.0 lib/ameba/shard.yml says version: 0.14.3

drujensen-happymoney commented 3 years ago

I think you need to install the CLI. Checkout the getting started guide: https://docs.amberframework.org/amber/getting-started

szabgab commented 3 years ago

I tried to follow the instructions there, but

$ curl -L https://github.com/amberframework/amber/archive/stable.tar.gz | tar xz
$ cd amber-stable
$ shards install
Resolving dependencies
Fetching https://github.com/amberframework/amber-router.git
Fetching https://github.com/crystal-lang/json_mapping.cr.git
Fetching https://github.com/crystal-ameba/ameba.git
Fetching https://github.com/amberframework/cli.git
Unable to satisfy the following requirements:

- `crystal (>= 0.35.0)` required by `amber_router 0.4.4`
- `crystal (>= 0.34.0, < 2.0.0)` required by `json_mapping 0.1.1`
- `crystal (>= 0.35.0)` required by `ameba 0.13.4`
- `crystal (~> 0.30, >= 0.30.0)` required by `cli 0.9.3`
Failed to resolve dependencies, try updating incompatible shards or use --ignore-crystal-version as a workaround if no update is available.

I don't understand why is that after all I have:

$ crystal --version Crystal 1.0.0 [dd40a2442] (2021-03-22)

LLVM: 10.0.0 Default target: x86_64-unknown-linux-gnu


Anyway I went on and installed the dependencies with

shards install --ignore-crystal-version


After that

$ make install Building amber in /home/gabor/work/amber-demo/amber-stable/bin/amber cp: cannot create regular file '/usr/local/bin/amber': Permission denied make: *** [Makefile:28: install] Error 1



I would like to install it in a local directory. As I can see it is hard-code in the Makefile. I guess I could manually edit it, but probably this whole thing should work with just a shard.yml file
drujensen commented 3 years ago

to build in your local project, add the amber dependency and the target to your shard.yml

targets:
...
  amber:
    main: lib/amber/src/amber/cli.cr

dependencies:
...
  amber:
    github: amberframework/amber
    version: 0.36.0

Then run shard build amber

This will build the cli and place it in the bin directory. From here, you can run bin/amber instead.

szabgab commented 3 years ago

Thanks, that worked.