File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -22,15 +22,28 @@ module Cssbundling
22
22
extend self
23
23
24
24
def install_command
25
- return "bun install" if File . exist? ( 'bun.lockb' ) || ( tool_exists? ( 'bun' ) && !File . exist? ( 'yarn.lock' ) )
26
- return "yarn install" if File . exist? ( 'yarn.lock' ) || tool_exists? ( 'yarn' )
27
- raise "cssbundling-rails: No suitable tool found for installing JavaScript dependencies"
25
+ case tool
26
+ when :bun then "bun install"
27
+ when :yarn then "yarn install"
28
+ else raise "cssbundling-rails: No suitable tool found for installing JavaScript dependencies"
29
+ end
28
30
end
29
31
30
32
def build_command
31
- return "bun run build:css" if File . exist? ( 'bun.lockb' ) || ( tool_exists? ( 'bun' ) && !File . exist? ( 'yarn.lock' ) )
32
- return "yarn build:css" if File . exist? ( 'yarn.lock' ) || tool_exists? ( 'yarn' )
33
- raise "cssbundling-rails: No suitable tool found for building CSS"
33
+ case tool
34
+ when :bun then "bun run build:css"
35
+ when :yarn then "yarn build:css"
36
+ else raise "cssbundling-rails: No suitable tool found for building CSS"
37
+ end
38
+ end
39
+
40
+ def tool
41
+ case
42
+ when File . exist? ( 'bun.lockb' ) then :bun
43
+ when File . exist? ( 'yarn.lock' ) then :yarn
44
+ when tool_exists? ( 'bun' ) then :bun
45
+ when tool_exists? ( 'yarn' ) then :yarn
46
+ end
34
47
end
35
48
36
49
def tool_exists? ( tool )
You can’t perform that action at this time.
0 commit comments