Class: Dappgen::DapperConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/dappgen/dapper_config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(script, filename) ⇒ DapperConfig

Returns a new instance of DapperConfig.



11
12
13
14
15
# File 'lib/dappgen/dapper_config.rb', line 11

def initialize(script, filename)
  @arguments = {}
  @script = []
  instance_eval script, filename
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



9
10
11
# File 'lib/dappgen/dapper_config.rb', line 9

def arguments
  @arguments
end

#scriptObject (readonly)

Returns the value of attribute script.



9
10
11
# File 'lib/dappgen/dapper_config.rb', line 9

def script
  @script
end

Class Method Details

.execute(filename) ⇒ Object



5
6
7
# File 'lib/dappgen/dapper_config.rb', line 5

def self.execute(filename)
  DapperConfig.new(File.read(filename), filename)
end

Instance Method Details

#copy_base!(source = nil) ⇒ Object



36
37
38
# File 'lib/dappgen/dapper_config.rb', line 36

def copy_base!(source = nil)
  @script << { copy_base: source }
end

#generate(name, with:) ⇒ Object



28
29
30
# File 'lib/dappgen/dapper_config.rb', line 28

def generate(name, with:)
  @script << { generate: name, with: with }
end

#in_directory(name) ⇒ Object



32
33
34
# File 'lib/dappgen/dapper_config.rb', line 32

def in_directory(name)
  @script << { setdir: name }
end

#remove(name) ⇒ Object



24
25
26
# File 'lib/dappgen/dapper_config.rb', line 24

def remove(name)
  @script << { remove: name }
end

#requires(argument_name) ⇒ Object



17
18
19
20
21
22
# File 'lib/dappgen/dapper_config.rb', line 17

def requires(argument_name)
  @arguments[argument_name] = {
    required: true,
    multiple: false
  }
end