whitefusionhq / bulmatown

A Bulma CSS starter theme for Bridgetown.
https://bulmatown.onrender.com/
MIT License
17 stars 9 forks source link

File.exists? produces NoMethodError on install #27

Open zalom opened 1 month ago

zalom commented 1 month ago

File.exists? produces NoMethodError.

Steps to reproduce

  1. Try installing with bridgetown new mysite --use-sass -a https://github.com/whitefusionhq/bulmatown
  2. Select Y on the first prompt
  3. Select a on the next prompt (or input multiple Y on subsequent prompts)

Observe:

The Bulmatown installer can update styles, layouts, and page templates to use the new theme. You'll have the option to type 'a' to overwrite all existing files or 'd' to inspec
  The Bulmatown installer can update styles, layouts, and page templates to use the new theme. You'll have the option to type 'a' to overwrite all existing files or 'd' to inspect each change. Would you like to proceed? (Y/N) Y
         run    git clone --quiet https://github.com/whitefusionhq/bulmatown.git /var/folders/ty/0bssnlqn3fn86l3mc7thcfs80000gn/T/bulmatown-20240730-54820-2pk0vy from "."
Already on 'master'
Your branch is up to date with 'origin/master'.
    conflict    frontend/styles/index.scss
  Overwrite /Users/zlatko/apps/personal/bridgetown/mysite/frontend/styles/index.scss? (enter "h" for help) [Ynaqdhm] Y
       force    frontend/styles/index.scss
      create    src/_layouts/home.liquid
    conflict    src/_layouts/page.liquid
  Overwrite /Users/zlatko/apps/personal/bridgetown/mysite/src/_layouts/page.liquid? (enter "h" for help) [Ynaqdhm] Y
       force    src/_layouts/page.liquid
    conflict    src/_layouts/post.liquid
  Overwrite /Users/zlatko/apps/personal/bridgetown/mysite/src/_layouts/post.liquid? (enter "h" for help) [Ynaqdhm] Y
       force    src/_layouts/post.liquid
  Exception raised: NoMethodError
undefined method `exists?' for class File
                 1: https://raw.githubusercontent.com/whitefusionhq/bulmatown/master/bridgetown.automation.rb:65:in `substitute_in_default_if_exists'
                 2: https://raw.githubusercontent.com/whitefusionhq/bulmatown/master/bridgetown.automation.rb:80:in `apply'
                 3: /Users/zlatko/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/thor-1.3.1/lib/thor/actions.rb:231:in `instance_eval'
                 4: /Users/zlatko/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/thor-1.3.1/lib/thor/actions.rb:231:in `apply'
                 5: /Users/zlatko/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/bridgetown-core-1.3.4/lib/bridgetown-core/commands/concerns/actions.rb:113:in `apply_from_url'
         Backtrace: Use the --trace option for complete information.
toddkummer commented 16 hours ago

I ran into this issue, too. I can confirm that running on the fork resolved it for me: bridgetown new btwf --use-sass -a https://github.com/zalom/bulmatown/tree/fix-27-no-method-error

Stack Overflow suggests the issue occurs starting with ruby 3.2: https://stackoverflow.com/questions/14351272/undefined-method-exists-for-fileclass-nomethoderror