Class: Mycommands::ApplicationController

Inherits:
Controller
  • Object
show all
Defined in:
lib/mycommands/controllers/application_controller.rb

Instance Method Summary collapse

Methods inherited from Controller

#initialize, #render

Constructor Details

This class inherits a constructor from Mycommands::Controller

Instance Method Details

#copy_yaml_filesObject



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

#helpObject



32
33
34
35
# File 'lib/mycommands/controllers/application_controller.rb', line 32

def help
  @options = Application::OPTIONS
  render
end


28
29
30
# File 'lib/mycommands/controllers/application_controller.rb', line 28

def print_version
  puts "Mycommands #{VERSION}"
end

#sort_yaml_filesObject



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