module Kamaze::Project::Bundled::ClassMethods

Class methods

Protected Instance Methods

base_path() click to toggle source

@return [Pathname]

# File lib/kamaze/project/bundled.rb, line 49
def base_path
  @base_path
end
base_path=(path) click to toggle source

Set `base_path` from given `path`.

@param [String] path @return [Pathname]

# File lib/kamaze/project/bundled.rb, line 44
def base_path=(path)
  @base_path = Pathname.new(path).realpath
end
bundled?() click to toggle source

Denote current class is used in a bundled context.

@return [Boolean]

# File lib/kamaze/project/bundled.rb, line 56
def bundled?
  # @formatter:off
  [%w[gems.rb gems.locked], %w[Gemfile Gemfile.lock]].map do |m|
    Dir.chdir(base_path) do
      m.map { |f| Pathname(f).file? }.uniq
    end
  end.include?([true])
  # @formatter:on
end
development?() click to toggle source

Denote current class is used in development context.

@return [Boolean]

# File lib/kamaze/project/bundled.rb, line 69
def development?
  # @formatter:off
  bundled? and [['gemspec.tpl']].map do |m|
    Dir.chdir(base_path) do
      m.map { |f| Pathname(f).file? }
    end
  end.include?([true])
  # @formatter:on
end