fractaledmind / enlitenment

A Rails application template script to lead your app to SQLite enlightenment.
46 stars 4 forks source link

Can not create a new app #10

Closed trinitytakei closed 2 months ago

trinitytakei commented 2 months ago

Describe the bug

I can not create a new application using the current version of enlitement (89c28190960aed3e1b385f8444a6cdb0cef42b08).

To Reproduce

❯ ruby -v
ruby 3.3.3 (2024-06-12 revision f1c7b6f435) [arm64-darwin23]
❯ rails -v
Rails 7.2.1

I quadruple-checked that the local file (/Users/mia/Downloads/enlitement.rb) contains the most recent version of the script, and tried to create a new application with

rails new enlitement_test_3 -m /Users/mia/Downloads/enlitement.rb

It bombs with

       apply  /Users/mia/Downloads/enlitement.rb
The template [/Users/mia/Downloads/enlitement.rb] could not be loaded. Error: No such file or directory @ rb_sysopen - /Users/mia/workspace/rails/enlitement_test_4/Gemfile.lock

I got past that by changing this line

return if file_includes?("Gemfile.lock", "    #{name}")

to

return if File.exist?('Gemfile.lock') &&  file_includes?("Gemfile.lock", "    #{name}")

but then it blows up with

       apply  /Users/mia/Downloads/enlitement.rb
     gemfile    sqlite3 (~> 2.0)
     gemfile    activerecord-enhancedsqlite3-adapter (~> 0.8.0)
     gemfile    solid_queue
/Users/mia/Downloads/enlitement.rb:130:in `bundle_install': uninitialized constant #<Class:#<Rails::Generators::AppGenerator:0x0000000101983990>>::Bundler (NameError)
    from /Users/mia/Downloads/enlitement.rb:156:in `apply'

while I could try to debug/fix this further, it sounds like I'm doing something fundamentally wrong (I can hardly imagine how something as basic as "I can't create an app" made it this far after all the testing) so please take a look.

Expected behavior

A new application should be created.

NB: I'm not even saying 'created correctly', i.e. everything works as intended once the app is set up. In fact, I wanted to set this app up to demonstrate a bug I ran into, but well, now you know how that went 😅

thedumbtechguy commented 2 months ago

Your ticket makes sense. Stephen added a check for gems in the gem file and it seems that should occur only after bundling for new apps.

fractaledmind commented 2 months ago

Fixed now after https://github.com/fractaledmind/enlitenment/commit/1162f2cf079d8e1281aa96c6999a6ecbf5fa6e72 and https://github.com/fractaledmind/enlitenment/commit/1f20d67bd4d425a3bc8d8510631abda0bd5404cb