Class: Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/cli.rb

Overview

owncloud-admin - the owncloud administration tool

Copyright © 2011 Cornelius Schumacher <[email protected]>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.settings=(s) ⇒ Object



26
27
28
# File 'lib/cli.rb', line 26

def self.settings= s
  @@settings = s
end

Instance Method Details

#configObject



42
43
44
45
46
47
48
# File 'lib/cli.rb', line 42

def config
  if options[:set_server]
    puts "SET SERVER TO #{options[:set_server]}"
  else
    puts "SHOW CONFIG"
  end
end

#globalObject



31
32
33
34
35
36
37
# File 'lib/cli.rb', line 31

def global
  if options[:version]
    puts "owncloud-admin: #{@@settings.version}"
  else
    Cli.help shell
  end
end

#installObject



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/cli.rb', line 76

def install
  installer = Installer.new @@settings

  installer.skip_download = options["skip_download"]

  installer.server = options["server"]
  installer.ftp_user = options["ftp_user"]
  installer.ftp_password = options["ftp_password"]
  if options["root_helper"]
    installer.root_helper = options["root_helper"]
  else
    installer.root_helper = "sudo bash -c"
  end
  installer.admin_user = options["admin_user"]
  installer.admin_password = options["admin_password"]
  
  server_type = options["server_type"]

  if Installer.server_types.include? server_type
    installer.install server_type
  else
    STDERR.puts "Unsupported server type '#{server_type}."
    STDERR.puts "Supported types are: #{Installer.server_types.join(", ")}."
    exit 1
  end
end

#pingObject



51
52
53
54
# File 'lib/cli.rb', line 51

def ping
  puts "PING SERVER"
  # Access <owncloud-server>/status.php (will be in 2beta3)
end