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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d7d8f1096ca9658b373dc9b9031fc9c0824fa78f
4
- data.tar.gz: 1ee4822c0cfe159e32ec339387905d275629e232
3
+ metadata.gz: 26ac19803a7f7675ca9a9b1f4821ff44ffdb28c8
4
+ data.tar.gz: 927a479f19f1bb8a124c70fe05cc8e5a3ef42c71
5
5
  SHA512:
6
- metadata.gz: 3f4fd03c2eb9d1c3b81f6d6e5ca7ba48591ca7de16e5ee73c0942db19704f053123a8c381e76f39a9bb60cd94cdb89f9b9e2c425c4de496797f061501231c21f
7
- data.tar.gz: 1cf7a15409c6225579128eccbdd7c8ab561cd5d4032b410f6fd3aef7690d9d9815503d3f01b0260397bd74bc225e38cf735b0802a861bf16ffc79ef5261834c9
6
+ metadata.gz: 66b91aa64613428eb9cc529fa1fdf5110ef3f55928199270ef08a33947a3795268aff596e6f43507f2329805150a0a859cdf19481805e02b5b9c0072b22e4698
7
+ data.tar.gz: 1f84dfcdc0d81ba0668ff41b5162692f63f874c5ad87a95a7bb5c9d5151513bb83d7065542dae3ebc085e9b3fa4376265c5e159a3869f7e2d4cefa1e10b0901c
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ .Tmp
2
+ *.gem
3
+ Beanfile
4
+ .DS_Store
data/bin/xbean CHANGED
@@ -5,9 +5,6 @@ require 'xbean'
5
5
 
6
6
  if ARGV.length > 0
7
7
  action = ARGV.first
8
- # file = File.join(Dir.pwd, 'aFile')
9
- # puts file
10
-
11
8
  Bean::Runner.new.exec(action)
12
9
 
13
10
  end
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: #{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(m.to_s.delete('='), args.first)
21
+ add_configuration(name, args.first)
22
22
  else
23
- @configs[m.to_sym]
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
- return plist
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
- return File.join(Dir.pwd, "#{self.output_name}")
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
- mobileprovision = File.join(File.expand_path("#{scheme}.xcarchive", Workspace::TMP_DIR), "Products/Applications/#{scheme}.app/embedded.mobileprovision")
58
- return unless File.exist?(mobileprovision)
59
- # puts "mobileprovision: #{mobileprovision}"
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
- if team_id != ""
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 exec(name)
10
- bean_file = Workspace::BEAN_FILE
11
- puts "Beanfile: #{bean_file}"
9
+ def init
10
+ beanfile = Workspace::BEAN_FILE
11
+ return puts "Beanfile already exist." if File.exist?(beanfile)
12
12
 
13
- unless Workspace.bean?
14
- puts "BeanFile does not exist.".red
15
- return
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 = 10
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 - 3
27
- right = @right_dash - 5
26
+ left = @left_dash - 6
27
+ right = @right_dash - 12
28
28
 
29
29
  r = line
30
- r << "| Key#{indent(left)} | Value#{indent(right)} |\n"
30
+ r << "| Option#{indent(left)} | Configuraton#{indent(right)} |\n"
31
31
  r << line
32
32
  end
33
33
 
@@ -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'
@@ -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
- puts config
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
- export_option_plist = config.export_options_plist.export_options_plist_file
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 'bean'
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/xiaoDian_Example.app/embedded.mobileprovision"
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.1'
3
+ s.version = '0.0.5'
4
4
  s.date = '2018-07-16'
5
5
  s.summary = "Archiver for iOS."
6
- s.description = "An Arciver tool for iOS."
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.1
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: An Arciver tool for iOS.
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: