Skip to content

Regression: Rake task methods override each other #131

Closed
@excid3

Description

@excid3

Rake task files that define methods end up in a global namespace, which means that cssbundling-rails and jsbundling-rails now conflict as they both define build_command.

https://github.com/rails/cssbundling-rails/blob/2f2945e74fb492ebecfd42fff11c0d206f67e7c0/lib/tasks/cssbundling/build.rake#L26C8-L26C8

To reproduce the issue, have a project with both cssbundling-rails and jsbundling-rails in it.

± rails css:build
yarn install v1.22.19
[1/4] 🔍  Resolving packages...
success Already up-to-date.
  Done in 0.05s.

From: /Users/chris/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/cssbundling-rails-1.3.0/lib/tasks/cssbundling/build.rake @ line 12 :

     7:     end
     8:   end
     9:
    10:   desc "Build your CSS bundle"
    11:   build_task = task :build do
 => 12:     binding.irb
    13:     command = build_command
    14:     unless system(command)
    15:       raise "cssbundling-rails: Command build failed, ensure `#{command}` runs without errors"
    16:     end
    17:   end

irb(main):001:0> method(:build_command)
=> #<Method: Object#build_command() /Users/chris/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/jsbundling-rails-1.2.0/lib/tasks/jsbundling/build.rake:27>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions