Class: MyHelp::Init
- Inherits:
-
Object
- Object
- MyHelp::Init
- Defined in:
- lib/my_help/init.rb
Instance Method Summary collapse
- #check_conf_exist ⇒ Object
- #cp_templates ⇒ Object
- #help_dir_exist? ⇒ Boolean
-
#initialize(config) ⇒ Init
constructor
A new instance of Init.
- #mk_help_dir ⇒ Object
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_exist ⇒ Object
11 12 13 |
# File 'lib/my_help/init.rb', line 11 def check_conf_exist File.exist?(@config[:conf_file]) end |
#cp_templates ⇒ Object
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
7 8 9 |
# File 'lib/my_help/init.rb', line 7 def help_dir_exist? File.exist?(@config[:local_help_dir]) end |
#mk_help_dir ⇒ Object
15 16 17 |
# File 'lib/my_help/init.rb', line 15 def mk_help_dir FileUtils.mkdir(@config[:local_help_dir]) end |