yk_command 0.5.2 → 0.5.3

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: 7a86ae389cad94055cc7b1078c498cf184bb4a3c316c29d75743c63c11f082c5
4
- data.tar.gz: 81b2ab46a6e03c45c210ae45b4e261d798779805aa8edccc8388ce240d6916d6
3
+ metadata.gz: a8d1eb70f1aeb80490615d2daf6d23297c3789629d7889d060466cb6c61c4d2a
4
+ data.tar.gz: bb5331d9981c1b1f9bcbe2b4b634abfdc07589e92bc3323ec5aa6870c9a74e2a
5
5
  SHA512:
6
- metadata.gz: 1167e9722bfc122e95aad69fee90af9d6d9965680494d58d9dfa83945d008d5ce596c34430ef8ab69d358fb7a4487d4336743f27ed8f4c02310a84f045d52251
7
- data.tar.gz: be9d9504b13ba9f850ee2eabd493b4bf00492dd546df93ac9cc38ceb53d6d306f55a1c050094e28d34e1286b2b308b4ef86cc61c132b12930e064e9b477b5556
6
+ metadata.gz: bb985042e783621b1cf095559757cda4fc26c669f16862889f897dd31bba59fc400bcaae63db84bbddfb3442d0d9cc54677176515a8e1aeb624482250556d6f5
7
+ data.tar.gz: 13d82d18acf28d6b07431850a05d6fe8f66c7317757a28900a8b01aa5d4fff3643dfaa386840ab3b5c6ff7dd4b0d1532ba0c09c8a5769a97649eeb2b7f3ad120
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yk_command (0.5.2)
4
+ yk_command (0.5.3)
5
5
  bundler
6
6
  cocoapods
7
7
  cocoapods-core
@@ -15,9 +15,19 @@ require 'yk_command/config/yk_config'
15
15
  module YkCommand
16
16
  IGNORE_PROJECT_FILE = '.YKAnalyzeConfig.yml'.freeze
17
17
  BOT_CONFIG_FILE = '.YKBotConfig.yml'.freeze
18
+ SERVER_ENV_CONFIG_FILE = '.YKServerConfig.yml'.freeze
19
+
18
20
  class Analyzer < Thor
21
+
22
+
19
23
  no_commands do
20
24
 
25
+
26
+ def initialize(path)
27
+ config = YkConfig.new.read_config path,SERVER_ENV_CONFIG_FILE
28
+ @app_server_api = Request.new(config)
29
+ end
30
+
21
31
  def dependency(path = nil)
22
32
  say "\ncurrent working folder: #{path}\n"
23
33
  project_path = ''
@@ -35,10 +45,11 @@ module YkCommand
35
45
  podfile_dir = Pathname.new(project_path).dirname.to_s
36
46
  say "start analyze... path contain [Podfile ,Pods/ ,Podfile.lock] is #{podfile_dir} \n ", :green
37
47
  result = analyze(podfile_dir)
38
- app_info = Request.new.get_project_info(project_name)
48
+
49
+ app_info = @app_server_api.get_project_info(project_name)
39
50
  if app_info['id']
40
51
  say "uploading dependencies for project #{project_name} ..."
41
- upload_res = Request.new.upload_app_dependency(app_info['id'], result)
52
+ upload_res = @app_server_api.upload_app_dependency(app_info['id'], result)
42
53
  if upload_res['code'] == 0
43
54
  result(0, project_name, 'uploaded , finished ', :green)
44
55
  else
@@ -1,17 +1,18 @@
1
1
  require 'httparty'
2
2
  module YkCommand
3
3
  class Request
4
- include HTTParty
5
- base_uri 'http://127.0.0.1:9988/'
6
4
 
7
- # base_uri 'http://10.30.106.143:9988/'
8
- # base_uri 'http://10.30.80.113:9988'
5
+ include HTTParty
9
6
 
10
7
  headers 'Content-Type' => 'application/json'
11
8
 
12
-
9
+ def initialize(config)
10
+ @config = config
11
+ self.class.base_uri @config[:pro]
12
+ end
13
13
 
14
14
  def upload_app_dependency(project_id,data)
15
+
15
16
  self.class.post('/dependency/addDependency', query: { "projectId" => project_id },body: data)
16
17
  end
17
18
 
@@ -30,14 +30,14 @@ module YkCommand
30
30
  method_option :dependency, aliases: '-d'
31
31
 
32
32
  def dependency(path = nil)
33
- Analyzer.new.dependency path
33
+ Analyzer.new(path).dependency path
34
34
  end
35
35
 
36
36
  desc 'workspace_analyze <AppHost Path>', '遍历项目目录 批量上传项目依赖信息'
37
37
  method_option :workspace_analyze, aliases: '-w'
38
38
 
39
39
  def workspace_analyze(path = nil)
40
- Analyzer.new.workspace_analyze path
40
+ Analyzer.new(path).workspace_analyze path
41
41
  end
42
42
 
43
43
 
@@ -2,24 +2,33 @@
2
2
 
3
3
  require 'yk_command/gitlab/yk_gitlab'
4
4
  require 'yk_command/analyze/request'
5
+ require 'yk_command/config/yk_config'
5
6
 
6
7
  module YkCommand
7
8
 
9
+ GITLAB_CONFIG_FILE = '.YKGitlabConfig.yml'.freeze
10
+
8
11
  class ComponentManagePlatform < Thor
9
12
  include Thor::Actions
10
13
  no_commands do
14
+ def initialize
15
+ path = __dir__
16
+ @gitlab_srvice =YkGitlab.new(YkConfig.new.read_config path,GITLAB_CONFIG_FILE)
17
+ @api_service = Request.new(YkConfig.new.read_config path,SERVER_ENV_CONFIG_FILE)
18
+ end
19
+
11
20
  def update_app_data
12
- data = YkGitlab.new.get_all_app
21
+ data = @gitlab_srvice.get_all_app
13
22
  list = data.parsed_response['shared_projects']
14
23
 
15
- r = Request.new.upload_app(list)
24
+ r = @api_service.upload_app(list)
16
25
  pp r
17
26
  end
18
27
 
19
28
  def update_component_data
20
- data = YkGitlab.new.get_all_components
29
+ data = @gitlab_srvice.get_all_components
21
30
  list = data.parsed_response['projects']
22
- r = Request.new.upload_component(list)
31
+ r = @api_service.upload_component(list)
23
32
  pp r
24
33
  end
25
34
  end
@@ -2,26 +2,20 @@
2
2
  require 'httparty'
3
3
 
4
4
  module YkCommand
5
- GITLAB_TOKEN = 'oPvxMkmDhVjhhzixBAiJ'
6
5
 
7
6
  class YkGitlab
8
7
 
9
8
  include HTTParty
10
9
 
11
-
12
- # http://gitlab.yeahka.com/api/v3/groups/917?private_token=oPvxMkmDhVjhhzixBAiJ
13
-
14
- base_uri 'http://gitlab.yeahka.com/api/v3'
15
-
16
-
17
-
18
10
  headers 'Content-Type' => 'application/json'
19
11
 
20
-
21
-
12
+ def initialize(config)
13
+ @config = config
14
+ self.class.base_uri @config[:uri]
15
+ @token = @config[:token]
16
+ end
22
17
 
23
18
  def get_all_app
24
-
25
19
  get_group_projects 917,100,0
26
20
 
27
21
  end
@@ -35,7 +29,7 @@ module YkCommand
35
29
 
36
30
 
37
31
  def get_group_projects(group_id,per_page,page)
38
- self.class.get("/groups/#{group_id}", query: { "private_token" => GITLAB_TOKEN,"per_page"=> per_page,"page"=> page })
32
+ self.class.get("/groups/#{group_id}", query: { "private_token" => @token,"per_page"=> per_page,"page"=> page })
39
33
  end
40
34
 
41
35
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module YkCommand
4
- VERSION = '0.5.2'.freeze
4
+ VERSION = '0.5.3'.freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yk_command
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Major Tom