Module: Ubb

Defined in:
lib/ubb.rb,
lib/ubb/version.rb

Constant Summary collapse

VERSION =
"0.0.3"

Class Method Summary collapse

Class Method Details

.check_config(config) ⇒ Object



34
35
36
37
38
39
# File 'lib/ubb.rb', line 34

def self.check_config(config)
  cand = [ 'development', 'release', 'distribution' ]
  cand.select! { |c| c =~ /^#{config}/i }
  return cand[0] if cand.size == 1
  return nil
end

.check_target(target) ⇒ Object



28
29
30
31
32
33
# File 'lib/ubb.rb', line 28

def self.check_target(target)
  cand = [ 'ios', 'android' ]
  cand.select! { |c| c =~ /^#{target}/i }
  return cand[0] if cand.size == 1
  return nil
end

.editor_pathObject



12
13
14
# File 'lib/ubb.rb', line 12

def self.editor_path
  "#{$project_path}/Assets/Editor"
end

.find_projectObject



18
19
20
21
22
23
24
25
26
27
# File 'lib/ubb.rb', line 18

def self.find_project
  return unless $project_path.nil?
  dirs = Dir.glob("**/Assets")
  dirs.each do |d|
    d = d.sub(/(\/)?Assets$/, '')
    if Dir.exist?("#{d}/ProjectSettings")
      $project_path = File.expand_path(d)
    end
  end
end

.has_editor?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/ubb.rb', line 15

def self.has_editor?
  Dir.exist?(self.editor_path)
end

.sh(cmd) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/ubb.rb', line 5

def self.sh(cmd)
  print "exec: #{cmd}\n"
  system cmd
  if $? != 0
    raise "ERROR: #{$?.to_i}"
  end
end