Class: PigMediaServer::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/pig-media-server/cli.rb

Instance Method Summary collapse

Instance Method Details

#aspectObject



38
39
40
41
# File 'lib/pig-media-server/cli.rb', line 38

def aspect
  require 'pig-media-server/aspect'
  PigMediaServer::Aspect.new.run
end

#backupObject



50
51
52
53
# File 'lib/pig-media-server/cli.rb', line 50

def backup
  require 'pig-media-server/backup'
  PigMediaServer::Backup.new.backup
end

#crawlObject



22
23
24
25
# File 'lib/pig-media-server/cli.rb', line 22

def crawl
  require 'pig-media-server/crawl'
  PigMediaServer::Crawl.new.all
end

#kindle_sendObject



44
45
46
47
# File 'lib/pig-media-server/cli.rb', line 44

def kindle_send
  require 'pig-media-server/kindle_send'
  PigMediaServer::KindleSend.new.run
end

#restoreObject



57
58
59
60
# File 'lib/pig-media-server/cli.rb', line 57

def restore
  require 'pig-media-server/backup'
  PigMediaServer::Backup.new.restore_from options[:path]
end

#server(port = nil) ⇒ Object



30
31
32
33
34
35
# File 'lib/pig-media-server/cli.rb', line 30

def server(port = nil)
  require 'pig-media-server/web'
  port ||= options[:port]
  Sinatra::Base.server.delete 'HTTP' # conflict with HTTP.gem
  PigMediaServer::Web.run! :bind => options[:bind], :port => port.to_i
end

#setupObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/pig-media-server/cli.rb', line 6

def setup
  require 'fileutils'
  config = Pit.get("Pig Media Server", require:{
    'hostname' => 'Your host name',
    'path' => 'Path of your storage',
    'groonga' => "Path of groonga's files",
    'exclude_path' => 'Exclude Path(Array)',
    'user_data_path' => 'Path of User Data'
  })

  puts "Path: #{config['path']}"
  puts "Groonga: #{config['groonga']}"
  FileUtils.mkdir_p config['user_data_path']
end