tuya-ci-DSL 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/bin/ci-trigger +7 -0
- data/lib/tuya/ci/DSL.rb +20 -0
- data/lib/tuya/ci/DSL/analyzer/file_parse.rb +26 -0
- data/lib/tuya/ci/DSL/command.rb +34 -0
- data/lib/tuya/ci/DSL/command/create.rb +45 -0
- data/lib/tuya/ci/DSL/command/simulate_trigger.rb +29 -0
- data/lib/tuya/ci/DSL/exe/dsl_exe.rb +54 -0
- data/lib/tuya/ci/DSL/git/script_download.rb +5 -0
- data/lib/tuya/ci/DSL/trigger_create.rb +76 -0
- data/lib/tuya/ci/DSL/trigger_test.rb +25 -0
- data/lib/tuya/ci/DSL/tuya_ci_monitor.rb +75 -0
- data/lib/tuya/ci/DSL/tuya_dsl.rb +70 -0
- data/lib/tuya/ci/DSL/version.rb +7 -0
- metadata +150 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 204f1ee85290441a131eac43962c84950cb84f65
|
4
|
+
data.tar.gz: a9ba70a216d33a98c760245f28be4fe6a49a8452
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 53a5269753be9410d5a2d83a78627606e885a310d767f8e8e70bed0bb9d6e66646cb388db6725a6019eee3385cc7cf120701b038bad0e923d1b8f3b3badc9955
|
7
|
+
data.tar.gz: b59a278586172c456157ec82de6a109955c18911e3879d87c2fcc0a43a60360bd45719844167b2a3f786e3e0c68608458cf41572b9a9e8fc215ba9ca3d89dde6
|
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::Ci::DSL
|
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/ci/DSL`. 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-ci-DSL'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install tuya-ci-DSL
|
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-ci-DSL. 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::Ci::DSL project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/tuya-ci-DSL/blob/master/CODE_OF_CONDUCT.md).
|
data/bin/ci-trigger
ADDED
data/lib/tuya/ci/DSL.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'colored'
|
2
|
+
require 'tuya/ci/core'
|
3
|
+
|
4
|
+
require 'tuya/ci/DSL'
|
5
|
+
|
6
|
+
require "tuya/ci/DSL/version"
|
7
|
+
require 'tuya/ci/DSL/tuya_ci_monitor'
|
8
|
+
require 'tuya/ci/DSL/tuya_dsl'
|
9
|
+
require 'tuya/ci/DSL/analyzer/file_parse'
|
10
|
+
require 'tuya/ci/DSL/exe/dsl_exe'
|
11
|
+
|
12
|
+
require 'tuya/ci/DSL/trigger_create'
|
13
|
+
require 'tuya/ci/DSL/trigger_test'
|
14
|
+
# module Tuya
|
15
|
+
# module Ci
|
16
|
+
# module DSL
|
17
|
+
# # Your code goes here...
|
18
|
+
# end
|
19
|
+
# end
|
20
|
+
# end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module TuyaCIDSL
|
2
|
+
class Analyzer
|
3
|
+
def initialize(file='./CIFile')
|
4
|
+
@file = file
|
5
|
+
puts "Can not find: #{@file}".red unless File.exist? @file
|
6
|
+
file_content = File.read @file
|
7
|
+
file_content.gsub! /^\s*(#|\/\/).*$/,''
|
8
|
+
@content = file_content
|
9
|
+
end
|
10
|
+
|
11
|
+
def p_monitor
|
12
|
+
monitor_content = @content
|
13
|
+
monitor = TuyaCIMonitor.new
|
14
|
+
monitor.name = @file
|
15
|
+
monitor.ci do
|
16
|
+
begin
|
17
|
+
eval monitor_content
|
18
|
+
rescue Exception => e
|
19
|
+
puts "Load trigger failed: #{e}".red
|
20
|
+
ensure
|
21
|
+
end
|
22
|
+
end
|
23
|
+
monitor
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
|
4
|
+
|
5
|
+
require 'claide'
|
6
|
+
require 'colored'
|
7
|
+
|
8
|
+
|
9
|
+
module TuyaCIDSL
|
10
|
+
class Command < CLAide::Command
|
11
|
+
|
12
|
+
require 'tuya/ci/DSL/command/create'
|
13
|
+
require 'tuya/ci/DSL/command/simulate_trigger'
|
14
|
+
|
15
|
+
self.abstract_command = true
|
16
|
+
|
17
|
+
self.description = 'welcome to tuya ci trigger'
|
18
|
+
|
19
|
+
puts "\n
|
20
|
+
████████╗██╗ ██╗██╗ ██╗ █████╗
|
21
|
+
╚══██╔══╝██║ ██║╚██╗ ██╔╝██╔══██╗
|
22
|
+
██║ ██║ ██║ ╚████╔╝ ███████║
|
23
|
+
██║ ██║ ██║ ╚██╔╝ ██╔══██║
|
24
|
+
██║ ╚██████╔╝ ██║ ██║ ██║
|
25
|
+
╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ \n" .yellow
|
26
|
+
|
27
|
+
|
28
|
+
self.command = 'ci-trigger'
|
29
|
+
|
30
|
+
def run
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
|
2
|
+
|
3
|
+
require 'tuya/ci/DSL/command'
|
4
|
+
|
5
|
+
module TuyaCIDSL
|
6
|
+
class Command
|
7
|
+
class MonitorCreate < Command
|
8
|
+
|
9
|
+
self.abstract_command = false
|
10
|
+
|
11
|
+
self.summary = 'tuya ci trigger create'
|
12
|
+
self.command = 'create'
|
13
|
+
|
14
|
+
self.description = 'tuya ci trigger create'
|
15
|
+
|
16
|
+
def self.options
|
17
|
+
[
|
18
|
+
['--name=file_name', 'file name']
|
19
|
+
].concat(super)
|
20
|
+
end
|
21
|
+
|
22
|
+
def validate!
|
23
|
+
@file_name = 'CIFile' unless @name
|
24
|
+
if @file_name == 'CIFile'
|
25
|
+
if File.exist? './CIFile'
|
26
|
+
@file_name = TYCiCore::TYAsk.ask 'File: CIFile is existed, please enter another file name'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def initialize(argv)
|
32
|
+
super
|
33
|
+
@name = argv.option('name')
|
34
|
+
@file_name = @name
|
35
|
+
end
|
36
|
+
|
37
|
+
def run
|
38
|
+
super
|
39
|
+
|
40
|
+
dsl = TuyaCIDSL::TriggerCreator.new @file_name
|
41
|
+
dsl.create
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
|
2
|
+
|
3
|
+
require 'tuya/ci/DSL/command'
|
4
|
+
|
5
|
+
module TuyaCIDSL
|
6
|
+
class Command
|
7
|
+
class MonitorTest < Command
|
8
|
+
|
9
|
+
self.abstract_command = false
|
10
|
+
|
11
|
+
self.summary = 'tuya ci trigger test'
|
12
|
+
self.command = 'test'
|
13
|
+
|
14
|
+
self.description = 'tuya ci trigger test'
|
15
|
+
|
16
|
+
def validate!
|
17
|
+
end
|
18
|
+
|
19
|
+
def initialize(argv)
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
def run
|
24
|
+
super
|
25
|
+
TuyaCIDSL::TriggerTest.new.simulate
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module TuyaCIDSL
|
2
|
+
class DSLExecute
|
3
|
+
|
4
|
+
attr_accessor :sh, :git, :from_git, :folder_path, :folder
|
5
|
+
|
6
|
+
def initialize(sh)
|
7
|
+
@sh = sh
|
8
|
+
@git = ''
|
9
|
+
@from_git = false
|
10
|
+
@folder = ''
|
11
|
+
@folder_path = ''
|
12
|
+
end
|
13
|
+
|
14
|
+
def execute
|
15
|
+
if @from_git
|
16
|
+
`cp -a #{@folder_path} ./`
|
17
|
+
run_shell
|
18
|
+
delete
|
19
|
+
else
|
20
|
+
run_shell
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def download(git)
|
25
|
+
@from_git = true
|
26
|
+
@git = git
|
27
|
+
@folder = git.scan(/^.*\/(.*).git$/)[0][0]
|
28
|
+
@folder_path = "#{ENV['HOME']}/.dsl/#{folder}"
|
29
|
+
|
30
|
+
if File.exist? @folder_path
|
31
|
+
`git -C #{@folder_path} add .`
|
32
|
+
`git -C #{@folder_path} reset --hard`
|
33
|
+
`git -C #{@folder_path} fetch`
|
34
|
+
`git -C #{@folder_path} rebase`
|
35
|
+
else
|
36
|
+
`git clone #{git} #{@folder_path}`
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def run_shell
|
43
|
+
puts "CI will execute: #{@sh}".yellow
|
44
|
+
system @sh
|
45
|
+
end
|
46
|
+
|
47
|
+
def delete
|
48
|
+
if @from_git
|
49
|
+
`rm -rf #{@folder}`
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module TuyaCIDSL
|
2
|
+
class TriggerCreator
|
3
|
+
attr_accessor :file_name
|
4
|
+
def initialize(name)
|
5
|
+
@file_name = name
|
6
|
+
end
|
7
|
+
|
8
|
+
def create
|
9
|
+
puts "Create trigger file named: #{@file_name}".green
|
10
|
+
|
11
|
+
default_file = @file_name != 'CIFile'
|
12
|
+
|
13
|
+
@file_path = './'
|
14
|
+
@file_path = './CIMonitors/' if default_file
|
15
|
+
|
16
|
+
`mkdir -p #{@file_path}`
|
17
|
+
|
18
|
+
@file = "#{@file_path}#{@file_name}"
|
19
|
+
`touch #{@file}`
|
20
|
+
|
21
|
+
|
22
|
+
@content = trigger_content
|
23
|
+
|
24
|
+
puts "Trigger: #{@file} saved".green
|
25
|
+
fh = File.new(@file, "w")
|
26
|
+
fh.puts @content
|
27
|
+
fh.close
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def trigger_content
|
34
|
+
"before_module_build do |options|
|
35
|
+
|
36
|
+
#repo = options[:repo]
|
37
|
+
#branch = options[:branch]
|
38
|
+
#module_name = options[:moduleName]
|
39
|
+
#version = options[:version]
|
40
|
+
|
41
|
+
//puts \"module: \#{module_name} build version: \#{version} with branch: \#{branch} on repo: \#{repo}\"
|
42
|
+
end
|
43
|
+
|
44
|
+
after_module_build do |options|
|
45
|
+
# launch shell from remote
|
46
|
+
#puts tuya_sh_from_git 'go run ./ci-script-test/client.go', 'https://code.registry.wgine.com/tuyaIOS/ci-script-test.git'
|
47
|
+
#puts tuya_sh_from_git 'ruby ./ci-script-test/test.rb', 'https://code.registry.wgine.com/tuyaIOS/ci-script-test.git'
|
48
|
+
|
49
|
+
# launch shell from local
|
50
|
+
# tuya_sh('python language.py -a 168 -v 3.8.0')
|
51
|
+
end
|
52
|
+
|
53
|
+
before_project_build do |options|
|
54
|
+
|
55
|
+
#branch = options[:branch]
|
56
|
+
#depend_branch = options[:dependBranch]
|
57
|
+
#update_components = options[:updateComponents]
|
58
|
+
#delete_components = options[:deleteComponents]
|
59
|
+
#integrate = options[:isIntegrate]
|
60
|
+
|
61
|
+
//puts \"if this build is integrate: \#{integrate}\"
|
62
|
+
//puts \"this build branch is: \#{branch} base: \#{depend_branch}\"
|
63
|
+
//puts \"this build will update: \#{update_components}\"
|
64
|
+
//puts \"this build will delete: \#{delete_components}\"
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
after_project_build do |options|
|
69
|
+
end
|
70
|
+
|
71
|
+
error do |exception, position, options, process|
|
72
|
+
end
|
73
|
+
"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module TuyaCIDSL
|
2
|
+
class TriggerTest
|
3
|
+
|
4
|
+
def initialize()
|
5
|
+
|
6
|
+
end
|
7
|
+
|
8
|
+
def simulate
|
9
|
+
puts "Start test your ci monitor files, ci-trigger will simulate ci environment.".magenta
|
10
|
+
dsl = TuyaCIDSL::TuyaDSL.instance
|
11
|
+
dsl.load_monitors
|
12
|
+
|
13
|
+
|
14
|
+
options_p = {:branch=>"develop_3.8.0", :dependBranch=>"master", :updateComponents=>"[{\"id\":509,\"name\":\"TYUIKit\",\"branch\":\"develop\",\"version\":\"0.1.4-rc.1\"},{\"id\":500,\"name\":\"TYBusinessLibrary\",\"branch\":\"master\",\"version\":\"6.4.2-rc.3\"}]", :deleteComponents=>"[{\"id\":683,\"name\":\"TYSmartApplicationImpl\",\"branch\":\"develop\",\"version\":\"\"}]", :advanceFields=>"{}", :isIntegrate=>"0", :hashKey=>"48a62cb2cf577a0de28f60d561e8adb2", :buildId=>"146", :jobName=>"TuyaSmartV3.8.0_90"}
|
15
|
+
options_m = {:repo=>"TYSpecs", :branch=>"develop", :project=>"TestDemo", :version=>"10.4.1-rc.4", :hashKey=>"66f6f34a45ae9f71c77836069cd758ea", :buildId=>"12", :moduleName=>"TestDemo"}
|
16
|
+
|
17
|
+
dsl.trigger_module_begin options_m
|
18
|
+
dsl.trigger_module_end options_m
|
19
|
+
dsl.trigger_project_begin options_p
|
20
|
+
dsl.trigger_project_end options_p
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
class TuyaCIMonitor
|
2
|
+
attr_accessor :methods, :name
|
3
|
+
def initialize
|
4
|
+
# puts 'in initialize'
|
5
|
+
@methods = {}
|
6
|
+
end
|
7
|
+
|
8
|
+
def exe_action(action, options)
|
9
|
+
method = @methods[action.to_sym]
|
10
|
+
begin
|
11
|
+
method.call options if method
|
12
|
+
rescue Exception
|
13
|
+
puts "Trigger Exception cached, you can puts detail in your error method".red
|
14
|
+
exe_error action, $!, $@, options
|
15
|
+
ensure
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def tuya_sh(shell)
|
20
|
+
dsl = TuyaCIDSL::DSLExecute.new shell
|
21
|
+
dsl.execute
|
22
|
+
end
|
23
|
+
|
24
|
+
def tuya_sh_from_git(shell, git)
|
25
|
+
dsl = TuyaCIDSL::DSLExecute.new shell
|
26
|
+
dsl.download git
|
27
|
+
dsl.execute
|
28
|
+
end
|
29
|
+
|
30
|
+
def exe_error(process, error, position, options)
|
31
|
+
method = @methods['error'.to_sym]
|
32
|
+
# require 'tuya/ci/DSL/exe/dsl_exe'
|
33
|
+
method.call error, position, options, process
|
34
|
+
end
|
35
|
+
|
36
|
+
def exe
|
37
|
+
@methods.each_key do |key|
|
38
|
+
l = @methods[key]
|
39
|
+
l.call
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def ci(*args, &block)
|
44
|
+
# puts "in ci args is: #{args}"
|
45
|
+
dsl 'root', args, &block
|
46
|
+
end
|
47
|
+
|
48
|
+
def dsl(process, args, &block)
|
49
|
+
# puts "in dsl process is: #{process} args is: #{args}"
|
50
|
+
if block_given?
|
51
|
+
if process
|
52
|
+
# puts "process: #{process}"
|
53
|
+
if process == 'root'
|
54
|
+
instance_eval &block
|
55
|
+
else
|
56
|
+
@methods[process] = block
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def method_missing(m, *args, &block)
|
63
|
+
# puts "in method_missing method is: #{m}, args is: #{args}"
|
64
|
+
dsl m, args, &block
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
class TuyaCIMonitorMethods
|
69
|
+
attr_accessor :name, :args, :block
|
70
|
+
def initialize
|
71
|
+
@name = ''
|
72
|
+
@args = ''
|
73
|
+
@block = nil
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module TuyaCIDSL
|
2
|
+
|
3
|
+
require 'singleton'
|
4
|
+
|
5
|
+
class TuyaDSL
|
6
|
+
|
7
|
+
include Singleton
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@default_root_file = 'CIFile'
|
11
|
+
@default_folder = 'CIMonitors'
|
12
|
+
@files = []
|
13
|
+
@monitors = {}
|
14
|
+
load_files
|
15
|
+
end
|
16
|
+
|
17
|
+
def load_monitors
|
18
|
+
@files.each do |item|
|
19
|
+
add_monitor item
|
20
|
+
end
|
21
|
+
# puts @monitors
|
22
|
+
end
|
23
|
+
|
24
|
+
def trigger_module_begin(options)
|
25
|
+
trigger 'before_module_build', options
|
26
|
+
end
|
27
|
+
|
28
|
+
def trigger_module_end(options)
|
29
|
+
trigger 'after_module_build', options
|
30
|
+
end
|
31
|
+
|
32
|
+
def trigger_project_begin(options)
|
33
|
+
trigger 'before_project_build', options
|
34
|
+
end
|
35
|
+
|
36
|
+
def trigger_project_end(options)
|
37
|
+
trigger 'after_project_build', options
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def trigger(action, options)
|
43
|
+
# puts "trigger action: #{action} options: #{options}"
|
44
|
+
|
45
|
+
@monitors.each_key do |key|
|
46
|
+
puts "Start trigger: #{action} in #{key}".green
|
47
|
+
item = @monitors[key]
|
48
|
+
item.exe_action action, options
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
def load_files
|
54
|
+
@files << "./#{@default_root_file}" if File.exist? "./#{@default_root_file}"
|
55
|
+
if File.exist? "./#{@default_folder}/"
|
56
|
+
@files += Dir["./#{@default_folder}/**/*"].reject{|o|File.directory?(o)}
|
57
|
+
end
|
58
|
+
# puts `pwd`
|
59
|
+
# puts "files is now:"
|
60
|
+
# puts @files
|
61
|
+
end
|
62
|
+
|
63
|
+
def add_monitor(file)
|
64
|
+
analyzer = TuyaCIDSL::Analyzer.new file
|
65
|
+
monitor = analyzer.p_monitor
|
66
|
+
@monitors[file] = monitor
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
metadata
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tuya-ci-DSL
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- fangdong
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-01-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: claide
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.0.2
|
62
|
+
- - "<"
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '2.0'
|
65
|
+
type: :runtime
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: 1.0.2
|
72
|
+
- - "<"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '2.0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: colored
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
type: :runtime
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: tuya-ci-core
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
type: :runtime
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
description: used in tuya-ci
|
104
|
+
email:
|
105
|
+
- fangdong@tuyasmart.com
|
106
|
+
executables:
|
107
|
+
- ci-trigger
|
108
|
+
extensions: []
|
109
|
+
extra_rdoc_files: []
|
110
|
+
files:
|
111
|
+
- LICENSE.txt
|
112
|
+
- README.md
|
113
|
+
- bin/ci-trigger
|
114
|
+
- lib/tuya/ci/DSL.rb
|
115
|
+
- lib/tuya/ci/DSL/analyzer/file_parse.rb
|
116
|
+
- lib/tuya/ci/DSL/command.rb
|
117
|
+
- lib/tuya/ci/DSL/command/create.rb
|
118
|
+
- lib/tuya/ci/DSL/command/simulate_trigger.rb
|
119
|
+
- lib/tuya/ci/DSL/exe/dsl_exe.rb
|
120
|
+
- lib/tuya/ci/DSL/git/script_download.rb
|
121
|
+
- lib/tuya/ci/DSL/trigger_create.rb
|
122
|
+
- lib/tuya/ci/DSL/trigger_test.rb
|
123
|
+
- lib/tuya/ci/DSL/tuya_ci_monitor.rb
|
124
|
+
- lib/tuya/ci/DSL/tuya_dsl.rb
|
125
|
+
- lib/tuya/ci/DSL/version.rb
|
126
|
+
homepage: https://docs.tuya.com/cn/
|
127
|
+
licenses:
|
128
|
+
- MIT
|
129
|
+
metadata: {}
|
130
|
+
post_install_message:
|
131
|
+
rdoc_options: []
|
132
|
+
require_paths:
|
133
|
+
- lib
|
134
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
requirements: []
|
145
|
+
rubyforge_project:
|
146
|
+
rubygems_version: 2.5.2.3
|
147
|
+
signing_key:
|
148
|
+
specification_version: 4
|
149
|
+
summary: ci easy DSL action container
|
150
|
+
test_files: []
|