tycli-public 0.0.4 → 0.0.5
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 +4 -4
- data/lib/tycli/command/lib/create.rb +23 -35
- data/lib/tycli/command/lib.rb +1 -1
- data/lib/tycli/executable.rb +7 -2
- data/lib/tycli/lib.rb +19 -2
- data/lib/tycli/repo/spec.rb +3 -1
- data/lib/tycli/version.rb +1 -1
- data/lib/tycli.rb +1 -0
- metadata +8 -9
- data/lib/tycli/util/ask.rb +0 -60
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b1f153ef884f03993b0948929fde0e4e9346414
|
4
|
+
data.tar.gz: 97cb015de86c7b8496ba67cdf288bcec2a7040db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5de90253725d52f068e2e4d7479745d541ec0606d1eafa421f9bd83618e202e7814521f42ed2c9130f72d474daea0b3067fa08b7c37e5d27ff2337694917b0e
|
7
|
+
data.tar.gz: db974dcb1c334f70fa44e0eab859d7d9b8956903d7a144f3c0a20ba7a53c9b9ac05ff1418e5c66e04a533e3ec0e772632dbe38fecbdaf0da03512e34cfdf7984
|
@@ -3,53 +3,34 @@ module Tuya
|
|
3
3
|
class Lib < Command
|
4
4
|
class Create < Lib
|
5
5
|
self.abstract_command = false
|
6
|
-
self.summary = "create
|
6
|
+
self.summary = "create tuya module"
|
7
7
|
self.command = 'create'
|
8
8
|
|
9
9
|
def self.options
|
10
10
|
[
|
11
|
-
|
12
|
-
].concat(super)
|
13
|
-
end
|
14
|
-
|
15
|
-
def validate!
|
16
|
-
help! "name need" unless @name
|
11
|
+
]
|
17
12
|
end
|
18
13
|
|
19
14
|
def initialize(argv)
|
20
15
|
super
|
21
|
-
@name = argv.option('name')
|
22
16
|
end
|
23
17
|
|
24
18
|
def run
|
25
|
-
puts "
|
26
|
-
|
27
|
-
require 'ruby-progressbar'
|
19
|
+
puts "Start create tuya module...".yellow
|
28
20
|
|
29
21
|
require 'colored'
|
30
22
|
|
31
|
-
|
32
|
-
puts "#{@name} is alerady exits".red unless file_not_exist
|
33
|
-
|
34
|
-
if file_not_exist
|
35
|
-
|
36
|
-
progressbar = ProgressBar.create
|
37
|
-
15.times { progressbar.increment; sleep 3 }
|
38
|
-
|
39
|
-
t_c = Thread.new {createModule()}
|
40
|
-
|
41
|
-
t_c.join
|
42
|
-
progressbar.finish
|
23
|
+
createModule
|
43
24
|
|
44
|
-
|
25
|
+
puts "create module successful".green
|
45
26
|
|
46
|
-
|
47
|
-
|
27
|
+
puts "\n\n我们默认添加了SDK依赖, 可在Podfile文件中查看, SDK文档及使用请参考:".green
|
28
|
+
puts "https://github.com/TuyaInc/tuyasmart_home_ios_sdk\n".magenta.underline
|
29
|
+
puts "我们的文档地址:".green
|
30
|
+
puts "https://tuyainc.github.io/\n".magenta.underline
|
48
31
|
|
49
|
-
|
50
|
-
|
51
|
-
Tuya::TYLib.create_lib @name
|
52
|
-
end
|
32
|
+
require 'tycli/lib'
|
33
|
+
Tuya::TYLib.create_lib @name
|
53
34
|
|
54
35
|
end
|
55
36
|
|
@@ -60,13 +41,20 @@ module Tuya
|
|
60
41
|
|
61
42
|
def createModule
|
62
43
|
|
63
|
-
|
64
|
-
|
44
|
+
|
45
|
+
require 'tycli/system'
|
46
|
+
system = Tuya::System.instance
|
47
|
+
|
48
|
+
group = system.group
|
49
|
+
|
50
|
+
if group
|
51
|
+
template = TYCiCore::TYTemplate.new(group.name)
|
52
|
+
template.create
|
53
|
+
@name = template.configurator.pod_name
|
65
54
|
else
|
66
|
-
|
67
|
-
require 'tycli/executable'
|
68
|
-
EXE.exe("pod", command, true )
|
55
|
+
puts "\nCan not find your Tuya Group, please use 'tuya group create --name=group_name'".red
|
69
56
|
end
|
57
|
+
|
70
58
|
end
|
71
59
|
end
|
72
60
|
end
|
data/lib/tycli/command/lib.rb
CHANGED
data/lib/tycli/executable.rb
CHANGED
@@ -1,13 +1,18 @@
|
|
1
1
|
module Tuya
|
2
2
|
class EXE
|
3
|
-
def self.exe(executable, command, raise_if_need = false)
|
3
|
+
def self.exe(executable, command, raise_if_need = false, puts_filter = true )
|
4
4
|
require 'cocoapods'
|
5
5
|
require 'cocoapods/executable'
|
6
6
|
require 'tycli/util/puts_util'
|
7
7
|
|
8
8
|
result = Pod::Executable.execute_command(executable, command, raise_if_need)
|
9
9
|
|
10
|
-
|
10
|
+
# puts "##########"
|
11
|
+
# puts command
|
12
|
+
# puts "##########"
|
13
|
+
|
14
|
+
|
15
|
+
TYUtil::TYPuts.filter(result, TYUtil::TYPuts::ERROR_KEYS) if puts_filter
|
11
16
|
|
12
17
|
result
|
13
18
|
end
|
data/lib/tycli/lib.rb
CHANGED
@@ -13,7 +13,7 @@ module Tuya
|
|
13
13
|
if remote_lib_exist? config.url
|
14
14
|
puts "remote #{config.name} exist".yellow
|
15
15
|
else
|
16
|
-
puts "\
|
16
|
+
puts "\npushing #{name} to remote...".yellow
|
17
17
|
push_lib config
|
18
18
|
end
|
19
19
|
|
@@ -43,6 +43,10 @@ module Tuya
|
|
43
43
|
|
44
44
|
repair_podspec(target_path, "#{config.name}.podspec", config)
|
45
45
|
|
46
|
+
FileUtils.cd "Example"
|
47
|
+
repair_podfile_source
|
48
|
+
FileUtils.cd ".."
|
49
|
+
|
46
50
|
git_commands = [
|
47
51
|
%W(init),
|
48
52
|
%W(add -A),
|
@@ -56,6 +60,19 @@ module Tuya
|
|
56
60
|
FileUtils.cd origin_path
|
57
61
|
end
|
58
62
|
|
63
|
+
def self.repair_podfile_source
|
64
|
+
|
65
|
+
require 'tuya/ci/core'
|
66
|
+
require 'tycli/system'
|
67
|
+
|
68
|
+
system = Tuya::System.instance
|
69
|
+
|
70
|
+
group = system.group
|
71
|
+
podfile = TYCiCore::Podfile.new
|
72
|
+
podfile.source_replace("# source '@{GROUP_SPEC}'", "source '#{group.url}'")
|
73
|
+
podfile.save
|
74
|
+
end
|
75
|
+
|
59
76
|
def self.repair_podspec(path, file, config)
|
60
77
|
require 'tycli/repo/spec'
|
61
78
|
Tuya::PodSpec.repair_lib_spec(path, file, config)
|
@@ -65,7 +82,7 @@ module Tuya
|
|
65
82
|
|
66
83
|
require 'tycli/executable'
|
67
84
|
|
68
|
-
result = Tuya::EXE.exe('git', %W(ls-remote #{url}))
|
85
|
+
result = Tuya::EXE.exe('git', %W(ls-remote #{url}), false , false )
|
69
86
|
|
70
87
|
result.include? "refs/heads/master"
|
71
88
|
end
|
data/lib/tycli/repo/spec.rb
CHANGED
@@ -26,7 +26,9 @@ module Tuya
|
|
26
26
|
files.each do |podspec_path|
|
27
27
|
podspecs.push File.basename(podspec_path)
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
|
+
require 'tuya/ci/core'
|
31
|
+
answer = TYCiCore::TYAsk.ask_with_answers("which podspec will be pushed", podspecs)
|
30
32
|
end
|
31
33
|
|
32
34
|
answer
|
data/lib/tycli/version.rb
CHANGED
data/lib/tycli.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tycli-public
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fangdong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -53,19 +53,19 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: tuya-ci-core
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
62
|
-
type: :
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: ruby-progressbar
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,7 +142,6 @@ files:
|
|
142
142
|
- lib/tycli/repo/spec.rb
|
143
143
|
- lib/tycli/spec_repo.rb
|
144
144
|
- lib/tycli/system.rb
|
145
|
-
- lib/tycli/util/ask.rb
|
146
145
|
- lib/tycli/util/file_util.rb
|
147
146
|
- lib/tycli/util/puts_util.rb
|
148
147
|
- lib/tycli/version.rb
|
data/lib/tycli/util/ask.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
module Tuya
|
2
|
-
class TYAsk
|
3
|
-
|
4
|
-
def self.ask(question)
|
5
|
-
answer = ""
|
6
|
-
loop do
|
7
|
-
puts "\n#{question}?"
|
8
|
-
|
9
|
-
# @message_bank.show_prompt
|
10
|
-
print ">".green
|
11
|
-
answer = STDIN.gets.chomp
|
12
|
-
|
13
|
-
break if answer.length > 0
|
14
|
-
|
15
|
-
print "\nYou need to provide an answer."
|
16
|
-
end
|
17
|
-
answer
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.ask_with_answers(question, possible_answers)
|
21
|
-
|
22
|
-
print "\n#{question}? ["
|
23
|
-
|
24
|
-
print_info = Proc.new {
|
25
|
-
|
26
|
-
possible_answers_string = possible_answers.each_with_index do |answer, i|
|
27
|
-
_answer = (i == 0) ? answer.underline : answer
|
28
|
-
print " " + _answer
|
29
|
-
print(" /") if i != possible_answers.length-1
|
30
|
-
end
|
31
|
-
print " ]\n"
|
32
|
-
}
|
33
|
-
print_info.call
|
34
|
-
|
35
|
-
answer = ""
|
36
|
-
|
37
|
-
loop do
|
38
|
-
# @message_bank.show_prompt
|
39
|
-
print ">".green
|
40
|
-
answer = STDIN.gets.downcase.chomp
|
41
|
-
|
42
|
-
answer = "yes" if answer == "y"
|
43
|
-
answer = "no" if answer == "n"
|
44
|
-
|
45
|
-
# default to first answer
|
46
|
-
if answer == ""
|
47
|
-
answer = possible_answers[0].downcase
|
48
|
-
print answer.yellow
|
49
|
-
end
|
50
|
-
|
51
|
-
break if possible_answers.map { |a| a.downcase }.include? answer
|
52
|
-
|
53
|
-
print "\nPossible answers are ["
|
54
|
-
print_info.call
|
55
|
-
end
|
56
|
-
|
57
|
-
answer
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|