class Chino::Config
Public Class Methods
new(file: nil, install: false)
click to toggle source
# File lib/chino/config.rb, line 8 def initialize(file: nil, install: false) path = File.basename(file || '') file ||= 'Chinofile' @chinofile = Chinofile.new(path: path) do instance_eval File.read(file), file end @dep_puller = DepPuller.new @chinofile.information[:dependencies].each do |dep| @dep_puller.load_dependency!(dep) end end
Public Instance Methods
bundle_company_name()
click to toggle source
# File lib/chino/config.rb, line 37 def bundle_company_name @chinofile.information[:company_name] end
bundle_created_at()
click to toggle source
# File lib/chino/config.rb, line 45 def bundle_created_at @chinofile.information[:created_at] end
bundle_exports()
click to toggle source
# File lib/chino/config.rb, line 49 def bundle_exports @chinofile.information[:exports] end
bundle_identifier()
click to toggle source
# File lib/chino/config.rb, line 41 def bundle_identifier @chinofile.information[:identifier] end
bundle_name()
click to toggle source
# File lib/chino/config.rb, line 21 def bundle_name @chinofile.information[:name] end
bundle_version()
click to toggle source
# File lib/chino/config.rb, line 25 def bundle_version @chinofile.information[:version] end
common_path()
click to toggle source
# File lib/chino/config.rb, line 57 def common_path "#{data_path}/common" end
data_path()
click to toggle source
# File lib/chino/config.rb, line 53 def data_path "#{Gem.loaded_specs['chino'].full_gem_path}/data/chino" end
dependency_has_file?(file)
click to toggle source
# File lib/chino/config.rb, line 70 def dependency_has_file?(file) @dep_puller.dependency_has_file?(file) end
erb(file)
click to toggle source
# File lib/chino/config.rb, line 82 def erb(file) renderer = ERB.new(File.read(erb_name(file))) { string: renderer.result(binding) } end
erb_name(file)
click to toggle source
# File lib/chino/config.rb, line 78 def erb_name(file) "#{common_path}/#{file}.erb" end
get_file(file)
click to toggle source
# File lib/chino/config.rb, line 61 def get_file(file) return { filename: file.to_s } if File.exist?(file.to_s) return erb(file) if File.exist?(erb_name(file)) return { filename: "#{common_path}/#{file}" } if File.exist?("#{common_path}/#{file}") return get_from_dependency(file) if dependency_has_file?(file) {} end
get_from_dependency(file)
click to toggle source
# File lib/chino/config.rb, line 74 def get_from_dependency(file) @dep_puller.get_from_dependency(file) end