fir-cli 0.2.3.1 → 1.0.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 +4 -4
- data/.gitignore +13 -82
- data/CHANGELOG +36 -0
- data/Gemfile +3 -1
- data/LICENSE.txt +1 -1
- data/README.md +83 -103
- data/Rakefile +1 -0
- data/bin/fir +9 -11
- data/fir-cli.gemspec +47 -26
- data/lib/fir/api.yml +5 -0
- data/lib/fir/cli.rb +107 -0
- data/lib/fir/patches/bin/pngcrush +0 -0
- data/lib/fir/patches/native_patch.rb +199 -0
- data/lib/fir/patches/os_patch.rb +22 -0
- data/lib/fir/patches/parser_patch.rb +165 -0
- data/lib/fir/patches.rb +5 -0
- data/lib/fir/util/build.rb +158 -0
- data/lib/fir/util/info.rb +79 -0
- data/lib/fir/util/login.rb +17 -0
- data/lib/fir/util/publish.rb +103 -0
- data/lib/fir/util.rb +45 -0
- data/lib/fir/version.rb +5 -0
- data/lib/fir-cli.rb +3 -0
- data/lib/fir.rb +87 -0
- data/lib/fir_cli.rb +3 -0
- metadata +57 -109
- data/Gemfile.lock +0 -45
- data/fir-cli.rb +0 -27
- data/lib/fir-cli/version.rb +0 -5
- data/lib/fir-cli-commands/00-info.rb +0 -17
- data/lib/fir-cli-commands/00-login.rb +0 -30
- data/lib/fir-cli-commands/00-profile.rb +0 -31
- data/lib/fir-cli-commands/00-upgrade.rb +0 -15
- data/lib/fir-cli-commands/00-version.rb +0 -10
- data/lib/fir-cli-commands/01-config.rb +0 -17
- data/lib/fir-cli-commands/100-resign_codesign.rb +0 -59
- data/lib/fir-cli-commands/100-resign_tapbeta.rb +0 -85
- data/lib/fir-cli-commands/101-resign.rb +0 -26
- data/lib/fir-cli-commands/11-publish.rb +0 -73
- data/lib/fir-cli-commands/12-build_ipa.rb +0 -153
- data/lib/fir-cli.chk.rb +0 -33
- data/lib/fir-cli.core.rb +0 -96
- data/lib/fir-cli.fir.rb +0 -49
- data/lib/fir-cli.opt.rb +0 -35
- data/lib/fir-cli.output.rb +0 -55
- data/lib/fir-cli.utils.rb +0 -108
- data/lib/lagunitas.ext.rb +0 -56
- data/lib/lagunitas.patch.rb +0 -51
- data/lib/user_config.patch.rb +0 -10
data/lib/fir-cli.output.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
module Fir
|
3
|
-
class Cli
|
4
|
-
def self.output_options
|
5
|
-
option :verbose,
|
6
|
-
:desc => '设置输出辅助信息的详细程度',
|
7
|
-
:type => :string,
|
8
|
-
:enum => ['v', 'vv', 'vvv']
|
9
|
-
option :quiet,
|
10
|
-
:aliases => '-q',
|
11
|
-
:desc => '安静模式,不输出任何辅助信息',
|
12
|
-
:type => 'boolean'
|
13
|
-
option :color,
|
14
|
-
:desc => '设置输出带有颜色的信息',
|
15
|
-
:type => 'boolean'
|
16
|
-
end
|
17
|
-
private
|
18
|
-
def _puts(text)
|
19
|
-
return puts _format text if !/^[->!] /.match text
|
20
|
-
return if _opt_quiet
|
21
|
-
case _opt_verbose || 'vv' # If nothing about log is set, use the default option - vv
|
22
|
-
when 'v'
|
23
|
-
puts _format text if text.start_with?('!')
|
24
|
-
when 'vv'
|
25
|
-
puts _format text if text.start_with?('!') || text.start_with?('>')
|
26
|
-
when 'vvv'
|
27
|
-
puts _format text if text.start_with?('!') || text.start_with?('>') || text.start_with?('-')
|
28
|
-
end
|
29
|
-
end
|
30
|
-
def _format(text)
|
31
|
-
return text.gsub /\e\[\d+(?:;\d+)*m/, '' if _opt_color == false
|
32
|
-
text
|
33
|
-
end
|
34
|
-
def _puts_welcome
|
35
|
-
_puts "> #{Paint['欢迎使用 FIR.im 命令行工具,如需帮助请输入:', :green]} fir help"
|
36
|
-
end
|
37
|
-
def _puts_require_token
|
38
|
-
_puts "! #{Paint['用户 token 不能为空', :red]}"
|
39
|
-
end
|
40
|
-
def _puts_invalid_token
|
41
|
-
_puts "! #{Paint['输入的用户 token 不合法', :red]}"
|
42
|
-
end
|
43
|
-
def _puts_invalid_email
|
44
|
-
_puts "! #{Paint['输入的邮件地址不合法', :red]}"
|
45
|
-
end
|
46
|
-
def _prompt_secret(prompt)
|
47
|
-
prompt = '' if _opt_quiet
|
48
|
-
ask(prompt) { |_q| _q.echo = false }
|
49
|
-
end
|
50
|
-
def _prompt(prompt)
|
51
|
-
prompt = '' if _opt_quiet
|
52
|
-
ask(prompt) { |_q| _q }
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
data/lib/fir-cli.utils.rb
DELETED
@@ -1,108 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
module Fir
|
3
|
-
class Cli
|
4
|
-
def initialize(*args)
|
5
|
-
super
|
6
|
-
@tmpfiles = []
|
7
|
-
_init_config
|
8
|
-
_load_config
|
9
|
-
_puts_welcome
|
10
|
-
end
|
11
|
-
def self.find_extends
|
12
|
-
`gem list --local`
|
13
|
-
.each_line("\n")
|
14
|
-
.map { |gem| /^[^\s]+/.match(gem)[0] }
|
15
|
-
.select { |gem| true if gem.start_with? 'fir-cli-' }
|
16
|
-
end
|
17
|
-
private
|
18
|
-
def _init_config
|
19
|
-
@uconfig = UserConfig.new '.fir'
|
20
|
-
@global_config = @uconfig['global.yaml']
|
21
|
-
end
|
22
|
-
def _load_config
|
23
|
-
@config = @uconfig[_profile]
|
24
|
-
end
|
25
|
-
def _set_config(configs)
|
26
|
-
if configs.length > 0
|
27
|
-
configs.each do |option|
|
28
|
-
_puts "> #{Paint[option[0].to_s.rjust(10), :blue]} : #{@config[option[0].to_s]} => #{option[1]}"
|
29
|
-
@config[option[0].to_s] = option[1]
|
30
|
-
end
|
31
|
-
if @config['token'] && !_user(@config['token'])
|
32
|
-
_puts_invalid_token
|
33
|
-
_exit
|
34
|
-
end
|
35
|
-
@config.save
|
36
|
-
end
|
37
|
-
end
|
38
|
-
def _profile
|
39
|
-
@global_config['profile'] || 'default.yaml'
|
40
|
-
end
|
41
|
-
def _path(path)
|
42
|
-
path = Pathname.new(Dir.pwd).join(path).cleanpath
|
43
|
-
end
|
44
|
-
def _is_ipa?(path)
|
45
|
-
path.end_with? '.ipa'
|
46
|
-
end
|
47
|
-
def _is_apk?(path)
|
48
|
-
path.end_with? '.apk'
|
49
|
-
end
|
50
|
-
def _is_workspace?(path)
|
51
|
-
path.end_with? '.xcworkspace'
|
52
|
-
end
|
53
|
-
def _is_xcodeproject?(path)
|
54
|
-
path.end_with? '.xcodeproj'
|
55
|
-
end
|
56
|
-
def _is_identifier?(str)
|
57
|
-
/^(?:(?:[a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*(?:[A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$/.match str
|
58
|
-
end
|
59
|
-
def _is_email?(str)
|
60
|
-
/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)$/i.match str
|
61
|
-
end
|
62
|
-
def _extends
|
63
|
-
@extends ||= Cli.find_extends
|
64
|
-
end
|
65
|
-
def _os
|
66
|
-
return 'mac' if /darwin/ =~ RUBY_PLATFORM
|
67
|
-
return 'windows' if /cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM
|
68
|
-
return 'linux'
|
69
|
-
end
|
70
|
-
def _exit
|
71
|
-
exit 1
|
72
|
-
end
|
73
|
-
def _exec(cmd)
|
74
|
-
output = `#{cmd}`
|
75
|
-
if $?.exitstatus != 0
|
76
|
-
puts output
|
77
|
-
_exit
|
78
|
-
end
|
79
|
-
end
|
80
|
-
def _convert_settings(*settings)
|
81
|
-
settings.reduce({}) do |hash, setting|
|
82
|
-
key,val = setting.split('=', 2).map(&:strip)
|
83
|
-
hash[key.to_sym] = val
|
84
|
-
hash
|
85
|
-
end
|
86
|
-
end
|
87
|
-
def _edit(ipath, opath=nil)
|
88
|
-
ipath = _path ipath
|
89
|
-
if !opath then opath = ipath else opath = _path opath end
|
90
|
-
extname = File.extname opath
|
91
|
-
Dir.mktmpdir do |_d|
|
92
|
-
Dir.chdir(_d) do
|
93
|
-
|
94
|
-
Zip::ZipFile.open(ipath) do |_z|
|
95
|
-
_z.each do |_entry|
|
96
|
-
entrypath = File.join _d, _entry.name
|
97
|
-
FileUtils.mkdir_p File.dirname entrypath
|
98
|
-
_z.extract _entry, entrypath unless File.file? entrypath
|
99
|
-
end
|
100
|
-
end
|
101
|
-
yield _d if block_given?
|
102
|
-
File.unlink opath if File.file? opath
|
103
|
-
_exec "zip -qr #{opath} Payload"
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
data/lib/lagunitas.ext.rb
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'cfpropertylist'
|
2
|
-
require 'lagunitas'
|
3
|
-
module Lagunitas
|
4
|
-
class App
|
5
|
-
def initialize(path, root)
|
6
|
-
@path = path
|
7
|
-
@root = root
|
8
|
-
end
|
9
|
-
def name
|
10
|
-
@info['CFBundleName']
|
11
|
-
end
|
12
|
-
def mobileprovision
|
13
|
-
return if !mobileprovision?
|
14
|
-
@mobileprovision ||= CFPropertyList.native_types CFPropertyList::List.new(:data => `security cms -D -i "#{File.join @path, 'embedded.mobileprovision'}"`).value
|
15
|
-
end
|
16
|
-
def mobileprovision?
|
17
|
-
return true if @mobileprovision
|
18
|
-
File.file? File.join @path, 'embedded.mobileprovision'
|
19
|
-
end
|
20
|
-
def devices
|
21
|
-
mobileprovision['ProvisionedDevices'] if mobileprovision
|
22
|
-
end
|
23
|
-
def distribution_name
|
24
|
-
# mobileprovision['DeveloperCertificates'] if mobileprovision
|
25
|
-
"#{mobileprovision['Name']}: #{mobileprovision['TeamName']}" if mobileprovision
|
26
|
-
end
|
27
|
-
def metadata
|
28
|
-
return if !metadata?
|
29
|
-
@metadata ||= CFPropertyList.native_types(CFPropertyList::List.new(file: File.join(@root, 'iTunesMetadata.plist')).value)
|
30
|
-
end
|
31
|
-
def metadata?
|
32
|
-
return true if @metadata
|
33
|
-
File.file? File.join @root, 'iTunesMetadata.plist'
|
34
|
-
end
|
35
|
-
def release_type
|
36
|
-
@release_type ||= begin
|
37
|
-
if mobileprovision?
|
38
|
-
if devices
|
39
|
-
'adhoc'
|
40
|
-
else
|
41
|
-
'inhouse'
|
42
|
-
end
|
43
|
-
elsif metadata?
|
44
|
-
'store'
|
45
|
-
else
|
46
|
-
'adhoc'
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
class IPA
|
52
|
-
def root_path
|
53
|
-
contents
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
data/lib/lagunitas.patch.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'lagunitas'
|
2
|
-
module Lagunitas
|
3
|
-
class App
|
4
|
-
def initialize(path, root)
|
5
|
-
@path = path
|
6
|
-
@root = root
|
7
|
-
end
|
8
|
-
def icons
|
9
|
-
icons = []
|
10
|
-
info['CFBundleIcons']['CFBundlePrimaryIcon']['CFBundleIconFiles'].each do |name|
|
11
|
-
icons << get_image(name)
|
12
|
-
icons << get_image("#{name}.png")
|
13
|
-
icons << get_image("#{name}@2x.png")
|
14
|
-
icons << get_image("#{name}@3x.png")
|
15
|
-
end
|
16
|
-
icons.delete_if { |i| !i }
|
17
|
-
rescue
|
18
|
-
nil
|
19
|
-
end
|
20
|
-
def get_image(name)
|
21
|
-
path = File.join @path, name
|
22
|
-
return nil unless File.file? path
|
23
|
-
dimensions = Pngdefry.dimensions(path)
|
24
|
-
{
|
25
|
-
path: path,
|
26
|
-
width: dimensions.first,
|
27
|
-
height: dimensions.last
|
28
|
-
}
|
29
|
-
rescue Errno::ENOENT
|
30
|
-
nil
|
31
|
-
end
|
32
|
-
end
|
33
|
-
class IPA
|
34
|
-
def app
|
35
|
-
@app ||= App.new app_path, root_path
|
36
|
-
end
|
37
|
-
def contents
|
38
|
-
@contents ||= begin
|
39
|
-
tmp_path = "tmp/lagunitas-#{SecureRandom.hex}"
|
40
|
-
Zip::ZipFile.open @path do |zip_file|
|
41
|
-
zip_file.each do |f|
|
42
|
-
f_path = File.join tmp_path, f.name
|
43
|
-
FileUtils.mkdir_p File.dirname f_path
|
44
|
-
zip_file.extract f, f_path unless File.file? f_path
|
45
|
-
end
|
46
|
-
end
|
47
|
-
tmp_path
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|