Skip to content

Commit

Permalink
Tidy up code.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Aug 20, 2024
1 parent 40c7f34 commit 2ec9e53
Showing 1 changed file with 14 additions and 32 deletions.
46 changes: 14 additions & 32 deletions lib/bake/registry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,6 @@ def empty?
@ordered.empty?
end

def append_bakefile(path)
@ordered << Loader::FileLoader.new({
[] => path
})
end

# Add registry according to the current working directory and loaded gems.
# @parameter working_directory [String]
def append_defaults(working_directory)
# Load recipes from working directory:
self.append_path(working_directory)

# Load recipes from loaded gems:
self.append_from_gems
end

# Enumerate the registry in order.
def each(&block)
@ordered.each(&block)
Expand All @@ -83,6 +67,12 @@ def scopes_for(path)
end
end

def append_bakefile(path)
@ordered << Loader::FileLoader.new({
[] => path
})
end

# Append a specific project path to the search path for recipes.
# The computed path will have `bake` appended to it.
# @parameter current [String] The path to add.
Expand All @@ -96,22 +86,14 @@ def append_path(current = Dir.pwd, **options)
return false
end

# Search from the current working directory until a suitable bakefile is found and add it.
# @parameter current [String] The path to start searching from.
def append_from_root(current = Dir.pwd, **options)
while current
Console.debug(self) {"Checking current #{current}..."}

append_path(current, **options)

parent = File.dirname(current)

if current == parent
break
else
current = parent
end
end
# Add registry according to the current working directory and loaded gems.
# @parameter working_directory [String]
def append_defaults(working_directory)
# Load recipes from working directory:
self.append_path(working_directory)

# Load recipes from loaded gems:
self.append_from_gems
end

# Enumerate all loaded gems and add them.
Expand Down

0 comments on commit 2ec9e53

Please sign in to comment.