Class: Epuber::Compiler::FileTypes::AbstractFile
- Inherits:
-
Object
- Object
- Epuber::Compiler::FileTypes::AbstractFile
show all
- Defined in:
- lib/epuber/compiler/file_types/abstract_file.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Attribute Details
40
41
42
|
# File 'lib/epuber/compiler/file_types/abstract_file.rb', line 40
def compilation_context
@compilation_context
end
|
#destination_path ⇒ String
9
10
11
|
# File 'lib/epuber/compiler/file_types/abstract_file.rb', line 9
def destination_path
@destination_path
end
|
#final_destination_path ⇒ String
32
33
34
|
# File 'lib/epuber/compiler/file_types/abstract_file.rb', line 32
def final_destination_path
@final_destination_path
end
|
#group ⇒ Symbol
14
15
16
|
# File 'lib/epuber/compiler/file_types/abstract_file.rb', line 14
def group
@group
end
|
#path_type ⇒ Symbol
36
37
38
|
# File 'lib/epuber/compiler/file_types/abstract_file.rb', line 36
def path_type
@path_type
end
|
#pkg_destination_path ⇒ String
28
29
30
|
# File 'lib/epuber/compiler/file_types/abstract_file.rb', line 28
def pkg_destination_path
@pkg_destination_path
end
|
#properties ⇒ Set<Symbol>
22
23
24
|
# File 'lib/epuber/compiler/file_types/abstract_file.rb', line 22
def properties
@properties ||= Set.new
end
|
Class Method Details
.file_copy!(source_path, dest_path) ⇒ Object
54
55
56
57
58
|
# File 'lib/epuber/compiler/file_types/abstract_file.rb', line 54
def self.file_copy!(source_path, dest_path)
FileUtils.mkdir_p(File.dirname(dest_path))
FileUtils.cp(source_path, dest_path)
end
|
.write_to_file(content, to_path) ⇒ Object
76
77
78
79
80
|
# File 'lib/epuber/compiler/file_types/abstract_file.rb', line 76
def self.write_to_file(content, to_path)
return unless write_to_file?(content, to_path)
write_to_file!(content, to_path)
end
|
.write_to_file!(content, to_path) ⇒ Object
87
88
89
90
91
|
# File 'lib/epuber/compiler/file_types/abstract_file.rb', line 87
def self.write_to_file!(content, to_path)
FileUtils.mkdir_p(File.dirname(to_path))
File.write(to_path, content)
end
|
.write_to_file?(content, to_path) ⇒ Boolean
65
66
67
68
69
|
# File 'lib/epuber/compiler/file_types/abstract_file.rb', line 65
def self.write_to_file?(content, to_path)
return true unless File.exist?(to_path)
File.read(to_path) != content.to_s
end
|
Instance Method Details
#==(other) ⇒ Object
42
43
44
|
# File 'lib/epuber/compiler/file_types/abstract_file.rb', line 42
def ==(other)
self.class == other.class && final_destination_path == other.final_destination_path
end
|