class C21e::ExeFile
Attributes
target_file[RW]
Public Class Methods
new(executable_pattern, props = load_props)
click to toggle source
# File lib/c21e/exe_file.rb, line 8 def initialize(executable_pattern, props = load_props) @props = props @target_file = executable_pattern .gsub('{{.OS}}', os) .gsub('{{.Arch}}', arch) .gsub('{{.Ext}}', ext) end
Public Instance Methods
arch()
click to toggle source
# File lib/c21e/exe_file.rb, line 39 def arch # https://github.com/kolosek/residds/blob/master/vendor/bundle/ruby/2.0.0/gems/launchy-2.4.3/spec/tattle-host-os.yaml case @props[:arch] when /i\d86/ then '386' when /x64|x86_64/ then 'amd64' else @props[:arch] end end
ext()
click to toggle source
# File lib/c21e/exe_file.rb, line 23 def ext os == 'windows' ? '.exe' : '' end
load_props()
click to toggle source
# File lib/c21e/exe_file.rb, line 16 def load_props { os: RbConfig::CONFIG['target_os'], arch: RbConfig::CONFIG['target_cpu'] } end
os()
click to toggle source
# File lib/c21e/exe_file.rb, line 27 def os case @props[:os] when /darwin/ then 'darwin' when /freebsd/ then 'freebsd' when /linux/ then 'linux' when /netbsd/ then 'netbsd' when /openbsd/ then 'openbsd' when /cygwin|mingw32|mswin32/ then 'windows' else @props[:os] end end