Class: Botup::FileProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/botup/file_processor.rb

Constant Summary collapse

FILE_NAMES_TO_SKIP =
['.', '..', 'core_file.erb'].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_name) ⇒ FileProcessor

Returns a new instance of FileProcessor.



11
12
13
# File 'lib/botup/file_processor.rb', line 11

def initialize(base_name)
  @base_name = base_name
end

Instance Attribute Details

#base_nameObject (readonly)

Returns the value of attribute base_name.



9
10
11
# File 'lib/botup/file_processor.rb', line 9

def base_name
  @base_name
end

Instance Method Details

#callObject



15
16
17
18
19
20
21
# File 'lib/botup/file_processor.rb', line 15

def call
  prepare_files
  populate_basic_templates(templates_folder, output_main_folder)
  populate_bot_named_files("#{templates_folder}/core_file.erb", "#{output_lib_folder}/#{base_name}.rb")
  populate_bot_named_files("#{bin_folder}/exec.erb", "#{output_folder}/bin/#{base_name}")
  FileUtils.chmod('+x', "#{output_folder}/bin/#{base_name}")
end