Class: Stool::Command::WorkSpace

Inherits:
Stool::Command show all
Defined in:
lib/stool/Command/WorkSpace.rb,
lib/stool/Command/WorkSpace/list.rb,
lib/stool/Command/WorkSpace/update.rb

Direct Known Subclasses

List, Update

Defined Under Namespace

Classes: List, Update

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Stool::Command

#checkConfigFile, options, #pp, #run

Constructor Details

#initialize(argv) ⇒ WorkSpace

Returns a new instance of WorkSpace.



21
22
23
# File 'lib/stool/Command/WorkSpace.rb', line 21

def initialize(argv)
  super
end

Instance Attribute Details

#infoObject

查询结果workspace信息



19
20
21
# File 'lib/stool/Command/WorkSpace.rb', line 19

def info
  @info
end

#tagObject

要查询的workspace的唯一标识



17
18
19
# File 'lib/stool/Command/WorkSpace.rb', line 17

def tag
  @tag
end

Instance Method Details

#cleanAllCacheObject

清理所有pod缓存(除master repo的pod)



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/stool/Command/WorkSpace.rb', line 75

def cleanAllCache
  puts "clean all cache"
  hasClean = []
  path = @@config.repoCachePath
  Dir.entries(path).each{|file|
    if file['.'] || file.eql?('master')
      #do nothing
    else
      podCache = File.join(path,file)
      Dir.entries(podCache).sort.each{|podName|
        unless hasClean.include?(podName) || podName['.']
          puts "清理缓存#{podName} "
          puts `pod cache clean #{podName} --all`
          hasClean.push(podName)
        end
      }
    end
  }
end

#existAtConfig?Boolean

Returns:

  • (Boolean)


40
41
42
43
44
45
46
47
48
49
# File 'lib/stool/Command/WorkSpace.rb', line 40

def existAtConfig?
  #在本地配置中中查找workspace
  arrayTasks = WorkSpace::List::tasks_from_config
  arrayTasks.each {|task|
    if @tag.eql?(task.tag)
      @info = task
    end
  }
  @info
end

#getAllReposObject

获取task用的所有repos



52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/stool/Command/WorkSpace.rb', line 52

def getAllRepos
  arr = []
  if @info.repos.count == 0
    path = @@config.repoCachePath
    arr = Dir.entries(path).delete_if{|file|
      if file['.'] || file.eql?('master')
        1
      end
    }
  else
    arr = @info.repos
  end
  arr
end

#hasPodfile?(path) ⇒ Boolean

def run

end

Returns:

  • (Boolean)


35
36
37
38
# File 'lib/stool/Command/WorkSpace.rb', line 35

def hasPodfile?(path)
  arr = Dir.glob(File.join(path,'Podfile'))
  arr[0]
end

#pathForTaskInfo_last_pod_updateObject



67
68
69
70
71
72
# File 'lib/stool/Command/WorkSpace.rb', line 67

def pathForTaskInfo_last_pod_update
  unless Dir.exist?(Config::logsDirPath)
    Dir.mkdir(Config::logsDirPath)
  end
  File.join(Config::logsDirPath, 'TaskInfo_lastUpdate.yaml')
end

#validate!Object



27
28
29
# File 'lib/stool/Command/WorkSpace.rb', line 27

def validate!
  super
end