Class: Lono::Jadespec

Inherits:
Object
  • Object
show all
Extended by:
Memoist
Defined in:
lib/lono/jadespec.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root, source_type) ⇒ Jadespec

Returns a new instance of Jadespec.



9
10
11
# File 'lib/lono/jadespec.rb', line 9

def initialize(root, source_type)
  @root, @source_type = root, source_type
end

Instance Attribute Details

#fromObject

Returns the value of attribute from.



7
8
9
# File 'lib/lono/jadespec.rb', line 7

def from
  @from
end

#rootObject (readonly)

Returns the value of attribute root.



8
9
10
# File 'lib/lono/jadespec.rb', line 8

def root
  @root
end

#source_typeObject (readonly)

Returns the value of attribute source_type.



8
9
10
# File 'lib/lono/jadespec.rb', line 8

def source_type
  @source_type
end

Instance Method Details

#auto_camelizeObject

backward-compatiable for now



47
48
49
# File 'lib/lono/jadespec.rb', line 47

def auto_camelize
  ["lono_auto_camelize"] || false
end

#detect_typeObject



35
36
37
38
# File 'lib/lono/jadespec.rb', line 35

def detect_type
  configset = Dir.glob("#{@root}/lib/configset.*").size > 0
  configset ? "configset" : "blueprint"
end

#exist?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/lono/jadespec.rb', line 17

def exist?
  !!gemspec_file
end

#gemspecObject



21
22
23
# File 'lib/lono/jadespec.rb', line 21

def gemspec
  Gem::Specification::load(gemspec_file)
end

#gemspec_fileObject



26
27
28
# File 'lib/lono/jadespec.rb', line 26

def gemspec_file
  Dir.glob("#{@root}/*.gemspec").first
end

#lono_strategyObject



40
41
42
43
44
# File 'lib/lono/jadespec.rb', line 40

def lono_strategy
  deprecation_check()
  return ["lono_strategy"] if ["lono_strategy"]
  lono_type == "blueprint" ? "dsl" : "erb" # TODO: default to dsl for configset also in next major release
end

#lono_typeObject



30
31
32
33
# File 'lib/lono/jadespec.rb', line 30

def lono_type
  deprecation_check()
  ["lono_type"] || detect_type
end

#metadataObject



51
52
53
# File 'lib/lono/jadespec.rb', line 51

def 
  gemspec. || {}
end

#nameObject



13
14
15
# File 'lib/lono/jadespec.rb', line 13

def name
  exist? ? gemspec.name : "not gemspec file found for @root: #{@root}"
end