class Chino::Chinofile

Attributes

information[RW]

Public Class Methods

new(path: `pwd`.chomp.to_s, &block) click to toggle source
# File lib/chino/chinofile.rb, line 7
def initialize(path: `pwd`.chomp.to_s, &block)
  @information = defaults(path)

  instance_eval(&block)
end

Public Instance Methods

author(value) click to toggle source
# File lib/chino/chinofile.rb, line 21
def author(value)
  @information[:author] = value
end
author_email(value) click to toggle source
# File lib/chino/chinofile.rb, line 25
def author_email(value)
  @information[:author_email] = value
end
company_name(value) click to toggle source
# File lib/chino/chinofile.rb, line 29
def company_name(value)
  @information[:company_name] = value
end
created_at(value) click to toggle source
# File lib/chino/chinofile.rb, line 37
def created_at(value)
  @information[:created_at] = value
end
exports(filename) click to toggle source
# File lib/chino/chinofile.rb, line 41
def exports(filename)
  @information[:exports][filename] = File.join(@information[:path], filename)
end
find_file(filename) click to toggle source
# File lib/chino/chinofile.rb, line 52
def find_file(filename)
  return @information[:exports][filename] if @information[:exports][filename]

  @information[:dependencies].map { |_k, v| v.find_file(filename) }.select { |x| x }.first
end
identifier(value) click to toggle source
# File lib/chino/chinofile.rb, line 33
def identifier(value)
  @information[:identifier] = value
end
imports(hash = {}) click to toggle source
# File lib/chino/chinofile.rb, line 45
def imports(hash = {})
  driver = hash.keys.first
  location = hash[driver]
  version = hash[:version]
  @information[:dependencies] << { driver: driver.to_s, version: version, location: location }
end
name(value) click to toggle source
# File lib/chino/chinofile.rb, line 13
def name(value)
  @information[:name] = value
end
version(value) click to toggle source
# File lib/chino/chinofile.rb, line 17
def version(value)
  @information[:version] = value
end

Private Instance Methods

defaults(path) click to toggle source
# File lib/chino/chinofile.rb, line 60
def defaults(path)
  {
    path: path,
    dependencies: [],
    exports: {},
    name: 'UnnamedChinoProject',
    version: '0.1.0',
    author: 'Incognito',
    author_email: 'incognito@example.com',
    company_name: 'Incognito',
    identifier: "com.Incognito.UnnamedChinoProject",
    created_at: Time.now
  }
end