DYAutomate 1.1.0 → 1.1.1

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: ca40553f032c4e9d73485419d62ab39396340fa3c884ae22c9c323ea4222cc2a
4
- data.tar.gz: 8c96d0b43dff6fe910d66967e233004907d8441b711a2a98a09a1f47575e7518
3
+ metadata.gz: 488a3c5f4815c40ae02294499acb20770b78d1a7789aab5b709082c68efe4f35
4
+ data.tar.gz: a761a7d0166d42d1dfcaba894cd456e6ea306d0f5edde717f56cb78a6a6de54b
5
5
  SHA512:
6
- metadata.gz: 72d26755088d66ac96ba98e3f457e184bfa514db907b3ec49b48eecd5c03e60b5f1a54228b408b04fd3d09335ffa74f9ce4c23f2b9079b315d8ddd3db5a2cb5f
7
- data.tar.gz: 07c5579de29bc7d0af3f67825f7cbfe94c68890b7fe4e4cdfc5e997480ae8a13d9b82b54444b40039139a715c6c082a0ae40c9d05c09dc6f18458bdb45c9083b
6
+ metadata.gz: aa07c1a77398558bc1fcf8c04fb8b02df83d747f720152e7a369a6c33aac6dc8d1df303366549fce9be75b580c8c40b3b4333c47106338a8aeb26de23fd118c7
7
+ data.tar.gz: f762ad8ed262d8b41e8eceb989dbddb0a7bf23845b37f6015016eff654813ce40a58b4cb83dc206c654a2039b34d2198d1acc4b762e97ca90ea5223d80cb4753
@@ -1,6 +1,5 @@
1
1
  require 'DYAutomate.rb'
2
2
  require 'version'
3
- require 'Core/CoreConfig'
4
3
  require 'CustomConfig/DYAutomateConfig'
5
4
  require 'Core/user_interface'
6
5
 
@@ -8,12 +7,14 @@ module DYAutomate
8
7
  require 'CLAide'
9
8
  include UI
10
9
  class Command < CLAide::Command
11
- include CoreConfig
12
10
  require 'Command/pod.rb'
13
11
  require 'Command/workspace.rb'
14
12
  require 'Command/codeGenerate'
13
+ require 'Command/codeSnippet'
15
14
 
16
15
  attr_accessor :config
16
+ attr_accessor :config
17
+
17
18
  self.abstract_command = true
18
19
  self.command = 'dj'
19
20
  self.version = VERSION
@@ -24,10 +25,8 @@ module DYAutomate
24
25
 
25
26
  def initialize(argv)
26
27
  super
27
- @repoName = CoreConfig::Core_previte_repo_name
28
- @env_str = CoreConfig::Core_env_str
29
28
  @config = DYAutomateConfig.loadConfig
30
- pp("当前环境变量 #{@env_str}",1)
29
+ pp("当前环境变量 #{env_str}",1)
31
30
  end
32
31
 
33
32
  def self.options
@@ -50,7 +49,15 @@ module DYAutomate
50
49
  elsif level == 2
51
50
  puts msg.red if msg
52
51
  end
53
- end
52
+ end
53
+
54
+ def repoName
55
+ @config.detailObj.private_repo_name if @config
56
+ end
57
+
58
+ def env_str
59
+ @config.detailObj.env_str if @config
60
+ end
54
61
 
55
62
  end
56
63
  end
@@ -26,9 +26,8 @@ module DYAutomate
26
26
  super
27
27
  unless @config.templates_git_url
28
28
  help! "
29
- error -- >!!! Not found <templates_git_url> in the #{DYAutomateConfig::configFilePath}"
29
+ error -- >!!! Not found <templates_git_url> in the #{DYAutomateConfig.configFilePath}"
30
30
  end
31
-
32
31
  end
33
32
 
34
33
  def run
@@ -0,0 +1,57 @@
1
+
2
+ module DYAutomate
3
+ class Command
4
+ class CodeSnippet < Command
5
+
6
+ require "fileutils"
7
+
8
+ self.abstract_command = false
9
+ self.command = 'snippet'
10
+ self.summary = '拷贝代码片段到Xcode中'
11
+ # self.default_subcommand = 'list'
12
+ self.arguments = [
13
+ # CLAide::Argument.new('NAME', true),
14
+ ]
15
+
16
+ #当前路径
17
+ attr_accessor :xcode_snippsets_path
18
+
19
+ def initialize(argv)
20
+ super
21
+ @xcode_snippsets_path = File.join(Dir.home,"/Library/Developer/Xcode/UserData/CodeSnippets")
22
+ end
23
+
24
+ def validate!
25
+ super
26
+ unless Dir.exist?(@xcode_snippsets_path)
27
+ help! "
28
+ error -- >!!! Not found Xcode CodeSnippets at the #{@xcode_snippsets_path}"
29
+ end
30
+
31
+ unless @config.detailObj.codeSnippsets_git_url
32
+ help! "
33
+ error -- >!!! Not found the value of codeSnippsets_git_url"
34
+ end
35
+ end
36
+
37
+ def run
38
+ clone_templates
39
+ end
40
+
41
+ def clone_templates
42
+ tempPath = File.join(Dir.home,'Documents','.iOSCodeSnippet')
43
+ unless Dir.exist?(tempPath)
44
+ system("mkdir #{tempPath}")
45
+ end
46
+ system ("git clone #{@config.codeSnippsets_git_url} --depth 1 #{tempPath}")
47
+ Dir.chdir("#{tempPath}/CodeSnippets")
48
+ Dir.glob("*") do |path|
49
+ FileUtils.cp(path, @xcode_snippsets_path)
50
+ end
51
+ `rm -rf #{tempPath}`
52
+ puts "安装完成..."
53
+ end
54
+
55
+ end
56
+ end
57
+ end
@@ -2,6 +2,14 @@ require 'Core/DYBaseObj'
2
2
 
3
3
 
4
4
  module DYAutomate
5
+
6
+ class DYAutomateConfigDetail < DYBaseObj
7
+ attr_accessor :templates_git_url
8
+ attr_accessor :codeSnippsets_git_url
9
+ attr_accessor :private_repo_name
10
+ attr_accessor :env_str
11
+ end
12
+
5
13
  class DYAutomateConfig < DYBaseObj
6
14
  @public
7
15
  #cache相关的路径
@@ -10,17 +18,31 @@ module DYAutomate
10
18
  @@configGitClonePath = File.join(@@cachePath, 'Git')
11
19
  @@logsDirPath = File.join(@@cachePath, 'log')
12
20
 
13
- attr_accessor :git
14
- attr_accessor :git_tag
21
+ attr_accessor :detail_git
22
+ attr_accessor :detail_git_tag
23
+
24
+ attr_accessor :detailObj
15
25
  attr_accessor :templates_git_url
16
- # attr_accessor :templates_git_url
17
- attr_accessor :templates_cache_path
26
+ attr_accessor :codeSnippsets_git_url
18
27
 
28
+ attr_accessor :templates_cache_path
19
29
 
20
30
  def initialize
21
31
  super
22
32
  end
23
33
 
34
+ def self.cachePath
35
+ @@cachePath
36
+ end
37
+
38
+ def self.configFilePath
39
+ @@configFilePath
40
+ end
41
+
42
+ def self.configGitClonePath
43
+ @@configGitClonePath
44
+ end
45
+
24
46
  def self.logsDirPath
25
47
  @@logsDirPath
26
48
  end
@@ -28,8 +50,7 @@ module DYAutomate
28
50
  #从配置中心读取
29
51
  def self.loadConfig
30
52
  checkConfigFile?
31
- cc = DYAutomateConfig::fromFile(@@configFilePath)
32
- puts cc
53
+ cc = DYAutomateConfig.fromFile(@@configFilePath)
33
54
  cc.loadDetailFromGit if cc
34
55
  cc
35
56
  end
@@ -61,14 +82,32 @@ module DYAutomate
61
82
  #DYAutomate 配置
62
83
 
63
84
  DYAutomateConfig.new do |c|
64
- c.git = ""
65
- c.git_tag = ""
85
+ # 配置的git地址
86
+ c.detail_git = ""
87
+
88
+ # 配置的git tag
89
+ c.detail_git_tag = ""
66
90
  end
67
91
  EOF
68
-
69
92
  f.write(demo)
70
93
  end
71
94
 
95
+ def templates_git_url
96
+ url = ''
97
+ url = @detailObj.templates_git_url if @detailObj
98
+ url
99
+ end
100
+
101
+ def codeSnippsets_git_url
102
+ url = ''
103
+ url = @detailObj.codeSnippsets_git_url if @detailObj
104
+ url
105
+ end
106
+
107
+ def templates_cache_path
108
+ File.join(@@cachePath,'templates')
109
+ end
110
+
72
111
  def check_git_dir
73
112
  unless Dir.exist?(@@configGitClonePath)
74
113
  Dir.mkdir(@@configGitClonePath,0777)
@@ -81,7 +120,7 @@ module DYAutomate
81
120
  if File.exist?(versionFile)
82
121
  versionContent = File.open(versionFile, 'r:utf-8', &:read)
83
122
  if versionContent
84
- isSame = versionContent.chomp.eql?(@git_tag.chomp)
123
+ isSame = versionContent.chomp.eql?(@detail_git_tag.chomp)
85
124
  end
86
125
  end
87
126
  isSame
@@ -89,12 +128,12 @@ module DYAutomate
89
128
 
90
129
  def clone_git
91
130
  check_git_dir
92
- if @git_tag && @git
93
- url = "#{@git} --branch #{@git_tag}"
131
+ if @detail_git_tag && @detail_git
132
+ url = "#{@detail_git} --branch #{@detail_git_tag}"
94
133
  # url = "#{@git} "
95
134
  cloneOk = system "git clone #{url} #{@@configGitClonePath}"
96
135
  if cloneOk
97
- puts "加载配置成功。。。"
136
+ puts "clone #{url}成功。。。"
98
137
  else
99
138
  puts "clone #{url}失败!!"
100
139
  end
@@ -110,10 +149,9 @@ module DYAutomate
110
149
  system("rm -rf #{@@configGitClonePath}")
111
150
  clone_git
112
151
  end
113
- end
114
-
115
- def templates_cache_path
116
- File.join(@@cachePath,'templates')
152
+ path = File.join(@@configGitClonePath,'detailConfig.rb')
153
+ @detailObj = DYAutomateConfigDetail.fromFile(path) if File.exist?(path)
154
+ puts "加载配置成功。。。" if @detailObj
117
155
  end
118
156
 
119
157
  end
@@ -1,3 +1,3 @@
1
1
  module DYAutomate
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: DYAutomate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - 陈冬冬
@@ -138,7 +138,6 @@ extra_rdoc_files: []
138
138
  files:
139
139
  - README.md
140
140
  - bin/dj
141
- - lib/Core/CoreConfig.rb
142
141
  - lib/Core/DYBaseObj.rb
143
142
  - lib/Core/user_interface.rb
144
143
  - lib/DYAutomate.rb
@@ -149,6 +148,7 @@ files:
149
148
  - lib/DYAutomate/Command/Workspace/install.rb
150
149
  - lib/DYAutomate/Command/Workspace/update.rb
151
150
  - lib/DYAutomate/Command/codeGenerate.rb
151
+ - lib/DYAutomate/Command/codeSnippet.rb
152
152
  - lib/DYAutomate/Command/dgit.rb
153
153
  - lib/DYAutomate/Command/pod.rb
154
154
  - lib/DYAutomate/Command/workspace.rb
@@ -1,10 +0,0 @@
1
-
2
- module CoreConfig
3
- Core_previte_repo_name = 'dy_repo_private_pods'
4
- Core_previte_repo_url = 'git@gitlab.dongyin.net:iospodrepos/dy_repo_private_pods.git'
5
- Core_public_repo_url = 'git@gitlab.dongyin.net:iospodrepos/dy_repo_public_pods.git'
6
- Core_cocoapods_repo_url = 'https://github.com/CocoaPods/Specs.git'
7
-
8
- Core_pod_git_url = "git@gitlab.dongyin.net:iosprivatepods"
9
- Core_env_str = "Core_pod_git_url=#{Core_pod_git_url} Core_previte_repo_url=#{Core_previte_repo_url}#####{Core_public_repo_url}#####{Core_cocoapods_repo_url}"
10
- end