Class: AqaraLocalizable::Command::Gen
- Inherits:
-
AqaraLocalizable::Command
- Object
- CLAide::Command
- AqaraLocalizable::Command
- AqaraLocalizable::Command::Gen
- Defined in:
- lib/Aqara_localizable/command/command_gen.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Gen
constructor
A new instance of Gen.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Gen
Returns a new instance of Gen.
7 8 9 10 11 12 |
# File 'lib/Aqara_localizable/command/command_gen.rb', line 7 def initialize(argv) super project_directory = argv.option('project-directory') project_directory = Dir.pwd if project_directory.nil? @project_directory = Pathname.new(project_directory). end |
Class Method Details
.options ⇒ Object
21 22 23 24 25 |
# File 'lib/Aqara_localizable/command/command_gen.rb', line 21 def self. [ ['--project-directory=/project/dir/', 'The path to the root of the project directory'] ].concat(super) end |
Instance Method Details
#run ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/Aqara_localizable/command/command_gen.rb', line 27 def run puts '如果多语言脚本插件有问题可以找zxf看看'.green target_path = Pathname.new(File.dirname(__FILE__)).realpath.parent.parent puts target_path # system "pip3 install requests;pip3 install openpyxl" system "cd #{target_path}/script/ios_py_code;python3 ios_sp_str_generator.py #{@project_directory}" # system 'cd /lib/script/ios_py_code;python3 ios_sp_str_generator.py' end |
#validate! ⇒ Object
14 15 16 17 18 19 |
# File 'lib/Aqara_localizable/command/command_gen.rb', line 14 def validate! super if @project_directory.nil? help! 'error: no input project directory which to use with the `--project-directory` option.' end end |