Class: Hyla::Commands::Add
- Inherits:
-
Hyla::Command
- Object
- Hyla::Command
- Hyla::Commands::Add
- Defined in:
- lib/hyla/commands/add.rb
Class Method Summary collapse
-
.copy_artefact(type, artefact_type, destination) ⇒ Object
Copy Artefact to Destination directory.
-
.copy_fonts(type, destination) ⇒ Object
Copy fonts.
- .process(args, options) ⇒ Object
Methods inherited from Hyla::Command
Class Method Details
.copy_artefact(type, artefact_type, destination) ⇒ Object
Copy Artefact to Destination directory
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/hyla/commands/add.rb', line 19 def self.copy_artefact(type, artefact_type, destination) artefact_file_name = type + '_' + artefact_type + Configuration::ADOC_EXT source = [Configuration::samples, artefact_file_name] * '/' destination = File.(destination) FileUtils.cp(source, destination) Hyla::logger2.info ">> Artefact #{artefact_file_name} added to project #{destination}" case artefact_type when 'image','audio','video','source' source_dir = [Configuration::samples, artefact_type] * '/' FileUtils.cp_r(source_dir,destination) end end |
.copy_fonts(type, destination) ⇒ Object
Copy fonts
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/hyla/commands/add.rb', line 38 def self.copy_fonts(type, destination) source = [Configuration::fonts, type] * '/' destination = [destination, 'fonts'] * '/' destination = File. destination FileUtils.mkdir_p(destination) unless File.exists?(destination) FileUtils.cp_r source, destination Hyla::logger2.info ">> Fonts #{type} added to project #{destination}" end |
.process(args, options) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/hyla/commands/add.rb', line 5 def self.process(args, ) destination = [:destination] if check_mandatory_option?('-d / --destination', [:destination]) artefact_type = [:artefact_type] if check_mandatory_option?('-a / --artefact_type', [:artefact_type]) type = [:type] if check_mandatory_option?('-t / --type', [:type]) font_type = 'liberation' copy_fonts(font_type, destination) copy_artefact(type, artefact_type, destination) end |