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

Inherits:
Tuya::Command::Lib show all
Defined in:
lib/tuya/cli/odm/command/lib/create.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Create

Returns a new instance of Create.



14
15
16
# File 'lib/tuya/cli/odm/command/lib/create.rb', line 14

def initialize(argv)
  super
end

Class Method Details

.optionsObject



9
10
11
12
# File 'lib/tuya/cli/odm/command/lib/create.rb', line 9

def self.options
  [
  ]
end

Instance Method Details

#createModuleObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/tuya/cli/odm/command/lib/create.rb', line 37

def createModule

  system = Tuya::System.instance

  group = system.group

  if group
    template = TYCiCore::TYTemplate.new(group.name)
    template.create
    @template = template
  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
# File 'lib/tuya/cli/odm/command/lib/create.rb', line 18

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

    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

    Tuya::TYLib.create_lib @template
end

#showProgressObject



32
33
34
35
# File 'lib/tuya/cli/odm/command/lib/create.rb', line 32

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