ocean_package 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.idea/.gitignore +8 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/dictionaries/ocean.xml +3 -0
- data/.idea/inspectionProfiles/Project_Default.xml +6 -0
- data/.idea/misc.xml +7 -0
- data/.idea/modules.xml +8 -0
- data/.idea/ocean_package.iml +27 -0
- data/.idea/vcs.xml +6 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +40 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/oceanpackage +5 -0
- data/bin/setup +8 -0
- data/lib/ocean_package.rb +41 -0
- data/lib/ocean_package/command.rb +162 -0
- data/lib/ocean_package/config.rb +41 -0
- data/lib/ocean_package/constants.rb +14 -0
- data/lib/ocean_package/dingtalk.rb +34 -0
- data/lib/ocean_package/fir.rb +167 -0
- data/lib/ocean_package/ipa.rb +188 -0
- data/lib/ocean_package/logger.rb +22 -0
- data/lib/ocean_package/oss.rb +92 -0
- data/lib/ocean_package/package.rb +242 -0
- data/lib/ocean_package/version.rb +3 -0
- data/ocean_package.gemspec +43 -0
- metadata +117 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f5db61be1518b5da4f3ef4c45e633dd297b100e764f727b6383dab1184d7785f
|
4
|
+
data.tar.gz: e6033bd98e8e7c77040f6d718a0276d110621fee1c5761ac8bf977e6818b95cd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5c0a50632aff577c7afd3a1de8526a0a71e91c24e0401bb9f443a1fd1b8a24911dde8dff71f5dc82b5a9e939bfbc65119a81c22545a0a2faa61e4b121a40b76c
|
7
|
+
data.tar.gz: 2831507550cb19d8778094f0a035ff7d230f3f9775874824f349ccb689c4bf044c889acdaf52cfc06826aec291a46ef4b497c246ac4509c5c7ca09ba278ffe91
|
data/.gitignore
ADDED
data/.idea/.gitignore
ADDED
data/.idea/.rakeTasks
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
3
|
+
You are allowed to:
|
4
|
+
1. Remove rake task
|
5
|
+
2. Add existing rake tasks
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build ocean_package-0.1.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install ocean_package-0.1.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install ocean_package-0.1.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.1.0 and build and push ocean_package-0.1.0.gem to rubygems.org" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run tests" fullCmd="test" taksId="test" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
|
data/.idea/misc.xml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="JavaScriptSettings">
|
4
|
+
<option name="languageLevel" value="ES6" />
|
5
|
+
</component>
|
6
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.6.3" project-jdk-type="RUBY_SDK" />
|
7
|
+
</project>
|
data/.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/ocean_package.iml" filepath="$PROJECT_DIR$/.idea/ocean_package.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
4
|
+
<shared />
|
5
|
+
</component>
|
6
|
+
<component name="NewModuleRootManager">
|
7
|
+
<content url="file://$MODULE_DIR$">
|
8
|
+
<sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
|
9
|
+
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
10
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
11
|
+
</content>
|
12
|
+
<orderEntry type="jdk" jdkName="ruby-2.6.3-p62" jdkType="RUBY_SDK" />
|
13
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="CFPropertyList (v2.3.6, ruby-2.6.3-p62) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.17.2, ruby-2.6.3-p62) [gem]" level="application" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="claide (v1.0.3, ruby-2.6.3-p62) [gem]" level="application" />
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.6, ruby-2.6.3-p62) [gem]" level="application" />
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="dingbot (v0.2.3, ruby-2.6.3-p62) [gem]" level="application" />
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="httparty (v0.18.1, ruby-2.6.3-p62) [gem]" level="application" />
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="mime-types (v3.3.1, ruby-2.6.3-p62) [gem]" level="application" />
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2020.0512, ruby-2.6.3-p62) [gem]" level="application" />
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.11.3, ruby-2.6.3-p62) [gem]" level="application" />
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="multi_xml (v0.6.0, ruby-2.6.3-p62) [gem]" level="application" />
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, ruby-2.6.3-p62) [gem]" level="application" />
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="semantic_logger (v4.7.1, ruby-2.6.3-p62) [gem]" level="application" />
|
26
|
+
</component>
|
27
|
+
</module>
|
data/.idea/vcs.xml
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at 849638313@qq.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in ocean_package.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem 'claide', '~> 1.0', '>= 1.0.3'
|
9
|
+
gem 'dingbot'
|
10
|
+
gem 'CFPropertyList'
|
11
|
+
gem 'semantic_logger'
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ocean_package (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
CFPropertyList (2.3.6)
|
10
|
+
claide (1.0.3)
|
11
|
+
concurrent-ruby (1.1.6)
|
12
|
+
dingbot (0.2.3)
|
13
|
+
httparty
|
14
|
+
httparty (0.18.1)
|
15
|
+
mime-types (~> 3.0)
|
16
|
+
multi_xml (>= 0.5.2)
|
17
|
+
mime-types (3.3.1)
|
18
|
+
mime-types-data (~> 3.2015)
|
19
|
+
mime-types-data (3.2020.0512)
|
20
|
+
minitest (5.11.3)
|
21
|
+
multi_xml (0.6.0)
|
22
|
+
rake (10.5.0)
|
23
|
+
semantic_logger (4.7.1)
|
24
|
+
concurrent-ruby (~> 1.0)
|
25
|
+
|
26
|
+
PLATFORMS
|
27
|
+
ruby
|
28
|
+
|
29
|
+
DEPENDENCIES
|
30
|
+
CFPropertyList
|
31
|
+
bundler (~> 1.17.2)
|
32
|
+
claide (~> 1.0, >= 1.0.3)
|
33
|
+
dingbot
|
34
|
+
minitest (~> 5.0)
|
35
|
+
ocean_package!
|
36
|
+
rake (~> 10.0)
|
37
|
+
semantic_logger
|
38
|
+
|
39
|
+
BUNDLED WITH
|
40
|
+
1.17.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 ocean
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# OceanPackage
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ocean_package`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'ocean_package'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install ocean_package
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ocean_package. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
+
|
41
|
+
## Code of Conduct
|
42
|
+
|
43
|
+
Everyone interacting in the OceanPackage project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/ocean_package/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "ocean_package"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/oceanpackage
ADDED
data/bin/setup
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'dingbot'
|
3
|
+
require 'cfpropertylist'
|
4
|
+
require 'semantic_logger'
|
5
|
+
|
6
|
+
# 注意:这里使用 require_relative 来引用文件
|
7
|
+
require_relative 'ocean_package/version'
|
8
|
+
require_relative 'ocean_package/config'
|
9
|
+
require_relative 'ocean_package/command'
|
10
|
+
require_relative 'ocean_package/constants'
|
11
|
+
require_relative 'ocean_package/fir'
|
12
|
+
require_relative 'ocean_package/oss'
|
13
|
+
require_relative 'ocean_package/dingtalk'
|
14
|
+
require_relative 'ocean_package/ipa'
|
15
|
+
require_relative 'ocean_package/logger'
|
16
|
+
require_relative 'ocean_package/package'
|
17
|
+
|
18
|
+
module OceanPackage
|
19
|
+
require 'claide'
|
20
|
+
|
21
|
+
def self.run(argvs)
|
22
|
+
puts "====="
|
23
|
+
puts ARGV
|
24
|
+
puts "====="
|
25
|
+
|
26
|
+
command = OceanPackage::Command.new(argvs)
|
27
|
+
command.run
|
28
|
+
|
29
|
+
|
30
|
+
# # command = OceanPackage::Command.new(config)
|
31
|
+
#
|
32
|
+
# argv = CLAide::ARGV.new(ARGV)
|
33
|
+
# if !argv.arguments.include?("oceanpackage")
|
34
|
+
# puts "不包含命令 oceanpackage"
|
35
|
+
# exit 1
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
# puts "包含命令 oceanpackage"
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,162 @@
|
|
1
|
+
|
2
|
+
module OceanPackage
|
3
|
+
class Command
|
4
|
+
|
5
|
+
# xcodebuild 打包相关
|
6
|
+
attr_accessor :package
|
7
|
+
# fir 平台
|
8
|
+
attr_accessor :fir
|
9
|
+
# oss 对象
|
10
|
+
attr_accessor :oss
|
11
|
+
# ding ding
|
12
|
+
attr_accessor :ding
|
13
|
+
|
14
|
+
# 命令参数
|
15
|
+
attr_accessor :arguments
|
16
|
+
|
17
|
+
# 本次更新内容
|
18
|
+
attr_accessor :change_log
|
19
|
+
|
20
|
+
# @ 的手机号
|
21
|
+
attr_accessor :at_mobiles
|
22
|
+
|
23
|
+
def initialize(params = [])
|
24
|
+
argv = CLAide::ARGV.new(params)
|
25
|
+
|
26
|
+
@arguments = argv.arguments
|
27
|
+
Log.info("arguments: #{@arguments}")
|
28
|
+
|
29
|
+
workspace_path = argv.option("workspace-path", "")
|
30
|
+
Log.info("workspace_path: #{workspace_path}")
|
31
|
+
|
32
|
+
scheme = argv.option("scheme", "")
|
33
|
+
Log.info("scheme: #{scheme}")
|
34
|
+
|
35
|
+
configuration = argv.option("configuration", OceanPackage::Constants::DEFAULT_CONFIGURATION)
|
36
|
+
Log.info("configuration: #{configuration}")
|
37
|
+
|
38
|
+
archive_path = argv.option("archive-path", OceanPackage::Constants::DEFAULT_ARCHIVE_PATH)
|
39
|
+
Log.info("archive_path: #{archive_path}")
|
40
|
+
|
41
|
+
company_name = argv.option("company-name", OceanPackage::Constants::DEFAULT_COMPANY_NAME)
|
42
|
+
Log.info("company_name: #{company_name}")
|
43
|
+
|
44
|
+
export_options_plist = argv.option("export-options-plist", "")
|
45
|
+
Log.info("export_options_plist: #{export_options_plist}")
|
46
|
+
|
47
|
+
@package = OceanPackage::Package.new(workspace_path, scheme, configuration, archive_path, company_name, export_options_plist)
|
48
|
+
|
49
|
+
fir_token = argv.option("fir-token", "")
|
50
|
+
Log.info("fir_token: #{fir_token}")
|
51
|
+
|
52
|
+
change_log = argv.option("change-log", "")
|
53
|
+
@change_log = change_log
|
54
|
+
Log.info("change_log: #{change_log}")
|
55
|
+
|
56
|
+
fir_log_path = @package.final_archive_path + 'fir.log'
|
57
|
+
@fir = OceanPackage::Fir.new(fir_token, final_change_log, @package.ipa_file_path, fir_log_path)
|
58
|
+
|
59
|
+
##### oss #####
|
60
|
+
oss_bucket_name = argv.option("oss-bucket-name", "")
|
61
|
+
Log.info("oss_bucket_name: #{oss_bucket_name}")
|
62
|
+
|
63
|
+
oss_bucket_path = argv.option("oss-bucket-path", "")
|
64
|
+
Log.info("oss_bucket_path: #{oss_bucket_path}")
|
65
|
+
|
66
|
+
oss_endpoint = argv.option("oss-endpoint", "")
|
67
|
+
Log.info("oss_endpoint: #{oss_endpoint}")
|
68
|
+
|
69
|
+
@oss = OceanPackage::Oss.new(oss_bucket_name, oss_bucket_path, oss_endpoint)
|
70
|
+
|
71
|
+
ding_token = argv.option("ding-token", "")
|
72
|
+
Log.info("ding_token: #{ding_token}")
|
73
|
+
|
74
|
+
at_mobiles = argv.option("at-mobiles", "").split(",")
|
75
|
+
Log.info("ding_at_mobiles: #{at_mobiles}")
|
76
|
+
@at_mobiles = at_mobiles
|
77
|
+
|
78
|
+
@ding = OceanPackage::DingTalk.new(ding_token)
|
79
|
+
end
|
80
|
+
|
81
|
+
# 最终的 change log
|
82
|
+
def final_change_log
|
83
|
+
if @change_log.empty?
|
84
|
+
syscall('git log --pretty=format:%s -1')
|
85
|
+
else
|
86
|
+
@change_log
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def run
|
91
|
+
package.run
|
92
|
+
upload
|
93
|
+
send_ding_talk_msg
|
94
|
+
end
|
95
|
+
|
96
|
+
# 上传 ipa 文件
|
97
|
+
def upload
|
98
|
+
upload_to_fir
|
99
|
+
end
|
100
|
+
|
101
|
+
# 上传到 fir 平台
|
102
|
+
def upload_to_fir
|
103
|
+
fir.run
|
104
|
+
upload_qr_code(fir.find_qr_code_path, fir.find_release_id)
|
105
|
+
@ipa_download_link = fir.whole_download_link
|
106
|
+
end
|
107
|
+
|
108
|
+
# 上传 二维码 QRCode 图片到 oss
|
109
|
+
def upload_qr_code(path, name)
|
110
|
+
@qr_code_url = oss.upload(path, name)
|
111
|
+
end
|
112
|
+
|
113
|
+
# 总共时间,单位 秒 s
|
114
|
+
def compute_total_time
|
115
|
+
time1 = package.start_time
|
116
|
+
time2 = Time.now
|
117
|
+
seconds = time2 - time1
|
118
|
+
|
119
|
+
Log.info("total time: #{seconds}")
|
120
|
+
|
121
|
+
seconds
|
122
|
+
end
|
123
|
+
|
124
|
+
# web hook 消息标题
|
125
|
+
def make_web_hook_message_title
|
126
|
+
"iOS 来新包啦~"
|
127
|
+
end
|
128
|
+
|
129
|
+
# web hook 消息内容
|
130
|
+
def make_web_hook_message
|
131
|
+
ipa = OceanPackage::Ipa.new(package.ipa_file_path)
|
132
|
+
ipa.run
|
133
|
+
|
134
|
+
# markdown 格式
|
135
|
+
content = "# #{ipa.display_name} \n\n"
|
136
|
+
content += "当前平台: iOS \n\n"
|
137
|
+
content += "APP名称: " + ipa.display_name + "\n\n"
|
138
|
+
content += "当前版本: " + ipa.version + "(#{ipa.build_version})" + "\n\n"
|
139
|
+
content += "打包耗时: " + "#{compute_total_time}" + "\n\n"
|
140
|
+
content += "发布环境: " + "#{package.configuration}" + "\n\n"
|
141
|
+
content += "更新描述: " + final_change_log + "\n\n"
|
142
|
+
content += "发布时间: " + Time.new.strftime("%Y-%m-%d_%H-%M-%S") + "\n\n"
|
143
|
+
content += "下载链接: [点我](#{@ipa_download_link})" + "\n\n"
|
144
|
+
content += "![二维码](#{@qr_code_url})"
|
145
|
+
|
146
|
+
Log.info("web hook message: \n#{content}")
|
147
|
+
|
148
|
+
content
|
149
|
+
end
|
150
|
+
|
151
|
+
def send_ding_talk_msg
|
152
|
+
# 消息卡片,富文本
|
153
|
+
title = make_web_hook_message_title
|
154
|
+
content = make_web_hook_message
|
155
|
+
|
156
|
+
ding.send_card_message(title, content)
|
157
|
+
ding.send_text_message(title, @at_mobiles)
|
158
|
+
end
|
159
|
+
|
160
|
+
end
|
161
|
+
|
162
|
+
end
|