Class: MyHelp::Init

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

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Init

Returns a new instance of Init.



3
4
5
# File 'lib/my_help/init.rb', line 3

def initialize(config)
  @config = config
end

Instance Method Details

#check_conf_existObject



11
12
13
# File 'lib/my_help/init.rb', line 11

def check_conf_exist
  File.exist?(@config[:conf_file])
end

#cp_templatesObject



19
20
21
22
23
24
25
26
# File 'lib/my_help/init.rb', line 19

def cp_templates
  target_dir = @config[:local_help_dir]
  src_dir = @config[:template_dir]
  ext = @config[:ext]
  Dir.glob(File.join(src_dir, "*#{ext}")).each do |file|
    FileUtils.cp(file, target_dir, verbose: false)
  end
end

#help_dir_exist?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/my_help/init.rb', line 7

def help_dir_exist?
  File.exist?(@config[:local_help_dir])
end

#mk_help_dirObject



15
16
17
# File 'lib/my_help/init.rb', line 15

def mk_help_dir
  FileUtils.mkdir(@config[:local_help_dir])
end