xbean 0.0.1 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/bin/xbean +0 -3
- data/lib/bean/config.rb +23 -13
- data/lib/bean/export_options_plist.rb +11 -8
- data/lib/bean/runner.rb +16 -7
- data/lib/bean/table.rb +4 -4
- data/lib/bean/xcode_tool.rb +0 -3
- data/lib/bean/xcodebuild.rb +16 -6
- data/lib/test.rb +7 -2
- data/xbean-0.0.1.gem +0 -0
- data/xbean.gemspec +2 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26ac19803a7f7675ca9a9b1f4821ff44ffdb28c8
|
4
|
+
data.tar.gz: 927a479f19f1bb8a124c70fe05cc8e5a3ef42c71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66b91aa64613428eb9cc529fa1fdf5110ef3f55928199270ef08a33947a3795268aff596e6f43507f2329805150a0a859cdf19481805e02b5b9c0072b22e4698
|
7
|
+
data.tar.gz: 1f84dfcdc0d81ba0668ff41b5162692f63f874c5ad87a95a7bb5c9d5151513bb83d7065542dae3ebc085e9b3fa4376265c5e159a3869f7e2d4cefa1e10b0901c
|
data/.gitignore
ADDED
data/bin/xbean
CHANGED
data/lib/bean/config.rb
CHANGED
@@ -13,21 +13,21 @@ module Workspace
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def method_missing(m, *args)
|
16
|
-
# puts "config ---- method: #{m.to_s}, args: #{
|
16
|
+
# puts "config ---- method: #{m.to_s}, args: #{@configs}"
|
17
17
|
name = m.to_s
|
18
18
|
name = m.to_s.delete('=') if m.to_s =~ /=$/
|
19
19
|
return unless %w(workspace scheme output_name compile_bitcode method signing_style team_id thinning).include? name
|
20
20
|
if m.to_s =~ /=$/
|
21
|
-
add_configuration(
|
21
|
+
add_configuration(name, args.first)
|
22
22
|
else
|
23
|
-
|
23
|
+
get_configuration(m.to_s)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
# The ExportOptions Plist object.
|
28
28
|
|
29
29
|
def export_options_plist
|
30
|
-
get_team_identifier
|
30
|
+
return nil unless get_team_identifier
|
31
31
|
|
32
32
|
plist = ExportOptions::Plist.new(@name)
|
33
33
|
@configs.each do | key, value |
|
@@ -37,14 +37,16 @@ module Workspace
|
|
37
37
|
plist.send key.to_sym, value
|
38
38
|
# end
|
39
39
|
end
|
40
|
-
|
40
|
+
File.join(Workspace::TMP_DIR, "#{@name.to_s.capitalize}-ExportOptions.plist")
|
41
41
|
end
|
42
42
|
|
43
43
|
def export_path
|
44
|
-
File.join(Dir.pwd, "#{self.scheme}")
|
44
|
+
path = File.join(Dir.pwd, "#{self.scheme}-Archived")
|
45
45
|
if self.output_name
|
46
|
-
|
46
|
+
path = File.join(Dir.pwd, "#{self.output_name}-Archived")
|
47
47
|
end
|
48
|
+
@configs[:exportPath] = path
|
49
|
+
return path
|
48
50
|
end
|
49
51
|
|
50
52
|
def to_s
|
@@ -54,13 +56,15 @@ module Workspace
|
|
54
56
|
private
|
55
57
|
|
56
58
|
def get_team_identifier
|
57
|
-
|
58
|
-
|
59
|
-
|
59
|
+
application_path = File.join(File.expand_path("#{scheme}.xcarchive", Workspace::TMP_DIR), "Products/Applications")
|
60
|
+
# puts application_path.red
|
61
|
+
return nil unless File.exist?(application_path)
|
62
|
+
mobileprovision = File.join(Dir.glob("#{application_path}/*.app").first, 'embedded.mobileprovision')
|
63
|
+
return nil unless File.exist?(mobileprovision)
|
64
|
+
|
65
|
+
# puts "mobileprovision: #{mobileprovision}".red
|
60
66
|
team_id = XcodeTool::Mobileprovision.new(mobileprovision).team_identifier
|
61
|
-
|
62
|
-
@configs = {teamID: team_id.chomp}
|
63
|
-
end
|
67
|
+
@configs[:teamID] = team_id.chomp
|
64
68
|
end
|
65
69
|
|
66
70
|
def add_configuration(key, value)
|
@@ -68,5 +72,11 @@ module Workspace
|
|
68
72
|
key = key.gsub(/id|Id/, 'ID') if key =~ /id|Id/
|
69
73
|
@configs[key.to_sym] = value
|
70
74
|
end
|
75
|
+
|
76
|
+
def get_configuration(key)
|
77
|
+
key = key.sub(/_\w/) { |e| e.delete('_').upcase } if key.index('_')
|
78
|
+
key = key.gsub(/id|Id/, 'ID') if key =~ /id|Id/
|
79
|
+
@configs[key.to_sym]
|
80
|
+
end
|
71
81
|
end
|
72
82
|
end
|
@@ -4,9 +4,6 @@ module ExportOptions
|
|
4
4
|
class Plist
|
5
5
|
ALL_KEYS = %w(compileBitcode method signingStyle teamID thinning)
|
6
6
|
|
7
|
-
# The ExportOptions plist file
|
8
|
-
attr_reader :export_options_plist_file
|
9
|
-
|
10
7
|
def initialize(name)
|
11
8
|
@export_options_plist_file = File.join(Workspace::TMP_DIR, "#{name.to_s.capitalize}-ExportOptions.plist")
|
12
9
|
|
@@ -37,12 +34,10 @@ module ExportOptions
|
|
37
34
|
undef_method m unless m.to_s =~ /^__|send|method_missing|export_options_plist_file|object_id|response_to?/
|
38
35
|
end
|
39
36
|
|
40
|
-
def self.exist?(name)
|
41
|
-
ALL_KEYS.include?(name.to_s)
|
42
|
-
# puts ALL_KEYS.include?(name.to_s)
|
43
|
-
end
|
44
|
-
|
45
37
|
def method_missing(m, *args)
|
38
|
+
if m.to_s == 'export_options_plist_file'
|
39
|
+
return @export_options_plist_file
|
40
|
+
end
|
46
41
|
# puts "Plist call #{m.to_s}(#{args.join(',')})"
|
47
42
|
return unless ALL_KEYS.include? m.to_s
|
48
43
|
|
@@ -50,5 +45,13 @@ module ExportOptions
|
|
50
45
|
plist_buddy.send m.to_sym, args.join(', ')
|
51
46
|
end
|
52
47
|
|
48
|
+
def self.exist?(name)
|
49
|
+
ALL_KEYS.include?(name.to_s)
|
50
|
+
# puts ALL_KEYS.include?(name.to_s)
|
51
|
+
end
|
52
|
+
|
53
|
+
def export_options_plist_file
|
54
|
+
@export_options_plist_file
|
55
|
+
end
|
53
56
|
end
|
54
57
|
end
|
data/lib/bean/runner.rb
CHANGED
@@ -6,15 +6,24 @@ require_relative 'colored'
|
|
6
6
|
|
7
7
|
module Bean
|
8
8
|
class Runner
|
9
|
-
def
|
10
|
-
|
11
|
-
puts "Beanfile
|
9
|
+
def init
|
10
|
+
beanfile = Workspace::BEAN_FILE
|
11
|
+
return puts "Beanfile already exist." if File.exist?(beanfile)
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
File.open(beanfile, 'w') do |f|
|
14
|
+
f.write <<-"..."
|
15
|
+
bean :dev do |a|
|
16
|
+
a.workspace = '<Your Workspace>'
|
17
|
+
a.scheme = '<Your scheme>'
|
18
|
+
end
|
19
|
+
...
|
16
20
|
end
|
17
|
-
|
21
|
+
end
|
22
|
+
|
23
|
+
def exec(name)
|
24
|
+
return init if name.to_s == 'init'
|
25
|
+
bean_file = Workspace::BEAN_FILE
|
26
|
+
return puts "Beanfile does not exist.".red unless Workspace.bean?
|
18
27
|
Action::BeanAction.new(bean_file).run(name)
|
19
28
|
end
|
20
29
|
end
|
data/lib/bean/table.rb
CHANGED
@@ -5,7 +5,7 @@ class Table
|
|
5
5
|
|
6
6
|
def initialize(map)
|
7
7
|
@map = map
|
8
|
-
@left_dash =
|
8
|
+
@left_dash = 20
|
9
9
|
@right_dash = 20
|
10
10
|
end
|
11
11
|
|
@@ -23,11 +23,11 @@ class Table
|
|
23
23
|
|
24
24
|
def header
|
25
25
|
max
|
26
|
-
left = @left_dash -
|
27
|
-
right = @right_dash -
|
26
|
+
left = @left_dash - 6
|
27
|
+
right = @right_dash - 12
|
28
28
|
|
29
29
|
r = line
|
30
|
-
r << "|
|
30
|
+
r << "| Option#{indent(left)} | Configuraton#{indent(right)} |\n"
|
31
31
|
r << line
|
32
32
|
end
|
33
33
|
|
data/lib/bean/xcode_tool.rb
CHANGED
@@ -14,7 +14,6 @@ module XcodeTool
|
|
14
14
|
def method_missing(m, *args)
|
15
15
|
# puts "PlistBuddy call #{m.to_s}, args: #{args}"
|
16
16
|
# return unless m.to_s.include?('=')
|
17
|
-
|
18
17
|
key = m.to_s
|
19
18
|
format_plist(key, args)
|
20
19
|
end
|
@@ -38,8 +37,6 @@ module XcodeTool
|
|
38
37
|
# If key contain `id` or `Id`, replace it with `ID`
|
39
38
|
key = key.gsub(/id|Id/, 'ID') if key =~ /id|Id/
|
40
39
|
|
41
|
-
puts "#{key} #{args}"
|
42
|
-
|
43
40
|
_args = args.join().split(", ")
|
44
41
|
key = key.delete('=') if key.index('=')
|
45
42
|
name = exit?(key) ? 'Set' : 'Add'
|
data/lib/bean/xcodebuild.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby -W
|
2
2
|
|
3
3
|
require_relative 'colored'
|
4
|
+
require 'time'
|
4
5
|
|
5
6
|
module XcodeBuilder
|
6
7
|
class Archiver
|
7
8
|
def self.archive(config)
|
8
|
-
|
9
|
+
|
9
10
|
workspace = config.workspace
|
10
11
|
scheme = config.scheme
|
11
12
|
export_path = config.export_path
|
@@ -13,18 +14,27 @@ module XcodeBuilder
|
|
13
14
|
Dir.mkdir(tmp_dir) unless Dir.exist?(tmp_dir)
|
14
15
|
|
15
16
|
# The archivePath is /your/project/root/.Tmp/scheme.xcarchive
|
16
|
-
|
17
17
|
archive_path = File.expand_path("#{scheme}.xcarchive", tmp_dir)
|
18
18
|
archive_command = "xcodebuild -workspace #{workspace} -scheme #{scheme} clean archive -archivePath #{archive_path}"
|
19
|
+
|
20
|
+
begin_time = Time.now
|
21
|
+
|
19
22
|
# puts archive_command.red
|
20
|
-
|
23
|
+
return Workspace.clear unless system archive_command
|
24
|
+
|
25
|
+
# If the ExportOptionsPlist does not exist, just return.
|
26
|
+
return unless export_option_plist = config.export_options_plist
|
27
|
+
|
28
|
+
# Print the config
|
29
|
+
puts config
|
30
|
+
|
21
31
|
export_command = "xcodebuild -exportArchive -archivePath #{archive_path} -exportPath #{export_path} -exportOptionsPlist #{export_option_plist}"
|
22
32
|
# puts export_command.red
|
23
|
-
|
24
|
-
system archive_command
|
25
|
-
system export_command
|
33
|
+
return Workspace.clear unless system export_command
|
26
34
|
|
27
35
|
Workspace.clear
|
36
|
+
duration = (Time.now - begin_time) / 60
|
37
|
+
puts "🎉🎉🎉 Done. It takes you #{duration.to_i.to_s.yellow} min."
|
28
38
|
end
|
29
39
|
|
30
40
|
end
|
data/lib/test.rb
CHANGED
@@ -1,13 +1,18 @@
|
|
1
1
|
#!/usr/bin/env ruby -W
|
2
2
|
|
3
|
-
require_relative '
|
3
|
+
require_relative 'xbean'
|
4
4
|
|
5
5
|
# plist = ExportOptions::Plist.new
|
6
6
|
# plist.team_id = 'TeamIDDDD'
|
7
7
|
# plist.user_id = 'user', 'string'
|
8
8
|
# plist.compile_bitcode = 'true', 'bool'
|
9
9
|
|
10
|
-
# path = "/Users/huluobo/Developer/xiaoDian/Example/xiaoDian-Example.xcarchive/Products/Applications/
|
10
|
+
# path = "/Users/huluobo/Developer/xiaoDian/Example/.Tmp/xiaoDian-Example.xcarchive/Products/Applications/xiaoDian-Example.app/embedded.mobileprovision"
|
11
|
+
|
12
|
+
# path = "/Users/huluobo/Developer/xiaoDian/Example/.Tmp/xiaoDian-Example.xcarchive/Products/Applications/xiaoDian_Example.app/embedded.mobileprovision"
|
13
|
+
|
14
|
+
# puts path
|
15
|
+
|
11
16
|
# m = XcodeTool::Mobileprovision.new(path)
|
12
17
|
# puts m.team_identifier
|
13
18
|
# m.team_name
|
data/xbean-0.0.1.gem
ADDED
Binary file
|
data/xbean.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'xbean'
|
3
|
-
s.version = '0.0.
|
3
|
+
s.version = '0.0.5'
|
4
4
|
s.date = '2018-07-16'
|
5
5
|
s.summary = "Archiver for iOS."
|
6
|
-
s.description = "
|
6
|
+
s.description = "A tool to Arcive iOS App."
|
7
7
|
s.authors = ["jewelz"]
|
8
8
|
s.email = 'hujewelz@163.com'
|
9
9
|
s.files = `git ls-files -z`.split("\x0").reject do |f|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xbean
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jewelz
|
@@ -10,13 +10,14 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2018-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description: A tool to Arcive iOS App.
|
14
14
|
email: hujewelz@163.com
|
15
15
|
executables:
|
16
16
|
- xbean
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- ".gitignore"
|
20
21
|
- README.md
|
21
22
|
- bin/xbean
|
22
23
|
- lib/bean/action.rb
|
@@ -30,6 +31,7 @@ files:
|
|
30
31
|
- lib/bean/xcodebuild.rb
|
31
32
|
- lib/test.rb
|
32
33
|
- lib/xbean.rb
|
34
|
+
- xbean-0.0.1.gem
|
33
35
|
- xbean.gemspec
|
34
36
|
homepage: https://github.com/hujewelz/bean.git
|
35
37
|
licenses:
|