Class: Poli::Generators::Config

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/poli/generators/config.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



29
30
31
# File 'lib/poli/generators/config.rb', line 29

def self.source_root
  File.dirname(__FILE__)
end

Instance Method Details

#copy_configObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/poli/generators/config.rb', line 11

def copy_config
  file_path = path
  unless file_path
    file_path = File.join(Dir.pwd, 'config')
    if File.directory?(file_path)
      say("Seems like there is a /config folder, do you want Poli to generate configuration file to this folder?")
      y = ask("Yes to generate to /config folder, others to generate to current folder. (Y|N): ")
      unless "Y".casecmp(y) == 0
        file_path = Dir.pwd
      end
    else
      file_path = Dir.pwd
    end
  end
  
  template "poli.yml", File.join(file_path, 'poli.yml')
end