cocoapods-xzdevelop 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c53c1ced928ca4cc465df01f365e3ba4a6a64c1bfd258bea1547c4472c60e202
4
+ data.tar.gz: 0555feae1bad3b39a37dda33094e26191d33917ed7721c8fe9fe163820911681
5
+ SHA512:
6
+ metadata.gz: a11caa16b62f897e3f3295e770951ab6c153c7b69afa80ea84ff44d21cee720a2564cdbf0dbd564095f20288b3c011c591f4ca9e702c63a17a05d955a60d4e65
7
+ data.tar.gz: 56da1913a1a66a7521d95040978d9276495a881049fd15e134976c02630faf7a3a54e66816452adf55f8024a308e6debc11eb20c6b6f393669b1b1cc679ca176
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ .DS_Store
2
+ pkg
3
+ .idea/
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cocoapods-xzdevelop.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem 'cocoapods'
8
+
9
+ gem 'mocha'
10
+ gem 'bacon'
11
+ gem 'mocha-on-bacon'
12
+ gem 'prettybacon'
13
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2019 liushuhua <liushuhua@xiaozhu.com>
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # cocoapods-xzdevelop
2
+
3
+ A description of cocoapods-xzdevelop.
4
+
5
+ ## Installation
6
+
7
+ $ gem install cocoapods-xzdevelop
8
+
9
+ ## Usage
10
+
11
+ $ pod spec xzdevelop POD_NAME
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ def specs(dir)
4
+ FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
5
+ end
6
+
7
+ desc 'Runs all the specs'
8
+ task :specs do
9
+ sh "bundle exec bacon #{specs('**')}"
10
+ end
11
+
12
+ task :default => :specs
13
+
data/TAGS ADDED
@@ -0,0 +1,21 @@
1
+
2
+ spec/spec_helper.rb,430
3
+ ROOT = Pathname.new(File.expand_path('../../', __FILE__))ROOT2,0
4
+ module PodPod19,0
5
+ module UIUI27,0
6
+ module UIPod::UI27,0
7
+ attr_accessor :outputoutput32,0
8
+ attr_accessor :outputoutput=32,0
9
+ attr_accessor :warningswarnings33,0
10
+ attr_accessor :warningswarnings=33,0
11
+ def puts(message = '')puts35,0
12
+ def warn(message = '', actions = [])warn39,0
13
+ def print(message)print43,0
14
+
15
+ spec/command/xzdevelop_spec.rb,19
16
+ module PodPod3,0
17
+
18
+ lib/cocoapods-xzdevelop/gem_version.rb,133
19
+ module CocoapodsXzdevelopCocoapodsXzdevelop1,0
20
+ VERSION = "0.0.1"VERSION2,0
21
+ VERSION = "0.0.1"CocoapodsXzdevelop::VERSION2,0
data/change.txt ADDED
@@ -0,0 +1,2 @@
1
+ external_source.rb
2
+ installer/analyzer.rb
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cocoapods-xzdevelop/gem_version.rb'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'cocoapods-xzdevelop'
8
+ spec.version = CocoapodsXzdevelop::VERSION
9
+ spec.authors = ['liushuhua']
10
+ spec.email = ['liushuhua@xiaozhu.com']
11
+ spec.description = %q{A short description of cocoapods-xzdevelop.}
12
+ spec.summary = %q{A longer description of cocoapods-xzdevelop.}
13
+ spec.homepage = 'https://github.com/EXAMPLE/cocoapods-xzdevelop'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.3'
22
+ spec.add_development_dependency 'rake'
23
+ end
@@ -0,0 +1,3 @@
1
+ module CocoapodsXzdevelop
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,197 @@
1
+ module Pod
2
+ module ExternalSources
3
+ def self.concrete_class_from_params(params,podfile_path,podname)
4
+ puts "concrete_class_from_params xzdevelop plugin--> #{params}"
5
+ if podfile_path
6
+ process_custome_parameters(params,podfile_path,podname)
7
+ end
8
+ if params.key?(:podspec)
9
+ PodspecSource
10
+ elsif params.key?(:path)
11
+ PathSource
12
+ elsif Downloader.strategy_from_options(params)
13
+ DownloaderSource
14
+ end
15
+ end
16
+
17
+ def self.process_custome_parameters(params,podfile_path,podname)
18
+ devpod_path = File.dirname(podfile_path)
19
+ if params.key?(:dev) && params.key?(:binary)
20
+ if params[:dev] == true && params[:binary] == true
21
+ params = clone_dev(params,podfile_path,podname)
22
+ elsif params[:dev] == true && params[:binary] == false
23
+ params = clone_dev(params,podfile_path,podname)
24
+ elsif params[:dev] == false && params[:binary] == true
25
+ params = clone_binary(params,podfile_path,podname)
26
+ elsif params[:dev] == false && params[:binary] == false
27
+ params = clone_binary(params,podfile_path,podname)
28
+ end
29
+ elsif params.key?(:dev)
30
+ if params[:dev] == true
31
+ params = clone_dev(params,podfile_path,podname)
32
+ else
33
+ params.delete(:dev)
34
+ if Dir.exist?("#{devpod_path}/DevPods")
35
+ itselfpath = findposepec("#{devpod_path}/DevPods",podname)
36
+ if !itselfpath.empty?
37
+ `rm -rf #{itselfpath}`
38
+ end
39
+ end
40
+ end
41
+ elsif params.key?(:binary)
42
+ if params[:binary] == true
43
+ params = clone_binary(params,podfile_path,podname)
44
+ else
45
+ params.delete(:binary)
46
+ if Dir.exist?("#{devpod_path}/DevPods")
47
+ itselfpath = findposepec("#{devpod_path}/DevPods",podname)
48
+ if !itselfpath.empty?
49
+ `rm -rf #{itselfpath}`
50
+ end
51
+ end
52
+ end
53
+ else
54
+ params = clone_binary(params,podfile_path,podname)
55
+ end
56
+ params
57
+ end
58
+
59
+ def self.clone_dev(params,podfile_path,podname)
60
+ if !params.key?(:git)
61
+ puts "dev model need git source"
62
+ exit
63
+ end
64
+ devpod_path = File.dirname(podfile_path)
65
+ unless Dir.exist?("#{devpod_path}/DevPods")
66
+ Dir.chdir(devpod_path)
67
+ `mkdir DevPods`
68
+ end
69
+ if params[:binary] == true
70
+ hasframework = false
71
+ itselfpath = findposepec("#{devpod_path}/DevPods",podname)
72
+ if !itselfpath.empty?
73
+ Find.find(itselfpath) do |path|
74
+ if path.end_with?('.framework')
75
+ hasframework = true
76
+ end
77
+ end
78
+ end
79
+ if !itselfpath.empty? && !hasframework
80
+ `rm -rf #{itselfpath}`
81
+ elsif !itselfpath.empty? && hasframework
82
+ params.clear()
83
+ params[:path] = itselfpath
84
+ return params
85
+ end
86
+ itselfpath = findposepec("#{devpod_path}/DevPods",podname)
87
+ if itselfpath.empty?
88
+ # 下载二进制包 然后更改path
89
+ gitv = params[:tag]
90
+ binary_url = "http://10.0.2.77/staticpods/#{podname}/#{podname}-#{gitv}.zip"
91
+ downloadpath = "#{devpod_path}/DevPods"
92
+ downloadermanager = Pod::Downloader::Http.new(downloadpath,binary_url,{})
93
+ full_path = "#{downloadpath}/#{podname}-#{gitv}.zip"
94
+ downloadermanager.download_file(full_path)
95
+ downloadermanager.verify_checksum(full_path)
96
+ `unzip -d #{downloadpath}/#{podname}-#{gitv} #{full_path}`
97
+ `rm -rf #{full_path}`
98
+ # 使用 Downloader 下载并自动解压
99
+ params.clear
100
+ # 注意一下路径问题
101
+ params[:path] = "#{downloadpath}/#{podname}-#{gitv}"
102
+ return params
103
+ end
104
+ else
105
+ hasframework = false
106
+ itselfpath = findposepec("#{devpod_path}/DevPods",podname)
107
+ if !itselfpath.empty?
108
+ Find.find(itselfpath) do |path|
109
+ if path.end_with?('.framework')
110
+ hasframework = true
111
+ end
112
+ end
113
+ end
114
+ if !itselfpath.empty? && hasframework
115
+ `rm -rf #{itselfpath}`
116
+ elsif !itselfpath.empty? && !hasframework
117
+ params.clear()
118
+ params[:path] = itselfpath
119
+ return params
120
+ end
121
+ gitsource = params[:git]
122
+ itselfpath = findposepec("#{devpod_path}/DevPods",podname)
123
+ if itselfpath.empty?
124
+ Dir.chdir("#{devpod_path}/DevPods")
125
+ `git clone #{gitsource}`
126
+ if $?.exitstatus == 0
127
+ itselfpath = findposepec("#{devpod_path}/DevPods",podname)
128
+ if params.key?(:tag) || params.key?(:commit)
129
+ Dir.chdir(itselfpath)
130
+ gittag = params[:tag]
131
+ gitcomm = params[:commit]
132
+ gitbranch = params[:branch]
133
+ if gittag
134
+ `git checkout #{gittag}`
135
+ elsif gitcomm
136
+ `git checkout #{gitcomm}`
137
+ elsif gitbranch
138
+ `git checkout #{gitbranch}`
139
+ end
140
+
141
+ end
142
+ end
143
+ else
144
+ `echo start`
145
+ end
146
+
147
+ if $?.exitstatus != 0
148
+ puts("git soure maybe error please check #{podname} --> #{gitsource}")
149
+ exit
150
+ else
151
+ itselfpath = findposepec("#{devpod_path}/DevPods",podname)
152
+ params.clear()
153
+ params[:path] = itselfpath
154
+ puts "dev process params #{params}"
155
+ return params
156
+ end
157
+ end
158
+ end
159
+
160
+ def self.clone_binary(params,podfile_path,podname)
161
+ devpod_path = File.dirname(podfile_path)
162
+ if Dir.exist?("#{devpod_path}/DevPods")
163
+ itselfpath = findposepec("#{devpod_path}/DevPods",podname)
164
+ if !itselfpath.empty?
165
+ `rm -rf #{itselfpath}`
166
+ end
167
+ end
168
+ if params[:binary] == true
169
+ gitv = params[:tag]
170
+ binary_url = "http://10.0.2.77/staticpods/#{podname}/#{podname}-#{gitv}.zip"
171
+ #生成二进制url下载
172
+ params.clear()
173
+ params[:http] = binary_url
174
+ return params
175
+ else
176
+ params.delete(:dev)
177
+ params.delete(:binary)
178
+ return params
179
+ end
180
+ end
181
+
182
+ def self.findposepec(podpath,podname)
183
+ itselfpath = ''
184
+ Find.find(podpath) do |path|
185
+ if !File.directory?(path)
186
+ if path.end_with?('.podspec')
187
+ specname = File.basename(path).delete_suffix('.podspec')
188
+ if specname == podname
189
+ itselfpath = File.dirname(path)
190
+ end
191
+ end
192
+ end
193
+ end
194
+ itselfpath
195
+ end
196
+ end
197
+ end
@@ -0,0 +1,29 @@
1
+ module Pod
2
+ class Installer
3
+ class Analyzer
4
+ def dependencies_to_fetch(podfile_state)
5
+ @deps_to_fetch ||= begin
6
+ deps_to_fetch = []
7
+ deps_with_external_source = podfile_dependencies.select(&:external_source)
8
+ if update_mode == :all
9
+ deps_to_fetch = deps_with_external_source
10
+ else
11
+ deps_to_fetch = deps_with_external_source.select do |dep|
12
+ pods_to_fetch(podfile_state).include?(dep.root_name)
13
+ end
14
+ deps_to_fetch_if_needed = deps_with_external_source.select { |dep| podfile_state.unchanged.include?(dep.root_name) }
15
+ deps_to_fetch += deps_to_fetch_if_needed.select do |dep|
16
+ sandbox.specification_path(dep.root_name).nil? ||
17
+ !dep.external_source[:path].nil? ||
18
+ !sandbox.pod_dir(dep.root_name).directory? ||
19
+ checkout_requires_update?(dep) ||
20
+ !dep.external_source[:dev].nil? ||
21
+ !dep.external_source[:binary].nil?
22
+ end
23
+ end
24
+ deps_to_fetch.uniq(&:root_name)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1 @@
1
+ require 'cocoapods-xzdevelop/gem_version'
@@ -0,0 +1,2 @@
1
+ require 'cocoapods-xzdevelop/xz_external_sources'
2
+ require 'cocoapods-xzdevelop/xz_installer_analyzer'
@@ -0,0 +1,12 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+ describe Command::Xzdevelop do
5
+ describe 'CLAide' do
6
+ it 'registers it self' do
7
+ Command.parse(%w{ xzdevelop }).should.be.instance_of Command::Xzdevelop
8
+ end
9
+ end
10
+ end
11
+ end
12
+
@@ -0,0 +1,50 @@
1
+ require 'pathname'
2
+ ROOT = Pathname.new(File.expand_path('../../', __FILE__))
3
+ $:.unshift((ROOT + 'lib').to_s)
4
+ $:.unshift((ROOT + 'spec').to_s)
5
+
6
+ require 'bundler/setup'
7
+ require 'bacon'
8
+ require 'mocha-on-bacon'
9
+ require 'pretty_bacon'
10
+ require 'pathname'
11
+ require 'cocoapods'
12
+
13
+ Mocha::Configuration.prevent(:stubbing_non_existent_method)
14
+
15
+ require 'cocoapods_plugin'
16
+
17
+ #-----------------------------------------------------------------------------#
18
+
19
+ module Pod
20
+
21
+ # Disable the wrapping so the output is deterministic in the tests.
22
+ #
23
+ UI.disable_wrap = true
24
+
25
+ # Redirects the messages to an internal store.
26
+ #
27
+ module UI
28
+ @output = ''
29
+ @warnings = ''
30
+
31
+ class << self
32
+ attr_accessor :output
33
+ attr_accessor :warnings
34
+
35
+ def puts(message = '')
36
+ @output << "#{message}\n"
37
+ end
38
+
39
+ def warn(message = '', actions = [])
40
+ @warnings << "#{message}\n"
41
+ end
42
+
43
+ def print(message)
44
+ @output << message
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ #-----------------------------------------------------------------------------#
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-xzdevelop
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - liushuhua
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-09-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: A short description of cocoapods-xzdevelop.
42
+ email:
43
+ - liushuhua@xiaozhu.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - TAGS
54
+ - change.txt
55
+ - cocoapods-xzdevelop.gemspec
56
+ - lib/cocoapods-xzdevelop.rb
57
+ - lib/cocoapods-xzdevelop/gem_version.rb
58
+ - lib/cocoapods-xzdevelop/xz_external_sources.rb
59
+ - lib/cocoapods-xzdevelop/xz_installer_analyzer.rb
60
+ - lib/cocoapods_plugin.rb
61
+ - spec/command/xzdevelop_spec.rb
62
+ - spec/spec_helper.rb
63
+ homepage: https://github.com/EXAMPLE/cocoapods-xzdevelop
64
+ licenses:
65
+ - MIT
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubygems_version: 3.0.3
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: A longer description of cocoapods-xzdevelop.
86
+ test_files:
87
+ - spec/command/xzdevelop_spec.rb
88
+ - spec/spec_helper.rb