Class: Gct::Generator::GctFile
- Inherits:
-
Object
- Object
- Gct::Generator::GctFile
- Defined in:
- lib/gct/generator/gct_file.rb
Class Method Summary collapse
- .backup_folder_path ⇒ Object
- .config_file_path ⇒ Object
- .get_system_home_path ⇒ Object
-
.get_system_user_name ⇒ Object
获取系统用户名.
- .root_folder_path ⇒ Object
- .temp_folder_path ⇒ Object
Class Method Details
.backup_folder_path ⇒ Object
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_path ⇒ Object
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_path ⇒ Object
33 34 35 |
# File 'lib/gct/generator/gct_file.rb', line 33 def self.get_system_home_path "#{`echo ~`}" end |
.get_system_user_name ⇒ Object
获取系统用户名
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_path ⇒ Object
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_path ⇒ Object
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 |