class DYAutomate::Command::WorkSpace

Attributes

isSilent[RW]

是否静默

name[RW]

lib名字

path[RW]

当前路径

project_path[RW]

spec文件路径

workSpace_path[RW]

查询结果lib信息

Public Class Methods

new(argv) click to toggle source
Calls superclass method DYAutomate::Command::new
# File lib/DYAutomate/Command/workspace.rb, line 34
def initialize(argv)
  # @path = '/Users/cw/Documents/Dy/Apps/doing/doing'
  super
  @path = Dir.pwd
  @isSilent = argv.flag?("silent")
  puts "env == #{@env_str}"
end
options() click to toggle source
Calls superclass method
# File lib/DYAutomate/Command/workspace.rb, line 15
def self.options
  [
    ['--silent', 'Show nothing'],
  ].concat(super)
end

Public Instance Methods

dy_update_repo() click to toggle source

更新repo

# File lib/DYAutomate/Command/workspace.rb, line 92
def dy_update_repo
  path = File.join(Dir.home,'.cocoapods/repos')
  excludeFiles = [".","..",".DS_Store",'master','trunk']
  Dir.entries(path).each do |subDir|
    puts subDir
    unless excludeFiles.include?(subDir)
      system "#{@env_str} pod repo update #{subDir}"
    end
  end
end
existProject?() click to toggle source

project文件是否存在

# File lib/DYAutomate/Command/workspace.rb, line 64
def existProject?
  exist = false
  Dir.entries(@path).each{ |d|
    if d.to_s =~ /.xcodeproj/
      exist = true
      @project_path = File.join(@path,d.to_s)
      # @spec_name = d.to_s
      @name = d.to_s.split('.')[0]
      break
    end
  }
  exist
end
existWorkSpace?() click to toggle source

workspace文件是否存在

# File lib/DYAutomate/Command/workspace.rb, line 79
def existWorkSpace?
  exist = false
  Dir.entries(@path).each{ |d|
    if d.to_s =~ /.xcworkspace/
      exist = true
      @workSpace_path = File.join(@path,d.to_s)
      break
    end
  }
  exist
end
run() click to toggle source
# File lib/DYAutomate/Command/workspace.rb, line 58
def run
  pp('WorkSpace run ...',1)
  pp("当前环境变量 #{@env_str}",1)
end
validate!() click to toggle source
Calls superclass method
# File lib/DYAutomate/Command/workspace.rb, line 42
def validate!
  super
  unless existProject?
    help! "
    error -- >has no project file at -->  #{@path}"
  else
    pp("find project at -->#{@project_path}",1)
  end

  # unless existWorkSpace?
  #   help! "!!! has no xcworkspace file at --> #{@path}"
  # else
  #   pp("find xcworkspace at --> " + "#{@workSpace_path}",1)
  # end
end