Skip to content
Snippets Groups Projects
Commit c2a5a838 authored by Xu Cheng's avatar Xu Cheng
Browse files

Tap: add formula_file_to_name and alias_file_to_name

parent ea81963b
No related branches found
No related tags found
No related merge requests found
......@@ -168,7 +168,7 @@ class Tap
# an array of all {Formula} names of this {Tap}.
def formula_names
@formula_names ||= formula_files.map { |f| "#{name}/#{f.basename(".rb")}" }
@formula_names ||= formula_files.map { |f| formula_file_to_name(f) }
end
# path to the directory of all alias files for this {Tap}.
......@@ -186,7 +186,7 @@ class Tap
# an array of all aliases of this {Tap}.
# @private
def aliases
@aliases ||= alias_files.map { |f| "#{name}/#{f.basename}" }
@aliases ||= alias_files.map { |f| alias_file_to_name(f) }
end
# a table mapping alias to formula name
......@@ -195,7 +195,7 @@ class Tap
return @alias_table if @alias_table
@alias_table = Hash.new
alias_files.each do |alias_file|
@alias_table["#{name}/#{alias_file.basename}"] = "#{name}/#{alias_file.resolved_path.basename(".rb")}"
@alias_table[alias_file_to_name(alias_file)] = formula_file_to_name(alias_file.resolved_path)
end
@alias_table
end
......@@ -291,4 +291,14 @@ class Tap
def self.names
map(&:name)
end
private
def formula_file_to_name(file)
"#{name}/#{file.basename(".rb")}"
end
def alias_file_to_name(file)
"#{name}/#{file.basename}"
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment