Class: Pod::Command::Bdtransform::ToDev

Inherits:
Pod::Command::Bdtransform show all
Defined in:
lib/cocoapods-BDTransform/command/BDTransform/ToDev.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ ToDev

Returns a new instance of ToDev.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/cocoapods-BDTransform/command/BDTransform/ToDev.rb', line 59

def initialize(argv)
  super
  @podspec = argv.option('podspec')
  subspecs = argv.option('subspecs')
  targets = argv.option('targets')
  @revert = argv.option('revert')
  @subspecs = subspecs.split(',') unless subspecs.nil?
  @targets = targets.split(',') unless targets.nil?
  if @podspec
    @podspecName = File.basename(@podspec, ".*")
  else
    @podspec = 'no support'
  end
  @podProjectPath = Dir::pwd + "/" + "Pods/Pods.xcodeproj"

end

Class Method Details

.optionsObject



50
51
52
53
54
55
56
57
# File 'lib/cocoapods-BDTransform/command/BDTransform/ToDev.rb', line 50

def self.options
  [
    ['--podspec=',     'the absolute path of your podspec to dev. i.e --podspec=xxx/xxx.podspec'],
    ['--subspecs=', 'build with given subspecs. i.e --subspecs=Core,Monitor'],
    ['--targets=', 'the effected target of this operation. Default action effects all your target of Project'],
    ['--revert=', 'revert the to-dev operation pod,and reInstall your project i.e --revert=SDWebImage']
  ]
end

Instance Method Details

#runObject



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/cocoapods-BDTransform/command/BDTransform/ToDev.rb', line 83

def run
  if @revert
    revertProject
  else
    accessor
    if $WORK_DIR_Dev == Dir.home() + '/.cocoapods-BDTransform'
      $LOAD_PATH << "#{$WORK_DIR_Dev}"
      require "#{$WORK_DIR_Dev}/dev.rb"
    else
      require 'cocoapods-BDTransform/command/BDTransform/develop/dev.rb'
    end
    BDAwesomeTransmit::BDPodsTrans.transmit(@podspec,@subspecs,@sandboxPath,@podProjectPath,@podspecName,@workspacePath,@workspaceName,@targets)
  end

end

#validate!Object



76
77
78
79
80
81
# File 'lib/cocoapods-BDTransform/command/BDTransform/ToDev.rb', line 76

def validate!
  unless @revert
    help! 'A Podspec path is required.' unless File::exist?(@podspec)
    help! 'Did not find your Pods Dir in current Dir' unless File::directory?(@podProjectPath)
  end
end