Class: DYAutomate::Command::WorkSpace
- Inherits:
-
DYAutomate::Command
- Object
- CLAide::Command
- DYAutomate::Command
- DYAutomate::Command::WorkSpace
- Defined in:
- lib/DYAutomate/Command/workspace.rb,
lib/DYAutomate/Command/Workspace/update.rb,
lib/DYAutomate/Command/Workspace/install.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#name ⇒ Object
lib名字.
-
#path ⇒ Object
当前路径.
-
#project_path ⇒ Object
spec文件路径.
-
#workSpace_path ⇒ Object
#查询结果lib信息.
Attributes inherited from DYAutomate::Command
Instance Method Summary collapse
-
#dy_update_repo ⇒ Object
更新repo.
-
#existProject? ⇒ Boolean
project文件是否存在.
-
#existWorkSpace? ⇒ Boolean
workspace文件是否存在.
-
#initialize(argv) ⇒ WorkSpace
constructor
A new instance of WorkSpace.
- #run ⇒ Object
- #validate! ⇒ Object
Methods inherited from DYAutomate::Command
Constructor Details
#initialize(argv) ⇒ WorkSpace
Returns a new instance of WorkSpace.
25 26 27 28 29 30 |
# File 'lib/DYAutomate/Command/workspace.rb', line 25 def initialize(argv) # @path = '/Users/cw/Documents/Dy/Apps/doing/doing' super @path = Dir.pwd puts "env == #{@env_str}" end |
Instance Attribute Details
#name ⇒ Object
lib名字
16 17 18 |
# File 'lib/DYAutomate/Command/workspace.rb', line 16 def name @name end |
#path ⇒ Object
当前路径
18 19 20 |
# File 'lib/DYAutomate/Command/workspace.rb', line 18 def path @path end |
#project_path ⇒ Object
spec文件路径
21 22 23 |
# File 'lib/DYAutomate/Command/workspace.rb', line 21 def project_path @project_path end |
#workSpace_path ⇒ Object
#查询结果lib信息
23 24 25 |
# File 'lib/DYAutomate/Command/workspace.rb', line 23 def workSpace_path @workSpace_path end |
Instance Method Details
#dy_update_repo ⇒ Object
更新repo
82 83 84 85 86 87 88 89 90 91 |
# File 'lib/DYAutomate/Command/workspace.rb', line 82 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? ⇒ Boolean
project文件是否存在
54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/DYAutomate/Command/workspace.rb', line 54 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? ⇒ Boolean
workspace文件是否存在
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/DYAutomate/Command/workspace.rb', line 69 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 ⇒ Object
48 49 50 51 |
# File 'lib/DYAutomate/Command/workspace.rb', line 48 def run pp('WorkSpace run ...',1) pp("当前环境变量 #{@env_str}",1) end |
#validate! ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/DYAutomate/Command/workspace.rb', line 32 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 |