Module: Nehm::App

Defined in:
lib/nehm.rb

Class Method Summary collapse

Class Method Details

.do(args) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/nehm.rb', line 22

def self.do(args)
  init unless initialized?

  command = args.shift
  case command
  when 'get'
    Get[:get, args]
  when 'dl'
    Get[:dl, args]
  when 'configure'
    Configure.menu
  when 'version'
    puts Nehm::VERSION
  when 'help', nil
    Help.show(args.first)
  else
    puts Paint["Invalid command '#{command}'", :red]
    puts "Input #{Paint['nehm help', :yellow]} for all avalaible commands"
  end
end

.initObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/nehm.rb', line 45

def init
  puts Paint['Hello!', :green]
  puts 'Before using the nehm, you should set it up:'
  Cfg.create unless Cfg.exist?

  PathManager.set_dl_path
  puts "\n"

  unless OS.linux?
    PlaylistManager.set_playlist
    puts "\n"
  end

  UserManager.

  puts Paint["Now you can use nehm!\n", :green]
end

.initialized?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/nehm.rb', line 63

def initialized?
  File.exist?(Cfg::FILE_PATH)
end