cocoapods-byte-csjm 0.0.4 → 0.0.6

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
  SHA256:
3
- metadata.gz: 374c780bde27274f76af08f94bf9dc0bc2697e37877c6f8a781b68a5368da3d5
4
- data.tar.gz: d04034a4b6ed01528493a7a7f06498277f3a9ec41f26dc7c7b7e11a3743f6c07
3
+ metadata.gz: db3d1cc60a57737f5f18b7cdd3429e77907e9485d088987f1525d9c02567cc12
4
+ data.tar.gz: 30aa01483e4e96849f33594af076073a23396e6a8a236eae64ccc263122640dc
5
5
  SHA512:
6
- metadata.gz: 421a89a93612e67f18d0658801cf32a74c20d0262a01b17ece8b5daa25135e5451ef99175b519fe52131acb9a4c45efb07912d35f25d4b795d64f6d0ace9e14d
7
- data.tar.gz: '08c8478bcce199997012f480098317d5979311932e7f0b7730639d014f628a342beab1ba465b612e9b956f80493764e33572b72f4a730c8a2ec2d401604222a5'
6
+ metadata.gz: f97a785c0dd789e00a029bfe94a2c3eb68326bc2605ea6560fe00576710714b8f84e91490f083dea2087bad7474940ccfa27ef70790ac8d447db4f613c56d785
7
+ data.tar.gz: 352e40cca23eea2989716e841115e2d255c401b3efd5e434e13df077de3aae84b5375d85c4d13ba1ccdc7cb3ff245f01445a42f983d5ebd450c713834d722f4e
Binary file
Binary file
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.version = CocoapodsByteCsjm::VERSION
9
9
  spec.authors = ['zhangtianhao.1230@bytedance.com']
10
10
  spec.email = ['zhangtianhao.1230@bytedance.com']
11
- spec.description = 'a plugin for csjm'
11
+ # spec.description = 'a plugin for csjm'
12
12
  spec.summary ='a plugin for csjm'
13
13
  spec.homepage = 'https://github.com/EXAMPLE/cocoapods-byte-csjm'
14
14
  spec.license = 'MIT'
@@ -1,5 +1,5 @@
1
1
  module CocoapodsByteCsjm
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.6"
3
3
  class Version
4
4
  def self.version
5
5
  VERSION
@@ -8,6 +8,12 @@ require "thread"
8
8
  require_relative 'net'
9
9
  require 'xcodeproj'
10
10
  require 'json'
11
+ require 'cocoapods/command/update'
12
+ require 'time'
13
+ require 'open3'
14
+
15
+
16
+
11
17
 
12
18
 
13
19
  module CSJMPlugin
@@ -17,6 +23,23 @@ module CSJMPlugin
17
23
  yield(recoder) if block_given?
18
24
  end
19
25
  end
26
+
27
+ def CSJMPlugin.update
28
+ puts "Checking for updates..."
29
+
30
+ # output = system('gem update cocoapods-byte-csjm')
31
+
32
+
33
+ command = 'gem install cocoapods-byte-csjm'
34
+ stdout, stderr, status = Open3.capture3(command)
35
+
36
+ if status.success?
37
+ puts "Gem安装成功"
38
+ else
39
+ puts "Gem安装失败"
40
+ puts "错误信息:#{stderr}"
41
+ end
42
+ end
20
43
  end
21
44
 
22
45
  module GM
@@ -443,7 +466,6 @@ module GM
443
466
  } if gm_spec
444
467
  ## 网络请求
445
468
  response_data = request_adapter gm_spec.spec.version.version, adn_info_list
446
-
447
469
  result = GM::SpecificationInfo.get_specfication response_data
448
470
  result.each{|item|
449
471
 
@@ -500,6 +522,7 @@ module GM
500
522
  end
501
523
 
502
524
  def self.get_package_name
525
+
503
526
  project_path = Pod::Config.instance.project_root
504
527
  # pattern = File.join(project_path, '*.xcodeproj') # 匹配所有子目录下的 .xcodeproj 文件
505
528
  # xcodeproj_path = Dir.glob(pattern).first
@@ -521,12 +544,17 @@ module GM
521
544
 
522
545
  def self.request_adapter(m_version, adn_list)
523
546
 
524
- package_name = get_package_name
547
+ package_name = ['com.bytedance.gromore-inhouse'] ##get_package_name
525
548
  body = Hash["package_name"=>package_name, "mediation_version"=>m_version, "os_type"=>"ios", "list"=>adn_list]
526
549
  Pod::UserInterface.section '[DEBUG]CSJM plugin Network request data' do
527
550
  puts "请求信息:#{body}"
528
551
  end
552
+ config_time_start = (Time.now.to_f * 1000).to_i
529
553
  data = GM::Network.request_adapter(body)
554
+ config_time_end = (Time.now.to_f * 1000).to_i
555
+ ## 埋点信息
556
+ push_track config_time_start ,config_time_end ,data,m_version
557
+
530
558
  if data["code"] == "PG0000"
531
559
  ## 请求adn数目和返回adapter 个数不一致时进行报错处理
532
560
  result = data["data"]
@@ -552,6 +580,24 @@ module GM
552
580
  end
553
581
  end
554
582
 
583
+ def self.push_track(config_start_time, config_end_time, response_data, m_version)
584
+ config_duration = config_end_time - config_start_time
585
+ package_name = get_package_name
586
+ event_extra = Hash["package_ids"=>package_name, "mediation_version"=>m_version, "os"=>"ios", "config_time_start" => config_start_time,"config_time_end" => config_end_time,"config_duration"=>config_duration,"response"=>response_data, "plugin_version" => CocoapodsByteCsjm::Version.version]
587
+ event_extra = event_extra.to_json
588
+ stats_list = Array.new << Hash["conn_type" => 1, "event_id" => "3C0BA297-0C19-4F68-949A-3196B6F0B895", "timestamp" =>(Time.now.to_f * 1000).to_i ,"type" => "auto_tools", "event_extra" => event_extra]
589
+ body = Hash["ts" =>Time.now.to_i, "stats_list" => stats_list]
590
+ # Pod::UserInterface.section '[DEBUG]CSJM plugin Network request data' do
591
+ # puts "埋点信息:#{body}"
592
+ # end
593
+ data = GM::Network.push_track(body)
594
+ if data["code"] == "20000"
595
+ ## 埋点成功. 目前什么也不做
596
+ else
597
+ ## 埋点失败
598
+ end
599
+ end
600
+
555
601
  def self.is_update?(value)
556
602
  is_auto_update?(value) || is_stable_update?(value)
557
603
  end
@@ -665,7 +711,11 @@ module Pod
665
711
 
666
712
  alias_method :original_plugin, :plugin
667
713
  def plugin(name, options = {})
668
- GM::Recorder.instance.set_plugin_load true if name == 'cocoapods-byte-csjm'
714
+ if name == 'cocoapods-byte-csjm'
715
+ GM::Recorder.instance.set_plugin_load true
716
+ CSJMPlugin.update
717
+ end
718
+
669
719
  original_plugin(name, options)
670
720
  end
671
721
  end
@@ -31,5 +31,9 @@ module GM
31
31
  def Network.request_adapter(body)
32
32
  data = post("https://www.csjplatform.com/union_pangle/api/sdk_adapter/query",body)
33
33
  end
34
+
35
+ def Network.push_track(body)
36
+ data = post("https://gromore.pangolin-sdk-toutiao.com/api/ad/union/mediation/stats/",body)
37
+ end
34
38
  end
35
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-byte-csjm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - zhangtianhao.1230@bytedance.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-03 00:00:00.000000000 Z
11
+ date: 2023-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods
@@ -58,7 +58,7 @@ dependencies:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
- description: a plugin for csjm
61
+ description:
62
62
  email:
63
63
  - zhangtianhao.1230@bytedance.com
64
64
  executables: []
@@ -69,6 +69,8 @@ files:
69
69
  - LICENSE.txt
70
70
  - README.md
71
71
  - Rakefile
72
+ - cocoapods-byte-csjm-0.0.4.gem
73
+ - cocoapods-byte-csjm-0.0.5.gem
72
74
  - cocoapods-byte-csjm.gemspec
73
75
  - lib/cocoapods-byte-csjm.rb
74
76
  - lib/cocoapods-byte-csjm/config.rb
@@ -98,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
100
  - !ruby/object:Gem::Version
99
101
  version: '0'
100
102
  requirements: []
101
- rubygems_version: 3.2.3
103
+ rubygems_version: 3.4.13
102
104
  signing_key:
103
105
  specification_version: 4
104
106
  summary: a plugin for csjm