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.



11
12
13
# File 'lib/lono/jadespec.rb', line 11

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

Instance Attribute Details

#fromObject

Returns the value of attribute from.



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

def from
  @from
end

#rootObject (readonly)

Returns the value of attribute root.



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

def root
  @root
end

#source_typeObject (readonly)

Returns the value of attribute source_type.



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

def source_type
  @source_type
end

Instance Method Details

#auto_camelizeObject

backward-compatiable for now



43
44
45
# File 'lib/lono/jadespec.rb', line 43

def auto_camelize
  ["lono_auto_camelize"] || false
end

#detect_typeObject



32
33
34
35
# File 'lib/lono/jadespec.rb', line 32

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

#exist?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/lono/jadespec.rb', line 15

def exist?
  !!gemspec_file
end

#gemspecObject



19
20
21
# File 'lib/lono/jadespec.rb', line 19

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

#gemspec_fileObject



24
25
26
# File 'lib/lono/jadespec.rb', line 24

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

#lono_strategyObject



37
38
39
40
# File 'lib/lono/jadespec.rb', line 37

def lono_strategy
  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



28
29
30
# File 'lib/lono/jadespec.rb', line 28

def lono_type
  ["lono_type"] || detect_type
end

#metadataObject



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

def 
  gemspec. || {}
end