Class: Cachivache::InitCommand
Instance Method Summary
collapse
Methods inherited from Command
#current_folder, #gem_folder, #inform, #raise_error, run, #validate_cachivache_folder
Instance Method Details
#clone_stuff_library_submodule ⇒ Object
29
30
31
|
# File 'lib/cachivache/init-command.rb', line 29
def clone_stuff_library_submodule()
system "git submodule add #{stuff_library_repo} cachivache/stuff-library"
end
|
#copy_template_folder ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/cachivache/init-command.rb', line 21
def copy_template_folder()
raise_folder_exist_error if File.directory? destination
FileUtils.mkdir destination
FileUtils.copy_entry template_folder, destination
FileUtils.cp readme_file, destination
end
|
#destination ⇒ Object
17
18
19
|
# File 'lib/cachivache/init-command.rb', line 17
def destination()
current_folder + 'cachivache'
end
|
#raise_folder_exist_error ⇒ Object
41
42
43
|
# File 'lib/cachivache/init-command.rb', line 41
def raise_folder_exist_error()
raise_error "A folder 'cachivache' already exists."
end
|
#readme_file ⇒ Object
37
38
39
|
# File 'lib/cachivache/init-command.rb', line 37
def readme_file()
gem_folder + '../README.md'
end
|
#run ⇒ Object
6
7
8
9
10
11
|
# File 'lib/cachivache/init-command.rb', line 6
def run()
copy_template_folder
clone_stuff_library_submodule
inform "A 'cachivache' folder with a Vagrant configuration was created."
end
|
#stuff_library_repo ⇒ Object
33
34
35
|
# File 'lib/cachivache/init-command.rb', line 33
def stuff_library_repo()
'https://github.com/cabeza-de-termo/stuff-library'
end
|
#template_folder ⇒ Object
13
14
15
|
# File 'lib/cachivache/init-command.rb', line 13
def template_folder()
gem_folder + 'template'
end
|