Class: Pod::Command::Vemars::Patch
- Inherits:
-
Pod::Command::Vemars
- Object
- Pod::Command
- Pod::Command::Vemars
- Pod::Command::Vemars::Patch
- Defined in:
- lib/cocoapods-vemars/command/vemars/patch.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Patch
constructor
A new instance of Patch.
- #openXcodeWorkSpaceIfNeeded ⇒ Object
- #podInstallIfNeeded ⇒ Object
- #run ⇒ Object
- #validate! ⇒ Object
Methods inherited from Pod::Command::Vemars
Constructor Details
#initialize(argv) ⇒ Patch
Returns a new instance of Patch.
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/cocoapods-vemars/command/vemars/patch.rb', line 30 def initialize(argv) @baseline = argv.shift_argument @path = argv.option('path', '') @selected_components = argv.option('com', '').split(',') @config_json = argv.option('config', '/onekit-config.json') @repo_no_update = argv.flag?('pod_repo_no_update',false) git_url = argv.option('git', '[email protected]:volcengine/ve_Template_iOS.git') service_url = argv.option('service_url',nil) @project = VemarsProject.new(@appkey, @selected_components, @config_json, @baseline, git_url, service_url) super @additional_args = argv.remainder! end |
Class Method Details
.options ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/cocoapods-vemars/command/vemars/patch.rb', line 18 def self. = [ ['--path=PODFILE_PATH', 'the /path/to/Dir_contains_Podfile'], ['--com=COM1,COM2', 'Selected components in vemars.'], ['--config=CONFIG_PATH', 'config path of vemars.'], ['--service_url=SERVICE_URL', 'url of vemars CLI service.'], ['--git=GIT_URL', 'git url of demo repo'], ['--pod_repo_no_update', 'do not run pod repo update'] ] .concat(super.reject { |option, _| option == '--silent' }) end |
Instance Method Details
#openXcodeWorkSpaceIfNeeded ⇒ Object
81 82 83 84 85 |
# File 'lib/cocoapods-vemars/command/vemars/patch.rb', line 81 def openXcodeWorkSpaceIfNeeded workspaces = Dir.entries(@path).select { |e| e.end_with?(".xcworkspace") } full_path = File.join(@path, workspaces.first) system("open -a /Applications/Xcode.app '#{full_path}'") end |
#podInstallIfNeeded ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/cocoapods-vemars/command/vemars/patch.rb', line 59 def podInstallIfNeeded puts "Current dir: #{Dir.pwd}" project_dir = @path puts "Pod install directory: #{project_dir}" if @silent puts "Pod install skipped!" puts "You can run Pod install in '#{project_dir}' later!" return end Dir.chdir(project_dir) do # system('bundle install') # system('bundle exec pod install --repo-update') if @repo_no_update puts "pod install with no repo update" system('pod install --no-repo-update') else system('pod install --repo-update') end end end |
#run ⇒ Object
53 54 55 56 57 |
# File 'lib/cocoapods-vemars/command/vemars/patch.rb', line 53 def run @project.patch @path podInstallIfNeeded openXcodeWorkSpaceIfNeeded end |
#validate! ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/cocoapods-vemars/command/vemars/patch.rb', line 43 def validate! super if @path.nil? || @path.empty? help! 'A project path where Podfile locates is required ' end unless File.exist? @config_json help! "onekit-config.json is not found at #{Dir.pwd}" end end |