class Kamaze::Project

Represent a project

Sample of use:

“`ruby Kamaze.project do |c|

c.subject     = Kamaze::Project
c.name        = :'kamaze-project'
c.tasks       = [ :doc, :gem ]

end “`

Constants

VERSION

@see github.com/SwagDevOps/kamaze-version

Attributes

gem_name[R]

Project name

@return [Symbol]

name[R]

Project name

@return [Symbol]

subject[R]

Project subject, main class

@return [Class]

Public Class Methods

boot() click to toggle source

Load “env file” + ruby files from “boot“ directory

@return [self]

# File lib/kamaze/project.rb, line 90
def boot
  env_load

  Dir.glob("#{__dir__}/project/boot/*.rb").each do |bootable|
    require_relative bootable
  end

  self
end
instance(&block) click to toggle source

Get an instance of project

@return [Kamaze::Project]

# File lib/kamaze/project.rb, line 63
def instance(&block)
  helper.get(:project).setup(&block)
end
new() { |config| ... } click to toggle source
# File lib/kamaze/project.rb, line 101
def initialize(&block)
  self.class.boot

  if block
    config = helper.get('project/config')
    yield(config)
    config.configure(self)
  end

  self.name ||= ENV.fetch('PROJECT_NAME')
  self.subject ||= subject!

  self.tools.freeze
end

Public Instance Methods

load!() click to toggle source

Load project

@return [self]

# File lib/kamaze/project.rb, line 124
def load!
  tasks_load!
end
path(*args) click to toggle source

@return [Pathname]

# File lib/kamaze/project.rb, line 117
def path(*args)
  pwd.join(*args)
end
pwd() click to toggle source

@return [Pathname]

# File lib/kamaze/project.rb, line 129
def pwd
  Pathname.new(Dir.pwd)
end
version() click to toggle source

@see Kamaze::Project::Version @return [Object]

# File lib/kamaze/project.rb, line 70
def version
  subject.const_get('VERSION')
end

Protected Instance Methods

name=(name) click to toggle source

Set name

# File lib/kamaze/project.rb, line 138
def name=(name)
  @name = name.to_s.empty? ? nil : name.to_s.to_sym
end
subject!() click to toggle source

Main class (subject of project)

@return [Class]

# File lib/kamaze/project.rb, line 156
def subject!
  resolvable = name.to_s.tr('-', '/')

  helper.get(:inflector).resolve(resolvable)
end
subject=(subject) click to toggle source

Set subject

@param [Class] subject

# File lib/kamaze/project.rb, line 145
def subject=(subject)
  unless subject.is_a?(Class)
    # @todo raise error
  end

  @subject = subject
end