cocoapods-otssource 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cc62dc0973c8b6eb6ba75b2c20f11ad1dcfa84d9376d958284378134098112bf
4
+ data.tar.gz: b9ea76a2bb30495df07b78681cf36781ec3bf1d55b2f6d5485a5c5d4a9c18c5d
5
+ SHA512:
6
+ metadata.gz: 24e4649e17bb1b43fe850096ecd8c32063ecd78ca6c74eecf47e793222346e7250a9f5df72d7943f43b59a854b0c08ee80f51da5b278ad51ecfcd279ea48a415
7
+ data.tar.gz: d93f2bbdbd6e2532fa5d2ff1c2a7cc0de59f6e1357aaeb6da366860c47fcae98f6ef269391fa9cc49601f447ab07314997b6574e91ca5df7414f1fb3cc834f3d
@@ -0,0 +1,131 @@
1
+ module Pod
2
+ class Command
3
+ # This is an example of a cocoapods plugin adding a top-level subcommand
4
+ # to the 'pod' command.
5
+ #
6
+ # You can also create subcommands of existing or new commands. Say you
7
+ # wanted to add a subcommand to `list` to show newly deprecated pods,
8
+ # (e.g. `pod list deprecated`), there are a few things that would need
9
+ # to change.
10
+ #
11
+ # - move this file to `lib/pod/command/list/deprecated.rb` and update
12
+ # the class to exist in the the Pod::Command::List namespace
13
+ # - change this class to extend from `List` instead of `Command`. This
14
+ # tells the plugin system that it is a subcommand of `list`.
15
+ # - edit `lib/cocoapods_plugins.rb` to require this file
16
+ #
17
+ # @todo Create a PR to add your plugin to CocoaPods/cocoapods.org
18
+ # in the `plugins.json` file, once your plugin is released.
19
+ #
20
+ class Otssource < Command
21
+ self.summary = '本地添加源码,使用pod otssource #podname #tag'
22
+
23
+ self.description = <<-DESC
24
+ 指定源码podname,tag拉取源文件,使用pod otssource #podname #tag
25
+ DESC
26
+
27
+ self.arguments = [
28
+ CLAide::Argument.new('POD_NAME',true),
29
+ CLAide::Argument.new('TAG',true),
30
+ ]
31
+
32
+ def self.options
33
+ [
34
+ ['--all-clean', '删除所有已经下载的源码, pod otssource --all-clean'],
35
+ ['--clean', '删除指定下载的源码, pod otssource #podname --clean'],
36
+ ['--list', '列出所有已经下载的源码, pod otssource --list']
37
+ ]
38
+ end
39
+
40
+ def initialize(argv)
41
+ @pod_name = argv.shift_argument
42
+ @tag = argv.shift_argument
43
+
44
+ @list = argv.flag?('list', false )
45
+ @all_clean = argv.flag?('all-clean', false )
46
+ @clean = argv.flag?('clean', false )
47
+ super
48
+ end
49
+
50
+ # def validate!
51
+ # super
52
+ # help! 'A pod name and tag is required.' unless @pod_name && @tag
53
+ # end
54
+
55
+ def run
56
+ if @list
57
+ list
58
+ elsif @all_clean
59
+ allClean
60
+ elsif @pod_name
61
+ if @clean
62
+ clean
63
+ else
64
+ add
65
+ end
66
+ end
67
+
68
+ end
69
+
70
+ def add
71
+ if @pod_name == nil or @tag == nil
72
+ help! 'A pod name and tag is required.'
73
+ return
74
+ end
75
+
76
+ UI.puts "开始下载源码#{@pod_name}-#{@tag}"
77
+
78
+ target_path = "/var/tmp/iBiu_release/#{@pod_name}/App-Lint"
79
+ FileUtils.rm_rf(target_path)
80
+ options = {:git => "https://git.jd.com/onethestore/#{@pod_name}.git",:tag => @tag}
81
+ options = Pod::Downloader.preprocess_options(options)
82
+ downloader = Pod::Downloader.for_target(target_path,options)
83
+ downloader.download
84
+ downloader.checkout_options
85
+
86
+ UI.puts "源码下载成功"
87
+ end
88
+
89
+ def clean
90
+ if @pod_name == nil
91
+ help! 'A pod name required. pod otssource #podname --clean'
92
+ return
93
+ end
94
+ Dir::chdir("/var/tmp/iBiu_release/")
95
+ current_dir = Dir::getwd
96
+ Dir::entries("/var/tmp/iBiu_release/").each do |sub|
97
+ full_path = File.join(current_dir,@pod_name)
98
+ if File.directory?(full_path)
99
+ FileUtils.rm_rf(full_path)
100
+ UI.puts "#{@pod_name}已删除"
101
+ break
102
+ end
103
+ end
104
+ end
105
+
106
+ def list
107
+ UI.puts "列出所有已经下载的源码:"
108
+ Dir::chdir("/var/tmp/iBiu_release/")
109
+ current_dir = Dir::getwd
110
+ Dir::entries("/var/tmp/iBiu_release/").each do |sub|
111
+ unless sub.eql?("App-Lint") or sub.eql?(".") or sub.eql?("..")
112
+ full_path = File.join(current_dir,sub)
113
+ UI.puts "#{sub}" if File.directory?(full_path)
114
+ end
115
+ end
116
+ end
117
+
118
+ def allClean
119
+ Dir::chdir("/var/tmp/iBiu_release/")
120
+ current_dir = Dir::getwd
121
+ Dir::entries("/var/tmp/iBiu_release/").each do |sub|
122
+ unless sub.eql?("App-Lint") or sub.eql?(".") or sub.eql?("..")
123
+ full_path = File.join(current_dir,sub)
124
+ FileUtils.rm_rf(full_path) if File.directory?(full_path)
125
+ end
126
+ end
127
+ UI.puts "所有源码已删除"
128
+ end
129
+ end
130
+ end
131
+ end
@@ -0,0 +1 @@
1
+ require 'cocoapods-otssource/command/otssource'
@@ -0,0 +1,3 @@
1
+ module CocoapodsOtssource
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1 @@
1
+ require 'cocoapods-otssource/gem_version'
@@ -0,0 +1 @@
1
+ require 'cocoapods-otssource/command'
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-otssource
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - nickwang1202
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-09-28 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: 二进制源码切换插件
42
+ email:
43
+ - wdc1906231682@163.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - lib/cocoapods-otssource.rb
49
+ - lib/cocoapods-otssource/command.rb
50
+ - lib/cocoapods-otssource/command/otssource.rb
51
+ - lib/cocoapods-otssource/gem_version.rb
52
+ - lib/cocoapods_plugin.rb
53
+ homepage: https://rubygems.org/gems/cocoapods-otssource
54
+ licenses:
55
+ - MIT
56
+ metadata: {}
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubygems_version: 3.1.2
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: 指定源码podname,tag拉取源文件
76
+ test_files: []