Hanami: `hanami new .` generate broken app

Created on 20 May 2018  路  7Comments  路  Source: hanami/hanami

hanami version 1.2.0.

If you give the name in typical way e.g. hanami new app_x it will create folders like this:

lib/
    app_x/
          entities/
          mailers/
          repositories/
    app_x.rb

When the app name is . it puts folders entities, mailers and repositories directly in lib/ and creates a file ..rb (in lib/), which is then incorrectly required in config/environment.rb, like so:

# ...
require_relative '../lib/.'

Name . should be translated into real name of the current folder.

bug

All 7 comments

I (still) think we should have this functionality, since it's a common pattern for command line utilities.

I'm using hanami CLI that way because I like to put everything in rvm gemset. So I start new project like this:

mkdir project_x
cd project_x
rvm use ruby-2.5@project_x --create --ruby-version
gem install hanami
hanami new .

@cllns WDYT if we just add some simple format validators to CLI library and will use it here?

Just had another request for this (#939).

@davydovanton I'm not sure how format validators would solve this. We could use that to tell people they can't create a project at ., but, instead, I think we should allow it.

@cllns Might be a silly question (I probably missed something) but what was wrong with @tzmfreedom's PR #939 which (as far as I can see) has an implementation of a solution?

Dear all, we support this behavior since long time, but due to an evident regression it wasn't working anymore. I've opened #947 To fix this. Please review.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leo-generali picture leo-generali  路  3Comments

mkarganov picture mkarganov  路  3Comments

duykhoa picture duykhoa  路  6Comments

cllns picture cllns  路  4Comments

gerrywastaken picture gerrywastaken  路  3Comments