cocoapods-tuya-oss-publish 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 +7 -0
- data/.gitignore +4 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +121 -0
- data/LICENSE.txt +22 -0
- data/README.md +11 -0
- data/Rakefile +13 -0
- data/cocoapods-tuya-oss-publish.gemspec +27 -0
- data/lib/cocoapods-tuya-oss-publish.rb +1 -0
- data/lib/cocoapods-tuya-oss-publish/command.rb +3 -0
- data/lib/cocoapods-tuya-oss-publish/command/package.rb +40 -0
- data/lib/cocoapods-tuya-oss-publish/command/publish.rb +234 -0
- data/lib/cocoapods-tuya-oss-publish/command/upload.rb +55 -0
- data/lib/cocoapods-tuya-oss-publish/gem_version.rb +3 -0
- data/lib/cocoapods_plugin.rb +1 -0
- data/spec/command/publish_spec.rb +12 -0
- data/spec/spec_helper.rb +50 -0
- metadata +117 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ae36df8151efbc4333a13e1d0a296db32676b3f0224ef352f89cc2038baa46a9
|
4
|
+
data.tar.gz: 77871fbc8fd7cb797b9f932a7cd96034061174ab1f47c48519b3ab853f660017
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 050d1832a187f3d0fc9140b7c53b214df2a7e2495905c5594138cb960c9a95e20eeee960c78d16b99c001009cf0cf1824e668b6f107e1d0bea128e5d6761ecc4
|
7
|
+
data.tar.gz: 3eb977e49da0516b194343fcacc80da45fb77b9c95a19a541511e6ce82bf3a69378d06e2553f270cdd1db675827f56bcce5da960a3ed425e4cd9790a400cd231
|
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# source 'https://rubygems.org'
|
2
|
+
source 'https://gems.ruby-china.com/'
|
3
|
+
|
4
|
+
# Specify your gem's dependencies in cocoapods-tuya-oss-publish.gemspec
|
5
|
+
gemspec
|
6
|
+
|
7
|
+
group :development do
|
8
|
+
gem 'cocoapods'
|
9
|
+
|
10
|
+
gem 'mocha'
|
11
|
+
gem 'bacon'
|
12
|
+
gem 'mocha-on-bacon'
|
13
|
+
gem 'prettybacon'
|
14
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cocoapods-tuya-oss-publish (0.0.1)
|
5
|
+
aliyun-sdk
|
6
|
+
ty-cocoapods-packager (>= 1.5.5)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://gems.ruby-china.com/
|
10
|
+
specs:
|
11
|
+
CFPropertyList (3.0.0)
|
12
|
+
activesupport (4.2.11.1)
|
13
|
+
i18n (~> 0.7)
|
14
|
+
minitest (~> 5.1)
|
15
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
16
|
+
tzinfo (~> 1.1)
|
17
|
+
aliyun-sdk (0.7.0)
|
18
|
+
nokogiri (~> 1.6)
|
19
|
+
rest-client (~> 2.0)
|
20
|
+
atomos (0.1.3)
|
21
|
+
bacon (1.2.0)
|
22
|
+
claide (1.0.2)
|
23
|
+
cocoapods (1.7.3)
|
24
|
+
activesupport (>= 4.0.2, < 5)
|
25
|
+
claide (>= 1.0.2, < 2.0)
|
26
|
+
cocoapods-core (= 1.7.3)
|
27
|
+
cocoapods-deintegrate (>= 1.0.3, < 2.0)
|
28
|
+
cocoapods-downloader (>= 1.2.2, < 2.0)
|
29
|
+
cocoapods-plugins (>= 1.0.0, < 2.0)
|
30
|
+
cocoapods-search (>= 1.0.0, < 2.0)
|
31
|
+
cocoapods-stats (>= 1.0.0, < 2.0)
|
32
|
+
cocoapods-trunk (>= 1.3.1, < 2.0)
|
33
|
+
cocoapods-try (>= 1.1.0, < 2.0)
|
34
|
+
colored2 (~> 3.1)
|
35
|
+
escape (~> 0.0.4)
|
36
|
+
fourflusher (>= 2.3.0, < 3.0)
|
37
|
+
gh_inspector (~> 1.0)
|
38
|
+
molinillo (~> 0.6.6)
|
39
|
+
nap (~> 1.0)
|
40
|
+
ruby-macho (~> 1.4)
|
41
|
+
xcodeproj (>= 1.10.0, < 2.0)
|
42
|
+
cocoapods-core (1.7.3)
|
43
|
+
activesupport (>= 4.0.2, < 6)
|
44
|
+
fuzzy_match (~> 2.0.4)
|
45
|
+
nap (~> 1.0)
|
46
|
+
cocoapods-deintegrate (1.0.4)
|
47
|
+
cocoapods-downloader (1.2.2)
|
48
|
+
cocoapods-plugins (1.0.0)
|
49
|
+
nap
|
50
|
+
cocoapods-search (1.0.0)
|
51
|
+
cocoapods-stats (1.1.0)
|
52
|
+
cocoapods-trunk (1.3.1)
|
53
|
+
nap (>= 0.8, < 2.0)
|
54
|
+
netrc (~> 0.11)
|
55
|
+
cocoapods-try (1.1.0)
|
56
|
+
colored2 (3.1.2)
|
57
|
+
concurrent-ruby (1.1.5)
|
58
|
+
domain_name (0.5.20180417)
|
59
|
+
unf (>= 0.0.5, < 1.0.0)
|
60
|
+
escape (0.0.4)
|
61
|
+
fourflusher (2.3.1)
|
62
|
+
fuzzy_match (2.0.4)
|
63
|
+
gh_inspector (1.1.3)
|
64
|
+
http-cookie (1.0.3)
|
65
|
+
domain_name (~> 0.5)
|
66
|
+
i18n (0.9.5)
|
67
|
+
concurrent-ruby (~> 1.0)
|
68
|
+
metaclass (0.0.4)
|
69
|
+
mime-types (3.2.2)
|
70
|
+
mime-types-data (~> 3.2015)
|
71
|
+
mime-types-data (3.2019.0331)
|
72
|
+
mini_portile2 (2.4.0)
|
73
|
+
minitest (5.11.3)
|
74
|
+
mocha (1.9.0)
|
75
|
+
metaclass (~> 0.0.1)
|
76
|
+
mocha-on-bacon (0.2.3)
|
77
|
+
mocha (>= 0.13.0)
|
78
|
+
molinillo (0.6.6)
|
79
|
+
nanaimo (0.2.6)
|
80
|
+
nap (1.1.0)
|
81
|
+
netrc (0.11.0)
|
82
|
+
nokogiri (1.10.3)
|
83
|
+
mini_portile2 (~> 2.4.0)
|
84
|
+
prettybacon (0.0.2)
|
85
|
+
bacon (~> 1.2)
|
86
|
+
rake (12.3.2)
|
87
|
+
rest-client (2.0.2)
|
88
|
+
http-cookie (>= 1.0.2, < 2.0)
|
89
|
+
mime-types (>= 1.16, < 4.0)
|
90
|
+
netrc (~> 0.8)
|
91
|
+
ruby-macho (1.4.0)
|
92
|
+
thread_safe (0.3.6)
|
93
|
+
ty-cocoapods-packager (1.5.5)
|
94
|
+
cocoapods (>= 1.1.1, < 2.0)
|
95
|
+
tzinfo (1.2.5)
|
96
|
+
thread_safe (~> 0.1)
|
97
|
+
unf (0.1.4)
|
98
|
+
unf_ext
|
99
|
+
unf_ext (0.0.7.6)
|
100
|
+
xcodeproj (1.10.0)
|
101
|
+
CFPropertyList (>= 2.3.3, < 4.0)
|
102
|
+
atomos (~> 0.1.3)
|
103
|
+
claide (>= 1.0.2, < 2.0)
|
104
|
+
colored2 (~> 3.1)
|
105
|
+
nanaimo (~> 0.2.6)
|
106
|
+
|
107
|
+
PLATFORMS
|
108
|
+
ruby
|
109
|
+
|
110
|
+
DEPENDENCIES
|
111
|
+
bacon
|
112
|
+
bundler (~> 1.3)
|
113
|
+
cocoapods
|
114
|
+
cocoapods-tuya-oss-publish!
|
115
|
+
mocha
|
116
|
+
mocha-on-bacon
|
117
|
+
prettybacon
|
118
|
+
rake
|
119
|
+
|
120
|
+
BUNDLED WITH
|
121
|
+
1.17.3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2019 高森 <gaosen@tuya.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
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cocoapods-tuya-oss-publish/gem_version.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'cocoapods-tuya-oss-publish'
|
8
|
+
spec.version = CocoapodsTuyaOssPublish::VERSION
|
9
|
+
spec.authors = ['高森']
|
10
|
+
spec.email = ['gaosen@tuya.com']
|
11
|
+
spec.description = %q{A short description of cocoapods-tuya-oss-publish.}
|
12
|
+
spec.summary = %q{A longer description of cocoapods-tuya-oss-publish.}
|
13
|
+
spec.homepage = 'https://registry.code.tuya-inc.top/tuyaIOSSDK/cocoapods-tuya-oss-publish'
|
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
|
+
|
24
|
+
spec.add_dependency 'ty-cocoapods-packager', '>= 1.5.5'
|
25
|
+
spec.add_dependency 'aliyun-sdk'
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-tuya-oss-publish/gem_version'
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
|
4
|
+
# cocoapods-packager
|
5
|
+
class Package < Command
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
class TYPackage < Package
|
10
|
+
|
11
|
+
def run
|
12
|
+
super
|
13
|
+
self.merge_vendored_libraries
|
14
|
+
end
|
15
|
+
|
16
|
+
def merge_vendored_libraries
|
17
|
+
for platform in @spec.available_platforms
|
18
|
+
vendored_libraries = @spec.consumer(platform).vendored_libraries
|
19
|
+
if vendored_libraries != nil
|
20
|
+
next
|
21
|
+
end
|
22
|
+
|
23
|
+
UI.puts("Merge #{platform.name} vendored_libraries: #{vendored_libraries}")
|
24
|
+
framework_path = "#{@spec.name}-#{@spec.version}/#{platform.name}/#{@spec.name}.framework/Versions/A/#{@spec.name}"
|
25
|
+
library_path = "#{@spec.name}-#{@spec.version}/#{platform.name}/lib#{@spec.name}.a"
|
26
|
+
binary_path = @library ? library_path : framework_path
|
27
|
+
for vendored_library in vendored_libraries
|
28
|
+
Dir.glob(vendored_library) do |lib|
|
29
|
+
exitCode = system("libtool -static -o \"#{binary_path}\" \"#{binary_path}\" \"#{lib}\"")
|
30
|
+
if exitCode != 0
|
31
|
+
exit(-1)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,234 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
# This is an example of a cocoapods plugin adding a top-level subcommand
|
6
|
+
# to the 'pod' command.
|
7
|
+
#
|
8
|
+
# You can also create subcommands of existing or new commands. Say you
|
9
|
+
# wanted to add a subcommand to `list` to show newly deprecated pods,
|
10
|
+
# (e.g. `pod list deprecated`), there are a few things that would need
|
11
|
+
# to change.
|
12
|
+
#
|
13
|
+
# - move this file to `lib/pod/command/list/deprecated.rb` and update
|
14
|
+
# the class to exist in the the Pod::Command::List namespace
|
15
|
+
# - change this class to extend from `List` instead of `Command`. This
|
16
|
+
# tells the plugin system that it is a subcommand of `list`.
|
17
|
+
# - edit `lib/cocoapods_plugins.rb` to require this file
|
18
|
+
#
|
19
|
+
# @todo Create a PR to add your plugin to CocoaPods/cocoapods.org
|
20
|
+
# in the `plugins.json` file, once your plugin is released.
|
21
|
+
#
|
22
|
+
class TuyaOssPublish < Command
|
23
|
+
self.summary = 'Build binary and upload to oss.'
|
24
|
+
|
25
|
+
self.description = <<-DESC
|
26
|
+
cocoapods-tuya-oss-publish will call pod package and then upload binary to oss. Usually used for sdk.
|
27
|
+
DESC
|
28
|
+
|
29
|
+
self.arguments = [
|
30
|
+
CLAide::Argument.new('REPO', true),
|
31
|
+
CLAide::Argument.new('[NAME.podspec]', true),
|
32
|
+
]
|
33
|
+
|
34
|
+
def self.options
|
35
|
+
[
|
36
|
+
['--library', 'Generate static libraries.'],
|
37
|
+
['--spec-sources=private,https://github.com/CocoaPods/Specs.git', 'The sources to pull dependant ' \
|
38
|
+
'pods from (defaults to https://github.com/CocoaPods/Specs.git)'],
|
39
|
+
|
40
|
+
['--upload-to', 'The place where zip archive upload to, Defaults to oss. (oss/maven/bintray)'],
|
41
|
+
['--force', 'Override existing remote archive.'],
|
42
|
+
|
43
|
+
['--oss-endpoint', 'Aliyun oss endpoint, defaults to https://oss-cn-hangzhou.aliyuncs.com.'],
|
44
|
+
['--oss-access-key-id', 'Aliyun oss access key id.'],
|
45
|
+
['--oss-access-key-secret', 'Aliyun oss access key secret.'],
|
46
|
+
['--oss-bucket-name', 'Aliyun oss bucket name.'],
|
47
|
+
['--oss-base-path', 'Aliyun oss base path, defaults to /.'],
|
48
|
+
|
49
|
+
['--maven-auth', 'Maven auth (USER[:PASSWORD]).'],
|
50
|
+
['--maven-group-id', 'Maven group id, defaults to com.tuya.ios.'],
|
51
|
+
|
52
|
+
['--bintray-auth', 'Bintray auth (USER[:PASSWORD]).'],
|
53
|
+
['--bintray-subject', 'Bintray subject.'],
|
54
|
+
['--bintray-repo', 'Bintray repo.'],
|
55
|
+
]
|
56
|
+
end
|
57
|
+
|
58
|
+
def initialize(argv)
|
59
|
+
@repo = argv.shift_argument
|
60
|
+
@local_repo_path = "#{ENV["HOME"]}/.cocoapods/repos/#{@repo}"
|
61
|
+
|
62
|
+
@podspec_path = argv.shift_argument
|
63
|
+
@library = argv.flag?('library') # framework/library
|
64
|
+
@spec_sources = argv.option('spec-sources')
|
65
|
+
|
66
|
+
@upload_to = argv.option('upload-to', 'oss')
|
67
|
+
@force = argv.flag?('force', false)
|
68
|
+
|
69
|
+
@oss_endpoint = argv.option('oss-endpoint', 'https://oss-cn-hangzhou.aliyuncs.com')
|
70
|
+
@oss_access_key_id = argv.option('oss-access-key-id')
|
71
|
+
@oss_access_key_secret = argv.option('oss-access-key-secret')
|
72
|
+
@oss_bucket_name = argv.option('oss-bucket-name')
|
73
|
+
@oss_base_path = argv.option('oss-base-path', '')
|
74
|
+
|
75
|
+
super
|
76
|
+
end
|
77
|
+
|
78
|
+
def validate!
|
79
|
+
super
|
80
|
+
|
81
|
+
help! 'A spec-repo name or url is required.' unless @repo
|
82
|
+
help! "#{@repo} repo not exist in ~/.cocoapods/repos/." unless File.directory?(@local_repo_path)
|
83
|
+
|
84
|
+
help! 'A podspec file path is required.' unless @podspec_path
|
85
|
+
|
86
|
+
if @upload_to == 'oss'
|
87
|
+
help! 'A oss-access-key-id is required.' unless @oss_access_key_id
|
88
|
+
help! 'A oss-access-key-secret is required.' unless @oss_access_key_secret
|
89
|
+
help! 'A oss-bucket-name is required.' unless @oss_bucket_name
|
90
|
+
else
|
91
|
+
help! 'upload-to param is required.'
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
def run
|
97
|
+
@podspec = Pod::Specification::from_file(@podspec_path)
|
98
|
+
UI.puts "Building #{@dynamic ? "dynamic" : "static"} #{@library ? "library" : "framework"}: #{@podspec.name} (#{@podspec.version})"
|
99
|
+
|
100
|
+
self.package
|
101
|
+
|
102
|
+
if @upload_to == 'oss'
|
103
|
+
url = self.upload_to_oss(self.archive, @force)
|
104
|
+
end
|
105
|
+
|
106
|
+
binary_spec = self.create_binary_podspec(@podspec, url)
|
107
|
+
|
108
|
+
self.repo_push_without_build(binary_spec)
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
def package
|
113
|
+
|
114
|
+
# pod package
|
115
|
+
podspec_path = "#{@podspec.name}.podspec.json"
|
116
|
+
File.write(podspec_path, @podspec.to_pretty_json)
|
117
|
+
|
118
|
+
argv = CLAide::ARGV.new([
|
119
|
+
podspec_path,
|
120
|
+
"--no-mangle",
|
121
|
+
"--exclude-deps",
|
122
|
+
"--spec-sources=#{@spec_sources}",
|
123
|
+
@library ? "--library" : "",
|
124
|
+
"--force",
|
125
|
+
"--verbose",
|
126
|
+
])
|
127
|
+
|
128
|
+
begin
|
129
|
+
package = TYPackage.new(argv)
|
130
|
+
package.run
|
131
|
+
rescue => exception
|
132
|
+
UI.puts(exception)
|
133
|
+
help! "#{@podspec.name} (#{@podspec.version}) build failed."
|
134
|
+
ensure
|
135
|
+
File.delete(podspec_path)
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
139
|
+
|
140
|
+
def create_binary_podspec(source_spec, archive_url)
|
141
|
+
keys_to_be_removed = [
|
142
|
+
"source",
|
143
|
+
"prefix_header_contents",
|
144
|
+
"prefix_header_file",
|
145
|
+
"source_files",
|
146
|
+
"public_header_files",
|
147
|
+
"private_header_files",
|
148
|
+
"vendored_frameworks",
|
149
|
+
"vendored_libraries",
|
150
|
+
"subspecs",
|
151
|
+
# TODO copy resources
|
152
|
+
# "resource_bundles",
|
153
|
+
# "resources",
|
154
|
+
]
|
155
|
+
|
156
|
+
# Remove source-related keys
|
157
|
+
binary_spec = source_spec.to_hash
|
158
|
+
for key in keys_to_be_removed do
|
159
|
+
if binary_spec.key?(key)
|
160
|
+
binary_spec.delete(key)
|
161
|
+
end
|
162
|
+
for platform in source_spec.available_platforms
|
163
|
+
if binary_spec.key?(platform.name)
|
164
|
+
if binary_spec[platform.name].key?(key)
|
165
|
+
binary_spec[platform.name].delete(key)
|
166
|
+
end
|
167
|
+
else
|
168
|
+
binary_spec[platform.name] = {}
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
binary_spec['static_framework'] = true
|
174
|
+
|
175
|
+
# set source url
|
176
|
+
binary_spec['source'] = {
|
177
|
+
'type': 'zip',
|
178
|
+
'http': archive_url,
|
179
|
+
}
|
180
|
+
|
181
|
+
# set vendored_libraries/vendored_frameworks
|
182
|
+
for platform in source_spec.available_platforms
|
183
|
+
if @library
|
184
|
+
binary_spec[platform.name]['vendored_libraries'] = "#{platform.name}/*.a"
|
185
|
+
else
|
186
|
+
binary_spec[platform.name]['vendored_frameworks'] = "#{platform.name}/*.framework"
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
# set headers
|
191
|
+
if @library
|
192
|
+
binary_spec['public_header_files'] = "Headers/**/*.h"
|
193
|
+
end
|
194
|
+
|
195
|
+
binary_spec = Specification.from_hash(binary_spec)
|
196
|
+
UI.puts(binary_spec.to_pretty_json)
|
197
|
+
|
198
|
+
binary_spec
|
199
|
+
end
|
200
|
+
|
201
|
+
def repo_push_without_build(spec)
|
202
|
+
|
203
|
+
local_repo_path = "#{ENV["HOME"]}/.cocoapods/repos/#{@repo}"
|
204
|
+
repo_spec_path = "#{local_repo_path}/Specs/#{spec.name}/#{spec.version}"
|
205
|
+
|
206
|
+
# repo update
|
207
|
+
exit_code = system("""cd #{repo_spec_path} \
|
208
|
+
&& git fetch \
|
209
|
+
&& REPO_COMMIT_HASH=`git rev-parse origin/master` \
|
210
|
+
&& git reset --hard $REPO_COMMIT_HASH
|
211
|
+
""")
|
212
|
+
if exit_code != 0
|
213
|
+
exit(-1)
|
214
|
+
end
|
215
|
+
|
216
|
+
# write
|
217
|
+
FileUtils.mkdir_p(repo_spec_path)
|
218
|
+
File.write("#{repo_spec_path}/#{spec}.podspec.json", spec.to_pretty_json)
|
219
|
+
|
220
|
+
# commit
|
221
|
+
exit_code = system("""cd #{repo_spec_path} \
|
222
|
+
&& git add . \
|
223
|
+
&& git commit -m \"⚠️ [Add] #{spec.name} (#{spec.version})\" \
|
224
|
+
&& git push
|
225
|
+
""")
|
226
|
+
if exit_code != 0
|
227
|
+
exit(-1)
|
228
|
+
end
|
229
|
+
|
230
|
+
end
|
231
|
+
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'aliyun/oss'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class TuyaOssPublish < Command
|
6
|
+
|
7
|
+
def archive
|
8
|
+
pod_package_path = "#{@podspec.name}-#{@podspec.version}"
|
9
|
+
file_path = "#{pod_package_path}.zip"
|
10
|
+
UI.puts("Archiving #{file_path}")
|
11
|
+
|
12
|
+
Dir.chdir(pod_package_path) do
|
13
|
+
`rm -rf #{file_path}`
|
14
|
+
`zip -ry #{file_path} Headers #{@podspec.available_platforms.map{|p| p.name}.join(" ")}`
|
15
|
+
end
|
16
|
+
|
17
|
+
return "#{pod_package_path}/#{file_path}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def upload_to_oss(file_path, force)
|
21
|
+
if not File.exist?(file_path)
|
22
|
+
help! "#{file_path} not exists"
|
23
|
+
end
|
24
|
+
|
25
|
+
file_name = File.basename(file_path)
|
26
|
+
object_key = "#{@oss_base_path}/#{file_name}"
|
27
|
+
|
28
|
+
client = Aliyun::OSS::Client.new(
|
29
|
+
:endpoint => @oss_endpoint,
|
30
|
+
:access_key_id => @oss_access_key_id,
|
31
|
+
:access_key_secret => @oss_access_key_secret)
|
32
|
+
bucket = client.get_bucket(@oss_bucket_name)
|
33
|
+
|
34
|
+
url = bucket.object_url(object_key, false)
|
35
|
+
|
36
|
+
if bucket.object_exists?(object_key) && force == false
|
37
|
+
# 正式版上传不覆盖
|
38
|
+
help! "#{url} already exists" unless file_name.index(/\balpha|\bbeta|\brc|\bSNAPSHOT/)
|
39
|
+
end
|
40
|
+
|
41
|
+
UI.puts("Uploading #{file_path}")
|
42
|
+
begin
|
43
|
+
bucket.put_object(object_key, :file => file_path)
|
44
|
+
rescue => exception
|
45
|
+
UI.puts(exception)
|
46
|
+
help! "#{file_name} upload failed."
|
47
|
+
end
|
48
|
+
|
49
|
+
puts(url)
|
50
|
+
return url
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-tuya-oss-publish/command'
|
data/spec/spec_helper.rb
ADDED
@@ -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,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-tuya-oss-publish
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- 高森
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-07-10 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
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: ty-cocoapods-packager
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.5.5
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.5.5
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: aliyun-sdk
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: A short description of cocoapods-tuya-oss-publish.
|
70
|
+
email:
|
71
|
+
- gaosen@tuya.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- Gemfile
|
78
|
+
- Gemfile.lock
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- cocoapods-tuya-oss-publish.gemspec
|
83
|
+
- lib/cocoapods-tuya-oss-publish.rb
|
84
|
+
- lib/cocoapods-tuya-oss-publish/command.rb
|
85
|
+
- lib/cocoapods-tuya-oss-publish/command/package.rb
|
86
|
+
- lib/cocoapods-tuya-oss-publish/command/publish.rb
|
87
|
+
- lib/cocoapods-tuya-oss-publish/command/upload.rb
|
88
|
+
- lib/cocoapods-tuya-oss-publish/gem_version.rb
|
89
|
+
- lib/cocoapods_plugin.rb
|
90
|
+
- spec/command/publish_spec.rb
|
91
|
+
- spec/spec_helper.rb
|
92
|
+
homepage: https://registry.code.tuya-inc.top/tuyaIOSSDK/cocoapods-tuya-oss-publish
|
93
|
+
licenses:
|
94
|
+
- MIT
|
95
|
+
metadata: {}
|
96
|
+
post_install_message:
|
97
|
+
rdoc_options: []
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
requirements: []
|
111
|
+
rubygems_version: 3.0.3
|
112
|
+
signing_key:
|
113
|
+
specification_version: 4
|
114
|
+
summary: A longer description of cocoapods-tuya-oss-publish.
|
115
|
+
test_files:
|
116
|
+
- spec/command/publish_spec.rb
|
117
|
+
- spec/spec_helper.rb
|