Class: ProjectInitializer

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

Class Method Summary collapse

Class Method Details

.call(argv, a_path) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/project_initializer.rb', line 4

def self.call(argv, a_path)
  if argv.include?('html')
    thing = YAML.load_file("#{__dir__}/../config/html.yml")
    thing.keys.each do |key|
      path = key.split('/')
      _path = "#{a_path}/"
      path[0...-1].each do |folder|
        Dir.mkdir("#{_path}#{folder}")
        _path += "#{folder}/"
        File.open(key, 'w') do |file_content|
          file_content.write(thing[key])
        end
      end
    end
  end
end