Class: Mycommands::ApplicationController
- Inherits:
-
Controller
- Object
- Controller
- Mycommands::ApplicationController
show all
- Defined in:
- lib/mycommands/controllers/application_controller.rb
Instance Method Summary
collapse
Methods inherited from Controller
#initialize, #render
Instance Method Details
#copy_yaml_files ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/mycommands/controllers/application_controller.rb', line 11
def copy_yaml_files
Dir.chdir(YMLPATH)
@path = "#{ENV['HOME']}/Mycommands"
@copied = []
@skipped = []
FileUtils.mkdir(@path) unless File.exist?(@path)
Dir.glob('*.yml').each do |file|
unless File.exists?("#{@path}/#{file}")
FileUtils.cp(file, @path)
@copied << file
else
@skipped << file
end
end
render
end
|
#help ⇒ Object
32
33
34
35
|
# File 'lib/mycommands/controllers/application_controller.rb', line 32
def help
@options = Application::OPTIONS
render
end
|
#print_version ⇒ Object
28
29
30
|
# File 'lib/mycommands/controllers/application_controller.rb', line 28
def print_version
puts "Mycommands #{VERSION}"
end
|
#sort_yaml_files ⇒ Object
5
6
7
8
9
|
# File 'lib/mycommands/controllers/application_controller.rb', line 5
def sort_yaml_files
@category_file = Factory.get(:CategoryModel).sort_yaml_file!
@command_file = Factory.get(:CommandModel).sort_yaml_file!
render
end
|