fast_pack 0.3.0

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: c37e9bd1ecedf35fa75841b21868ba2fc7d9dc78863d038fb9b82b9819ab7f24
4
+ data.tar.gz: 57b75838cc69665bec44e92a1087597f3c47d41d86c9a489bacca56a30211e06
5
+ SHA512:
6
+ metadata.gz: e2bdf832bd5237e0e046db23df3099a4f17bbe72f640d5aa9563fa5a35ad102c6106e4d3c0fc08952872f1ca90a31444bb351af6a47a5cacc552998f266890dc
7
+ data.tar.gz: d496492686dec5279e70f937ebb80c5e71d5e123c43da196f7c50720428d96ccafe80315d7931ab8a0405e796fcee8993ccf9494b7857181b059acb8b7f20f96
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # Packager
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/packager`. 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
+ Install the gem and add to the application's Gemfile by executing:
10
+
11
+ $ bundle add packager
12
+
13
+ If bundler is not being used to manage dependencies, install the gem by executing:
14
+
15
+ $ gem install packager
16
+
17
+ ## Usage
18
+
19
+ TODO: Write usage instructions here
20
+
21
+ ## Development
22
+
23
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
24
+
25
+ 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
26
+
27
+ ## Contributing
28
+
29
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/packager. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/packager/blob/master/CODE_OF_CONDUCT.md).
30
+
31
+ ## License
32
+
33
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
34
+
35
+ ## Code of Conduct
36
+
37
+ Everyone interacting in the Packager project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/packager/blob/master/CODE_OF_CONDUCT.md).
data/bin/uki ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ if $PROGRAM_NAME == __FILE__
5
+ ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', __dir__)
6
+ require 'bundler/setup'
7
+ end
8
+
9
+
10
+ require "cocoapods-uki-packager/command/pack"
11
+
12
+ Pod::Command.run(ARGV)
@@ -0,0 +1,74 @@
1
+ require 'cocoapods'
2
+ require 'fileutils'
3
+ require 'cocoapods-uki-packager/uki_config.rb'
4
+ require 'cocoapods-uki-packager/shell.rb'
5
+
6
+ module Pod
7
+
8
+ class Command
9
+
10
+ class Pack < Command
11
+
12
+ include Uki_config::Mixin
13
+ include Shell_Command::Mixin
14
+
15
+ self.summary = 'Uki 打包工具'
16
+ self.description = '支持国内 海外打包'
17
+
18
+ def self.options
19
+ [
20
+ ['--overseas', '海外打包, 默认为海外'],
21
+ ['--internal', '国内打包'],
22
+ ['--no-build', '不执行编译命令,直接起飞'],
23
+ ['--dsym', '是否生成dsym, 默认不生成'],
24
+ ['--verbose', '详细流程'],
25
+ ['--release', '是否是正式环境'],
26
+
27
+ ].concat(super).uniq
28
+ end
29
+
30
+ # verbose Pods 会过滤掉 所以这里拿不到, 但是可以直接使用
31
+ def initialize(argv)
32
+ super
33
+ @no_build = !argv.flag?('build', true)
34
+ @project_sea = true
35
+ @project_sea = false if argv.flag?('internal', false)
36
+ @dsym = argv.flag?('dsym', false)
37
+ @release = argv.flag?('release', false)
38
+
39
+ uki_config.verbose = @verbose
40
+ uki_config.project_sea = @project_sea
41
+ uki_config.dsym = @dsym
42
+ uki_config.release = @release
43
+ uki_config.no_build = @no_build
44
+
45
+ end
46
+
47
+ def run
48
+ if verify_workspace_exists?
49
+ if uki_config.no_build
50
+ #直接导出
51
+ shell.export
52
+ elsif
53
+ # 编译导出
54
+ shell.build
55
+ end
56
+
57
+ end
58
+
59
+ end
60
+
61
+ def verify_workspace_exists?
62
+ uki_config.auto_work_space_name
63
+ unless uki_config.workspace_name
64
+ puts("大兄弟,请前往xxxx.workspace同级目录执行哦")
65
+ return false
66
+ end
67
+
68
+ return true
69
+ end
70
+
71
+ end
72
+ end
73
+
74
+ end
@@ -0,0 +1,112 @@
1
+ require 'cocoapods-uki-packager/uki_config.rb'
2
+ require 'cocoapods'
3
+
4
+ class Shell_Command
5
+
6
+ include Uki_config::Mixin
7
+
8
+ def build
9
+
10
+ puts %x{echo "********************************************************* 开始编译"}
11
+
12
+ log = %x{
13
+
14
+ xcodebuild build -workspace #{uki_config.workspace} -scheme #{uki_config.scheme} -destination generic/platform=iOS -configuration #{uki_config.configuration} DEBUG_INFORMATION_FORMAT=#{uki_config.dsym_config} DWARF_DSYM_FOLDER_PATH=#{uki_config.dsym_path}
15
+
16
+ if [[ $? -ne 0 ]]; then
17
+ echo "************************************* 编译失败 *************************************"
18
+ exit 1
19
+ fi
20
+ }
21
+
22
+ puts %x{echo "********************************************************* 编译完成"}
23
+
24
+ if uki_config.verbose?
25
+ # puts(log)
26
+ end
27
+
28
+ # 直接开始导出
29
+ self.export
30
+
31
+ end
32
+
33
+ # 暂时先不copy到跟目录, 防止Git提交代码时提交上去
34
+ # 需安装Fir 不太友好
35
+ # 安装命令 sudo gem install fir-cli
36
+ def export
37
+
38
+ unless uki_config.build_exe_path
39
+ puts "未生成目标文件目录"
40
+ return
41
+ end
42
+
43
+ puts %x{echo "********************************************************* 开始导出ipa"}
44
+
45
+ log = %x{
46
+ product_path=#{uki_config.build_exe_path}
47
+ if [[ $product_path == "" ]]; then
48
+ echo "===no path input==="
49
+ product_path=`dirname $0`
50
+ fi
51
+
52
+ echo -e “=====path=$product_path =====“
53
+
54
+ cd $product_path
55
+
56
+ fir_log="fir auto release"
57
+
58
+ #计时
59
+ SECONDS=0
60
+
61
+ APP=$(find $product_path -type d | grep ".app$" | head -n 1)
62
+ APP=${APP%.*}
63
+
64
+ echo -e “=====APP=$APP =====“
65
+
66
+ rm -rf "$APP.ipa";
67
+ rm -rf ./Payload;
68
+ mkdir Payload;
69
+ cp -rf "$APP.app" ./Payload;
70
+ zip -r -q "$APP.ipa" ./Payload;
71
+ rm -rf ./Payload;
72
+
73
+ echo "===生成ipa开始上传 time: ${SECONDS}s==="
74
+
75
+
76
+ fir_token="207c7aad886da8009a73486d5154a7a6"
77
+ fir publish "$APP.ipa" -T $fir_token -c "$fir_log" -Q -q
78
+
79
+ size=$(ls -l $APP.ipa | awk '{ print $5 }')
80
+
81
+ sizeM=`echo "scale=2; ${size}/1024.0/1024" | bc`
82
+ #sizeM="$((${size}/1000.0))
83
+ echo -e "===size=${sizeM}m==="
84
+
85
+ notification="Did uploaded to fir caost time:${SECONDS}s"
86
+ echo "===$notification==="
87
+
88
+ osascript -e 'display notification "size:'$sizeM'm\ncaost:'$SECONDS's" with title "Uploaded to fir!" sound name "default" '
89
+ }
90
+
91
+ puts("恭喜打包完成")
92
+
93
+ if uki_config.verbose?
94
+ puts(log)
95
+ end
96
+ end
97
+
98
+ def self.instance
99
+ @instance ||= new
100
+ end
101
+
102
+ class << self
103
+ attr_writer :instance
104
+ end
105
+
106
+ module Mixin
107
+ def shell
108
+ Shell_Command.instance
109
+ end
110
+ end
111
+
112
+ end
@@ -0,0 +1,116 @@
1
+
2
+ class Uki_config
3
+
4
+ # scheme info
5
+ PROJECT_SCHEME = ['UkiOverseas', 'miaohong'].freeze
6
+
7
+ # workspace name
8
+ PROJECT_WORKSPACENAME = ['UkiOverseas.xcworkspace', 'miaohong.xcworkspace']
9
+
10
+ # 是否展示详细信息
11
+ attr_accessor :verbose
12
+ # 是否海外
13
+ attr_accessor :project_sea
14
+ # 是否执行编译命令
15
+ attr_accessor :no_build
16
+ # 是否编译release环境
17
+ attr_accessor :release
18
+ # 是否产生dsym
19
+ attr_accessor :dsym
20
+ # 自动workspace名称
21
+ attr_accessor :workspace_name
22
+
23
+ alias_method :verbose?, :verbose
24
+
25
+ def scheme
26
+ unless project_sea
27
+ return PROJECT_SCHEME.last
28
+ end
29
+ return PROJECT_SCHEME.first
30
+ end
31
+
32
+ def workspace
33
+ unless project_sea
34
+ return PROJECT_WORKSPACENAME.last
35
+ end
36
+
37
+ return PROJECT_WORKSPACENAME.first
38
+ end
39
+
40
+ def configuration
41
+ unless release
42
+ return "Debug"
43
+ end
44
+ return "Release"
45
+ end
46
+
47
+ def archive_path
48
+ return @installation_root
49
+ end
50
+
51
+ def dsym_config
52
+ unless dsym
53
+ return "dwarf"
54
+ end
55
+
56
+ return "dwarf-with-dsym"
57
+ end
58
+
59
+ def dsym_path
60
+ return File.join(@installation_root.to_s, "dsym")
61
+ end
62
+
63
+ def ipa_path
64
+ return File.join(@installation_root.to_s, "ipa")
65
+ end
66
+
67
+ def verbose(v)
68
+ @verbose
69
+ end
70
+
71
+ # 路径相关
72
+
73
+ def installation_root
74
+ @installation_root ||= begin
75
+ current_dir = Pathname.new(Dir.pwd.unicode_normalize(:nfkc))
76
+ installation_root = current_dir
77
+ end
78
+ end
79
+
80
+
81
+ def auto_work_space_name
82
+ installation_root
83
+
84
+ Dir.foreach(@installation_root) do |entry|
85
+ if entry.end_with?('xcworkspace')
86
+ @workspace_name = entry.split('.').first
87
+ next
88
+ end
89
+ end
90
+ end
91
+
92
+ # 读取产物记录文件
93
+ def app_file_path
94
+ return File.join(@installation_root, "app_path")
95
+ end
96
+
97
+ # 产物路径
98
+ def build_exe_path
99
+ return IO.readlines(app_file_path).first
100
+ end
101
+
102
+ def self.instance
103
+ @instance ||= new
104
+ end
105
+
106
+ class << self
107
+ attr_writer :instance
108
+ end
109
+
110
+ module Mixin
111
+ def uki_config
112
+ Uki_config.instance
113
+ end
114
+ end
115
+
116
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Packager
4
+ VERSION = "0.3.0"
5
+ end
data/lib/packager.rb ADDED
File without changes
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fast_pack
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - 耿磊
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-07-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: cocoapods
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: fir-cli
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 2.0.14
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '2.0'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 2.0.14
47
+ description: Test
48
+ email:
49
+ - glworkfine@gmail.com
50
+ executables:
51
+ - uki
52
+ extensions: []
53
+ extra_rdoc_files: []
54
+ files:
55
+ - README.md
56
+ - bin/uki
57
+ - lib/cocoapods-uki-packager/command/pack.rb
58
+ - lib/cocoapods-uki-packager/shell.rb
59
+ - lib/cocoapods-uki-packager/uki_config.rb
60
+ - lib/cocoapods-uki-packager/version.rb
61
+ - lib/packager.rb
62
+ homepage: https://github.com/iOSGL/package.git
63
+ licenses:
64
+ - MIT
65
+ metadata: {}
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 2.6.0
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubygems_version: 3.0.9
82
+ signing_key:
83
+ specification_version: 4
84
+ summary: Test
85
+ test_files: []