cocoapods-vemars 0.0.9 → 0.0.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a851c66bb67131db1792030b809e4e1e67efabe6f572773ad7dafb1074b44ad9
4
- data.tar.gz: 37e96f45ae54e967b493d77c74862524e0d4dc2292dc4cddc24cf9c23011d3ae
3
+ metadata.gz: 7d81a66c150510648e25fbe3531441497c12747898eb9de3275070cfb718cc6d
4
+ data.tar.gz: 3b1258d0d7d2d94e7971ead3d0ef833454dea24d4836c1ebe04caa76c90f7d24
5
5
  SHA512:
6
- metadata.gz: ea27b65735cc062c672fd4c40beb42704c0445f9878a577c2d0ae28dea4052dc88edb1e1bf0d51c67cf36feba19f94cf93eb67a01b5d857df9bb8b1ec67cbcbf
7
- data.tar.gz: c579291d9c2719de1135781d658634190d88cca41042df43a82fb86fd79e980e18548bd2bfef179549e39cc57f9daca7038017059396c743351da8b0d3bf5cb5
6
+ metadata.gz: e542c8c246e666bc73b82a22c10b4cb841ec0f06c00d35e5d4c203f75b76e9c51c5a56c29cba05c7f32afc208bec87c8448a8a1d12ad5db3ad17c00c9ced467e
7
+ data.tar.gz: d5937b2e36900c422439246144762ade9c1d757c1057e9272d41d7ddebfd95588db84dc3453ed8d5c8c25f767c55733486335bff79f1af000d18121e5f359a84
data/Gemfile CHANGED
@@ -9,7 +9,8 @@ gem 'concurrent-ruby', require: 'concurrent'
9
9
  gem 'xcodeproj'
10
10
  gem 'json_pure'
11
11
  gem 'cocoapods'
12
- # gem 'json'
12
+ gem 'rubyzip', '>= 1.0.0'
13
+ gem 'open-uri'
13
14
  group :debug do
14
15
  gem 'ruby-debug-ide'
15
16
  gem 'debase', '0.2.5.beta2'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cocoapods-vemars (0.0.9)
4
+ cocoapods-vemars (0.0.10)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -78,6 +78,7 @@ GEM
78
78
  nanaimo (0.3.0)
79
79
  nap (1.1.0)
80
80
  netrc (0.11.0)
81
+ open-uri (0.1.0)
81
82
  plist (3.6.0)
82
83
  public_suffix (4.0.6)
83
84
  rake (13.0.6)
@@ -85,6 +86,7 @@ GEM
85
86
  ruby-debug-ide (0.7.2)
86
87
  rake (>= 0.8.1)
87
88
  ruby-macho (1.4.0)
89
+ rubyzip (2.3.2)
88
90
  thread_safe (0.3.6)
89
91
  typhoeus (1.4.0)
90
92
  ethon (>= 0.9.0)
@@ -108,10 +110,12 @@ DEPENDENCIES
108
110
  concurrent-ruby
109
111
  debase (= 0.2.5.beta2)
110
112
  json_pure
113
+ open-uri
111
114
  plist (~> 3.2)
112
115
  rake
113
116
  rexml
114
117
  ruby-debug-ide
118
+ rubyzip (>= 1.0.0)
115
119
  xcodeproj
116
120
 
117
121
  BUNDLED WITH
@@ -3,6 +3,8 @@ require_relative '../services/patcher'
3
3
  require_relative '../services/tailor'
4
4
  require_relative 'basicInfo'
5
5
  require_relative '../services/renamer'
6
+ require 'zip'
7
+ require 'open-uri'
6
8
  require 'json/pure'
7
9
  module Pod
8
10
 
@@ -15,13 +17,14 @@ module Pod
15
17
  attr_reader :service_url
16
18
 
17
19
  attr_accessor :components_details
18
- attr_accessor :source
20
+ attr_accessor :sources
21
+ attr_accessor :demo_tag
19
22
 
20
23
  def project_folder
21
24
  File.join(Dir.pwd, "Project")
22
25
  end
23
26
 
24
- def initialize(app_key, components, config_json, version=nil, bundle_id=nil, name='', language='objc', git_url, service_url)
27
+ def initialize(app_key, components, config_json, version=nil, bundle_id=nil, name='', language='objc', git_url, service_url,sources)
25
28
  @language = language
26
29
  @basicInfo = BasicInfo.new(app_key, bundle_id, name, version)
27
30
  @git_url = git_url
@@ -29,12 +32,13 @@ module Pod
29
32
  @selected_components = components | (language == 'swift' ? %w[OneKit SwiftOneKit] : ['OneKit'])
30
33
  @components_details = []
31
34
  @service_url = service_url
35
+ @sources = sources
32
36
  end
33
37
 
34
38
  def generate
35
39
  puts "generate project..."
36
- clone_template_project
37
40
  collect_components
41
+ clone_template_project
38
42
  Dir.chdir(basicInfo.name) do
39
43
  language_switch
40
44
  tailor_demos
@@ -55,7 +59,7 @@ module Pod
55
59
  collect_components
56
60
  Dir.chdir(podfile_dir) do
57
61
  construct_plist
58
- patcher = Patcher.new(podfile_dir, @basicInfo.version, @components_details, @source, @git_url)
62
+ patcher = Patcher.new(podfile_dir, @basicInfo.version, @components_details, @sources, @git_url, @demo_tag)
59
63
  patcher.execute
60
64
  end
61
65
  end
@@ -65,9 +69,32 @@ module Pod
65
69
  if File.directory?(basicInfo.name) || File.file?(basicInfo.name)
66
70
  system("rm -rf #{basicInfo.name}")
67
71
  end
72
+ if git_url.end_with?(".git")
73
+ cmd = ""
74
+ if @demo_tag.nil?
75
+ cmd = "git clone #{git_url} #{basicInfo.name}"
76
+ else
77
+ cmd = "git clone #{git_url} #{basicInfo.name} -b #{@demo_tag} --config advice.detachedHead=false"
78
+ end
79
+ system(cmd)
80
+ else
81
+ destination = basicInfo.name
82
+ FileUtils.mkdir_p(destination)
83
+ content = URI.open(git_url)
84
+
85
+ Zip::File.open_buffer(content) do |zip|
86
+ zip.each do |f|
87
+ fname = f.name
88
+ if fname.start_with?("ve_Template_iOS")
89
+ paths = fname.split("/")
90
+ fname = fname.sub(paths[0],"")
91
+ end
92
+ fpath = File.join(destination, fname)
93
+ zip.extract(f, fpath) unless File.exist?(fpath)
94
+ end
95
+ end
68
96
 
69
- cmd = "git clone #{git_url} #{basicInfo.name}"
70
- system(cmd)
97
+ end
71
98
  end
72
99
 
73
100
  def language_switch
@@ -87,18 +114,25 @@ module Pod
87
114
  def collect_components
88
115
  components_api = Components_api.new(@basicInfo.version,@service_url)
89
116
  all_components = components_api.getComponents
90
- @source = components_api.source
91
117
  @selected_components.each do |com|
92
118
  existed_com = all_components.find { |acom|
93
119
  acom.name == com
94
120
  }
95
121
  @components_details.append existed_com unless existed_com.nil?
96
122
  end
123
+
124
+ demo_com = all_components.find { |acom|
125
+ acom.name == "ve_Template_iOS"
126
+ }
127
+
128
+ if !demo_com.nil?
129
+ @demo_tag = demo_com.version
130
+ end
97
131
 
98
132
  end
99
133
 
100
134
  def construct_podfile
101
- template = PodfileTemplate.new(@basicInfo.version, @components_details, @source)
135
+ template = PodfileTemplate.new(@basicInfo.version, @components_details, @sources)
102
136
 
103
137
  File.open('Podfile', "w") { |file| file.puts template.to_dsl }
104
138
  end
@@ -108,13 +142,20 @@ module Pod
108
142
  content = File.read(@config_json)
109
143
  json = JSON.parse(content)
110
144
  json["project_info"]["app_id"] = json["project_info"]["app_id"].to_s
111
- services = Hash.new
112
- if @selected_components.include? "BDHotfix"
113
- services["bdhotfix"] = { "dist_area" => "cn", "domain_name" => "", "debug" => true}
145
+ services = json["services"]
146
+ if @selected_components.include?("BDHotfix") && services.include?("hotfix")
147
+ hotfix = services["hotfix"]
148
+ hotfix["dist_area"] = "cn"
149
+ hotfix["debug"] = true
150
+ services["hotfix"] = hotfix
114
151
  end
115
- if @selected_components.include? "VEH5Kit"
116
- services["jsbridge_services"] = { "auth_domain" => "", "auth_enable" => false}
117
- services["gecko_services"] = { "platform_domain" => "", "pattern" => "", "gecko_channels" => [], "gecko_access_key" => ""}
152
+ if @selected_components.include?("VEH5Kit") && services.include?("h5")
153
+ h5 = services["h5"]
154
+ h5["auth_enable"] = false
155
+ h5["pattern"] = ""
156
+ h5["gecko_channels"] = []
157
+ h5["gecko_access_key"] = ""
158
+ services["h5"] = h5
118
159
  end
119
160
  json["services"] = services
120
161
  File.open(Dir.pwd + "/onekit-config.plist", 'w') { |file|
@@ -25,7 +25,8 @@ module Pod
25
25
  ['--config=CONFIG_PATH', 'config path of vemars.'],
26
26
  ['--service_url=SERVICE_URL', 'url of vemars CLI service.'],
27
27
  ['--git=GIT_URL', 'git url of demo repo'],
28
- ['--pod_repo_no_update', 'do not run pod repo update']
28
+ ['--pod_repo_no_update', 'do not run pod repo update'],
29
+ ['--sources','pod repos sources']
29
30
  ]
30
31
  options.concat(super.reject { |option, _| option == '--silent' })
31
32
  end
@@ -34,7 +35,7 @@ module Pod
34
35
  @name = argv.shift_argument
35
36
  @version = argv.shift_argument
36
37
  @language = argv.option('language', 'objc')
37
- git_url = argv.option('git', 'git@github.com:volcengine/ve_Template_iOS.git')
38
+ git_url = argv.option('git', 'https://github.com/volcengine/ve_Template_iOS.git')
38
39
  @silent = argv.flag?('silent', false)
39
40
  @repo_no_update = argv.flag?('pod_repo_no_update',false)
40
41
  @appkey = argv.option('appkey', '')
@@ -42,7 +43,8 @@ module Pod
42
43
  @selected_components = argv.option('com', "").split(',')
43
44
  @config_json = argv.option('config', '/onekit-config.json')
44
45
  service_url = argv.option('service_url',nil)
45
- @project = VemarsProject.new(@appkey, @selected_components, @config_json, @version, @bundle_id, @name, @language, git_url,service_url)
46
+ sources = argv.option('sources','https://github.com/volcengine/volcengine-specs.git,https://cdn.cocoapods.org/')
47
+ @project = VemarsProject.new(@appkey, @selected_components, @config_json, @version, @bundle_id, @name, @language, git_url,service_url,sources)
46
48
  super
47
49
  @additional_args = argv.remainder!
48
50
  end
@@ -22,7 +22,8 @@ module Pod
22
22
  ['--config=CONFIG_PATH', 'config path of vemars.'],
23
23
  ['--service_url=SERVICE_URL', 'url of vemars CLI service.'],
24
24
  ['--git=GIT_URL', 'git url of demo repo'],
25
- ['--pod_repo_no_update', 'do not run pod repo update']
25
+ ['--pod_repo_no_update', 'do not run pod repo update'],
26
+ ['--sources','pod repos sources']
26
27
  ]
27
28
  options.concat(super.reject { |option, _| option == '--silent' })
28
29
  end
@@ -33,9 +34,10 @@ module Pod
33
34
  @selected_components = argv.option('com', '').split(',')
34
35
  @config_json = argv.option('config', '/onekit-config.json')
35
36
  @repo_no_update = argv.flag?('pod_repo_no_update',false)
36
- git_url = argv.option('git', 'git@github.com:volcengine/ve_Template_iOS.git')
37
+ git_url = argv.option('git', 'https://github.com/volcengine/ve_Template_iOS.git')
37
38
  service_url = argv.option('service_url',nil)
38
- @project = VemarsProject.new(@appkey, @selected_components, @config_json, @baseline, git_url, service_url)
39
+ sources = argv.option('sources','https://github.com/volcengine/volcengine-specs.git,https://cdn.cocoapods.org/')
40
+ @project = VemarsProject.new(@appkey, @selected_components, @config_json, @baseline, git_url, service_url,sources)
39
41
  super
40
42
  @additional_args = argv.remainder!
41
43
  end
@@ -1,3 +1,3 @@
1
1
  module CocoapodsVemars
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.13"
3
3
  end
@@ -2,15 +2,15 @@ module Pod
2
2
  class PodfileTemplate
3
3
 
4
4
  attr_reader :componentsList
5
- attr_reader :source
5
+ attr_reader :sources
6
6
  attr_reader :baseline_version
7
7
 
8
8
  IOS_VERSION = '9.0'.freeze
9
9
 
10
- def initialize(baseline_version, componentsList, source)
10
+ def initialize(baseline_version, componentsList, sources)
11
11
  @baseline_version = baseline_version
12
12
  @componentsList = componentsList
13
- @source = source
13
+ @sources = sources
14
14
  end
15
15
 
16
16
  def to_dsl
@@ -21,7 +21,6 @@ module Pod
21
21
  #plugin 'cocoapods-vemars'
22
22
  install! 'cocoapods', :deterministic_uuids => false
23
23
 
24
- source 'https://cdn.cocoapods.org/'
25
24
  #{source_template}
26
25
 
27
26
  #{releasePod}
@@ -38,7 +37,8 @@ inhibit_all_warnings!
38
37
  end
39
38
 
40
39
  def source_template
41
- "source '#{source}'"
40
+ source_urls = sources.split(",")
41
+ "#{source_urls.map{ |url| "source '#{url}'"}.join("\n")}"
42
42
  end
43
43
 
44
44
  def releasePod
@@ -4,7 +4,7 @@ module Pod
4
4
  class Baselines_api
5
5
  include Concurrent::Async
6
6
 
7
- BASELINES_URL = 'https://poc-api.vemarsdev.com/mpaas/baseline/baselines'.freeze
7
+ BASELINES_URL = 'https://mars-fwk.vemarsdev.com/mpaas/baseline/baselines'.freeze
8
8
  attr_accessor :result
9
9
 
10
10
  public def initialize(url=BASELINES_URL)
@@ -5,7 +5,7 @@ module Pod
5
5
  class Components_api
6
6
  include Concurrent::Async
7
7
 
8
- COMPONENTS_URL = 'https://poc-api.vemarsdev.com/mpaas/baseline/baseline_config'.freeze
8
+ COMPONENTS_URL = 'https://mars-fwk.vemarsdev.com/mpaas/baseline/baseline_config'.freeze
9
9
 
10
10
  attr_reader :source
11
11
  attr_reader :baseline
@@ -13,7 +13,7 @@ module Pod
13
13
  attr_reader :podfile_dir
14
14
  attr_reader :template
15
15
 
16
- def initialize(podfile_dir, baseline, components_details, source, git_url)
16
+ def initialize(podfile_dir, baseline, components_details, source, git_url,demo_tag)
17
17
  @podfile_dir = podfile_dir
18
18
  @template = PodfileTemplate.new(baseline, components_details, source)
19
19
  @components_details = components_details
@@ -21,6 +21,7 @@ module Pod
21
21
  puts git_url
22
22
  @hasInjectedSource = false
23
23
  @hasInjectedVemarsPods = false
24
+ @demo_tag = demo_tag
24
25
  end
25
26
 
26
27
  def execute
@@ -77,7 +78,11 @@ module Pod
77
78
  end
78
79
 
79
80
  def clone_project
80
- system("git clone #{@git_url} ./.vemars")
81
+ if @demo_tag.nil?
82
+ system("git clone #{@git_url} ./.vemars")
83
+ else
84
+ system("git clone #{@git_url} ./.vemars -b #{@demo_tag} --config advice.detachedHead=false")
85
+ end
81
86
  system("mv ./.vemars/DevPods ./DevPods")
82
87
  end
83
88
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-vemars
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - huangbomao@bytedance.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-24 00:00:00.000000000 Z
11
+ date: 2021-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler