Class: Tuya::Command::Lib::Create

Inherits:
Tuya::Command::Lib show all
Defined in:
lib/tycli/command/lib/create.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Create



14
15
16
# File 'lib/tycli/command/lib/create.rb', line 14

def initialize(argv)
  super
end

Class Method Details

.optionsObject



9
10
11
12
# File 'lib/tycli/command/lib/create.rb', line 9

def self.options
  [
  ]
end

Instance Method Details

#createModuleObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/tycli/command/lib/create.rb', line 42

def createModule


  require 'tycli/system'
  system = Tuya::System.instance

  group = system.group

  if group
    template = TYCiCore::TYTemplate.new(group.name)
    template.create
    @name = template.configurator.pod_name
  else
    puts "\nCan not find your Tuya Group, please use 'tuya group create --name=group_name'".red
  end

end

#runObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/tycli/command/lib/create.rb', line 18

def run
    puts "Start create tuya module...".yellow

    require 'colored'

    createModule

    puts "create module successful".green

    puts "\n\n我们默认添加了SDK依赖, 可在Podfile文件中查看, SDK文档及使用请参考:".green
    puts "https://github.com/TuyaInc/tuyasmart_home_ios_sdk\n".magenta.underline
    puts "我们的文档地址:".green
    puts "https://tuyainc.github.io/\n".magenta.underline

    require 'tycli/lib'
    Tuya::TYLib.create_lib @name

end

#showProgressObject



37
38
39
40
# File 'lib/tycli/command/lib/create.rb', line 37

def showProgress
  progressbar = ProgressBar.create
  100.times { progressbar.increment; sleep 3 }
end