Class: Gct::Generator::GctFile

Inherits:
Object
  • Object
show all
Defined in:
lib/gct/generator/gct_file.rb

Class Method Summary collapse

Class Method Details

.backup_folder_pathObject



16
17
18
# File 'lib/gct/generator/gct_file.rb', line 16

def self.backup_folder_path
  "#{get_system_home_path.rstrip}/.gct/backup"
end

.config_file_pathObject



12
13
14
# File 'lib/gct/generator/gct_file.rb', line 12

def self.config_file_path
  "#{get_system_home_path.rstrip}/.gct/config"
end

.get_system_home_pathObject



33
34
35
# File 'lib/gct/generator/gct_file.rb', line 33

def self.get_system_home_path
  "#{`echo ~`}"
end

.get_system_user_nameObject

获取系统用户名



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/gct/generator/gct_file.rb', line 21

def self.get_system_user_name
  # windows
  if RUBY_PLATFORM =~ /mswin|mingw/
    query = `reg query HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer /v "Logon User Name"`
    /Logon\ User\ Name\s+REG_SZ\s+(\S+)/ =~ query
    "#{$1}"
  # unix, cygwin, mac
  else
    "#{`whoami`}"
  end
end

.root_folder_pathObject



4
5
6
# File 'lib/gct/generator/gct_file.rb', line 4

def self.root_folder_path
  "#{get_system_home_path.rstrip}/.gct"
end

.temp_folder_pathObject



8
9
10
# File 'lib/gct/generator/gct_file.rb', line 8

def self.temp_folder_path
  "#{get_system_home_path.rstrip}/.gct/tmp"
end