tuya-cli-odm 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 915fad0e9ce3a446c0cfb3faa702f78e386d50fb
4
+ data.tar.gz: c38af3be8c2618cf7b606980ff4199b7cfc9f732
5
+ SHA512:
6
+ metadata.gz: f124be844e922d8753ca813843fdb31667ff1a2d2ab154099adf559bb9cb5fe24a3e277ef96557c568851674a414e8d57ee7f49d3b417cf9126e6a5e9981d9bd
7
+ data.tar.gz: 30a77b15839c2cd00d7e8f7151afd8684bc8d709027f38a2551ac2cf18c4a0c82a3e7a3e4cdb05fe66bac82e462eb415fdf2b57baddc549b3b22e420f0ea8b00
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 fangdong
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Tuya::Cli::Odm
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/tuya/cli/odm`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'tuya-cli-odm'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install tuya-cli-odm
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/tuya-cli-odm. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the Tuya::Cli::Odm project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/tuya-cli-odm/blob/master/CODE_OF_CONDUCT.md).
data/bin/tuya-odm ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'tuya/cli/odm'
4
+ require 'cocoapods'
5
+ require 'colored'
6
+
7
+ Tuya::Command.run(ARGV)
@@ -0,0 +1,37 @@
1
+
2
+ require 'ruby-progressbar'
3
+ require 'colored'
4
+ require 'tuya/ci/core'
5
+
6
+ require 'cocoapods'
7
+ require 'cocoapods/executable'
8
+
9
+ require 'tuya/cli/odm/executable'
10
+
11
+ require 'tuya/cli/odm/util/puts_util'
12
+ require 'tuya/cli/odm/util/file_util'
13
+
14
+ require 'tuya/cli/odm/data/data_odm'
15
+
16
+ require 'tuya/cli/odm/group'
17
+
18
+ require 'tuya/cli/odm/command'
19
+ require 'tuya/cli/odm/command/group'
20
+ require 'tuya/cli/odm/command/ci/show_log_tips'
21
+ require 'tuya/cli/odm/command/group/create'
22
+ require 'tuya/cli/odm/command/group/init'
23
+ require 'tuya/cli/odm/command/group/status'
24
+ require 'tuya/cli/odm/command/lib/create'
25
+ require 'tuya/cli/odm/command/repo/push'
26
+
27
+
28
+ require 'tuya/cli/odm/git'
29
+
30
+ require 'tuya/cli/odm/config'
31
+
32
+ require 'tuya/cli/odm/lib'
33
+ require 'tuya/cli/odm/system'
34
+
35
+ require 'tuya/cli/odm/repo/spec'
36
+ require 'tuya/cli/odm/spec_repo'
37
+
@@ -0,0 +1,38 @@
1
+ # encoding: utf-8
2
+
3
+ $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
4
+
5
+ require 'claide'
6
+ require 'colored'
7
+ require 'tuya/cli/odm'
8
+
9
+
10
+ module Tuya
11
+ class Command < CLAide::Command
12
+
13
+ require 'tuya/cli/odm/command/lib'
14
+ #require 'tuya/cli/odm/command/ci'
15
+ require 'tuya/cli/odm/command/repo'
16
+ require 'tuya/cli/odm/command/group'
17
+
18
+ self.abstract_command = true
19
+
20
+ self.description = 'welcome to tuya-cli'
21
+
22
+ puts "\n
23
+ ████████╗██╗ ██╗██╗ ██╗ █████╗
24
+ ╚══██╔══╝██║ ██║╚██╗ ██╔╝██╔══██╗
25
+ ██║ ██║ ██║ ╚████╔╝ ███████║
26
+ ██║ ██║ ██║ ╚██╔╝ ██╔══██║
27
+ ██║ ╚██████╔╝ ██║ ██║ ██║
28
+ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ \n" .yellow
29
+
30
+
31
+
32
+ self.command = 'tuya'
33
+
34
+ def run
35
+
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,36 @@
1
+ $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
2
+
3
+ require 'tuya/cli/odm/command/ci/show_log_tips'
4
+
5
+ require 'tuya/cli/odm/command'
6
+
7
+ module Tuya
8
+ class Command
9
+ class CI < Command
10
+
11
+ self.abstract_command = true
12
+
13
+ self.summary = 'help for tuya ci'
14
+ self.command = 'ci'
15
+
16
+ self.description = <<-DESC
17
+ tuya ci helper
18
+ DESC
19
+ def self.options
20
+ [
21
+ ['--te=te', 'te te t e']
22
+ ].concat(super)
23
+ end
24
+
25
+ def initialize(argv)
26
+ super
27
+ end
28
+
29
+ def run
30
+ super
31
+ end
32
+ end
33
+ end
34
+ end
35
+
36
+
@@ -0,0 +1,16 @@
1
+ module Tuya
2
+ class Command
3
+ class CI < Command
4
+ class ShowLogTips < CI
5
+ self.abstract_command = false
6
+ self.summary = "show ci log error tips"
7
+ self.command = 'tips'
8
+
9
+ def run
10
+ puts("when ci build errors, you can search keyworkds: \n")
11
+ puts("- ERROR\nfatal error:\nfastlane finished with errors\n")
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,34 @@
1
+ $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
2
+
3
+ require 'tuya/cli/odm/command/group/create'
4
+ require 'tuya/cli/odm/command/group/init'
5
+ require 'tuya/cli/odm/command/group/status'
6
+
7
+ require 'tuya/cli/odm/command'
8
+
9
+ module Tuya
10
+ class Command
11
+ class Group < Command
12
+
13
+ self.abstract_command = true
14
+
15
+ self.summary = 'help manage your group'
16
+ self.command = 'group'
17
+
18
+ self.description = <<-DESC
19
+ tuya group helper
20
+ DESC
21
+
22
+ def self.options
23
+ [
24
+ ['--name=group_name', '--name the name for your group']
25
+ ]
26
+ end
27
+
28
+ def run
29
+ super
30
+ end
31
+ end
32
+ end
33
+ end
34
+
@@ -0,0 +1,34 @@
1
+ module Tuya
2
+ class Command
3
+ class Group < Command
4
+ class GroupCreate < Group
5
+ self.abstract_command = false
6
+ self.summary = "create a remote repo spec(if need) & init your local repo spec"
7
+ self.command = 'create'
8
+
9
+ def run
10
+ puts "group name is #{@name}".green
11
+
12
+ group = Tuya::ConfigGroup.new(@name)
13
+ Tuya::TYGroup.setup_spec group
14
+ Tuya::TYGroup.create_tuya_public_inc_if_need
15
+ end
16
+
17
+ def self.options
18
+ [
19
+ ['--name=group_name', '--name the name for your group']
20
+ ]
21
+ end
22
+
23
+ def initialize(argv)
24
+ super
25
+ @name = argv.option('name')
26
+ end
27
+
28
+ def validate!
29
+ help! "name need" unless @name
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,33 @@
1
+ module Tuya
2
+ class Command
3
+ class Group < Command
4
+ class GroupInit < Group
5
+ self.abstract_command = false
6
+ self.summary = "init your local repo spec"
7
+ self.command = 'init'
8
+
9
+ def run
10
+ puts "group name is #{@name}".green
11
+
12
+ group = Tuya::ConfigGroup.new(@name)
13
+ Tuya::TYGroup.setup_local_repo group
14
+ end
15
+
16
+ def self.options
17
+ [
18
+ ['--name=group_name', '--name the name for your group']
19
+ ]
20
+ end
21
+
22
+ def initialize(argv)
23
+ super
24
+ @name = argv.option('name')
25
+ end
26
+
27
+ def validate!
28
+ help! "name need" unless @name
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/ruby -w
2
+
3
+ module Tuya
4
+ class Command
5
+ class Group < Command
6
+ class GroupStatus < Group
7
+ self.abstract_command = false
8
+ self.summary = "show your local tuya repo status"
9
+ self.command = 'status'
10
+
11
+ def run
12
+ Tuya::TYGroup.status
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,25 @@
1
+ $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
2
+
3
+ require 'tuya/cli/odm/command/lib/create'
4
+
5
+ require 'tuya/cli/odm/command'
6
+
7
+ module Tuya
8
+ class Command
9
+ class Lib < Command
10
+
11
+ self.abstract_command = true
12
+
13
+ self.summary = 'create tuya module'
14
+ self.command = 'lib'
15
+
16
+ self.description = "tuya module tools"
17
+
18
+ def run
19
+ super
20
+ end
21
+ end
22
+ end
23
+ end
24
+
25
+
@@ -0,0 +1,55 @@
1
+ module Tuya
2
+ class Command
3
+ class Lib < Command
4
+ class Create < Lib
5
+ self.abstract_command = false
6
+ self.summary = "create tuya module"
7
+ self.command = 'create'
8
+
9
+ def self.options
10
+ [
11
+ ]
12
+ end
13
+
14
+ def initialize(argv)
15
+ super
16
+ end
17
+
18
+ def run
19
+ puts "Start create tuya module...".yellow
20
+
21
+ createModule
22
+
23
+ puts "create module successful".green
24
+ puts "\n\n我们默认添加了SDK依赖, 可在Podfile文件中查看, SDK文档及使用请参考:".green
25
+ puts "https://github.com/TuyaInc/tuyasmart_home_ios_sdk\n".magenta.underline
26
+ puts "我们的文档地址:".green
27
+ puts "https://tuyainc.github.io/\n".magenta.underline
28
+
29
+ Tuya::TYLib.create_lib @template
30
+ end
31
+
32
+ def showProgress
33
+ progressbar = ProgressBar.create
34
+ 100.times { progressbar.increment; sleep 3 }
35
+ end
36
+
37
+ def createModule
38
+
39
+ system = Tuya::System.instance
40
+
41
+ group = system.group
42
+
43
+ if group
44
+ template = TYCiCore::TYTemplate.new(group.name)
45
+ template.create
46
+ @template = template
47
+ else
48
+ puts "\nCan not find your Tuya Group, please use 'tuya group create --name=group_name'".red
49
+ end
50
+
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,50 @@
1
+ module Tuya
2
+ class Command
3
+ class Lib < Command
4
+ class CreateSimple < Lib
5
+ self.abstract_command = false
6
+ self.summary = "create a module"
7
+ self.command = 'create-simple'
8
+
9
+ def self.options
10
+ [
11
+ ['--name=module_name', '--name to named your module']
12
+ ].concat(super)
13
+ end
14
+
15
+ def validate!
16
+ help! "name need" unless @name
17
+ end
18
+
19
+ def initialize(argv)
20
+ super
21
+ @name = argv.option('name')
22
+ end
23
+
24
+ def run
25
+
26
+ puts "do create a simple module named: #{@name}".green
27
+
28
+ progressbar = ProgressBar.create
29
+ 15.times { progressbar.increment; sleep 2 }
30
+
31
+ t_c = Thread.new {createModule()}
32
+
33
+ t_c.join
34
+ progressbar.finish
35
+
36
+ puts "end create simple module: #{@name}".green
37
+ end
38
+
39
+ def createModule
40
+ result = `pod lib create #{@name} --template-url=https://code.registry.wgine.com/client-platform/pod-template-simple.git`
41
+ result.each_line do |s|
42
+ if s.include?("fatal")
43
+ puts "#{s}".red
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end