Module: App

Defined in:
lib/nehm.rb

Class Method Summary collapse

Class Method Details

.do(args) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/nehm.rb', line 17

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 'help'
    Help.show(args.first)
  else
    puts Paint['Invalid command', :red]
    puts "Input #{Paint['nehm help', :yellow]} for all avalaible commands"
  end
end

.initObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/nehm.rb', line 38

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

  PathControl.set_dl_path
  puts "\n"

  PathControl.set_itunes_path_to_default

  UserControl.

  puts Paint['Now you can use nehm :)', :green]
end

.initialized?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/nehm.rb', line 53

def initialized?
  File.exist?(File.join(ENV['HOME'], '.nehmconfig'))
end