Skip to content

Commit 933df51

Browse files
committed
🔧 Add ability to change cuberfile path
1 parent ee294e2 commit 933df51

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/cuber/cli.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ module Cuber
1313
class CLI
1414

1515
def initialize
16+
file_path = ARGV[1] || 'Cuberfile'
17+
1618
@options = {}
1719
parse_command!
18-
parse_cuberfile
20+
parse_cuberfile(file_path)
1921
validate_cuberfile
2022
execute
2123
end
@@ -26,9 +28,9 @@ def parse_command!
2628
@options[:cmd] = ARGV.shift&.to_sym
2729
end
2830

29-
def parse_cuberfile
30-
abort 'Cuberfile not found in current directory' unless File.exist? 'Cuberfile'
31-
content = File.read 'Cuberfile'
31+
def parse_cuberfile(file_path)
32+
abort 'Cuberfile not found in current directory' unless File.exist? file_path
33+
content = File.read file_path
3234
parser = CuberfileParser.new
3335
parser.instance_eval(content)
3436
cuberfile_options = parser.instance_variables.map do |name|

0 commit comments

Comments
 (0)