Top Level Namespace

Defined Under Namespace

Modules: VVPrepare, VVTool

Constant Summary collapse

PropertiesFileName =

路径

'templatelist.properties'
ConfigPropertiesFileName =
'config.properties'
CompilerFileName =
'.compiler.jar'
TemplatesPath =
Dir.pwd
TemplatePath =
File.join(TemplatesPath, 'template')
VVBuildPath =
File.join(TemplatesPath, 'build')
VVBuildLogFilePath =
File.join(TemplatesPath, '.vvbuild.log')
VVCompilerFilePath =
File.join(TemplatesPath, CompilerFileName)
VVConfigPropertiesFilePath =
File.join(TemplatesPath, ConfigPropertiesFileName)
PropertiesFilePath =
File.join(TemplatesPath, PropertiesFileName)
DirFilePath =
File.join(TemplatesPath, '.dir')
VVCompilerDownloadURL =

VV 编译器下载地址 URL

'https://raw.githubusercontent.com/alibaba/virtualview_tools/bb727ac668856732f66c3845b27646c1b4124fc8/compiler-tools/TemplateWorkSpace/compiler.jar'
VVConfigPropertiesDownloadURL =

VV 默认的 config.properties 下载地址 URL

'https://raw.githubusercontent.com/alibaba/virtualview_tools/bb727ac668856732f66c3845b27646c1b4124fc8/compiler-tools/TemplateWorkSpace/config.properties'
LocalIP =

获取本机 IP

get_first_public_ipv4()
HTTPServerPort =

HTTP 服务端口号

7788
RubyGemsLatestVersionURL =
'https://rubygems.org/api/v1/versions/vvtool/latest.json'

Instance Method Summary collapse

Instance Method Details

#check_new_versionObject



19
20
21
22
23
24
25
26
# File 'lib/vvtool/version_checker.rb', line 19

def check_new_version
  get_remote_version { |remoteVersion| 
    currentVersion = VVTool::VERSION
    if currentVersion < remoteVersion
      puts "VVTool 发现新版本 v#{remoteVersion}(当前 v#{currentVersion}),可以通过命令 `sudo gem install vvtool` 升级"
    end
  }
end

#get_first_public_ipv4Object



3
4
5
6
# File 'lib/vvtool/utils.rb', line 3

def get_first_public_ipv4
  ip_info = Socket.ip_address_list.detect{|intf| intf.ipv4? and !intf.ipv4_loopback? and !intf.ipv4_multicast? and !intf.ipv4_private?}
  ip_info.ip_address unless ip_info.nil?
end

#get_remote_versionObject



9
10
11
12
13
14
15
16
17
# File 'lib/vvtool/version_checker.rb', line 9

def get_remote_version
  begin
    Thread.new {
      response = Net::HTTP.get(URI(RubyGemsLatestVersionURL))
      response = JSON.parse(response)
      yield response['version']
    }
  end
end