Class: Crane::Commands::Init

Inherits:
Engine show all
Defined in:
lib/crane/commands/init.rb

Instance Method Summary collapse

Methods inherited from Engine

#connect_ftp, #get_ignored_files, #initialize, #is_option, #no_command, #version

Methods included from Config

get_ignored_files, has_config_file?, load_config, make_config, save_config

Methods inherited from Shell::Run

#initialize

Constructor Details

This class inherits a constructor from Crane::Engine

Instance Method Details

#ask_ftp_infoObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/crane/commands/init.rb', line 15

def ask_ftp_info
  ftp = {}

  print "Your FTP host address (e.g. ftp.mysite.com.br): "
  ftp[:host] = Shell::Input.text

  print "FTP username: "
  ftp[:username] = Shell::Input.text

  system "stty -echo"
  print "FTP password: "
  ftp[:password] = Shell::Input.text
  system "stty echo"
  print "\n"

  print "Type the path to the site's folder (e.g. /public_html ): "
  ftp[:remote_root_dir] = Shell::Input.text

  @config[:ftp] = ftp

end

#helpObject



37
38
39
# File 'lib/crane/commands/init.rb', line 37

def help
  puts "Initializes environment."
end

#runObject



9
10
11
12
13
# File 'lib/crane/commands/init.rb', line 9

def run
  @config = Config.load_config
  ask_ftp_info
  Config.save_config @config
end