class Lono::Jadespec

Attributes

from[RW]
root[R]
source_type[R]

Public Class Methods

new(root, source_type) click to toggle source
# File lib/lono/jadespec.rb, line 9
def initialize(root, source_type)
  @root, @source_type = root, source_type
end

Public Instance Methods

auto_camelize() click to toggle source

backward-compatiable for now

# File lib/lono/jadespec.rb, line 47
def auto_camelize
  metadata["lono_auto_camelize"] || false
end
detect_type() click to toggle source
# File lib/lono/jadespec.rb, line 35
def detect_type
  configset = Dir.glob("#{@root}/lib/configset.*").size > 0
  configset ? "configset" : "blueprint"
end
exist?() click to toggle source
# File lib/lono/jadespec.rb, line 17
def exist?
  !!gemspec_file
end
gemspec() click to toggle source
# File lib/lono/jadespec.rb, line 21
def gemspec
  Gem::Specification::load(gemspec_file)
end
gemspec_file() click to toggle source
# File lib/lono/jadespec.rb, line 26
def gemspec_file
  Dir.glob("#{@root}/*.gemspec").first
end
lono_strategy() click to toggle source
# File lib/lono/jadespec.rb, line 40
def lono_strategy
  deprecation_check(metadata)
  return metadata["lono_strategy"] if metadata["lono_strategy"]
  lono_type == "blueprint" ? "dsl" : "erb" # TODO: default to dsl for configset also in next major release
end
lono_type() click to toggle source
# File lib/lono/jadespec.rb, line 30
def lono_type
  deprecation_check(metadata)
  metadata["lono_type"] || detect_type
end
metadata() click to toggle source
# File lib/lono/jadespec.rb, line 51
def metadata
  gemspec.metadata || {}
end
name() click to toggle source
# File lib/lono/jadespec.rb, line 13
def name
  exist? ? gemspec.name : "not gemspec file found for @root: #{@root}"
end

Private Instance Methods

deprecation_check(metadata) click to toggle source
# File lib/lono/jadespec.rb, line 58
def deprecation_check(metadata)
  return unless ENV['LONO_DEPRECATION_SOFT']
  return if @@deprecation_check_shown[name]

  unless metadata["lono_type"]
    puts "DEPRECATION WARNING: lono_type is not set for #{name}".color(:yellow)
  end
  @@deprecation_check_shown[name] = true
end