Class: Pod::Command::Jsource::Clean
- Inherits:
-
Pod::Command::Jsource
- Object
- Pod::Command
- Pod::Command::Jsource
- Pod::Command::Jsource::Clean
- Defined in:
- lib/cocoapods-jsource/command/jsource/clean.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Clean
constructor
A new instance of Clean.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Clean
Returns a new instance of Clean.
37 38 39 40 41 42 43 44 |
# File 'lib/cocoapods-jsource/command/jsource/clean.rb', line 37 def initialize(argv) @pod_name = argv.shift_argument @wipe_all = argv.flag?('all') @wipe_cache = argv.flag?('cache') @cache_dict = cache_object @manager = XcodeManager.new(argv) super end |
Class Method Details
.options ⇒ Object
30 31 32 33 34 35 |
# File 'lib/cocoapods-jsource/command/jsource/clean.rb', line 30 def self. [ ['--all', 'Remove all the project debug pods without asking'], ['--cache', 'Remove all the cached pods without asking'] ].concat(super) end |
Instance Method Details
#run ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/cocoapods-jsource/command/jsource/clean.rb', line 53 def run if @pod_name.nil? # Note: at that point, @wipe_all is always true (thanks to `validate!`) if @wipe_all if @wipe_cache clear_cache else @manager.clean_debug end end else # Remove only cache for this pod if @wipe_cache cache_descriptors = @cache_dict[@pod_name].values if cache_descriptors.nil? UI.notice("No cache for pod named #{@pod_name} found") elsif cache_descriptors.count > 1 && !@wipe_all # Ask which to remove choices = cache_descriptors.map { |c| "#{@pod_name} v#{c[:version]}" } index = UI.choose_from_array(choices, 'Which pod cache do you want to remove?') # 删除debug remove_caches([cache_descriptors[index]]) else # Remove all found cache of this pod remove_caches(cache_descriptors) end else @manager.remove_component_from_debug(@pod_name) end end end |
#validate! ⇒ Object
46 47 48 49 50 51 |
# File 'lib/cocoapods-jsource/command/jsource/clean.rb', line 46 def validate! super if @pod_name.nil? help! 'You should use the --all flag' if @wipe_all.nil? end end |