Class: Tuya::Command::Lib::CreateSimple
- Inherits:
-
Tuya::Command::Lib
- Object
- CLAide::Command
- Tuya::Command
- Tuya::Command::Lib
- Tuya::Command::Lib::CreateSimple
- Defined in:
- lib/tycli/command/lib/create_simple.rb
Class Method Summary collapse
Instance Method Summary collapse
- #createModule ⇒ Object
-
#initialize(argv) ⇒ CreateSimple
constructor
A new instance of CreateSimple.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ CreateSimple
Returns a new instance of CreateSimple.
19 20 21 22 |
# File 'lib/tycli/command/lib/create_simple.rb', line 19 def initialize(argv) super @name = argv.option('name') end |
Class Method Details
.options ⇒ Object
9 10 11 12 13 |
# File 'lib/tycli/command/lib/create_simple.rb', line 9 def self. [ ['--name=module_name', '--name to named your module'] ].concat(super) end |
Instance Method Details
#createModule ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/tycli/command/lib/create_simple.rb', line 41 def createModule result = `pod lib create #{@name} --template-url=https://code.registry.wgine.com/client-platform/pod-template-simple.git` result.each_line do |s| if s.include?("fatal") puts "#{s}".red end end end |
#run ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/tycli/command/lib/create_simple.rb', line 24 def run puts "do create a simple module named: #{@name}".green require 'ruby-progressbar' = ProgressBar.create 15.times { .increment; sleep 2 } t_c = Thread.new {createModule()} t_c.join .finish puts "end create simple module: #{@name}".green end |
#validate! ⇒ Object
15 16 17 |
# File 'lib/tycli/command/lib/create_simple.rb', line 15 def validate! help! "name need" unless @name end |