Class: Vump::BaseFileModule
Instance Method Summary
collapse
Methods inherited from BaseModule
#initialize, #name
Instance Method Details
#compose(_contents, _version) ⇒ Object
35
36
37
|
# File 'lib/vump/modules/base_file_module.rb', line 35
def compose(_contents, _version)
raise NotImplementedError, "Missing compose on #{name}"
end
|
#file_path ⇒ Object
9
10
11
|
# File 'lib/vump/modules/base_file_module.rb', line 9
def file_path
File.expand_path(filename, @base_path)
end
|
#filename ⇒ Object
5
6
7
|
# File 'lib/vump/modules/base_file_module.rb', line 5
def filename
raise NotImplementedError, "Missing filename on #{name}"
end
|
#read ⇒ Object
21
22
23
24
|
# File 'lib/vump/modules/base_file_module.rb', line 21
def read
@contents = File.read(file_path)
select(@contents)
end
|
#relevant? ⇒ Boolean
13
14
15
|
# File 'lib/vump/modules/base_file_module.rb', line 13
def relevant?
File.file?(file_path)
end
|
#select(_contents) ⇒ Object
31
32
33
|
# File 'lib/vump/modules/base_file_module.rb', line 31
def select(_contents)
raise NotImplementedError, "Missing select on #{name}"
end
|
#to_stage ⇒ Object
17
18
19
|
# File 'lib/vump/modules/base_file_module.rb', line 17
def to_stage
[file_path]
end
|
#write(version) ⇒ Object
26
27
28
29
|
# File 'lib/vump/modules/base_file_module.rb', line 26
def write(version)
contents = compose(@contents, version)
File.write(file_path, contents) unless @options[:dry]
end
|